ar71xx: add support for QCA956x ethernet
[openwrt/openwrt.git] / target / linux / ar71xx / patches-4.1 / 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 @@ -221,15 +221,30 @@ void __init ath79_gpio_output_select(uns
4 {
5 void __iomem *base = ath79_gpio_base;
6 unsigned long flags;
7 - unsigned int reg;
8 + unsigned int reg, reg_base;
9 + unsigned long gpio_count;
10 u32 t, s;
11
12 - BUG_ON(!soc_is_ar934x() && !soc_is_qca953x() && !soc_is_qca956x());
13 + if (soc_is_ar934x()) {
14 + gpio_count = AR934X_GPIO_COUNT;
15 + reg_base = AR934X_GPIO_REG_OUT_FUNC0;
16 + } else if (soc_is_qca953x()) {
17 + gpio_count = QCA953X_GPIO_COUNT;
18 + reg_base = QCA953X_GPIO_REG_OUT_FUNC0;
19 + } else if (soc_is_qca955x()) {
20 + gpio_count = QCA955X_GPIO_COUNT;
21 + reg_base = QCA955X_GPIO_REG_OUT_FUNC0;
22 + } else if (soc_is_qca956x()) {
23 + gpio_count = QCA956X_GPIO_COUNT;
24 + reg_base = QCA956X_GPIO_REG_OUT_FUNC0;
25 + } else {
26 + BUG();
27 + }
28
29 - if (gpio >= AR934X_GPIO_COUNT)
30 + if (gpio >= gpio_count)
31 return;
32
33 - reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4);
34 + reg = reg_base + 4 * (gpio / 4);
35 s = 8 * (gpio % 4);
36
37 spin_lock_irqsave(&ath79_gpio_lock, flags);
38 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
39 +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
40 @@ -868,6 +868,14 @@
41 #define QCA953X_GPIO_OUT_MUX_LED_LINK4 44
42 #define QCA953X_GPIO_OUT_MUX_LED_LINK5 45
43
44 +#define QCA955X_GPIO_REG_OUT_FUNC0 0x2c
45 +#define QCA955X_GPIO_REG_OUT_FUNC1 0x30
46 +#define QCA955X_GPIO_REG_OUT_FUNC2 0x34
47 +#define QCA955X_GPIO_REG_OUT_FUNC3 0x38
48 +#define QCA955X_GPIO_REG_OUT_FUNC4 0x3c
49 +#define QCA955X_GPIO_REG_OUT_FUNC5 0x40
50 +#define QCA955X_GPIO_REG_FUNC 0x6c
51 +
52 #define QCA956X_GPIO_REG_OUT_FUNC0 0x2c
53 #define QCA956X_GPIO_REG_OUT_FUNC1 0x30
54 #define QCA956X_GPIO_REG_OUT_FUNC2 0x34
55 @@ -1007,6 +1015,8 @@
56 #define AR934X_GPIO_OUT_EXT_LNA0 46
57 #define AR934X_GPIO_OUT_EXT_LNA1 47
58
59 +#define QCA955X_GPIO_OUT_GPIO 0
60 +
61 /*
62 * MII_CTRL block
63 */