Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux serial tty driver for Raspberry Pi firmware UART #6502

Merged
merged 5 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions arch/arm/boot/dts/overlays/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
12 changes: 12 additions & 0 deletions arch/arm/boot/dts/overlays/README
Original file line number Diff line number Diff line change
Expand Up @@ -4141,6 +4141,18 @@ Params: touchscreen-size-x Touchscreen X resolution (default 800)
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,<param>[=<val>]
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,<param>[=<val>]
Expand Down
41 changes: 41 additions & 0 deletions arch/arm/boot/dts/overlays/rpi-fw-uart-overlay.dts
Original file line number Diff line number Diff line change
@@ -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";
};
};
1 change: 1 addition & 0 deletions arch/arm/configs/bcm2709_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SERIAL_SC16IS7XX=m
CONFIG_SERIAL_SC16IS7XX_SPI=y
CONFIG_SERIAL_RPI_FW=m
CONFIG_SERIAL_DEV_BUS=y
CONFIG_TTY_PRINTK=y
CONFIG_HW_RANDOM=y
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/bcm2711_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SERIAL_SC16IS7XX=m
CONFIG_SERIAL_SC16IS7XX_SPI=y
CONFIG_SERIAL_RPI_FW=m
CONFIG_SERIAL_DEV_BUS=y
CONFIG_TTY_PRINTK=y
CONFIG_HW_RANDOM=y
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/bcmrpi_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SERIAL_SC16IS7XX=m
CONFIG_SERIAL_SC16IS7XX_SPI=y
CONFIG_SERIAL_RPI_FW=m
CONFIG_SERIAL_DEV_BUS=y
CONFIG_TTY_PRINTK=y
CONFIG_HW_RANDOM=y
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/bcm2711_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SERIAL_SC16IS7XX=m
CONFIG_SERIAL_SC16IS7XX_SPI=y
CONFIG_SERIAL_RPI_FW=m
CONFIG_SERIAL_DEV_BUS=y
CONFIG_TTY_PRINTK=y
CONFIG_HW_RANDOM=y
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/bcmrpi3_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SERIAL_SC16IS7XX=m
CONFIG_SERIAL_SC16IS7XX_SPI=y
CONFIG_SERIAL_RPI_FW=m
CONFIG_SERIAL_DEV_BUS=y
CONFIG_TTY_PRINTK=y
CONFIG_HW_RANDOM=y
Expand Down
11 changes: 11 additions & 0 deletions drivers/tty/serial/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,17 @@ config SERIAL_NUVOTON_MA35D1_CONSOLE
but you can alter that using a kernel command line option such as
"console=ttyNVTx".

config SERIAL_RPI_FW
tristate "Raspberry Pi Firmware software UART support"
depends on ARM_AMBA || COMPILE_TEST
select SERIAL_CORE
help
This selects the Raspberry Pi firmware UART. This is a bit-bashed
implementation running on the Raspbery Pi VPU core.
This is not supported on Raspberry Pi 5 or newer platforms.

If unsure, say N.

endmenu

config SERIAL_MCTRL_GPIO
Expand Down
1 change: 1 addition & 0 deletions drivers/tty/serial/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ obj-$(CONFIG_SERIAL_MILBEAUT_USIO) += milbeaut_usio.o
obj-$(CONFIG_SERIAL_SIFIVE) += sifive.o
obj-$(CONFIG_SERIAL_LITEUART) += liteuart.o
obj-$(CONFIG_SERIAL_SUNPLUS) += sunplus-uart.o
obj-$(CONFIG_SERIAL_RPI_FW) += rpi-fw-uart.o

# GPIOLIB helpers for modem control lines
obj-$(CONFIG_SERIAL_MCTRL_GPIO) += serial_mctrl_gpio.o
Expand Down
Loading
Loading