Skip to contentSkip to conversation

RISC-V (and others?) UART0 clock rate from OF_UPSTREAM

DISCUSSION E Shattow 1 participant 2 messages Apr 23, 2025 – Apr 28, 2025

lore
Share & tools
lore

E Shattow

author
#0 lore raw

Quoting Emil reply to
https://lore.kernel.org/lkml/CAJM55Z95pwTZmw-WPcUaB1BGpVoNgaRYYjUnqSFcLTNyVmZahg@mail.gmail.com/

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/riscv/boot/dts/starfive/jh7110-common.dtsi

arch/riscv/boot/dts/starfive/jh7110-common.dtsi GPOEN_DISABLE, · line 641

Quoted 11 lines

index 8a59c3001339..6bb13af82147 100644

arch/riscv/boot/dts/starfive/jh7110-common.dtsi +1 -0
@@ -635,6 +635,7 @@ GPOEN_DISABLE,
 };
 
 &uart0 {
+	clock-frequency = <24000000>;
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins>;
 	status = "okay";

"The uart0 node already has a reference to the uart0_core clock, so it shouldn't need this property."

jh7110-common-u-boot.dtsi-26-&uart0 {

jh7110-common-u-boot.dtsi-27-   bootph-pre-ram;
jh7110-common-u-boot.dtsi-28-   reg-offset = <0>;
jh7110-common-u-boot.dtsi-29-   current-speed = <115200>;
jh7110-common-u-boot.dtsi:30:   clock-frequency = <24000000>;
$ grep -B1 -rn 24000000 dts/upstream/src/riscv/starfive/
dts/upstream/src/riscv/starfive/jh7110-common.dtsi-115-&osc {
dts/upstream/src/riscv/starfive/jh7110-common.dtsi:116: clock-frequency
= <24000000>;

What should U-Boot be doing to get this uart0 setting when OF_UPSTREAM ?

-E

author
#1 lore raw
Quoted 26 lines · E Shattow

Quoting Emil reply to
https://lore.kernel.org/lkml/CAJM55Z95pwTZmw-WPcUaB1BGpVoNgaRYYjUnqSFcLTNyVmZahg@mail.gmail.com/

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/riscv/boot/dts/starfive/jh7110-common.dtsi

arch/riscv/boot/dts/starfive/jh7110-common.dtsi GPOEN_DISABLE, · line 641

Quoted 11 lines

index 8a59c3001339..6bb13af82147 100644

arch/riscv/boot/dts/starfive/jh7110-common.dtsi +1 -0
@@ -635,6 +635,7 @@ GPOEN_DISABLE,
 };
 
 &uart0 {
+	clock-frequency = <24000000>;
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins>;
 	status = "okay";

"The uart0 node already has a reference to the uart0_core clock, so it shouldn't need this property."

jh7110-common-u-boot.dtsi-26-&uart0 {

jh7110-common-u-boot.dtsi-27-   bootph-pre-ram;
jh7110-common-u-boot.dtsi-28-   reg-offset = <0>;
jh7110-common-u-boot.dtsi-29-   current-speed = <115200>;
jh7110-common-u-boot.dtsi:30:   clock-frequency = <24000000>;
Quoted 8 lines
$ grep -B1 -rn 24000000 dts/upstream/src/riscv/starfive/
dts/upstream/src/riscv/starfive/jh7110-common.dtsi-115-&osc {
dts/upstream/src/riscv/starfive/jh7110-common.dtsi:116: clock-frequency
= <24000000>;

What should U-Boot be doing to get this uart0 setting when OF_UPSTREAM ?

-E

P.S. As best I can yet understand in drivers/serial/ns16550.c the call to clk_get_by_index() returns -19 (error) when in SPL and returns 0 (success) when in U-Boot Main. I've tried adding bootph-pre-ram to every node in devicetree but it's the same error in SPL phase. Is this supposed to be working in SPL? -E