Skip to contentSkip to conversation

The latest U-boot reports an error when running on StarFive visionfive2 1.3B board

RFC New yanhong wang 3 participants 3 messages Jun 2, 2023 – Jun 3, 2023 2 messages not in the archive

Subsystems (4)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAPnjgZ1YU+Luu94_d5g-0zRbrifWSfOYf6-fEx7djvCN3iQBcA@mail.gmail.com

#2 lore raw
Quoted 31 lines · Simon Glass

Hi Yanhong,

Please can you send this to the mailing list and cc me?

Regards,
Simon

Quoted 22 lines · yanhong wang

Hi Simon Glass,

Running the latest U-boot on the StarFive VisionFive 2 1.3B board prompts the following error message:

U-Boot 2023.07-rc2-00133-g6e1852ca2c (May 17 2023 - 09:08:48 +0800)

CPU:   rv64imafdc_zba_zbb
Model: StarFive VisionFive 2 v1.3B
DRAM:  8 GiB

initcall sequence 00000000fffe08b0 failed at call 000000004021611e (err=-19) ### ERROR ### Please RESET the board ###

Roll back the most recent submission, and finally confirm that one of the submission affected [commit ID: 55171aedda88d12666e2a1bbc661dea1bec65337]. The author of this submission is you, so I sent this email to learn more about the specific situation.

Do you have any suggestions to solution this issue?

Best Regards.

[email protected]

#3 lore raw

RFC 1/1 riscv: JH7110: move pll clocks to their own device node (Was: The latest U-boot...) visionfive2 1.3B board

Quoted 5 lines · Simon Glass
Quoted 4 lines

Hi Yanhong,

Please can you send this to the mailing list and cc me?

Yes, that would have prevented some grief.

[...]

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

DRAM: 8 GiB
initcall sequence 00000000fffe08b0 failed at call 000000004021611e (err=-19) ### ERROR ### Please RESET the board ###

Roll back the most recent submission, and finally confirm that one of the submission affected [commit ID: 55171aedda88d12666e2a1bbc661dea1bec65337].

Here is the revert, along with a work in progress attempt to make the DT match the hardware. Conor had asked me to share it, regardless of its early stage. It compiles, and boots Linux kernels, but there is no PLL driver I can find currently. So clocks are still hanging in PROBE_DEFER.

Torsten

arch/riscv/dts/jh7110-starfive-visionfive-2.dtsi +3 -3
index 710b082766..6bb0ddf405 100644
@@ -313,9 +313,9 @@
 			  <&syscrg JH7110_SYSCLK_BUS_ROOT>,
 			  <&syscrg JH7110_SYSCLK_PERH_ROOT>,
 			  <&syscrg JH7110_SYSCLK_QSPI_REF>;
-	assigned-clock-parents = <&syscrg JH7110_SYSCLK_PLL0_OUT>,
-				 <&syscrg JH7110_SYSCLK_PLL2_OUT>,
-				 <&syscrg JH7110_SYSCLK_PLL2_OUT>,
+	assigned-clock-parents = <&sys_syscon JH7110_SYSCLK_PLL0_OUT>,
+				 <&sys_syscon JH7110_SYSCLK_PLL2_OUT>,
+				 <&sys_syscon JH7110_SYSCLK_PLL2_OUT>,
 				 <&syscrg JH7110_SYSCLK_QSPI_REF_SRC>;
 	assigned-clock-rates = <0>, <0>, <0>, <0>;
 };
