Skip to contentSkip to conversation

Fix J7200 kernel boot when using upstream u-boot

PATCH In review Reid Tonking 3 participants 5 messages Dec 7, 2023 – Dec 19, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover Fix J7200 kernel boot when using upstream u-boot

Since the 09.01.00.002 release of ti-linux-firmware [0] upstream uboot has led to the kernel hanging during boot [1] for the TI J7200 S0C. The issue was found to be a few patches that had be added to ti-u-boot, but not yet upstreamed. This series adds the missing two patches to allow upstream u-boot to boot the kernel properly [2].

[0] https://git.ti.com/cgit/processor-firmware/ti-linux-firmware/commit/?h=ti-linux-firmware-next&id=952fd03e36a50ec070e73560dc1060102d637ce0

Boot logs:
[1] https://gist.github.com/reidt1/5f4e85a0db258bcf20d7168bd0caebd0
[2] https://gist.github.com/reidt1/e950dc97f15ad0a09623d64f81edac39

Links to patches on ti-u-boot:
https://git.ti.com/cgit/ti-u-boot/ti-u-boot/commit/?h=ti-u-boot-2023.04-next&id=d878fbef4d4460e87608d8d2dfe5311499de49c5
https://git.ti.com/cgit/ti-u-boot/ti-u-boot/commit/?h=ti-u-boot-2023.04-next&id=543e735fe495be233a8a75b19b3d7f8ed44251e0

Changes since v2:
- changed platdata counts in clk-data.c to use array_size instead of
hardcoded value
Link to v2: https://lore.kernel.org/u-boot/[email protected]/T/#m0a035ac752b812b67c7e83719b5e2b34edab7b26

Reid Tonking (2):
arm: mach-k3: j72xx: add new 'virtual' mux
arm: dts: k3-j7200-r5-common-proc-board: Set parent clock for clock ID

    323
 arch/arm/dts/k3-j7200-r5-common-proc-board.dts |  3 ++-
 arch/arm/mach-k3/j7200/clk-data.c              | 13 +++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/2 arm: mach-k3: j72xx: add new 'virtual' mux

From: Bryan Brattlof <[email protected]>

In order for the Cortex-A72s to operate at different frequencies other than the default 2GHz, add in a new 'virtual' mux (a mux that does not physically exist in the clock tree) that can be selected.

---
 arch/arm/mach-k3/j7200/clk-data.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/mach-k3/j7200/clk-data.c +11 -2
index 9b45786a2d4..eb8436decbd 100644
@@ -141,6 +141,11 @@ static const char * const k3_pll_ctrl_wrap_main_0_sysclkout_clk_parents[] = {
 	"hsdiv4_16fft_main_0_hsdivout0_clk",
 };
 
