4ea67fdc3affceef95d840299811f0a1d2bdeb9e
[openwrt.git] / target / linux / ar71xx / patches-4.4 / 739-MIPS-ath79-add-gpio-func-register-for-QCA955x-SoC.patch
1 --- a/arch/mips/ath79/gpio.c
2 +++ b/arch/mips/ath79/gpio.c
3 @@ -33,6 +33,7 @@ static void __iomem *ath79_gpio_get_func
4                 reg = AR71XX_GPIO_REG_FUNC;
5         else if (soc_is_ar934x() ||
6                  soc_is_qca953x() ||
7 +                soc_is_qca955x() ||
8                  soc_is_qca956x() ||
9                  soc_is_tp9343())
10                 reg = AR934X_GPIO_REG_FUNC;
11 @@ -64,15 +65,21 @@ void ath79_gpio_function_disable(u32 mas
12  void __init ath79_gpio_output_select(unsigned gpio, u8 val)
13  {
14         void __iomem *base = ath79_gpio_base;
15 -       unsigned int reg;
16 +       unsigned int reg, reg_base;
17         u32 t, s;
18  
19 -       BUG_ON(!soc_is_ar934x() && !soc_is_qca953x() && !soc_is_qca956x());
20 -
21 -       if (gpio >= AR934X_GPIO_COUNT)
22 -               return;
23 +       if (soc_is_ar934x())
24 +               reg_base = AR934X_GPIO_REG_OUT_FUNC0;
25 +       else if (soc_is_qca953x())
26 +               reg_base = QCA953X_GPIO_REG_OUT_FUNC0;
27 +       else if (soc_is_qca955x())
28 +               reg_base = QCA955X_GPIO_REG_OUT_FUNC0;
29 +       else if (soc_is_qca956x())
30 +               reg_base = QCA956X_GPIO_REG_OUT_FUNC0;
31 +       else
32 +               BUG();
33  
34 -       reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4);
35 +       reg = reg_base + 4 * (gpio / 4);
36         s = 8 * (gpio % 4);
37  
38         t = __raw_readl(base + reg);
39 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
40 +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
41 @@ -875,6 +875,14 @@
42  #define QCA953X_GPIO_OUT_MUX_LED_LINK4         44
43  #define QCA953X_GPIO_OUT_MUX_LED_LINK5         45
44  
45 +#define QCA955X_GPIO_REG_OUT_FUNC0     0x2c
46 +#define QCA955X_GPIO_REG_OUT_FUNC1     0x30
47 +#define QCA955X_GPIO_REG_OUT_FUNC2     0x34
48 +#define QCA955X_GPIO_REG_OUT_FUNC3     0x38
49 +#define QCA955X_GPIO_REG_OUT_FUNC4     0x3c
50 +#define QCA955X_GPIO_REG_OUT_FUNC5     0x40
51 +#define QCA955X_GPIO_REG_FUNC          0x6c
52 +
53  #define QCA956X_GPIO_REG_OUT_FUNC0     0x2c
54  #define QCA956X_GPIO_REG_OUT_FUNC1     0x30
55  #define QCA956X_GPIO_REG_OUT_FUNC2     0x34
56 @@ -1014,6 +1022,8 @@
57  #define AR934X_GPIO_OUT_EXT_LNA0       46
58  #define AR934X_GPIO_OUT_EXT_LNA1       47
59  
60 +#define QCA955X_GPIO_OUT_GPIO          0
61 +
62  /*
63   * MII_CTRL block
64   */