Fresh pull from upstream
[librecmc/librecmc.git] / target / linux / ramips / patches-4.4 / 0084-MIPS-ralink-add-MT7628-EPHY-LEDs-pinmux-support.patch
1 From 2b436a351803f38d0c8ca9c26103472c8aaeb599 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
3 Date: Thu, 19 May 2016 22:07:36 +0200
4 Subject: [PATCH] MIPS: ralink: add MT7628 EPHY LEDs pinmux support
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
10 Cc: john@phrozen.org
11 Cc: linux-mips@linux-mips.org
12 Cc: linux-kernel@vger.kernel.org
13 Patchwork: https://patchwork.linux-mips.org/patch/13308/
14 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
15 ---
16  arch/mips/ralink/mt7620.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++
17  1 file changed, 100 insertions(+)
18
19 --- a/arch/mips/ralink/mt7620.c
20 +++ b/arch/mips/ralink/mt7620.c
21 @@ -188,6 +188,41 @@ static struct rt2880_pmx_func gpio_grp_m
22         FUNC("gpio", 0, 11, 1),
23  };
24  
25 +static struct rt2880_pmx_func p4led_kn_grp_mt7628[] = {
26 +       FUNC("jtag", 3, 30, 1),
27 +       FUNC("util", 2, 30, 1),
28 +       FUNC("gpio", 1, 30, 1),
29 +       FUNC("p4led_kn", 0, 30, 1),
30 +};
31 +
32 +static struct rt2880_pmx_func p3led_kn_grp_mt7628[] = {
33 +       FUNC("jtag", 3, 31, 1),
34 +       FUNC("util", 2, 31, 1),
35 +       FUNC("gpio", 1, 31, 1),
36 +       FUNC("p3led_kn", 0, 31, 1),
37 +};
38 +
39 +static struct rt2880_pmx_func p2led_kn_grp_mt7628[] = {
40 +       FUNC("jtag", 3, 32, 1),
41 +       FUNC("util", 2, 32, 1),
42 +       FUNC("gpio", 1, 32, 1),
43 +       FUNC("p2led_kn", 0, 32, 1),
44 +};
45 +
46 +static struct rt2880_pmx_func p1led_kn_grp_mt7628[] = {
47 +       FUNC("jtag", 3, 33, 1),
48 +       FUNC("util", 2, 33, 1),
49 +       FUNC("gpio", 1, 33, 1),
50 +       FUNC("p1led_kn", 0, 33, 1),
51 +};
52 +
53 +static struct rt2880_pmx_func p0led_kn_grp_mt7628[] = {
54 +       FUNC("jtag", 3, 34, 1),
55 +       FUNC("rsvd", 2, 34, 1),
56 +       FUNC("gpio", 1, 34, 1),
57 +       FUNC("p0led_kn", 0, 34, 1),
58 +};
59 +
60  static struct rt2880_pmx_func wled_kn_grp_mt7628[] = {
61         FUNC("rsvd", 3, 35, 1),
62         FUNC("rsvd", 2, 35, 1),
63 @@ -195,6 +230,41 @@ static struct rt2880_pmx_func wled_kn_gr
64         FUNC("wled_kn", 0, 35, 1),
65  };
66  
67 +static struct rt2880_pmx_func p4led_an_grp_mt7628[] = {
68 +       FUNC("jtag", 3, 39, 1),
69 +       FUNC("util", 2, 39, 1),
70 +       FUNC("gpio", 1, 39, 1),
71 +       FUNC("p4led_an", 0, 39, 1),
72 +};
73 +
74 +static struct rt2880_pmx_func p3led_an_grp_mt7628[] = {
75 +       FUNC("jtag", 3, 40, 1),
76 +       FUNC("util", 2, 40, 1),
77 +       FUNC("gpio", 1, 40, 1),
78 +       FUNC("p3led_an", 0, 40, 1),
79 +};
80 +
81 +static struct rt2880_pmx_func p2led_an_grp_mt7628[] = {
82 +       FUNC("jtag", 3, 41, 1),
83 +       FUNC("util", 2, 41, 1),
84 +       FUNC("gpio", 1, 41, 1),
85 +       FUNC("p2led_an", 0, 41, 1),
86 +};
87 +
88 +static struct rt2880_pmx_func p1led_an_grp_mt7628[] = {
89 +       FUNC("jtag", 3, 42, 1),
90 +       FUNC("util", 2, 42, 1),
91 +       FUNC("gpio", 1, 42, 1),
92 +       FUNC("p1led_an", 0, 42, 1),
93 +};
94 +
95 +static struct rt2880_pmx_func p0led_an_grp_mt7628[] = {
96 +       FUNC("jtag", 3, 43, 1),
97 +       FUNC("rsvd", 2, 43, 1),
98 +       FUNC("gpio", 1, 43, 1),
99 +       FUNC("p0led_an", 0, 43, 1),
100 +};
101 +
102  static struct rt2880_pmx_func wled_an_grp_mt7628[] = {
103         FUNC("rsvd", 3, 44, 1),
104         FUNC("rsvd", 2, 44, 1),
105 @@ -204,7 +274,17 @@ static struct rt2880_pmx_func wled_an_gr
106  
107  #define MT7628_GPIO_MODE_MASK          0x3
108  
109 +#define MT7628_GPIO_MODE_P4LED_KN      58
110 +#define MT7628_GPIO_MODE_P3LED_KN      56
111 +#define MT7628_GPIO_MODE_P2LED_KN      54
112 +#define MT7628_GPIO_MODE_P1LED_KN      52
113 +#define MT7628_GPIO_MODE_P0LED_KN      50
114  #define MT7628_GPIO_MODE_WLED_KN       48
115 +#define MT7628_GPIO_MODE_P4LED_AN      42
116 +#define MT7628_GPIO_MODE_P3LED_AN      40
117 +#define MT7628_GPIO_MODE_P2LED_AN      38
118 +#define MT7628_GPIO_MODE_P1LED_AN      36
119 +#define MT7628_GPIO_MODE_P0LED_AN      34
120  #define MT7628_GPIO_MODE_WLED_AN       32
121  #define MT7628_GPIO_MODE_PWM1          30
122  #define MT7628_GPIO_MODE_PWM0          28
123 @@ -251,8 +331,28 @@ static struct rt2880_pmx_group mt7628an_
124                                 1, MT7628_GPIO_MODE_GPIO),
125         GRP_G("wled_an", wled_an_grp_mt7628, MT7628_GPIO_MODE_MASK,
126                                 1, MT7628_GPIO_MODE_WLED_AN),
127 +       GRP_G("p0led_an", p0led_an_grp_mt7628, MT7628_GPIO_MODE_MASK,
128 +                               1, MT7628_GPIO_MODE_P0LED_AN),
129 +       GRP_G("p1led_an", p1led_an_grp_mt7628, MT7628_GPIO_MODE_MASK,
130 +                               1, MT7628_GPIO_MODE_P1LED_AN),
131 +       GRP_G("p2led_an", p2led_an_grp_mt7628, MT7628_GPIO_MODE_MASK,
132 +                               1, MT7628_GPIO_MODE_P2LED_AN),
133 +       GRP_G("p3led_an", p3led_an_grp_mt7628, MT7628_GPIO_MODE_MASK,
134 +                               1, MT7628_GPIO_MODE_P3LED_AN),
135 +       GRP_G("p4led_an", p4led_an_grp_mt7628, MT7628_GPIO_MODE_MASK,
136 +                               1, MT7628_GPIO_MODE_P4LED_AN),
137         GRP_G("wled_kn", wled_kn_grp_mt7628, MT7628_GPIO_MODE_MASK,
138                                 1, MT7628_GPIO_MODE_WLED_KN),
139 +       GRP_G("p0led_kn", p0led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK,
140 +                               1, MT7628_GPIO_MODE_P0LED_KN),
141 +       GRP_G("p1led_kn", p1led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK,
142 +                               1, MT7628_GPIO_MODE_P1LED_KN),
143 +       GRP_G("p2led_kn", p2led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK,
144 +                               1, MT7628_GPIO_MODE_P2LED_KN),
145 +       GRP_G("p3led_kn", p3led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK,
146 +                               1, MT7628_GPIO_MODE_P3LED_KN),
147 +       GRP_G("p4led_kn", p4led_kn_grp_mt7628, MT7628_GPIO_MODE_MASK,
148 +                               1, MT7628_GPIO_MODE_P4LED_KN),
149         { 0 }
150  };
151