669306d15ba3faf8452f295a5b6a75bf8fdd4130
[oweals/openwrt.git] /
1 From c46811a3b0e0fb76015ac956172e40bce4e6d9b3 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <pelwell@users.noreply.github.com>
3 Date: Fri, 5 Jul 2019 14:49:22 +0100
4 Subject: [PATCH] overlays: Rename pi3- overlays to be less
5  model-specific (#3052)
6
7 Rename the various pi3- overlays to be more generic, listing
8 the devices they apply to in the README. The original names are
9 retained for backwards compatibility as files that just include
10 the new versions - the README marks them as being deprecated.
11
12 See: https://github.com/raspberrypi/firmware/issues/1174
13
14 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
15 ---
16  arch/arm/boot/dts/overlays/Makefile           |  4 +
17  arch/arm/boot/dts/overlays/README             | 97 ++++++++++++-------
18  .../arm/boot/dts/overlays/act-led-overlay.dts | 27 ++++++
19  .../boot/dts/overlays/disable-bt-overlay.dts  | 55 +++++++++++
20  .../dts/overlays/disable-wifi-overlay.dts     | 20 ++++
21  .../boot/dts/overlays/miniuart-bt-overlay.dts | 74 ++++++++++++++
22  .../boot/dts/overlays/pi3-act-led-overlay.dts | 28 +-----
23  .../dts/overlays/pi3-disable-bt-overlay.dts   | 56 +----------
24  .../dts/overlays/pi3-disable-wifi-overlay.dts | 21 +---
25  .../dts/overlays/pi3-miniuart-bt-overlay.dts  | 75 +-------------
26  10 files changed, 246 insertions(+), 211 deletions(-)
27  create mode 100644 arch/arm/boot/dts/overlays/act-led-overlay.dts
28  create mode 100644 arch/arm/boot/dts/overlays/disable-bt-overlay.dts
29  create mode 100644 arch/arm/boot/dts/overlays/disable-wifi-overlay.dts
30  create mode 100644 arch/arm/boot/dts/overlays/miniuart-bt-overlay.dts
31
32 --- a/arch/arm/boot/dts/overlays/Makefile
33 +++ b/arch/arm/boot/dts/overlays/Makefile
34 @@ -1,6 +1,7 @@
35  # Overlays for the Raspberry Pi platform
36  
37  dtbo-$(CONFIG_ARCH_BCM2835) += \
38 +       act-led.dtbo \
39         adau1977-adc.dtbo \
40         adau7002-simple.dtbo \
41         ads1015.dtbo \
42 @@ -26,6 +27,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
43         dht11.dtbo \
44         dionaudio-loco.dtbo \
45         dionaudio-loco-v2.dtbo \
46 +       disable-bt.dtbo \
47 +       disable-wifi.dtbo \
48         dpi18.dtbo \
49         dpi24.dtbo \
50         draws.dtbo \
51 @@ -91,6 +94,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
52         media-center.dtbo \
53         midi-uart0.dtbo \
54         midi-uart1.dtbo \
55 +       miniuart-bt.dtbo \
56         mmc.dtbo \
57         mpu6050.dtbo \
58         mz61581.dtbo \
59 --- a/arch/arm/boot/dts/overlays/README
60 +++ b/arch/arm/boot/dts/overlays/README
61 @@ -180,14 +180,16 @@ Params:
62  
63          act_led_activelow       Set to "on" to invert the sense of the LED
64                                  (default "off")
65 -                                N.B. For Pi3 see pi3-act-led overlay.
66 +                                N.B. For Pi 3B, 3B+, 3A+ and 4B, use the act-led
67 +                                overlay.
68  
69          act_led_gpio            Set which GPIO to use for the activity LED
70                                  (in case you want to connect it to an external
71                                  device)
72                                  (default "16" on a non-Plus board, "47" on a
73                                  Plus or Pi 2)
74 -                                N.B. For Pi3 see pi3-act-led overlay.
75 +                                N.B. For Pi 3B, 3B+, 3A+ and 4B, use the act-led
76 +                                overlay.
77  
78          pwr_led_trigger
79          pwr_led_activelow
80 @@ -205,6 +207,23 @@ Params:
81          and the other i2c baudrate parameters.
82  
83  
84 +Name:   act-led
85 +Info:   Pi 3B, 3B+, 3A+ and 4B use a GPIO expander to drive the LEDs which can
86 +        only be accessed from the VPU. There is a special driver for this with a
87 +        separate DT node, which has the unfortunate consequence of breaking the
88 +        act_led_gpio and act_led_activelow dtparams.
89 +        This overlay changes the GPIO controller back to the standard one and
90 +        restores the dtparams.
91 +Load:   dtoverlay=act-led,<param>=<val>
92 +Params: activelow               Set to "on" to invert the sense of the LED
93 +                                (default "off")
94 +
95 +        gpio                    Set which GPIO to use for the activity LED
96 +                                (in case you want to connect it to an external
97 +                                device)
98 +                                REQUIRED
99 +
100 +
101  Name:   adau1977-adc
102  Info:   Overlay for activation of ADAU1977 ADC codec over I2C for control
103          and I2S for data.
104 @@ -509,6 +528,21 @@ Params: 24db_digital_gain       Allow ga
105                                  that does not result in clipping/distortion!)
106  
107  
108 +Name:   disable-bt
109 +Info:   Disable onboard Bluetooth on Pi 3B, 3B+, 3A+, 4B and Zero W, restoring
110 +        UART0/ttyAMA0 over GPIOs 14 & 15.
111 +        N.B. To disable the systemd service that initialises the modem so it
112 +        doesn't use the UART, use 'sudo systemctl disable hciuart'.
113 +Load:   dtoverlay=disable-bt
114 +Params: <None>
115 +
116 +
117 +Name:   disable-wifi
118 +Info:   Disable onboard WiFi on Pi 3B, 3B+, 3A+, 4B and Zero W.
119 +Load:   dtoverlay=disable-wifi
120 +Params: <None>
121 +
122 +
123  Name:   dpi18
124  Info:   Overlay for a generic 18-bit DPI display
125          This uses GPIOs 0-21 (so no I2C, uart etc.), and activates the output
126 @@ -1447,6 +1481,20 @@ Load:   dtoverlay=midi-uart1
127  Params: <None>
128  
129  
130 +Name:   miniuart-bt
131 +Info:   Switch the onboard Bluetooth function on Pi 3B, 3B+, 3A+, 4B and Zero W
132 +        to use the mini-UART (ttyS0) and restore UART0/ttyAMA0 over GPIOs 14 &
133 +        15. Note that this may reduce the maximum usable baudrate.
134 +        N.B. It is also necessary to edit /lib/systemd/system/hciuart.service
135 +        and replace ttyAMA0 with ttyS0, unless using Raspbian or another
136 +        distribution with udev rules that create /dev/serial0 and /dev/serial1,
137 +        in which case use /dev/serial1 instead because it will always be
138 +        correct. Furthermore, you must also set core_freq and core_freq_min to
139 +        the same value in config.txt or the miniuart will not work.
140 +Load:   dtoverlay=miniuart-bt
141 +Params: <None>
142 +
143 +
144  Name:   mmc
145  Info:   Selects the bcm2835-mmc SD/MMC driver, optionally with overclock
146  Load:   dtoverlay=mmc,<param>=<val>
147 @@ -1509,48 +1557,27 @@ Params: panel                   Display
148  
149  
150  Name:   pi3-act-led
151 -Info:   Pi3 uses a GPIO expander to drive the LEDs which can only be accessed
152 -        from the VPU. There is a special driver for this with a separate DT
153 -        node, which has the unfortunate consequence of breaking the
154 -        act_led_gpio and act_led_activelow dtparams.
155 -        This overlay changes the GPIO controller back to the standard one and
156 -        restores the dtparams.
157 -Load:   dtoverlay=pi3-act-led,<param>=<val>
158 -Params: activelow               Set to "on" to invert the sense of the LED
159 -                                (default "off")
160 -
161 -        gpio                    Set which GPIO to use for the activity LED
162 -                                (in case you want to connect it to an external
163 -                                device)
164 -                                REQUIRED
165 +Info:   This overlay has been renamed act-led, keeping pi3-act-led as an alias
166 +        for backwards compatibility.
167 +Load:   <Deprecated>
168  
169  
170  Name:   pi3-disable-bt
171 -Info:   Disable Pi3 Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15
172 -        N.B. To disable the systemd service that initialises the modem so it
173 -        doesn't use the UART, use 'sudo systemctl disable hciuart'.
174 -Load:   dtoverlay=pi3-disable-bt
175 -Params: <None>
176 +Info:   This overlay has been renamed disable-bt, keeping pi3-disable-bt as an
177 +        alias for backwards compatibility.
178 +Load:   <Deprecated>
179  
180  
181  Name:   pi3-disable-wifi
182 -Info:   Disable Pi3 onboard WiFi
183 -Load:   dtoverlay=pi3-disable-wifi
184 -Params: <None>
185 +Info:   This overlay has been renamed disable-wifi, keeping pi3-disable-wifi as
186 +        an alias for backwards compatibility.
187 +Load:   <Deprecated>
188  
189  
190  Name:   pi3-miniuart-bt
191 -Info:   Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore
192 -        UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum
193 -        usable baudrate.
194 -        N.B. It is also necessary to edit /lib/systemd/system/hciuart.service
195 -        and replace ttyAMA0 with ttyS0, unless you have a system with udev rules
196 -        that create /dev/serial0 and /dev/serial1, in which case use
197 -        /dev/serial1 instead because it will always be correct. Furthermore,
198 -        you must also set core_freq=250 in config.txt or the miniuart will not
199 -        work.
200 -Load:   dtoverlay=pi3-miniuart-bt
201 -Params: <None>
202 +Info:   This overlay has been renamed miniuart-bt, keeping pi3-miniuart-bt as
203 +        an alias for backwards compatibility.
204 +Load:   <Deprecated>
205  
206  
207  Name:   pibell
208 --- /dev/null
209 +++ b/arch/arm/boot/dts/overlays/act-led-overlay.dts
210 @@ -0,0 +1,27 @@
211 +/dts-v1/;
212 +/plugin/;
213 +
214 +/* Pi3 uses a GPIO expander to drive the LEDs which can only be accessed
215 +   from the VPU. There is a special driver for this with a separate DT node,
216 +   which has the unfortunate consequence of breaking the act_led_gpio and
217 +   act_led_activelow dtparams.
218 +
219 +   This overlay changes the GPIO controller back to the standard one and
220 +   restores the dtparams.
221 +*/
222 +
223 +/{
224 +       compatible = "brcm,bcm2835";
225 +
226 +       fragment@0 {
227 +               target = <&act_led>;
228 +               frag0: __overlay__ {
229 +                       gpios = <&gpio 0 0>;
230 +               };
231 +       };
232 +
233 +       __overrides__ {
234 +               gpio = <&frag0>,"gpios:4";
235 +               activelow = <&frag0>,"gpios:8";
236 +       };
237 +};
238 --- /dev/null
239 +++ b/arch/arm/boot/dts/overlays/disable-bt-overlay.dts
240 @@ -0,0 +1,55 @@
241 +/dts-v1/;
242 +/plugin/;
243 +
244 +/* Disable Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15.
245 +   To disable the systemd service that initialises the modem so it doesn't use
246 +   the UART:
247 +
248 +       sudo systemctl disable hciuart
249 +*/
250 +
251 +/{
252 +       compatible = "brcm,bcm2835";
253 +
254 +       fragment@0 {
255 +               target = <&uart1>;
256 +               __overlay__ {
257 +                       status = "disabled";
258 +               };
259 +       };
260 +
261 +       fragment@1 {
262 +               target = <&uart0>;
263 +               __overlay__ {
264 +                       pinctrl-names = "default";
265 +                       pinctrl-0 = <&uart0_pins>;
266 +                       status = "okay";
267 +               };
268 +       };
269 +
270 +       fragment@2 {
271 +               target = <&uart0_pins>;
272 +               __overlay__ {
273 +                       brcm,pins;
274 +                       brcm,function;
275 +                       brcm,pull;
276 +               };
277 +       };
278 +
279 +       fragment@3 {
280 +               target = <&bt_pins>;
281 +               __overlay__ {
282 +                       brcm,pins;
283 +                       brcm,function;
284 +                       brcm,pull;
285 +               };
286 +       };
287 +
288 +       fragment@4 {
289 +               target-path = "/aliases";
290 +               __overlay__ {
291 +                       serial0 = "/soc/serial@7e201000";
292 +                       serial1 = "/soc/serial@7e215040";
293 +               };
294 +       };
295 +};
296 --- /dev/null
297 +++ b/arch/arm/boot/dts/overlays/disable-wifi-overlay.dts
298 @@ -0,0 +1,20 @@
299 +/dts-v1/;
300 +/plugin/;
301 +
302 +/{
303 +       compatible = "brcm,bcm2835";
304 +
305 +       fragment@0 {
306 +               target = <&mmc>;
307 +               __overlay__ {
308 +                       status = "disabled";
309 +               };
310 +       };
311 +
312 +       fragment@1 {
313 +               target = <&mmcnr>;
314 +               __overlay__ {
315 +                       status = "disabled";
316 +               };
317 +       };
318 +};
319 --- /dev/null
320 +++ b/arch/arm/boot/dts/overlays/miniuart-bt-overlay.dts
321 @@ -0,0 +1,74 @@
322 +/dts-v1/;
323 +/plugin/;
324 +
325 +/* Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore
326 +   UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum
327 +   usable baudrate.
328 +
329 +   It is also necessary to edit /lib/systemd/system/hciuart.service and
330 +   replace ttyAMA0 with ttyS0, unless you have a system with udev rules
331 +   that create /dev/serial0 and /dev/serial1, in which case use /dev/serial1
332 +   instead because it will always be correct.
333 +
334 +   If cmdline.txt uses the alias serial0 to refer to the user-accessable port
335 +   then the firmware will replace with the appropriate port whether or not
336 +   this overlay is used.
337 +*/
338 +
339 +/{
340 +       compatible = "brcm,bcm2835";
341 +
342 +       fragment@0 {
343 +               target = <&uart0>;
344 +               __overlay__ {
345 +                       pinctrl-names = "default";
346 +                       pinctrl-0 = <&uart0_pins>;
347 +                       status = "okay";
348 +               };
349 +       };
350 +
351 +       fragment@1 {
352 +               target = <&uart1>;
353 +               __overlay__ {
354 +                       pinctrl-names = "default";
355 +                       pinctrl-0 = <&uart1_pins &bt_pins &fake_bt_cts>;
356 +                       status = "okay";
357 +               };
358 +       };
359 +
360 +       fragment@2 {
361 +               target = <&uart0_pins>;
362 +               __overlay__ {
363 +                       brcm,pins;
364 +                       brcm,function;
365 +                       brcm,pull;
366 +               };
367 +       };
368 +
369 +       fragment@3 {
370 +               target = <&uart1_pins>;
371 +               __overlay__ {
372 +                       brcm,pins = <32 33>;
373 +                       brcm,function = <2>; /* alt5=UART1 */
374 +                       brcm,pull = <0 2>;
375 +               };
376 +       };
377 +
378 +       fragment@4 {
379 +               target = <&gpio>;
380 +               __overlay__ {
381 +                       fake_bt_cts: fake_bt_cts {
382 +                               brcm,pins = <31>;
383 +                               brcm,function = <1>; /* output */
384 +                       };
385 +               };
386 +       };
387 +
388 +       fragment@5 {
389 +               target-path = "/aliases";
390 +               __overlay__ {
391 +                       serial0 = "/soc/serial@7e201000";
392 +                       serial1 = "/soc/serial@7e215040";
393 +               };
394 +       };
395 +};
396 --- a/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts
397 +++ b/arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts
398 @@ -1,27 +1 @@
399 -/dts-v1/;
400 -/plugin/;
401 -
402 -/* Pi3 uses a GPIO expander to drive the LEDs which can only be accessed
403 -   from the VPU. There is a special driver for this with a separate DT node,
404 -   which has the unfortunate consequence of breaking the act_led_gpio and
405 -   act_led_activelow dtparams.
406 -
407 -   This overlay changes the GPIO controller back to the standard one and
408 -   restores the dtparams.
409 -*/
410 -
411 -/{
412 -       compatible = "brcm,bcm2835";
413 -
414 -       fragment@0 {
415 -               target = <&act_led>;
416 -               frag0: __overlay__ {
417 -                       gpios = <&gpio 0 0>;
418 -               };
419 -       };
420 -
421 -       __overrides__ {
422 -               gpio = <&frag0>,"gpios:4";
423 -               activelow = <&frag0>,"gpios:8";
424 -       };
425 -};
426 +#include "act-led-overlay.dts"
427 --- a/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts
428 +++ b/arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts
429 @@ -1,55 +1 @@
430 -/dts-v1/;
431 -/plugin/;
432 -
433 -/* Disable Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15.
434 -   To disable the systemd service that initialises the modem so it doesn't use
435 -   the UART:
436 -
437 -       sudo systemctl disable hciuart
438 -*/
439 -
440 -/{
441 -       compatible = "brcm,bcm2835";
442 -
443 -       fragment@0 {
444 -               target = <&uart1>;
445 -               __overlay__ {
446 -                       status = "disabled";
447 -               };
448 -       };
449 -
450 -       fragment@1 {
451 -               target = <&uart0>;
452 -               __overlay__ {
453 -                       pinctrl-names = "default";
454 -                       pinctrl-0 = <&uart0_pins>;
455 -                       status = "okay";
456 -               };
457 -       };
458 -
459 -       fragment@2 {
460 -               target = <&uart0_pins>;
461 -               __overlay__ {
462 -                       brcm,pins;
463 -                       brcm,function;
464 -                       brcm,pull;
465 -               };
466 -       };
467 -
468 -       fragment@3 {
469 -               target = <&bt_pins>;
470 -               __overlay__ {
471 -                       brcm,pins;
472 -                       brcm,function;
473 -                       brcm,pull;
474 -               };
475 -       };
476 -
477 -       fragment@4 {
478 -               target-path = "/aliases";
479 -               __overlay__ {
480 -                       serial0 = "/soc/serial@7e201000";
481 -                       serial1 = "/soc/serial@7e215040";
482 -               };
483 -       };
484 -};
485 +#include "disable-bt-overlay.dts"
486 --- a/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts
487 +++ b/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts
488 @@ -1,20 +1 @@
489 -/dts-v1/;
490 -/plugin/;
491 -
492 -/{
493 -       compatible = "brcm,bcm2835";
494 -
495 -       fragment@0 {
496 -               target = <&mmc>;
497 -               __overlay__ {
498 -                       status = "disabled";
499 -               };
500 -       };
501 -
502 -       fragment@1 {
503 -               target = <&mmcnr>;
504 -               __overlay__ {
505 -                       status = "disabled";
506 -               };
507 -       };
508 -};
509 +#include "disable-wifi-overlay.dts"
510 --- a/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts
511 +++ b/arch/arm/boot/dts/overlays/pi3-miniuart-bt-overlay.dts
512 @@ -1,74 +1 @@
513 -/dts-v1/;
514 -/plugin/;
515 -
516 -/* Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore
517 -   UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum
518 -   usable baudrate.
519 -
520 -   It is also necessary to edit /lib/systemd/system/hciuart.service and
521 -   replace ttyAMA0 with ttyS0, unless you have a system with udev rules
522 -   that create /dev/serial0 and /dev/serial1, in which case use /dev/serial1
523 -   instead because it will always be correct.
524 -
525 -   If cmdline.txt uses the alias serial0 to refer to the user-accessable port
526 -   then the firmware will replace with the appropriate port whether or not
527 -   this overlay is used.
528 -*/
529 -
530 -/{
531 -       compatible = "brcm,bcm2835";
532 -
533 -       fragment@0 {
534 -               target = <&uart0>;
535 -               __overlay__ {
536 -                       pinctrl-names = "default";
537 -                       pinctrl-0 = <&uart0_pins>;
538 -                       status = "okay";
539 -               };
540 -       };
541 -
542 -       fragment@1 {
543 -               target = <&uart1>;
544 -               __overlay__ {
545 -                       pinctrl-names = "default";
546 -                       pinctrl-0 = <&uart1_pins &bt_pins &fake_bt_cts>;
547 -                       status = "okay";
548 -               };
549 -       };
550 -
551 -       fragment@2 {
552 -               target = <&uart0_pins>;
553 -               __overlay__ {
554 -                       brcm,pins;
555 -                       brcm,function;
556 -                       brcm,pull;
557 -               };
558 -       };
559 -
560 -       fragment@3 {
561 -               target = <&uart1_pins>;
562 -               __overlay__ {
563 -                       brcm,pins = <32 33>;
564 -                       brcm,function = <2>; /* alt5=UART1 */
565 -                       brcm,pull = <0 2>;
566 -               };
567 -       };
568 -
569 -       fragment@4 {
570 -               target = <&gpio>;
571 -               __overlay__ {
572 -                       fake_bt_cts: fake_bt_cts {
573 -                               brcm,pins = <31>;
574 -                               brcm,function = <1>; /* output */
575 -                       };
576 -               };
577 -       };
578 -
579 -       fragment@5 {
580 -               target-path = "/aliases";
581 -               __overlay__ {
582 -                       serial0 = "/soc/serial@7e201000";
583 -                       serial1 = "/soc/serial@7e215040";
584 -               };
585 -       };
586 -};
587 +#include "miniuart-bt-overlay.dts"