From b6b126861062020fb50859c5af71d8846ce43d7c Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Mon, 4 Nov 2024 13:44:10 +0000 Subject: [PATCH] dtoverlay: Add an overlay for the Raspberry Pi firmware UART Add a device-tree overlay to configure the GPIOs for the Raspberry Pi firmware UART. Example config.txt dtoverlay=rpi-fw-uart,txd0_pin=20,rxd0_pin=21 Signed-off-by: Phil Elwell Signed-off-by: Tim Gover --- arch/arm/boot/dts/overlays/Makefile | 1 + arch/arm/boot/dts/overlays/README | 12 ++++++ .../boot/dts/overlays/rpi-fw-uart-overlay.dts | 41 +++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 arch/arm/boot/dts/overlays/rpi-fw-uart-overlay.dts --- a/arch/arm/boot/dts/overlays/Makefile +++ b/arch/arm/boot/dts/overlays/Makefile @@ -233,6 +233,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ rpi-dacpro.dtbo \ rpi-digiampplus.dtbo \ rpi-ft5406.dtbo \ + rpi-fw-uart.dtbo \ rpi-poe.dtbo \ rpi-poe-plus.dtbo \ rpi-sense.dtbo \ --- a/arch/arm/boot/dts/overlays/README +++ b/arch/arm/boot/dts/overlays/README @@ -4141,6 +4141,18 @@ Params: touchscreen-size-x Touchscr touchscreen-swapped-x-y Swap X and Y cordinates (default 0); +Name: rpi-fw-uart +Info: Configures the firmware software UART driver. + This driver requires exclusive usage of the second VPU core. The + following config.txt entries should be set when this driver is used. + dtparam=audio=off + isp_use_vpu0=1 +Load: dtoverlay=rpi-fw-uart,[=] +Params: txd0_pin GPIO pin for TXD0 (any free - default 20) + + rxd0_pin GPIO pin for RXD0 (any free - default 21) + + Name: rpi-poe Info: Raspberry Pi PoE HAT fan Load: dtoverlay=rpi-poe,[=] --- /dev/null +++ b/arch/arm/boot/dts/overlays/rpi-fw-uart-overlay.dts @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0 +// Overlay for the Raspberry Pi Firmware UART driver +/dts-v1/; +/plugin/; + +/{ + compatible = "brcm,bcm2835"; + + fragment@0 { + target = <&gpio>; + __overlay__ { + rpi_fw_uart_pins: rpi_fw_uart_pins@4 { + brcm,pins = <20 21>; + brcm,function = <1 0>; /* output input */ + brcm,pull = <0 2>; /* none pull-up */ + }; + }; + }; + + fragment@1 { + target = <&soc>; + __overlay__ { + rpi_fw_uart: rpi_fw_uart@7e000000 { + compatible = "raspberrypi,firmware-uart"; + reg = <0x7e000000 0x100>; /* VideoCore MS sync regs */ + firmware = <&firmware>; + pinctrl-names = "default"; + pinctrl-0 = <&rpi_fw_uart_pins>; + tx-gpios = <&gpio 20 0>; + rx-gpios = <&gpio 21 0>; + }; + }; + }; + + __overrides__ { + txd0_pin = <&rpi_fw_uart>,"tx-gpios:4", + <&rpi_fw_uart_pins>, "brcm,pins:0"; + rxd0_pin = <&rpi_fw_uart>,"rx-gpios:4", + <&rpi_fw_uart_pins>, "brcm,pins:4"; + }; +};