Rework for AGL UCB integration
[AGL/meta-agl-refhw.git] / meta-agl-refhw-gen3 / recipes-kernel / linux / files / 0001-create-r8a7795-usb-ovc-pinmux-groups.patch
1 Create r8a7795 USB OVC pin groups
2
3 Split the r8a7795 USB pin groups to create separate groups for the
4 OVC pins.  This is required for the AGL reference hardware boards,
5 which use some of the OVC pins in other pinmux modes.
6
7 Upstream-Status: pending    
8  
9 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
10
11 ---
12  .../boot/dts/renesas/r8a7795-es1-salvator-x.dts    |  2 +-
13  arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts |  2 +-
14  .../arm64/boot/dts/renesas/r8a7795-salvator-xs.dts |  4 +-
15  arch/arm64/boot/dts/renesas/salvator-common.dtsi   |  6 +-
16  arch/arm64/boot/dts/renesas/ulcb-kf.dtsi           |  2 +-
17  arch/arm64/boot/dts/renesas/ulcb.dtsi              |  2 +-
18  drivers/pinctrl/sh-pfc/pfc-r8a7795-es1.c           | 75 +++++++++++++++++-----
19  drivers/pinctrl/sh-pfc/pfc-r8a7795.c               | 75 +++++++++++++++++-----
20  8 files changed, 129 insertions(+), 39 deletions(-)
21
22 diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
23 index 5c3935ef4fb9..07d3f03274e3 100644
24 --- a/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
25 +++ b/arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dts
26 @@ -202,7 +202,7 @@
27  
28  &pfc {
29         usb2_pins: usb2 {
30 -               groups = "usb2";
31 +               groups = "usb2", "usb2_ovc";
32                 function = "usb2";
33         };
34  };
35 diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
36 index 6928afbd8e06..9c229b1bbb59 100644
37 --- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
38 +++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
39 @@ -202,7 +202,7 @@
40  
41  &pfc {
42         usb2_pins: usb2 {
43 -               groups = "usb2";
44 +               groups = "usb2", "usb2_ovc";
45                 function = "usb2";
46         };
47  };
48 diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
49 index 498f78875dbd..abd1d480292e 100644
50 --- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
51 +++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts
52 @@ -217,7 +217,7 @@
53  
54  &pfc {
55         usb2_pins: usb2 {
56 -               groups = "usb2";
57 +               groups = "usb2", "usb2_ovc";
58                 function = "usb2";
59         };
60  
61 @@ -234,7 +234,7 @@
62          *      - Connect GP6_{04,21} to ADV7842.
63          */
64         usb2_ch3_pins: usb2_ch3 {
65 -               groups = "usb2_ch3";
66 +               groups = "usb2_ch3", "usb2_ch3_ovc";
67                 function = "usb2_ch3";
68         };
69  };
70 diff --git a/arch/arm64/boot/dts/renesas/salvator-common.dtsi b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
71 index 878ed7caca77..a9e2d0a02fe1 100644
72 --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
73 +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
74 @@ -690,13 +690,13 @@
75         };
76  
77         usb0_pins: usb0 {
78 -               groups = "usb0";
79 +               groups = "usb0", "usb0_ovc";
80                 function = "usb0";
81         };
82  
83         usb1_pins: usb1 {
84                 mux {
85 -                       groups = "usb1";
86 +                       groups = "usb1", "usb1_ovc";
87                         function = "usb1";
88                 };
89  
90 @@ -712,7 +712,7 @@
91         };
92  
93         usb30_pins: usb30 {
94 -               groups = "usb30";
95 +               groups = "usb30", "usb30_ovc";
96                 function = "usb30";
97         };
98  };
99 diff --git a/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi b/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
100 index 1b316d79df88..9d44b5ef4f63 100644
101 --- a/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
102 +++ b/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
103 @@ -170,7 +170,7 @@
104         };
105  
106         usb0_pins: usb0 {
107 -               groups = "usb0";
108 +               groups = "usb0", "usb0_ovc";
109                 function = "usb0";
110         };
111  };
112 diff --git a/arch/arm64/boot/dts/renesas/ulcb.dtsi b/arch/arm64/boot/dts/renesas/ulcb.dtsi
113 index b60fd45f0a17..6f054ab8e611 100644
114 --- a/arch/arm64/boot/dts/renesas/ulcb.dtsi
115 +++ b/arch/arm64/boot/dts/renesas/ulcb.dtsi
116 @@ -366,7 +366,7 @@
117         };
118  
119         usb1_pins: usb1 {
120 -               groups = "usb1";
121 +               groups = "usb1", "usb1_ovc";
122                 function = "usb1";
123         };
124  };
125 diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795-es1.c b/drivers/pinctrl/sh-pfc/pfc-r8a7795-es1.c
126 index 9f302f60297f..55f99fe4d8ac 100644
127 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7795-es1.c
128 +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7795-es1.c
129 @@ -3822,44 +3822,79 @@ static const unsigned int tmu_tclk2_b_mux[] = {
130  
131  /* - USB0 ------------------------------------------------------------------- */
132  static const unsigned int usb0_pins[] = {
133 -       /* PWEN, OVC */
134 -       RCAR_GP_PIN(6, 24), RCAR_GP_PIN(6, 25),
135 +       /* PWEN */
136 +       RCAR_GP_PIN(6, 24),
137  };
138  static const unsigned int usb0_mux[] = {
139 -       USB0_PWEN_MARK, USB0_OVC_MARK,
140 +       USB0_PWEN_MARK,
141 +};
142 +static const unsigned int usb0_ovc_pins[] = {
143 +       /* OVC */
144 +       RCAR_GP_PIN(6, 25),
145 +};
146 +static const unsigned int usb0_ovc_mux[] = {
147 +       USB0_OVC_MARK,
148  };
149  /* - USB1 ------------------------------------------------------------------- */
150  static const unsigned int usb1_pins[] = {
151 -       /* PWEN, OVC */
152 -       RCAR_GP_PIN(6, 26), RCAR_GP_PIN(6, 27),
153 +       /* PWEN */
154 +       RCAR_GP_PIN(6, 26),
155  };
156  static const unsigned int usb1_mux[] = {
157 -       USB1_PWEN_MARK, USB1_OVC_MARK,
158 +       USB1_PWEN_MARK,
159 +};
160 +static const unsigned int usb1_ovc_pins[] = {
161 +       /* OVC */
162 +       RCAR_GP_PIN(6, 27),
163 +};
164 +static const unsigned int usb1_ovc_mux[] = {
165 +       USB1_OVC_MARK,
166  };
167  /* - USB2 ------------------------------------------------------------------- */
168  static const unsigned int usb2_pins[] = {
169 -       /* PWEN, OVC */
170 -       RCAR_GP_PIN(6, 14), RCAR_GP_PIN(6, 15),
171 +       /* PWEN */
172 +       RCAR_GP_PIN(6, 14),
173  };
174  static const unsigned int usb2_mux[] = {
175 -       USB2_PWEN_MARK, USB2_OVC_MARK,
176 +       USB2_PWEN_MARK,
177 +};
178 +static const unsigned int usb2_ovc_pins[] = {
179 +       /* OVC */
180 +       RCAR_GP_PIN(6, 15),
181 +};
182 +static const unsigned int usb2_ovc_mux[] = {
183 +       USB2_OVC_MARK,
184  };
185  
186  /* - USB30 ------------------------------------------------------------------ */
187  static const unsigned int usb30_pins[] = {
188 -       /* PWEN, OVC */
189 -       RCAR_GP_PIN(6, 28), RCAR_GP_PIN(6, 29),
190 +       /* PWEN */
191 +       RCAR_GP_PIN(6, 28),
192  };
193  static const unsigned int usb30_mux[] = {
194 -       USB30_PWEN_MARK, USB30_OVC_MARK,
195 +       USB30_PWEN_MARK,
196 +};
197 +static const unsigned int usb30_ovc_pins[] = {
198 +       /* OVC */
199 +       RCAR_GP_PIN(6, 29),
200 +};
201 +static const unsigned int usb30_ovc_mux[] = {
202 +       USB30_OVC_MARK,
203  };
204  /* - USB31 ------------------------------------------------------------------ */
205  static const unsigned int usb31_pins[] = {
206 -       /* PWEN, OVC */
207 -       RCAR_GP_PIN(6, 30), RCAR_GP_PIN(6, 31),
208 +       /* PWEN */
209 +       RCAR_GP_PIN(6, 30),
210  };
211  static const unsigned int usb31_mux[] = {
212 -       USB31_PWEN_MARK, USB31_OVC_MARK,
213 +       USB31_PWEN_MARK,
214 +};
215 +static const unsigned int usb31_ovc_pins[] = {
216 +       /* OVC */
217 +       RCAR_GP_PIN(6, 31),
218 +};
219 +static const unsigned int usb31_ovc_mux[] = {
220 +       USB31_OVC_MARK,
221  };
222  
223  /* - VIN4 ------------------------------------------------------------------- */
224 @@ -4486,10 +4521,15 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
225         SH_PFC_PIN_GROUP(tmu_tclk2_a),
226         SH_PFC_PIN_GROUP(tmu_tclk2_b),
227         SH_PFC_PIN_GROUP(usb0),
228 +       SH_PFC_PIN_GROUP(usb0_ovc),
229         SH_PFC_PIN_GROUP(usb1),
230 +       SH_PFC_PIN_GROUP(usb1_ovc),
231         SH_PFC_PIN_GROUP(usb2),
232 +       SH_PFC_PIN_GROUP(usb2_ovc),
233         SH_PFC_PIN_GROUP(usb30),
234 +       SH_PFC_PIN_GROUP(usb30_ovc),
235         SH_PFC_PIN_GROUP(usb31),
236 +       SH_PFC_PIN_GROUP(usb31_ovc),
237         SH_PFC_PIN_GROUP(vin4_data8_a),
238         SH_PFC_PIN_GROUP(vin4_data16_a),
239         SH_PFC_PIN_GROUP(vin4_data18_a),
240 @@ -4977,22 +5017,27 @@ static const char * const tmu_groups[] = {
241  
242  static const char * const usb0_groups[] = {
243         "usb0",
244 +       "usb0_ovc",
245  };
246  
247  static const char * const usb1_groups[] = {
248         "usb1",
249 +       "usb1_ovc",
250  };
251  
252  static const char * const usb2_groups[] = {
253         "usb2",
254 +       "usb2_ovc",
255  };
256  
257  static const char * const usb30_groups[] = {
258         "usb30",
259 +       "usb30_ovc",
260  };
261  
262  static const char * const usb31_groups[] = {
263         "usb31",
264 +       "usb31_ovc",
265  };
266  
267  static const char * const vin4_groups[] = {
268 diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
269 index 3ebe8deb24d6..745f93884fe1 100644
270 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
271 +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c
272 @@ -3911,44 +3911,79 @@ static const unsigned int tmu_tclk2_b_mux[] = {
273  
274  /* - USB0 ------------------------------------------------------------------- */
275  static const unsigned int usb0_pins[] = {
276 -       /* PWEN, OVC */
277 -       RCAR_GP_PIN(6, 24), RCAR_GP_PIN(6, 25),
278 +       /* PWEN */
279 +       RCAR_GP_PIN(6, 24),
280  };
281  static const unsigned int usb0_mux[] = {
282 -       USB0_PWEN_MARK, USB0_OVC_MARK,
283 +       USB0_PWEN_MARK,
284 +};
285 +static const unsigned int usb0_ovc_pins[] = {
286 +       /* OVC */
287 +       RCAR_GP_PIN(6, 25),
288 +};
289 +static const unsigned int usb0_ovc_mux[] = {
290 +       USB0_OVC_MARK,
291  };
292  /* - USB1 ------------------------------------------------------------------- */
293  static const unsigned int usb1_pins[] = {
294 -       /* PWEN, OVC */
295 -       RCAR_GP_PIN(6, 26), RCAR_GP_PIN(6, 27),
296 +       /* PWEN */
297 +       RCAR_GP_PIN(6, 26),
298  };
299  static const unsigned int usb1_mux[] = {
300 -       USB1_PWEN_MARK, USB1_OVC_MARK,
301 +       USB1_PWEN_MARK,
302 +};
303 +static const unsigned int usb1_ovc_pins[] = {
304 +       /* OVC */
305 +       RCAR_GP_PIN(6, 27),
306 +};
307 +static const unsigned int usb1_ovc_mux[] = {
308 +       USB1_OVC_MARK,
309  };
310  /* - USB2 ------------------------------------------------------------------- */
311  static const unsigned int usb2_pins[] = {
312 -       /* PWEN, OVC */
313 -       RCAR_GP_PIN(6, 14), RCAR_GP_PIN(6, 15),
314 +       /* PWEN */
315 +       RCAR_GP_PIN(6, 14),
316  };
317  static const unsigned int usb2_mux[] = {
318 -       USB2_PWEN_MARK, USB2_OVC_MARK,
319 +       USB2_PWEN_MARK,
320 +};
321 +static const unsigned int usb2_ovc_pins[] = {
322 +       /* OVC */
323 +       RCAR_GP_PIN(6, 15),
324 +};
325 +static const unsigned int usb2_ovc_mux[] = {
326 +       USB2_OVC_MARK,
327  };
328  /* - USB2_CH3 --------------------------------------------------------------- */
329  static const unsigned int usb2_ch3_pins[] = {
330 -       /* PWEN, OVC */
331 -       RCAR_GP_PIN(6, 30), RCAR_GP_PIN(6, 31),
332 +       /* PWEN */
333 +       RCAR_GP_PIN(6, 30),
334  };
335  static const unsigned int usb2_ch3_mux[] = {
336 -       USB2_CH3_PWEN_MARK, USB2_CH3_OVC_MARK,
337 +       USB2_CH3_PWEN_MARK,
338 +};
339 +static const unsigned int usb2_ch3_ovc_pins[] = {
340 +       /* OVC */
341 +       RCAR_GP_PIN(6, 31),
342 +};
343 +static const unsigned int usb2_ch3_ovc_mux[] = {
344 +       USB2_CH3_OVC_MARK,
345  };
346  
347  /* - USB30 ------------------------------------------------------------------ */
348  static const unsigned int usb30_pins[] = {
349 -       /* PWEN, OVC */
350 -       RCAR_GP_PIN(6, 28), RCAR_GP_PIN(6, 29),
351 +       /* PWEN */
352 +       RCAR_GP_PIN(6, 28),
353  };
354  static const unsigned int usb30_mux[] = {
355 -       USB30_PWEN_MARK, USB30_OVC_MARK,
356 +       USB30_PWEN_MARK,
357 +};
358 +static const unsigned int usb30_ovc_pins[] = {
359 +       /* OVC */
360 +       RCAR_GP_PIN(6, 29),
361 +};
362 +static const unsigned int usb30_ovc_mux[] = {
363 +       USB30_OVC_MARK,
364  };
365  
366  /* - VIN4 ------------------------------------------------------------------- */
367 @@ -4528,10 +4563,15 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
368         SH_PFC_PIN_GROUP(tmu_tclk2_a),
369         SH_PFC_PIN_GROUP(tmu_tclk2_b),
370         SH_PFC_PIN_GROUP(usb0),
371 +       SH_PFC_PIN_GROUP(usb0_ovc),
372         SH_PFC_PIN_GROUP(usb1),
373 +       SH_PFC_PIN_GROUP(usb1_ovc),
374         SH_PFC_PIN_GROUP(usb2),
375 +       SH_PFC_PIN_GROUP(usb2_ovc),
376         SH_PFC_PIN_GROUP(usb2_ch3),
377 +       SH_PFC_PIN_GROUP(usb2_ch3_ovc),
378         SH_PFC_PIN_GROUP(usb30),
379 +       SH_PFC_PIN_GROUP(usb30_ovc),
380         VIN_DATA_PIN_GROUP(vin4_data_a, 8),
381         VIN_DATA_PIN_GROUP(vin4_data_a, 10),
382         VIN_DATA_PIN_GROUP(vin4_data_a, 12),
383 @@ -5026,22 +5066,27 @@ static const char * const tmu_groups[] = {
384  
385  static const char * const usb0_groups[] = {
386         "usb0",
387 +       "usb0_ovc",
388  };
389  
390  static const char * const usb1_groups[] = {
391         "usb1",
392 +       "usb1_ovc",
393  };
394  
395  static const char * const usb2_groups[] = {
396         "usb2",
397 +       "usb2_ovc",
398  };
399  
400  static const char * const usb2_ch3_groups[] = {
401         "usb2_ch3",
402 +       "usb2_ch3_ovc",
403  };
404  
405  static const char * const usb30_groups[] = {
406         "usb30",
407 +       "usb30_ovc",
408  };
409  
410  static const char * const vin4_groups[] = {