ar71xx: add support for 3.7
[openwrt.git] / target / linux / ar71xx / patches-3.7 / 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 @@ -136,6 +136,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_flash_acquire(void);
10  void ath79_flash_release(void);
11 --- a/arch/mips/ath79/common.c
12 +++ b/arch/mips/ath79/common.c
13 @@ -111,6 +111,32 @@ void ath79_device_reset_clear(u32 mask)
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);
42 +
43  void ath79_flash_acquire(void)
44  {
45         mutex_lock(&ath79_flash_mutex);