504-MIPS-ath79-add-ath79_device_reset_get.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --- a/arch/mips/include/asm/mach-ath79/ath79.h
  2. +++ b/arch/mips/include/asm/mach-ath79/ath79.h
  3. @@ -144,5 +144,6 @@ static inline u32 ath79_reset_rr(unsigne
  4. void ath79_device_reset_set(u32 mask);
  5. void ath79_device_reset_clear(u32 mask);
  6. +u32 ath79_device_reset_get(u32 mask);
  7. #endif /* __ASM_MACH_ATH79_H */
  8. --- a/arch/mips/ath79/common.c
  9. +++ b/arch/mips/ath79/common.c
  10. @@ -142,3 +142,29 @@ void ath79_device_reset_clear(u32 mask)
  11. spin_unlock_irqrestore(&ath79_device_reset_lock, flags);
  12. }
  13. EXPORT_SYMBOL_GPL(ath79_device_reset_clear);
  14. +
  15. +u32 ath79_device_reset_get(u32 mask)
  16. +{
  17. + unsigned long flags;
  18. + u32 reg;
  19. + u32 ret;
  20. +
  21. + if (soc_is_ar71xx())
  22. + reg = AR71XX_RESET_REG_RESET_MODULE;
  23. + else if (soc_is_ar724x())
  24. + reg = AR724X_RESET_REG_RESET_MODULE;
  25. + else if (soc_is_ar913x())
  26. + reg = AR913X_RESET_REG_RESET_MODULE;
  27. + else if (soc_is_ar933x())
  28. + reg = AR933X_RESET_REG_RESET_MODULE;
  29. + else if (soc_is_ar934x())
  30. + reg = AR934X_RESET_REG_RESET_MODULE;
  31. + else
  32. + BUG();
  33. +
  34. + spin_lock_irqsave(&ath79_device_reset_lock, flags);
  35. + ret = ath79_reset_rr(reg);
  36. + spin_unlock_irqrestore(&ath79_device_reset_lock, flags);
  37. + return ret;
  38. +}
  39. +EXPORT_SYMBOL_GPL(ath79_device_reset_get);