0e4b3e3747521177ab5f6a3b1c7d53446f0d5f45
[openwrt/staging/linusw.git] /
1 From b6b126861062020fb50859c5af71d8846ce43d7c Mon Sep 17 00:00:00 2001
2 From: Tim Gover <tim.gover@raspberrypi.com>
3 Date: Mon, 4 Nov 2024 13:44:10 +0000
4 Subject: [PATCH] dtoverlay: Add an overlay for the Raspberry Pi firmware UART
5
6 Add a device-tree overlay to configure the GPIOs for the
7 Raspberry Pi firmware UART.
8
9 Example config.txt
10 dtoverlay=rpi-fw-uart,txd0_pin=20,rxd0_pin=21
11
12 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
13 Signed-off-by: Tim Gover <tim.gover@raspberrypi.com>
14 ---
15 arch/arm/boot/dts/overlays/Makefile | 1 +
16 arch/arm/boot/dts/overlays/README | 12 ++++++
17 .../boot/dts/overlays/rpi-fw-uart-overlay.dts | 41 +++++++++++++++++++
18 3 files changed, 54 insertions(+)
19 create mode 100644 arch/arm/boot/dts/overlays/rpi-fw-uart-overlay.dts
20
21 --- a/arch/arm/boot/dts/overlays/Makefile
22 +++ b/arch/arm/boot/dts/overlays/Makefile
23 @@ -233,6 +233,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
24 rpi-dacpro.dtbo \
25 rpi-digiampplus.dtbo \
26 rpi-ft5406.dtbo \
27 + rpi-fw-uart.dtbo \
28 rpi-poe.dtbo \
29 rpi-poe-plus.dtbo \
30 rpi-sense.dtbo \
31 --- a/arch/arm/boot/dts/overlays/README
32 +++ b/arch/arm/boot/dts/overlays/README
33 @@ -4141,6 +4141,18 @@ Params: touchscreen-size-x Touchscr
34 touchscreen-swapped-x-y Swap X and Y cordinates (default 0);
35
36
37 +Name: rpi-fw-uart
38 +Info: Configures the firmware software UART driver.
39 + This driver requires exclusive usage of the second VPU core. The
40 + following config.txt entries should be set when this driver is used.
41 + dtparam=audio=off
42 + isp_use_vpu0=1
43 +Load: dtoverlay=rpi-fw-uart,<param>[=<val>]
44 +Params: txd0_pin GPIO pin for TXD0 (any free - default 20)
45 +
46 + rxd0_pin GPIO pin for RXD0 (any free - default 21)
47 +
48 +
49 Name: rpi-poe
50 Info: Raspberry Pi PoE HAT fan
51 Load: dtoverlay=rpi-poe,<param>[=<val>]
52 --- /dev/null
53 +++ b/arch/arm/boot/dts/overlays/rpi-fw-uart-overlay.dts
54 @@ -0,0 +1,41 @@
55 +// SPDX-License-Identifier: GPL-2.0
56 +// Overlay for the Raspberry Pi Firmware UART driver
57 +/dts-v1/;
58 +/plugin/;
59 +
60 +/{
61 + compatible = "brcm,bcm2835";
62 +
63 + fragment@0 {
64 + target = <&gpio>;
65 + __overlay__ {
66 + rpi_fw_uart_pins: rpi_fw_uart_pins@4 {
67 + brcm,pins = <20 21>;
68 + brcm,function = <1 0>; /* output input */
69 + brcm,pull = <0 2>; /* none pull-up */
70 + };
71 + };
72 + };
73 +
74 + fragment@1 {
75 + target = <&soc>;
76 + __overlay__ {
77 + rpi_fw_uart: rpi_fw_uart@7e000000 {
78 + compatible = "raspberrypi,firmware-uart";
79 + reg = <0x7e000000 0x100>; /* VideoCore MS sync regs */
80 + firmware = <&firmware>;
81 + pinctrl-names = "default";
82 + pinctrl-0 = <&rpi_fw_uart_pins>;
83 + tx-gpios = <&gpio 20 0>;
84 + rx-gpios = <&gpio 21 0>;
85 + };
86 + };
87 + };
88 +
89 + __overrides__ {
90 + txd0_pin = <&rpi_fw_uart>,"tx-gpios:4",
91 + <&rpi_fw_uart_pins>, "brcm,pins:0";
92 + rxd0_pin = <&rpi_fw_uart>,"rx-gpios:4",
93 + <&rpi_fw_uart_pins>, "brcm,pins:4";
94 + };
95 +};