arch/riscv/dts/jh7110.dtsi +1 -0
index 58e332e9d7..c9e820fa9b 100644
@@ -500,6 +500,7 @@
 		sys_syscon: sys_syscon@13030000 {
 			compatible = "starfive,jh7110-sys-syscon","syscon";
 			reg = <0x0 0x13030000 0x0 0x1000>;
+			#clock-cells = <1>;
 		};
 
 		sysgpio: pinctrl@13040000 {
drivers/clk/starfive/clk-jh7110-pll.c +33 -1
index 02e6d9000e..f2f970e0d0 100644
@@ -11,6 +11,7 @@
 #include <clk-uclass.h>
 #include <div64.h>
 #include <dm/device.h>
+#include <dt-bindings/clock/starfive,jh7110-crg.h>
 #include <linux/bitops.h>
 #include <linux/clk-provider.h>
 #include <linux/delay.h>
@@ -286,7 +287,10 @@ struct clk *starfive_jh7110_pll(const char *name, const char *parent_name,
 
 	if (!pll_clk || !base || !sysreg)
 		return ERR_PTR(-EINVAL);
-
+#ifdef DEBUG
+	printf("pll: %s - %s base: %p sysreg: %p\n",
+		parent_name, name, base, sysreg);
+#endif
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
 	if (!pll)
 		return ERR_PTR(-ENOMEM);
@@ -314,8 +318,36 @@ struct clk *starfive_jh7110_pll(const char *name, const char *parent_name,
 	return clk;
 }
 
+static int jh7110_pllclk_probe(struct udevice *dev)
+{
+	void __iomem *addr, *reg;
+
+	/* TODO: get below address(es) from OF DT! */
+	addr = (void __iomem *)0x13030000;
+	reg  = (void __iomem *)0x13020000;
+
+	clk_dm(JH7110_SYSCLK_PLL0_OUT,
+	       starfive_jh7110_pll("pll0_out", "oscillator", (void __iomem *)addr,
+				   reg, &starfive_jh7110_pll0));
+	clk_dm(JH7110_SYSCLK_PLL1_OUT,
+	       starfive_jh7110_pll("pll1_out", "oscillator", (void __iomem *)addr,
+				   reg, &starfive_jh7110_pll1));
+	clk_dm(JH7110_SYSCLK_PLL2_OUT,
+	       starfive_jh7110_pll("pll2_out", "oscillator", (void __iomem *)addr,
+				   reg, &starfive_jh7110_pll2));
+	return 0;
+}
+
+static const struct udevice_id jh7110_pllclk_of_match[] = {
+	{ .compatible = "starfive,jh7110-sys-syscon" },
+  { }
+};
+
 U_BOOT_DRIVER(jh7110_clk_pllx) = {
 	.name	= UBOOT_DM_CLK_JH7110_PLLX,
 	.id	= UCLASS_CLK,
+	.of_match = jh7110_pllclk_of_match,
 	.ops	= &clk_jh7110_ops,
+	.probe	= jh7110_pllclk_probe,
 };
+
drivers/clk/starfive/clk-jh7110.c +2 -0
index a74b70906a..899a9bb49e 100644
@@ -246,9 +246,11 @@ static int jh7110_syscrg_init(struct udevice *dev)
 	clk_dm(JH7110_SYSCLK_PLL0_OUT,
 	       starfive_jh7110_pll("pll0_out", "oscillator", (void __iomem *)addr,
 				   priv->reg, &starfive_jh7110_pll0));
+#if 0
 	clk_dm(JH7110_SYSCLK_PLL1_OUT,
 	       starfive_jh7110_pll("pll1_out", "oscillator", (void __iomem *)addr,
 				   priv->reg, &starfive_jh7110_pll1));
+#endif
 	clk_dm(JH7110_SYSCLK_PLL2_OUT,
 	       starfive_jh7110_pll("pll2_out", "oscillator", (void __iomem *)addr,
 				   priv->reg, &starfive_jh7110_pll2));
drivers/core/root.c +1 -1
index 6775fb0b65..2bd2737440 100644
@@ -436,7 +436,7 @@ int dm_init_and_scan(bool pre_reloc_only)
 			return ret;
 		}
 	}
-	if (CONFIG_IS_ENABLED(DM_EVENT) && !(gd->flags & GD_FLG_RELOC)) {
+	if (CONFIG_IS_ENABLED(DM_EVENT) /* && !(gd->flags & GD_FLG_RELOC) */ ) {
 		ret = event_notify_null(EVT_DM_POST_INIT_F);
 		if (ret)
 			return log_msg_ret("ev", ret);
include/dt-bindings/clock/starfive,jh7110-crg.h +3 -3
index 77b70e7a83..6b182888a7 100644
@@ -199,9 +199,9 @@
 #define JH7110_SYSCLK_TDM_CLK_TDM_N		188
 #define JH7110_SYSCLK_JTAG_CERTIFICATION_TRNG	189
 
-#define JH7110_SYSCLK_PLL0_OUT			190
-#define JH7110_SYSCLK_PLL1_OUT			191
-#define JH7110_SYSCLK_PLL2_OUT			192
+#define JH7110_SYSCLK_PLL0_OUT			0
+#define JH7110_SYSCLK_PLL1_OUT			1
+#define JH7110_SYSCLK_PLL2_OUT			2
 
 #define JH7110_SYSCLK_END			193
 
#4 lore raw
In reply to yanhong wang

Hi,

Quoted 26 lines · yanhong wang
Quoted 22 lines · Simon Glass

Hi Yanhong,

Please can you send this to the mailing list and cc me?

Regards,
Simon

Quoted 13 lines · yanhong wang

Hi Simon Glass,

Running the latest U-boot on the StarFive VisionFive 2 1.3B board prompts the following error message:

U-Boot 2023.07-rc2-00133-g6e1852ca2c (May 17 2023 - 09:08:48 +0800)

CPU:   rv64imafdc_zba_zbb
Model: StarFive VisionFive 2 v1.3B
DRAM:  8 GiB

initcall sequence 00000000fffe08b0 failed at call 000000004021611e (err=-19) ### ERROR ### Please RESET the board ###

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Roll back the most recent submission, and finally confirm that one of the submission affected [commit ID: 55171aedda88d12666e2a1bbc661dea1bec65337]. The author of this submission is you, so I sent this email to learn more about the specific situation.

Do you have any suggestions to solution this issue?

$ ./scripts/event_dump.py /tmp/b/starfive_visionfive2/u-boot
Event type            Id                              Source location
--------------------  ------------------------------
------------------------------
EVT_DM_POST_INIT_F    f:.text_rest                    arch/riscv/cpu/cpu.c:95
EVT_FT_FIXUP          f:bootmeth_vbe_ft_fixup         boot/vbe_request.c:153
EVT_FT_FIXUP          f:bootmeth_vbe_simple_ft_fixup  boot/vbe_simple_os.c:54

Looking at the first line, it is calling riscv_cpu_setup(). I'm not sure why it is failing now, but didn't before, since the commit drops the post-relocation call, leaving just the pre-relocation call. Is this failing before or after relocation? (GD_FLAG_RELOC)

But you should look at why riscv_cpu_setup() needs to be called before relocation and whether the CPU nodes in the devicetree need a bootph-pre-ram property as per [1].

Regards,
Simon

[1] https://u-boot.readthedocs.io/en/latest/develop/driver-model/design.html?highlight=bootph-pre-ram#pre-relocation-support