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

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