+static const char * const main_pll8_sel_extwave_out0_parents[] = {
+	"pllfracf_ssmod_16fft_main_8_foutvcop_clk",
+	"hsdiv0_16fft_main_8_hsdivout0_clk",
+};
+
 static const char * const mcu_obsclk_outmux_out0_parents[] = {
 	"mcu_obsclk_div_out0",
 	"gluelogic_hfosc0_clkout",
@@ -396,6 +401,7 @@ static const struct clk_data clk_list[] = {
 	CLK_DIV("hsdiv4_16fft_main_3_hsdivout2_clk", "pllfracf_ssmod_16fft_main_3_foutvcop_clk", 0x683088, 0, 7, 0, 0),
 	CLK_MUX_PLLCTRL("k3_pll_ctrl_wrap_main_0_sysclkout_clk", k3_pll_ctrl_wrap_main_0_sysclkout_clk_parents, 2, 0x410000, 0),
 	CLK_DIV("k3_pll_ctrl_wrap_main_0_chip_div1_clk_clk", "k3_pll_ctrl_wrap_main_0_sysclkout_clk", 0x410118, 0, 5, 0, 0),
+	CLK_MUX("main_pll8_sel_extwave_out0", main_pll8_sel_extwave_out0_parents, 2, 0x688040, 0, 1, 0),
 	CLK_DIV("mcu_obsclk_div_out0", "wkup_obsclk_mux_out0", 0x43008000, 8, 4, 0, 0),
 	CLK_MUX("mcu_obsclk_outmux_out0", mcu_obsclk_outmux_out0_parents, 2, 0x43008000, 24, 1, 0),
 	CLK_PLL("pllfracf_ssmod_16fft_main_4_foutvcop_clk", "main_pll4_xref_sel_out0", 0x684000, 0),
@@ -545,11 +551,14 @@ static const struct dev_clk soc_dev_clk_data[] = {
 	DEV_CLK(288, 14, "board_0_hfosc1_clk_out"),
 	DEV_CLK(288, 15, "k3_pll_ctrl_wrap_main_0_chip_div1_clk_clk"),
 	DEV_CLK(288, 17, "k3_pll_ctrl_wrap_main_0_chip_div1_clk_clk"),
+	DEV_CLK(323, 0, "main_pll8_sel_extwave_out0"),
+	DEV_CLK(323, 1, "pllfracf_ssmod_16fft_main_8_foutvcop_clk"),
+	DEV_CLK(323, 2, "hsdiv0_16fft_main_8_hsdivout0_clk"),
 };
 
 const struct ti_k3_clk_platdata j7200_clk_platdata = {
 	.clk_list = clk_list,
-	.clk_list_cnt = 109,
+	.clk_list_cnt = ARRAY_SIZE(clk_list),
 	.soc_dev_clk_data = soc_dev_clk_data,
-	.soc_dev_clk_data_cnt = 129,
+	.soc_dev_clk_data_cnt = ARRAY_SIZE(soc_dev_clk_data),
 };
Signature · 1 line
2.34.1
Reviewed-by on v3 1/2
#2 lore raw

Re: [PATCH v3 1/2] arm: mach-k3: j72xx: add new 'virtual' mux

Thanks Reid

Quoted 45 lines · Reid Tonking

From: Bryan Brattlof <[email protected]>

In order for the Cortex-A72s to operate at different frequencies other than the default 2GHz, add in a new 'virtual' mux (a mux that does not physically exist in the clock tree) that can be selected.

---
  arch/arm/mach-k3/j7200/clk-data.c | 13 +++++++++++--
  1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/mach-k3/j7200/clk-data.c +9 -0
index 9b45786a2d4..eb8436decbd 100644
@@ -141,6 +141,11 @@ static const char * const k3_pll_ctrl_wrap_main_0_sysclkout_clk_parents[] = {
  	"hsdiv4_16fft_main_0_hsdivout0_clk",
  };
 
+static const char * const main_pll8_sel_extwave_out0_parents[] = {
+	"pllfracf_ssmod_16fft_main_8_foutvcop_clk",
+	"hsdiv0_16fft_main_8_hsdivout0_clk",
+};
+
  static const char * const mcu_obsclk_outmux_out0_parents[] = {
  	"mcu_obsclk_div_out0",
  	"gluelogic_hfosc0_clkout",
@@ -396,6 +401,7 @@ static const struct clk_data clk_list[] = {
  	CLK_DIV("hsdiv4_16fft_main_3_hsdivout2_clk", "pllfracf_ssmod_16fft_main_3_foutvcop_clk", 0x683088, 0, 7, 0, 0),
  	CLK_MUX_PLLCTRL("k3_pll_ctrl_wrap_main_0_sysclkout_clk", k3_pll_ctrl_wrap_main_0_sysclkout_clk_parents, 2, 0x410000, 0),
  	CLK_DIV("k3_pll_ctrl_wrap_main_0_chip_div1_clk_clk", "k3_pll_ctrl_wrap_main_0_sysclkout_clk", 0x410118, 0, 5, 0, 0),
+	CLK_MUX("main_pll8_sel_extwave_out0", main_pll8_sel_extwave_out0_parents, 2, 0x688040, 0, 1, 0),
  	CLK_DIV("mcu_obsclk_div_out0", "wkup_obsclk_mux_out0", 0x43008000, 8, 4, 0, 0),
  	CLK_MUX("mcu_obsclk_outmux_out0", mcu_obsclk_outmux_out0_parents, 2, 0x43008000, 24, 1, 0),
  	CLK_PLL("pllfracf_ssmod_16fft_main_4_foutvcop_clk", "main_pll4_xref_sel_out0", 0x684000, 0),
@@ -545,11 +551,14 @@ static const struct dev_clk soc_dev_clk_data[] = {
  	DEV_CLK(288, 14, "board_0_hfosc1_clk_out"),
  	DEV_CLK(288, 15, "k3_pll_ctrl_wrap_main_0_chip_div1_clk_clk"),
  	DEV_CLK(288, 17, "k3_pll_ctrl_wrap_main_0_chip_div1_clk_clk"),
+	DEV_CLK(323, 0, "main_pll8_sel_extwave_out0"),
+	DEV_CLK(323, 1, "pllfracf_ssmod_16fft_main_8_foutvcop_clk"),
+	DEV_CLK(323, 2, "hsdiv0_16fft_main_8_hsdivout0_clk"),

arch/arm/mach-k3/j7200/clk-data.c static const struct dev_clk soc_dev_clk_data[] = { · line 564

Quoted 10 lines
arch/arm/mach-k3/j7200/clk-data.c +2 -2
  };
 
  const struct ti_k3_clk_platdata j7200_clk_platdata = {
  	.clk_list = clk_list,
-	.clk_list_cnt = 109,
+	.clk_list_cnt = ARRAY_SIZE(clk_list),
  	.soc_dev_clk_data = soc_dev_clk_data,
-	.soc_dev_clk_data_cnt = 129,
+	.soc_dev_clk_data_cnt = ARRAY_SIZE(soc_dev_clk_data),
  };
#3 lore raw

PATCH v3 2/2 arm: dts: k3-j7200-r5-common-proc-board: Set parent clock for clock ID 323

In reply to Reid Tonking

Previously, dynamic frequency scaling supported rates only through fixed divison.

This virtual clock mux configuration enables more varied rates on A72 clock ID 202 by setting up the required register.

---
 arch/arm/dts/k3-j7200-r5-common-proc-board.dts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/dts/k3-j7200-r5-common-proc-board.dts +2 -1
index f0a73605020..018faaa13b6 100644
@@ -24,7 +24,8 @@
 				<&k3_pds 4 TI_SCI_PD_EXCLUSIVE>;
 		resets = <&k3_reset 202 0>;
 		clocks = <&k3_clks 61 1>;
-		assigned-clocks = <&k3_clks 202 2>, <&k3_clks 61 1>;
+		assigned-clocks = <&k3_clks 202 2>, <&k3_clks 61 1>, <&k3_clks 323 0>;
+		assigned-clock-parents= <0>, <0>, <&k3_clks 323 2>;
 		assigned-clock-rates = <2000000000>, <200000000>;
 		ti,sci = <&dmsc>;
 		ti,sci-proc-id = <32>;
Signature · 1 line
2.34.1
#4 lore raw
In reply to Reid Tonking
Quoted 9 lines · Reid Tonking

Since the 09.01.00.002 release of ti-linux-firmware [0] upstream uboot has led to the kernel hanging during boot [1] for the TI J7200 S0C. The issue was found to be a few patches that had be added to ti-u-boot, but not yet upstreamed. This series adds the missing two patches to allow upstream u-boot to boot the kernel properly [2].

[0] https://git.ti.com/cgit/processor-firmware/ti-linux-firmware/commit/?h=ti-linux-firmware-next&id=952fd03e36a50ec070e73560dc1060102d637ce0

[...]

Applied to u-boot/next, thanks!

Signature · 1 line
Tom