[PATCH] ARM: DTS: make rpi3/4 use pl011 uart as primary

Daniel Brát danek.brat at gmail.com
Sat Jun 11 11:28:28 PDT 2022


When the videocore first-stage bootloader finds 'dtoverlay=disable-bt' in the
'config.txt', asides from applying said overlay, it also disables fixed
clock for the vpu, which miniuart requires to calculate correct baudrate,
rendering it non-functional. This can be fixed by adding 'core_freq=250'
to the config, but since barebox has drivers for the pl011 full-fledged UART,
lets just make barebox use it instead.

Signed-off-by: Daniel Brát <danek.brat at gmail.com>
---
 arch/arm/dts/bcm2711-rpi-4.dts       |  8 +-------
 arch/arm/dts/bcm2837-rpi-3.dts       |  2 ++
 arch/arm/dts/rpi-use-pl011-uart.dtsi | 24 ++++++++++++++++++++++++
 3 files changed, 27 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/rpi-use-pl011-uart.dtsi

diff --git a/arch/arm/dts/bcm2711-rpi-4.dts b/arch/arm/dts/bcm2711-rpi-4.dts
index 3c0caa73f..e082ad868 100644
--- a/arch/arm/dts/bcm2711-rpi-4.dts
+++ b/arch/arm/dts/bcm2711-rpi-4.dts
@@ -9,10 +9,4 @@
 	status = "disabled";
 };
 
-&uart1 {
-	/* VPU core clock is reported at 200MHz, but needs to be 500Mhz
-	 * for ns16550 driver to set correct baudrate. Until that's
-	 * figured out, hardcode clock frequency to the expected value
-	 */
-	clock-frequency = <500000000>;
-};
+#include "rpi-use-pl011-uart.dtsi"
diff --git a/arch/arm/dts/bcm2837-rpi-3.dts b/arch/arm/dts/bcm2837-rpi-3.dts
index e82d518fa..6af9e9d7c 100644
--- a/arch/arm/dts/bcm2837-rpi-3.dts
+++ b/arch/arm/dts/bcm2837-rpi-3.dts
@@ -7,3 +7,5 @@
 &sdhci {
 	status = "disabled";
 };
+
+#include "rpi-use-pl011-uart.dtsi"
diff --git a/arch/arm/dts/rpi-use-pl011-uart.dtsi b/arch/arm/dts/rpi-use-pl011-uart.dtsi
new file mode 100644
index 000000000..7c75b07f8
--- /dev/null
+++ b/arch/arm/dts/rpi-use-pl011-uart.dtsi
@@ -0,0 +1,24 @@
+/* https://www.raspberrypi.com/documentation/computers/configuration.html#primary-and-secondary-uart */
+
+/* Makes barebox use pl011 uart as primary */
+
+&uart1 {
+        status = "disabled";
+};
+
+&uart0 {
+        pinctrl-names = "default";
+        pinctrl-0 = <&uart0_gpio14>;
+        status = "okay";
+};
+
+/delete-node/ &bt;
+
+&{/aliases} {
+        serial0 = &uart0;
+        serial1 = &uart1;
+};
+
+&{/chosen} {
+        stdout-path = "/serial0:115200n8";
+};
-- 
2.17.1




More information about the barebox mailing list