v1.5 branch refresh based upon upstream master @ c8677ca89e53e3be7988d54280fce166cc894a7e
[librecmc/librecmc.git] / target / linux / ar71xx / patches-4.9 / 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 @@ -145,6 +145,7 @@ 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  void ath79_cpu_irq_init(unsigned irq_wb_chan2, unsigned irq_wb_chan3);
10  void ath79_misc_irq_init(void __iomem *regs, int irq,
11 --- a/arch/mips/ath79/common.c
12 +++ b/arch/mips/ath79/common.c
13 @@ -142,3 +142,29 @@ void ath79_device_reset_clear(u32 mask)
14         spin_unlock_irqrestore(&ath79_device_reset_lock, flags);
15  }
16  EXPORT_SYMBOL_GPL(ath79_device_reset_clear);
17 +
18 +u32 ath79_device_reset_get(u32 mask)
19 +{
20 +       unsigned long flags;
21 +       u32 reg;
22 +       u32 ret;
23 +
24 +       if (soc_is_ar71xx())
25 +               reg = AR71XX_RESET_REG_RESET_MODULE;
26 +       else if (soc_is_ar724x())
27 +               reg = AR724X_RESET_REG_RESET_MODULE;
28 +       else if (soc_is_ar913x())
29 +               reg = AR913X_RESET_REG_RESET_MODULE;
30 +       else if (soc_is_ar933x())
31 +               reg = AR933X_RESET_REG_RESET_MODULE;
32 +       else if (soc_is_ar934x())
33 +               reg = AR934X_RESET_REG_RESET_MODULE;
34 +       else
35 +               BUG();
36 +
37 +       spin_lock_irqsave(&ath79_device_reset_lock, flags);
38 +       ret = ath79_reset_rr(reg);
39 +       spin_unlock_irqrestore(&ath79_device_reset_lock, flags);
40 +       return ret;
41 +}
42 +EXPORT_SYMBOL_GPL(ath79_device_reset_get);