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

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --- a/arch/mips/include/asm/mach-ath79/ath79.h
  2. +++ b/arch/mips/include/asm/mach-ath79/ath79.h
  3. @@ -142,6 +142,7 @@ 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. void ath79_flash_acquire(void);
  8. void ath79_flash_release(void);
  9. --- a/arch/mips/ath79/common.c
  10. +++ b/arch/mips/ath79/common.c
  11. @@ -113,6 +113,32 @@ void ath79_device_reset_clear(u32 mask)
  12. }
  13. EXPORT_SYMBOL_GPL(ath79_device_reset_clear);
  14. +u32 ath79_device_reset_get(u32 mask)
  15. +{
  16. + unsigned long flags;
  17. + u32 reg;
  18. + u32 ret;
  19. +
  20. + if (soc_is_ar71xx())
  21. + reg = AR71XX_RESET_REG_RESET_MODULE;
  22. + else if (soc_is_ar724x())
  23. + reg = AR724X_RESET_REG_RESET_MODULE;
  24. + else if (soc_is_ar913x())
  25. + reg = AR913X_RESET_REG_RESET_MODULE;
  26. + else if (soc_is_ar933x())
  27. + reg = AR933X_RESET_REG_RESET_MODULE;
  28. + else if (soc_is_ar934x())
  29. + reg = AR934X_RESET_REG_RESET_MODULE;
  30. + else
  31. + BUG();
  32. +
  33. + spin_lock_irqsave(&ath79_device_reset_lock, flags);
  34. + ret = ath79_reset_rr(reg);
  35. + spin_unlock_irqrestore(&ath79_device_reset_lock, flags);
  36. + return ret;
  37. +}
  38. +EXPORT_SYMBOL_GPL(ath79_device_reset_get);
  39. +
  40. void ath79_flash_acquire(void)
  41. {
  42. mutex_lock(&ath79_flash_mutex);