diff --git a/buildroot-external/board/raspberrypi/yellow/patches/uboot/0001-drivers-bcm283x-don-t-explicitly-disable-init.patch b/buildroot-external/board/raspberrypi/yellow/patches/uboot/0001-drivers-bcm283x-don-t-explicitly-disable-init.patch new file mode 100644 index 000000000..a3f0ebf9d --- /dev/null +++ b/buildroot-external/board/raspberrypi/yellow/patches/uboot/0001-drivers-bcm283x-don-t-explicitly-disable-init.patch @@ -0,0 +1,54 @@ +From 78704bc154d695ee16fdf8396f4d60b740190014 Mon Sep 17 00:00:00 2001 +Message-Id: <78704bc154d695ee16fdf8396f4d60b740190014.1649951002.git.stefan@agner.ch> +From: Stefan Agner +Date: Thu, 14 Apr 2022 12:15:26 +0200 +Subject: [PATCH 1/2] drivers: bcm283x: don't explicitly disable init + +It seems that the reason why init doesn't succeed is the lack of clock +support in U-Boot. Setting the default clock of 48MHz for the PL011 +UARTs makes reinitialization work consistently. + +Note that for the first UART the "skip-init" is anyways set in the +device tree. This will only affect probing of UARTs not enabled by +firmware. + +Signed-off-by: Stefan Agner +--- + drivers/serial/serial_bcm283x_pl011.c | 6 ------ + include/configs/rpi.h | 3 +++ + 2 files changed, 3 insertions(+), 6 deletions(-) + +diff --git a/drivers/serial/serial_bcm283x_pl011.c b/drivers/serial/serial_bcm283x_pl011.c +index 2d2e970316..182274036c 100644 +--- a/drivers/serial/serial_bcm283x_pl011.c ++++ b/drivers/serial/serial_bcm283x_pl011.c +@@ -51,12 +51,6 @@ static int bcm283x_pl011_serial_probe(struct udevice *dev) + if (ret) + return ret; + +- /* +- * TODO: Reinitialization doesn't always work for now, just skip +- * init always - we know we're already initialized +- */ +- plat->skip_init = true; +- + return pl01x_serial_probe(dev); + } + +diff --git a/include/configs/rpi.h b/include/configs/rpi.h +index e24c94c7d2..98ba4dc052 100644 +--- a/include/configs/rpi.h ++++ b/include/configs/rpi.h +@@ -40,6 +40,9 @@ + #define CONFIG_SYS_BOOTM_LEN SZ_64M + #endif + ++/* Define PL011 default clock */ ++#define CONFIG_PL011_CLOCK 48000000 ++ + /* Devices */ + /* GPIO */ + #define CONFIG_BCM2835_GPIO +-- +2.35.1 + diff --git a/buildroot-external/board/raspberrypi/yellow/patches/uboot/0002-drivers-bcm283x-allow-to-spawn-any-PL011-UART.patch b/buildroot-external/board/raspberrypi/yellow/patches/uboot/0002-drivers-bcm283x-allow-to-spawn-any-PL011-UART.patch new file mode 100644 index 000000000..6a8ecf88f --- /dev/null +++ b/buildroot-external/board/raspberrypi/yellow/patches/uboot/0002-drivers-bcm283x-allow-to-spawn-any-PL011-UART.patch @@ -0,0 +1,68 @@ +From c2447aa922068cebd9bbaac45acae3d853abf687 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <78704bc154d695ee16fdf8396f4d60b740190014.1649951002.git.stefan@agner.ch> +References: <78704bc154d695ee16fdf8396f4d60b740190014.1649951002.git.stefan@agner.ch> +From: Stefan Agner +Date: Thu, 14 Apr 2022 12:18:41 +0200 +Subject: [PATCH 2/2] drivers: bcm283x: allow to spawn any PL011 UART + +The current code checks pinmux for the first PL011 only. Raspberry Pi 4 +has multiple PL011 UARTs. This code prevents probing of other UARTs in +case the first PL011 UART is not active. + +Furthermore, U-Boot supports pinmuxing, hence the pins should be muxed +at this point anyway. Drop the check entirly. + +This allows to use other UARTs as stdout paths (e.g. stdout-path = +"serial5:115200n8"). + +Signed-off-by: Stefan Agner +--- + drivers/serial/serial_bcm283x_pl011.c | 27 --------------------------- + 1 file changed, 27 deletions(-) + +diff --git a/drivers/serial/serial_bcm283x_pl011.c b/drivers/serial/serial_bcm283x_pl011.c +index 182274036c..98628e1ca4 100644 +--- a/drivers/serial/serial_bcm283x_pl011.c ++++ b/drivers/serial/serial_bcm283x_pl011.c +@@ -11,37 +11,10 @@ + #include + #include "serial_pl01x_internal.h" + +-/* +- * Check if this serial device is muxed +- * +- * The serial device will only work properly if it has been muxed to the serial +- * pins by firmware. Check whether that happened here. +- * +- * @return true if serial device is muxed, false if not +- */ +-static bool bcm283x_is_serial_muxed(void) +-{ +- int serial_gpio = 15; +- struct udevice *dev; +- +- if (uclass_first_device(UCLASS_PINCTRL, &dev) || !dev) +- return false; +- +- if (pinctrl_get_gpio_mux(dev, 0, serial_gpio) != BCM2835_GPIO_ALT0) +- return false; +- +- return true; +-} +- + static int bcm283x_pl011_serial_probe(struct udevice *dev) + { +- struct pl01x_serial_plat *plat = dev_get_plat(dev); + int ret; + +- /* Don't spawn the device if it's not muxed */ +- if (!bcm283x_is_serial_muxed()) +- return -ENODEV; +- + /* + * Read the ofdata here rather than in an of_to_plat() method + * since we need the soc simple-bus to be probed so that the 'ranges' +-- +2.35.1 +