Fresh pull from upstream
[librecmc/librecmc.git] / target / linux / ar71xx / patches-4.4 / 504-MIPS-ath79-add-ath79_device_reset_get.patch
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  
5  void ath79_device_reset_set(u32 mask);
6  void ath79_device_reset_clear(u32 mask);
7 +u32 ath79_device_reset_get(u32 mask);
8  
9  #endif /* __ASM_MACH_ATH79_H */
10 --- a/arch/mips/ath79/common.c
11 +++ b/arch/mips/ath79/common.c
12 @@ -142,3 +142,29 @@ void ath79_device_reset_clear(u32 mask)
13         spin_unlock_irqrestore(&ath79_device_reset_lock, flags);
14  }
15  EXPORT_SYMBOL_GPL(ath79_device_reset_clear);
16 +
17 +u32 ath79_device_reset_get(u32 mask)
18 +{
19 +       unsigned long flags;
20 +       u32 reg;
21 +       u32 ret;
22 +
23 +       if (soc_is_ar71xx())
24 +               reg = AR71XX_RESET_REG_RESET_MODULE;
25 +       else if (soc_is_ar724x())
26 +               reg = AR724X_RESET_REG_RESET_MODULE;
27 +       else if (soc_is_ar913x())
28 +               reg = AR913X_RESET_REG_RESET_MODULE;
29 +       else if (soc_is_ar933x())
30 +               reg = AR933X_RESET_REG_RESET_MODULE;
31 +       else if (soc_is_ar934x())
32 +               reg = AR934X_RESET_REG_RESET_MODULE;
33 +       else
34 +               BUG();
35 +
36 +       spin_lock_irqsave(&ath79_device_reset_lock, flags);
37 +       ret = ath79_reset_rr(reg);
38 +       spin_unlock_irqrestore(&ath79_device_reset_lock, flags);
39 +       return ret;
40 +}
41 +EXPORT_SYMBOL_GPL(ath79_device_reset_get);