Skip to contentSkip to conversation

Fix RPI5 uart clock when loading kernel with non-boot DT

PATCH In review Bruno Leite 2 participants 3 messages Apr 15, 2025 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

cover Fix RPI5 uart clock when loading kernel with non-boot DT

From: Bruno Leite <[email protected]>

When loading the kernel with a DT that was not used to boot the rpi (e.g. when using a FIT image), the uart-clk property that should have been patched by the firmware will be passed as is to the driver and thus cause the divisor to be set incorrectly, hence the uart will not work properly. Fix that by copying the correct uart-clk set by the firmware to the new DT loaded to be passed to the kernel.

Bruno Leite (1):
rpi: copy over uart clock-frequency in DT

 board/raspberrypi/rpi/rpi.c | 3 +++
 1 file changed, 3 insertions(+)
Signature · 1 line
2.45.2
#1 lore raw

PATCH 1/1 rpi: copy over uart clock-frequency in DT

From: Bruno Leite <[email protected]>

rpi5 firmware sets uart_clk clock-frequency in
the firmware and patches it to the DT, copy it
over when loading a new DT.

---

 board/raspberrypi/rpi/rpi.c | 3 +++
 1 file changed, 3 insertions(+)
board/raspberrypi/rpi/rpi.c +3 -0
index 70d3c35499b..5c84c324c71 100644
@@ -602,6 +602,9 @@ void  update_fdt_from_fw(void *fdt, void *fw_fdt)
 
 	/* Bluetooth device address as provided by the firmware */
 	copy_property(fdt, fw_fdt, "/soc/serial@7e201000/bluetooth", "local-bd-address");
+
+	/* copy uart clk as provided by the firmware */
+	copy_property(fdt, fw_fdt, "/clocks/clk-uart", "clock-frequency");
 }
 
 int ft_board_setup(void *blob, struct bd_info *bd)
Signature · 1 line
2.45.2
Reviewed-by Tested-by on v1 1/1
#2 lore raw

Re: [PATCH 1/1] rpi: copy over uart clock-frequency in DT

Quoted 8 lines · Bruno Leite

From: Bruno Leite <[email protected]>

rpi5 firmware sets uart_clk clock-frequency in
the firmware and patches it to the DT, copy it
over when loading a new DT.

Quoted 25 lines

---

 board/raspberrypi/rpi/rpi.c | 3 +++
 1 file changed, 3 insertions(+)
board/raspberrypi/rpi/rpi.c +3 -0
index 70d3c35499b..5c84c324c71 100644
@@ -602,6 +602,9 @@ void  update_fdt_from_fw(void *fdt, void *fw_fdt)
 
        /* Bluetooth device address as provided by the firmware */
        copy_property(fdt, fw_fdt, "/soc/serial@7e201000/bluetooth",
 "local-bd-address");
+
+       /* copy uart clk as provided by the firmware */
+       copy_property(fdt, fw_fdt, "/clocks/clk-uart", "clock-frequency");
 }
 

int ft_board_setup(void *blob, struct bd_info *bd)
--
2.45.2