Support OF_UPSTREAM for StarFive JH7110
Subsystems (8)
Hal Feng
maintainerv7 cover Support OF_UPSTREAM for StarFive JH7110
This patchset add OF_UPSTREAM support for StarFive JH7110 based boards. All the JH7110 based boards can use the DT from upstreaming linux kernel. The v1.3b board device tree is set as the default device tree. Support CONFIG_MULTI_DTB_FIT and the SPL selects the correct U-Boot dtb using the EEPROM information.
Note:
1. Mars CM (lite) are missing upstream dts and so are detected but not supported in this series. Users of Mars CM and Mars CM Lite may stay with U-Boot v2024.10 until this is resolved.
2. Property values of network phy0/1 for all JH7110 based boards now follow the upstream dts.
Changes since v6:
- Drop the "snps,dw-mshc" override of compatible in patch 2, then add "starfive,jh7110-mmc" compatible in mmc driver to match upstream DT.
- Delete newline at end of Mars DT file in patch 5.
- Sort OF_LIST in patch 7.
- Sort items of images and configurations in patch 8.
Changes since v5:
- In patch 2, drop the override of rx-internal-delay-ps on phy0 and phy1.
- In patch 5, drop "/delete-property/ motorcomm,tx-clk-10-inverted;" for Mars network phy0.
- In patch 8, rename fdt and conf based on the compatible identifier of boards.
Changes since v4:
- Merge patch 2, 3, 5 into patch 1, ensuring git bisect works.
- Add a new patch to sort the list of JH7110 imply statements.
- Drop the reparent of clock JH7110_AONCLK_APB_FUNC in patch 4, which is unnecessary and will cause errors in gmac0 initialization.
Changes since v3:
- Add detection for Milk-V Mars CM (lite) boards in patch 13.
Changes since v2:
- Drop patch 1, because the riscv of_upstream Makefile is created by Conor in commit 239e4705099c.
- Drop phy0 rx delay for milkv u-boot dtsi in patch 9.
- Add a Fixes tag for patch 13.
- In patch 14, the PCB version is only obtained when the product_id is VF7110. Improve the commit messages.
Changes since v1:
- Drop patch 12.
- Modify patch 11 and add three new patches to support CONFIG_MULTI_DTB_FIT. The SPL selects the correct U-Boot dtb using the EEPROM information.
History:
v6: https://lore.kernel.org/all/[email protected]/
v5: https://lore.kernel.org/all/[email protected]/
v4: https://lore.kernel.org/all/[email protected]/
v3: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/
Hal Feng (12):
dts: starfive: Switch to using upstream DT
riscv: dts: jh7110: Make u-boot device trees adapting to upstream DT
mmc: dw_mmc: Add "starfive,jh7110-mmc" compatible to match upstream DT
pcie: starfive: Make the driver compatible with upstream DT
riscv: dts: jh7110: Move common code to the new
jh7110-common-u-boot.dtsi
riscv: dts: jh7110: Add u-boot device tree for JH7110 based boards
board: starfive: spl: Drop the unneeded DT modification code
configs: visionfive2: Enable MULTI_DTB_FIT for JH7110 based board DT
riscv: dts: jh7110: Support multiple DTBs in a Fit image
board: starfive: spl: Fix the wrong use of CONFIG_IS_ENABLED()
board: starfive: spl: Support multiple DTBs for JH7110 based boards
riscv: cpu: jh7110: Sort the list of imply statements
arch/riscv/cpu/jh7110/Kconfig | 19 +- arch/riscv/dts/Makefile | 1 - arch/riscv/dts/jh7110-common-u-boot.dtsi | 196 +++++ arch/riscv/dts/jh7110-milkv-mars-u-boot.dtsi | 6 + .../dts/jh7110-pine64-star64-u-boot.dtsi | 6 + .../jh7110-starfive-visionfive-2-u-boot.dtsi | 117 --- ...10-starfive-visionfive-2-v1.2a-u-boot.dtsi | 6 + ...10-starfive-visionfive-2-v1.3b-u-boot.dtsi | 6 + .../dts/jh7110-starfive-visionfive-2.dts | 11 - .../dts/jh7110-starfive-visionfive-2.dtsi | 380 --------- arch/riscv/dts/jh7110-u-boot.dtsi | 36 +- arch/riscv/dts/jh7110.dtsi | 761 ------------------ board/starfive/visionfive2/spl.c | 391 +-------- configs/starfive_visionfive2_defconfig | 4 +- drivers/clk/starfive/clk-jh7110-pll.c | 6 +- drivers/clk/starfive/clk-jh7110.c | 44 +- drivers/mmc/snps_dw_mmc.c | 1 + drivers/pci/pcie_starfive_jh7110.c | 59 +- .../dt-bindings/clock/starfive,jh7110-crg.h | 258 ------ .../dt-bindings/reset/starfive,jh7110-crg.h | 183 ----- 20 files changed, 356 insertions(+), 2135 deletions(-) create mode 100644 arch/riscv/dts/jh7110-common-u-boot.dtsi create mode 100644 arch/riscv/dts/jh7110-milkv-mars-u-boot.dtsi create mode 100644 arch/riscv/dts/jh7110-pine64-star64-u-boot.dtsi delete mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-u-boot.dtsi create mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-v1.2a-u-boot.dtsi create mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsi delete mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2.dts delete mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2.dtsi delete mode 100644 arch/riscv/dts/jh7110.dtsi delete mode 100644 include/dt-bindings/clock/starfive,jh7110-crg.h delete mode 100644 include/dt-bindings/reset/starfive,jh7110-crg.h
base-commit: acab6e78aca767ef71470871842e5c090e3672c7
Signature · 1 line
2.43.2
Hal Feng
maintainerPATCH v7 1/12 dts: starfive: Switch to using upstream DT
Enable OF_UPSTREAM to use upstream DT and add starfive/ prefix to the DEFAULT_DEVICE_TREE. Rename jh7110-starfive-visionfive-2-u-boot.dtsi to jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsi and set the v1.3b device tree as the default device tree.
Drop redundant DT files from arch/riscv/dts/ and redundant clock and reset definitions from include/dt-bindings/.
Since the old clock definitions is a little different from those in upstream Linux, update the clock definitions in clock drivers accordingly.
---
arch/riscv/cpu/jh7110/Kconfig | 1 +
arch/riscv/dts/Makefile | 1 -
...0-starfive-visionfive-2-v1.3b-u-boot.dtsi} | 0
.../dts/jh7110-starfive-visionfive-2.dts | 11 -
.../dts/jh7110-starfive-visionfive-2.dtsi | 380 ---------
arch/riscv/dts/jh7110-u-boot.dtsi | 2 +-
arch/riscv/dts/jh7110.dtsi | 761 ------------------
configs/starfive_visionfive2_defconfig | 2 +-
drivers/clk/starfive/clk-jh7110-pll.c | 6 +-
drivers/clk/starfive/clk-jh7110.c | 44 +-
.../dt-bindings/clock/starfive,jh7110-crg.h | 258 ------
.../dt-bindings/reset/starfive,jh7110-crg.h | 183 -----
12 files changed, 28 insertions(+), 1621 deletions(-)
rename arch/riscv/dts/{jh7110-starfive-visionfive-2-u-boot.dtsi => jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsi} (100%)
delete mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2.dts
delete mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2.dtsi
delete mode 100644 arch/riscv/dts/jh7110.dtsi
delete mode 100644 include/dt-bindings/clock/starfive,jh7110-crg.h
delete mode 100644 include/dt-bindings/reset/starfive,jh7110-crg.harch/riscv/cpu/jh7110/Kconfig +1 -0
@@ -19,6 +19,7 @@ config STARFIVE_JH7110 imply MMC imply MMC_BROKEN_CD imply MMC_SPI + imply OF_UPSTREAM imply RISCV_TIMER if (RISCV_SMODE || SPL_RISCV_SMODE) imply SIFIVE_CACHE imply SIFIVE_CCACHE
arch/riscv/dts/Makefile +0 -1
@@ -7,7 +7,6 @@ dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) += openpiton-riscv64.dtb dtb-$(CONFIG_TARGET_SIFIVE_UNLEASHED) += hifive-unleashed-a00.dtb dtb-$(CONFIG_TARGET_SIFIVE_UNMATCHED) += hifive-unmatched-a00.dtb dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb -dtb-$(CONFIG_TARGET_STARFIVE_VISIONFIVE2) += jh7110-starfive-visionfive-2.dtb dtb-$(CONFIG_TARGET_TH1520_LPI4A) += th1520-lichee-pi-4a.dtb dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-mbv32.dtb dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-mbv64.dtb
arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsi renamed from arch/riscv/dts/jh7110-starfive-visionfive-2-u-boot.dtsi +0 -0
arch/riscv/dts/jh7110-starfive-visionfive-2.dts deleted +0 -11
@@ -1,11 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 OR MIT -/* - * Copyright (C) 2023 StarFive Technology Co., Ltd. - */ - -/dts-v1/; -#include "jh7110-starfive-visionfive-2.dtsi" - -/ { - compatible = "starfive,visionfive-2-v1.3b", "starfive,jh7110"; -};
arch/riscv/dts/jh7110-starfive-visionfive-2.dtsi deleted +0 -380
380 lines not on this page · raw message
arch/riscv/dts/jh7110-u-boot.dtsi +1 -1
@@ -62,7 +62,7 @@ <&syscrg JH7110_SYSRST_DDR_OSC>, <&syscrg JH7110_SYSRST_DDR_APB>; reset-names = "axi", "osc", "apb"; - clocks = <&syscrg JH7110_SYSCLK_PLL1_OUT>; + clocks = <&syscrg JH7110_PLLCLK_PLL1_OUT>; clock-names = "pll1_out"; clock-frequency = <2133>; };
arch/riscv/dts/jh7110.dtsi deleted +0 -761
761 lines not on this page · raw message
configs/starfive_visionfive2_defconfig +1 -1
@@ -9,7 +9,7 @@ CONFIG_SF_DEFAULT_SPEED=100000000 CONFIG_ENV_SIZE=0x10000 CONFIG_ENV_OFFSET=0xf0000 CONFIG_SPL_DM_SPI=y -CONFIG_DEFAULT_DEVICE_TREE="jh7110-starfive-visionfive-2" +CONFIG_DEFAULT_DEVICE_TREE="starfive/jh7110-starfive-visionfive-2-v1.3b" CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_SPL_MMC=y
drivers/clk/starfive/clk-jh7110-pll.c +3 -3
@@ -374,13 +374,13 @@ static int jh7110_pll_clk_probe(struct udevice *dev)if (sysreg ==FDT_ADDR_T_NONE )return -EINVAL ; -clk_dm (JH7110_PLL_ID_TRANS (JH7110_SYSCLK_PLL0_OUT ), +clk_dm (JH7110_PLL_ID_TRANS (JH7110_PLLCLK_PLL0_OUT ),starfive_jh7110_pll ("pll0_out" ,"oscillator" , reg, (void __iomem *)sysreg, &starfive_jh7110_pll0)); -clk_dm (JH7110_PLL_ID_TRANS (JH7110_SYSCLK_PLL1_OUT ), +clk_dm (JH7110_PLL_ID_TRANS (JH7110_PLLCLK_PLL1_OUT ),starfive_jh7110_pll ("pll1_out" ,"oscillator" , reg, (void __iomem *)sysreg, &starfive_jh7110_pll1)); -clk_dm (JH7110_PLL_ID_TRANS (JH7110_SYSCLK_PLL2_OUT ), +clk_dm (JH7110_PLL_ID_TRANS (JH7110_PLLCLK_PLL2_OUT ),starfive_jh7110_pll ("pll2_out" ,"oscillator" , reg, (void __iomem *)sysreg, &starfive_jh7110_pll2));
drivers/clk/starfive/clk-jh7110.c +22 -22
83 lines not on this page · raw message
include/dt-bindings/clock/starfive,jh7110-crg.h deleted +0 -258
258 lines not on this page · raw message
include/dt-bindings/reset/starfive,jh7110-crg.h deleted +0 -183
183 lines not on this page · raw message
Signature · 1 line
2.43.2
Hal Feng
maintainerPATCH v7 2/12 riscv: dts: jh7110: Make u-boot device trees adapting to upstream DT
In reply to Hal FengAdd u-boot features to the U-Boot device tree.
--- ...10-starfive-visionfive-2-v1.3b-u-boot.dtsi | 33 +++++++++++++++--- arch/riscv/dts/jh7110-u-boot.dtsi | 34 +++++++++++++++++++ 2 files changed, 63 insertions(+), 4 deletions(-)
arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsi +29 -4
@@ -6,6 +6,10 @@ #include "binman.dtsi" #include "jh7110-u-boot.dtsi" / { + aliases { + spi0 = &qspi; + }; + chosen { bootph-pre-ram; };
@@ -27,6 +31,9 @@ &uart0 { bootph-pre-ram; + reg-offset = <0>; + current-speed = <115200>; + clock-frequency = <24000000>; }; &mmc0 {
@@ -39,30 +46,45 @@ &qspi { bootph-pre-ram; + spi-max-frequency = <250000000>; - nor-flash@0 { + flash@0 { bootph-pre-ram; + /delete-property/ cdns,read-delay; + spi-max-frequency = <100000000>; }; }; +&syscrg { + assigned-clocks = <&syscrg JH7110_SYSCLK_CPU_ROOT>, + <&syscrg JH7110_SYSCLK_BUS_ROOT>, + <&syscrg JH7110_SYSCLK_PERH_ROOT>, + <&syscrg JH7110_SYSCLK_QSPI_REF>; + assigned-clock-parents = <&pllclk JH7110_PLLCLK_PLL0_OUT>, + <&pllclk JH7110_PLLCLK_PLL2_OUT>, + <&pllclk JH7110_PLLCLK_PLL2_OUT>, + <&syscrg JH7110_SYSCLK_QSPI_REF_SRC>; + assigned-clock-rates = <0>, <0>, <0>, <0>; +}; + &sysgpio { bootph-pre-ram; }; &mmc0_pins { bootph-pre-ram; - mmc0-pins-rest { + rst-pins { bootph-pre-ram; }; }; &mmc1_pins { bootph-pre-ram; - mmc1-pins0 { + clk-pins { bootph-pre-ram; }; - mmc1-pins1 { + mmc-pins { bootph-pre-ram; }; };
@@ -78,6 +100,9 @@ bootph-pre-ram; eeprom@50 { bootph-pre-ram; + compatible = "atmel,24c04"; + reg = <0x50>; + pagesize = <16>; }; };
arch/riscv/dts/jh7110-u-boot.dtsi +34 -0
@@ -46,6 +46,15 @@ }; }; + timer { + compatible = "riscv,timer"; + interrupts-extended = <&cpu0_intc 5>, + <&cpu1_intc 5>, + <&cpu2_intc 5>, + <&cpu3_intc 5>, + <&cpu4_intc 5>; + }; + soc { bootph-pre-ram;
@@ -73,10 +82,35 @@ bootph-pre-ram; }; +&gmac0_rgmii_rxin { + bootph-pre-ram; +}; + &gmac0_rmii_refin { bootph-pre-ram; }; +&gmac1_rgmii_rxin { + bootph-pre-ram; +}; + +&gmac1_rmii_refin { + bootph-pre-ram; +}; + +&stmmac_axi_setup { + snps,wr_osr_lmt = <4>; + snps,rd_osr_lmt = <4>; +}; + +&gmac0 { + snps,perfect-filter-entries = <8>; +}; + +&gmac1 { + snps,perfect-filter-entries = <8>; +}; + &aoncrg { bootph-pre-ram; };
Signature · 1 line
2.43.2
Re: [PATCH v7 02/12] riscv: dts: jh7110: Make u-boot device trees adapting to upstream DT
Quoted 142 lines · Hal Feng
Add u-boot features to the U-Boot device tree.
Tested-by Anand Moon <[email protected]>Tested-by E Shattow <[email protected]>Reviewed-by E Shattow <[email protected]>Acked-by Sumit Garg <[email protected]>Signed-off-by Hal Feng <[email protected]>--- ...10-starfive-visionfive-2-v1.3b-u-boot.dtsi | 33 +++++++++++++++--- arch/riscv/dts/jh7110-u-boot.dtsi | 34 +++++++++++++++++++ 2 files changed, 63 insertions(+), 4 deletions(-)arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsi +29
-4@@ -6,6 +6,10 @@ #include "binman.dtsi" #include "jh7110-u-boot.dtsi" / { + aliases { + spi0 = &qspi; + }; + chosen { bootph-pre-ram; };@@ -27,6 +31,9 @@ &uart0 { bootph-pre-ram; + reg-offset = <0>; + current-speed = <115200>; + clock-frequency = <24000000>; }; &mmc0 {@@ -39,30 +46,45 @@ &qspi { bootph-pre-ram; + spi-max-frequency = <250000000>; - nor-flash@0 { + flash@0 { bootph-pre-ram; + /delete-property/ cdns,read-delay; + spi-max-frequency = <100000000>; }; }; +&syscrg { + assigned-clocks = <&syscrg JH7110_SYSCLK_CPU_ROOT>, + <&syscrg JH7110_SYSCLK_BUS_ROOT>, + <&syscrg JH7110_SYSCLK_PERH_ROOT>, + <&syscrg JH7110_SYSCLK_QSPI_REF>; + assigned-clock-parents = <&pllclk JH7110_PLLCLK_PLL0_OUT>, + <&pllclk JH7110_PLLCLK_PLL2_OUT>, + <&pllclk JH7110_PLLCLK_PLL2_OUT>, + <&syscrg JH7110_SYSCLK_QSPI_REF_SRC>; + assigned-clock-rates = <0>, <0>, <0>, <0>; +}; + &sysgpio { bootph-pre-ram; }; &mmc0_pins { bootph-pre-ram; - mmc0-pins-rest { + rst-pins { bootph-pre-ram; }; }; &mmc1_pins { bootph-pre-ram; - mmc1-pins0 { + clk-pins { bootph-pre-ram; }; - mmc1-pins1 { + mmc-pins { bootph-pre-ram; }; };@@ -78,6 +100,9 @@ bootph-pre-ram; eeprom@50 { bootph-pre-ram; + compatible = "atmel,24c04"; + reg = <0x50>; + pagesize = <16>; }; };arch/riscv/dts/jh7110-u-boot.dtsi +24
-0@@ -46,6 +46,15 @@ }; }; + timer { + compatible = "riscv,timer"; + interrupts-extended = <&cpu0_intc 5>, + <&cpu1_intc 5>, + <&cpu2_intc 5>, + <&cpu3_intc 5>, + <&cpu4_intc 5>; + }; + soc { bootph-pre-ram;@@ -73,10 +82,35 @@ bootph-pre-ram; }; +&gmac0_rgmii_rxin { + bootph-pre-ram; +}; + &gmac0_rmii_refin { bootph-pre-ram; }; +&gmac1_rgmii_rxin { + bootph-pre-ram; +}; + +&gmac1_rmii_refin { + bootph-pre-ram; +}; + +&stmmac_axi_setup { + snps,wr_osr_lmt = <4>; + snps,rd_osr_lmt = <4>;
arch/riscv/dts/jh7110-u-boot.dtsi line 114
Quoted 10 lines
arch/riscv/dts/jh7110-u-boot.dtsi +10
-0+}; + +&gmac0 { + snps,perfect-filter-entries = <8>; +}; + +&gmac1 { + snps,perfect-filter-entries = <8>; +}; +
Redundant &stmmac_axi_setup &gmac0 &gmac1 property overrides (upstream has all these). Drop.
Quoted 6 lines
arch/riscv/dts/jh7110-u-boot.dtsi +0
-0&aoncrg { bootph-pre-ram;};
--
2.43.2
There's also a redundant &S7_0 { status = "okay"; }; which can be dropped, it is no-op since that alias is already set to be status="okay".
I tested on Star64 network function and cold boot, is fine. What remains are the liberal use of bootph-pre-ram properties, the DRAM Memory Controller dmc which does not appear yet in Linux, the timer {} node; elsewhere the eeprom and uart of which the eeprom and bootph-pre-ram properties can probably get upstream easily enough later on.
Your choice if you want to trim these redundant properties here or if it should be done as a later clean-up patch, as upstream does not have the same values for these properties all.
-E
Hal Feng
maintainerRE: [PATCH v7 02/12] riscv: dts: jh7110: Make u-boot device trees adapting to upstream DT
Quoted 144 lines · E Shattow
Quoted 140 lines · Hal Feng
Add u-boot features to the U-Boot device tree.
Tested-by Anand Moon <[email protected]>Tested-by E Shattow <[email protected]>Reviewed-by E Shattow <[email protected]>Acked-by Sumit Garg <[email protected]>Signed-off-by Hal Feng <[email protected]>--- ...10-starfive-visionfive-2-v1.3b-u-boot.dtsi | 33 +++++++++++++++--- arch/riscv/dts/jh7110-u-boot.dtsi | 34 +++++++++++++++++++ 2 files changed, 63 insertions(+), 4 deletions(-)diff --git
a/arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsib/arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsiindex3012466b30..7953459e67100644arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsi +28
-4@@ -6,6 +6,10 @@ #include "binman.dtsi" #include "jh7110-u-boot.dtsi" / { + aliases { + spi0 = &qspi; + }; + chosen { bootph-pre-ram; };@@ -27,6 +31,9 @@ &uart0 { bootph-pre-ram; + reg-offset = <0>; + current-speed = <115200>; + clock-frequency = <24000000>; }; &mmc0 {@@ -39,30 +46,45 @@ &qspi { bootph-pre-ram; + spi-max-frequency = <250000000>; - nor-flash@0 { + flash@0 { bootph-pre-ram; + /delete-property/ cdns,read-delay; + spi-max-frequency = <100000000>; }; }; +&syscrg { + assigned-clocks = <&syscrg JH7110_SYSCLK_CPU_ROOT>, + <&syscrg JH7110_SYSCLK_BUS_ROOT>, + <&syscrg JH7110_SYSCLK_PERH_ROOT>, + <&syscrg JH7110_SYSCLK_QSPI_REF>; + assigned-clock-parents = <&pllclk JH7110_PLLCLK_PLL0_OUT>, + <&pllclk JH7110_PLLCLK_PLL2_OUT>, + <&pllclk JH7110_PLLCLK_PLL2_OUT>, + <&syscrg JH7110_SYSCLK_QSPI_REF_SRC>; + assigned-clock-rates = <0>, <0>, <0>, <0>; }; + &sysgpio { bootph-pre-ram; }; &mmc0_pins { bootph-pre-ram; - mmc0-pins-rest { + rst-pins { bootph-pre-ram; }; }; &mmc1_pins { bootph-pre-ram; - mmc1-pins0 { + clk-pins { bootph-pre-ram; }; - mmc1-pins1 { + mmc-pins { bootph-pre-ram; }; };@@ -78,6 +100,9 @@ bootph-pre-ram; eeprom@50 { bootph-pre-ram; + compatible = "atmel,24c04"; + reg = <0x50>; + pagesize = <16>; }; };arch/riscv/dts/jh7110-u-boot.dtsi +21
-0@@ -46,6 +46,15 @@ }; }; + timer { + compatible = "riscv,timer"; + interrupts-extended = <&cpu0_intc 5>, + <&cpu1_intc 5>, + <&cpu2_intc 5>, + <&cpu3_intc 5>, + <&cpu4_intc 5>; + }; + soc { bootph-pre-ram;@@ -73,10 +82,35 @@ bootph-pre-ram; }; +&gmac0_rgmii_rxin { + bootph-pre-ram; +}; + &gmac0_rmii_refin { bootph-pre-ram; }; +&gmac1_rgmii_rxin { + bootph-pre-ram; +}; + +&gmac1_rmii_refin { + bootph-pre-ram; +}; +
Quoted 14 lines
arch/riscv/dts/jh7110-u-boot.dtsi line 113
Quoted 11 lines
arch/riscv/dts/jh7110-u-boot.dtsi +11
-0+&stmmac_axi_setup { + snps,wr_osr_lmt = <4>; + snps,rd_osr_lmt = <4>; +}; + +&gmac0 { + snps,perfect-filter-entries = <8>; }; + +&gmac1 { + snps,perfect-filter-entries = <8>; }; +Redundant
&stmmac_axi_setup&gmac0 &gmac1 property overrides (upstream has all these). Drop.
OK. Actually these properties are unused in U-Boot.
Quoted 10 lines
Quoted 7 lines
arch/riscv/dts/jh7110-u-boot.dtsi +0
-1&aoncrg { bootph-pre-ram; }; --2.43.2
There's also a redundant
&S7_0{ status = "okay"; }; which can be dropped, it is no-op since that alias is already set to be status="okay".
OK. Drop it.
Quoted 10 lines
I tested on Star64 network function and cold boot, is fine. What remains are the liberal use of bootph-pre-ram properties, the DRAM Memory Controller dmc which does not appear yet in Linux, the timer {} node; elsewhere the eeprom and uart of which the eeprom and bootph-pre-ram properties can probably get upstream easily enough later on.
Your choice if you want to trim these redundant properties here or if it should be done as a later clean-up patch, as upstream does not have the same values for these properties all.
I prefer to send a clean-up patch after some changes like qspi and eeprom are synced to upstream Linux. Because the clean-up work is not the purpose of this series and I will note all properties this series changes in the cover letter.
Best regards,
Hal
Hal Feng
maintainerPATCH v7 3/12 mmc: dw_mmc: Add "starfive, jh7110-mmc" compatible to match upstream DT
In reply to Hal FengMake the U-Boot JH7110 MMC driver compatible with upstream DT.
--- drivers/mmc/snps_dw_mmc.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/snps_dw_mmc.c +1 -0
@@ -186,6 +186,7 @@ static int snps_dwmmc_bind(struct udevice *dev)static const struct udevice_id snps_dwmmc_ids[] = { { .compatible ="snps,dw-mshc" }, + { .compatible ="starfive,jh7110-mmc" }, { } };
Signature · 1 line
2.43.2
RE: [PATCH v7 03/12] mmc: dw_mmc: Add "starfive, jh7110-mmc" compatible to match upstream DT
Quoted 13 lines
-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Hal Feng
Sent: Tuesday, December 3, 2024 12:04 PM
To: Leo <[email protected]>; Tom Rini <[email protected]>; Sumit Garg <[email protected]>; Rick Chen <[email protected]>; Heinrich Schuchardt <[email protected]>; H Bell <[email protected]>; E Shattow <[email protected]>; Conor Dooley <[email protected]>; Nam Cao <[email protected]>; Bo Gan <[email protected]>
Cc: Emil Renner Berthing <[email protected]>; Minda Chen <[email protected]>; Hal Feng <[email protected]>; [email protected]
Subject: [PATCH v7 03/12] mmc:dw_mmc: Add "starfive, jh7110-mmc" compatible to match upstream DT
Quoted 3 lines
Make the U-Boot JH7110 MMC driver compatible with upstream DT.
Signed-off-by Hal Feng <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 18 lines
--- drivers/mmc/snps_dw_mmc.c | 1 + 1 file changed, 1 insertion(+)drivers/mmc/snps_dw_mmc.c +1
-1@@ -186,6 +186,7 @@ static int snps_dwmmc_bind(struct udevice *dev)static const struct udevice_id snps_dwmmc_ids[] = { { .compatible ="snps,dw-mshc" }, + { .compatible ="starfive,jh7110-mmc" }, { } }; --2.43.2
Hal Feng
maintainerPATCH v7 4/12 pcie: starfive: Make the driver compatible with upstream DT
In reply to Hal FengThere are difference between upstream DT and the old DT in terms of reg base, reset gpio and syscon. Make the driver compatible with upstream DT.
--- drivers/pci/pcie_starfive_jh7110.c | 59 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 29 deletions(-)
drivers/pci/pcie_starfive_jh7110.c +30 -29
@@ -25,13 +25,19 @@#include "pcie_plda_common.h" /* system control */ -#define STG_SYSCON_K_RP_NEP_MASK BIT(8) +#define STG_SYSCON_PCIE0_BASE 0x48 +#define STG_SYSCON_PCIE1_BASE 0x1f8 + +#define STG_SYSCON_AR_OFFSET 0x78#define STG_SYSCON_AXI4_SLVL_ARFUNC_MASK GENMASK(22, 8)#define STG_SYSCON_AXI4_SLVL_ARFUNC_SHIFT 8 +#define STG_SYSCON_AW_OFFSET 0x7c#define STG_SYSCON_AXI4_SLVL_AWFUNC_MASK GENMASK(14, 0)#define STG_SYSCON_CLKREQ_MASK BIT(22)#define STG_SYSCON_CKREF_SRC_SHIFT 18#define STG_SYSCON_CKREF_SRC_MASK GENMASK(19, 18) +#define STG_SYSCON_RP_NEP_OFFSET 0xe8 +#define STG_SYSCON_K_RP_NEP_MASK BIT(8)DECLARE_GLOBAL_DATA_PTR ;
@@ -41,9 +47,7 @@ struct starfive_pcie {struct reset_ctl_bulk rsts;struct gpio_desc reset_gpio;struct regmap *regmap; -u32 stg_arfun; -u32 stg_awfun; -u32 stg_rp_nep; +unsigned int stg_pcie_base; };static int starfive_pcie_atr_init (struct starfive_pcie *priv)
@@ -92,7 +96,6 @@ static int starfive_pcie_get_syscon(struct udevice *dev)struct starfive_pcie *priv =dev_get_priv (dev);struct udevice *syscon;struct ofnode_phandle_args syscfg_phandle; -u32 cells[4 ];int ret;/* get corresponding syscon phandle */
@@ -117,20 +120,6 @@ static int starfive_pcie_get_syscon(struct udevice *dev)return -ENODEV ; } -/* get syscon register offset */ - ret =dev_read_u32_array (dev,"starfive,stg-syscon" , - cells,ARRAY_SIZE (cells)); -if (ret) { -dev_err (dev,"Get syscon register err %d\n" , ret); -return -EINVAL ; - } - -dev_dbg (dev,"Get syscon values: %x, %x, %x\n" , - cells[1 ], cells[2 ], cells[3 ]); - priv->stg_arfun = cells[1 ]; - priv->stg_awfun = cells[2 ]; - priv->stg_rp_nep = cells[3 ]; -return 0 ; }
@@ -138,8 +127,9 @@ static int starfive_pcie_parse_dt(struct udevice *dev) {struct starfive_pcie *priv =dev_get_priv (dev);int ret; +u32 domain_nr; - priv->plda.reg_base = (void *)dev_read_addr_name (dev,"reg" ); + priv->plda.reg_base = (void *)dev_read_addr_name (dev,"apb" );if (priv->plda.reg_base == (void __iomem *)FDT_ADDR_T_NONE ) {dev_err (dev,"Missing required reg address range\n" );return -EINVAL ;
@@ -147,7 +137,7 @@ static int starfive_pcie_parse_dt(struct udevice *dev) priv->plda.cfg_base = (void *)dev_read_addr_size_name (dev, -"config" , +"cfg" , &priv->plda.cfg_size);if (priv->plda.cfg_base == (void __iomem *)FDT_ADDR_T_NONE ) {dev_err (dev,"Missing required config address range" );
@@ -172,7 +162,18 @@ static int starfive_pcie_parse_dt(struct udevice *dev)return ret; } - ret =gpio_request_by_name (dev,"reset-gpios" ,0 , &priv->reset_gpio, + ret =dev_read_u32 (dev,"linux,pci-domain" , &domain_nr); +if (ret) { +dev_err (dev,"Can't get pci domain: %d\n" , ret); +return ret; + } + +if (domain_nr ==0 ) + priv->stg_pcie_base =STG_SYSCON_PCIE0_BASE ; +else + priv->stg_pcie_base =STG_SYSCON_PCIE1_BASE ; + + ret =gpio_request_by_name (dev,"perst-gpios" ,0 , &priv->reset_gpio,GPIOD_IS_OUT );if (ret) {dev_err (dev,"Can't get reset-gpio: %d\n" , ret);
@@ -208,12 +209,12 @@ static int starfive_pcie_init_port(struct udevice *dev)/* Disable physical functions except #0 */ for (i =1 ; i <PLDA_FUNC_NUM ; i++) {regmap_update_bits (priv->regmap, - priv->stg_arfun, + priv->stg_pcie_base +STG_SYSCON_AR_OFFSET ,STG_SYSCON_AXI4_SLVL_ARFUNC_MASK , (i <<PLDA_PHY_FUNC_SHIFT ) <<STG_SYSCON_AXI4_SLVL_ARFUNC_SHIFT );regmap_update_bits (priv->regmap, - priv->stg_awfun, + priv->stg_pcie_base +STG_SYSCON_AW_OFFSET ,STG_SYSCON_AXI4_SLVL_AWFUNC_MASK , i <<PLDA_PHY_FUNC_SHIFT );
@@ -222,11 +223,11 @@ static int starfive_pcie_init_port(struct udevice *dev)/* Disable physical functions */ regmap_update_bits (priv->regmap, - priv->stg_arfun, + priv->stg_pcie_base +STG_SYSCON_AR_OFFSET ,STG_SYSCON_AXI4_SLVL_ARFUNC_MASK ,0 );regmap_update_bits (priv->regmap, - priv->stg_awfun, + priv->stg_pcie_base +STG_SYSCON_AW_OFFSET ,STG_SYSCON_AXI4_SLVL_AWFUNC_MASK ,0 );
@@ -273,17 +274,17 @@ static int starfive_pcie_probe(struct udevice *dev)return ret;regmap_update_bits (priv->regmap, - priv->stg_rp_nep, + priv->stg_pcie_base +STG_SYSCON_RP_NEP_OFFSET ,STG_SYSCON_K_RP_NEP_MASK ,STG_SYSCON_K_RP_NEP_MASK );regmap_update_bits (priv->regmap, - priv->stg_awfun, + priv->stg_pcie_base +STG_SYSCON_AW_OFFSET ,STG_SYSCON_CKREF_SRC_MASK ,2 <<STG_SYSCON_CKREF_SRC_SHIFT );regmap_update_bits (priv->regmap, - priv->stg_awfun, + priv->stg_pcie_base +STG_SYSCON_AW_OFFSET ,STG_SYSCON_CLKREQ_MASK ,STG_SYSCON_CLKREQ_MASK );
Signature · 1 line
2.43.2
Hal Feng
maintainerPATCH v7 5/12 riscv: dts: jh7110: Move common code to the new jh7110-common-u-boot.dtsi
In reply to Hal FengTo support JH7110 based boards besides v1.3B,
add a common dtsi and add common code to it.
--- arch/riscv/dts/jh7110-common-u-boot.dtsi | 142 ++++++++++++++++++ ...10-starfive-visionfive-2-v1.3b-u-boot.dtsi | 138 +---------------- 2 files changed, 143 insertions(+), 137 deletions(-) create mode 100644 arch/riscv/dts/jh7110-common-u-boot.dtsi
arch/riscv/dts/jh7110-common-u-boot.dtsi new file +142 -0
@@ -0,0 +1,142 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2023 StarFive Technology Co., Ltd. + */ + +#include "binman.dtsi" +#include "jh7110-u-boot.dtsi" +/ { + aliases { + spi0 = &qspi; + }; + + chosen { + bootph-pre-ram; + }; + + firmware { + spi0 = &qspi; + bootph-pre-ram; + }; + + config { + bootph-pre-ram; + u-boot,spl-payload-offset = <0x100000>; + }; + + memory@40000000 { + bootph-pre-ram; + }; +}; + +&uart0 { + bootph-pre-ram; + reg-offset = <0>; + current-speed = <115200>; + clock-frequency = <24000000>; +}; + +&mmc0 { + bootph-pre-ram; +}; + +&mmc1 { + bootph-pre-ram; +}; + +&qspi { + bootph-pre-ram; + spi-max-frequency = <250000000>; + + flash@0 { + bootph-pre-ram; + /delete-property/ cdns,read-delay; + spi-max-frequency = <100000000>; + }; +}; + +&syscrg { + assigned-clocks = <&syscrg JH7110_SYSCLK_CPU_ROOT>, + <&syscrg JH7110_SYSCLK_BUS_ROOT>, + <&syscrg JH7110_SYSCLK_PERH_ROOT>, + <&syscrg JH7110_SYSCLK_QSPI_REF>; + assigned-clock-parents = <&pllclk JH7110_PLLCLK_PLL0_OUT>, + <&pllclk JH7110_PLLCLK_PLL2_OUT>, + <&pllclk JH7110_PLLCLK_PLL2_OUT>, + <&syscrg JH7110_SYSCLK_QSPI_REF_SRC>; + assigned-clock-rates = <0>, <0>, <0>, <0>; +}; + +&sysgpio { + bootph-pre-ram; +}; + +&mmc0_pins { + bootph-pre-ram; + rst-pins { + bootph-pre-ram; + }; +}; + +&mmc1_pins { + bootph-pre-ram; + clk-pins { + bootph-pre-ram; + }; + + mmc-pins { + bootph-pre-ram; + }; +}; + +&i2c5_pins { + bootph-pre-ram; + i2c-pins { + bootph-pre-ram; + }; +}; + +&i2c5 { + bootph-pre-ram; + eeprom@50 { + bootph-pre-ram; + compatible = "atmel,24c04"; + reg = <0x50>; + pagesize = <16>; + }; +}; + +&binman { + itb { + fit { + images { + fdt-1 { + description = "NAME"; + load = <0x40400000>; + compression = "none"; + + uboot_fdt_blob: blob-ext { + filename = "u-boot.dtb"; + }; + }; + }; + + configurations { + conf-1 { + fdt = "fdt-1"; + }; + }; + }; + }; + + spl-img { + filename = "spl/u-boot-spl.bin.normal.out"; + + mkimage { + args = "-T sfspl"; + + u-boot-spl { + }; + }; + }; +};
arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsi +1 -137
141 lines not on this page · raw message
Signature · 1 line
2.43.2
Re: [PATCH v7 05/12] riscv: dts: jh7110: Move common code to the new jh7110-common-u-boot.dtsi
Quoted 60 lines · Hal Feng
To support JH7110 based boards besides v1.3B,
add a common dtsi and add common code to it.Tested-by Anand Moon <[email protected]>Tested-by E Shattow <[email protected]>Reviewed-by E Shattow <[email protected]>Signed-off-by Hal Feng <[email protected]>--- arch/riscv/dts/jh7110-common-u-boot.dtsi | 142 ++++++++++++++++++ ...10-starfive-visionfive-2-v1.3b-u-boot.dtsi | 138 +---------------- 2 files changed, 143 insertions(+), 137 deletions(-) create mode 100644 arch/riscv/dts/jh7110-common-u-boot.dtsiarch/riscv/dts/jh7110-common-u-boot.dtsi new file +40
-0@@ -0,0 +1,142 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2023 StarFive Technology Co., Ltd. + */ + +#include "binman.dtsi" +#include "jh7110-u-boot.dtsi" +/ { + aliases { + spi0 = &qspi; + }; + + chosen { + bootph-pre-ram; + }; + + firmware { + spi0 = &qspi; + bootph-pre-ram; + }; + + config { + bootph-pre-ram; + u-boot,spl-payload-offset = <0x100000>; + }; + + memory@40000000 { + bootph-pre-ram; + }; +}; + +&uart0 { + bootph-pre-ram; + reg-offset = <0>; + current-speed = <115200>; + clock-frequency = <24000000>; +}; + +&mmc0 { + bootph-pre-ram;
arch/riscv/dts/jh7110-common-u-boot.dtsi line 49
Quoted 10 lines
arch/riscv/dts/jh7110-common-u-boot.dtsi new file +9
-0+}; + +&mmc1 { + bootph-pre-ram; +}; + +&qspi { + bootph-pre-ram; + spi-max-frequency = <250000000>;
Drop this line spi-max-frequency 250Mhz. The driver expects spi-max-frequency in any sub-node, and not here?
arch/riscv/dts/jh7110-common-u-boot.dtsi line 53
Quoted 5 lines
arch/riscv/dts/jh7110-common-u-boot.dtsi new file +4
-0+ + flash@0 { + bootph-pre-ram; + /delete-property/ cdns,read-delay;
Drop this line /delete-property/ because it is a problem for the parser if we need to re-define 'cdns,read-delay' later in dts files downstream of jh7110-common-u-boot.dtsi
If you want drivers/spi/cadence_qspi.c:spi_calibration() to do this work then it needs to be the same upstream. In my testing on 4GB Star64 the calibration (via /delete-property/ cdns,read-delay) method with spi-max-frequency less than exactly 49.8MHz results in a failure to write SPI-NOR correctly. When spi-max-frequency is approximately 25MHz up to 49.799999MHz and written with a known good tool then the boot may be successful but "Main section boot fail,use backup section" or other errors on boot after using that unstable configuration of U-Boot to write U-Boot image to the SPI-NOR. No problems writing and boot during testing with spi-max-frequency 49.8MHz up to 100MHz (not tested above 100MHz).
The upstream dts has spi-max-frequency 12MHz which is not successful with any of the read-delay values I tested: 0 1 2 3 4 5
Quoted 1 line
+ spi-max-frequency = <100000000>;
Why 12MHz upstream and 100MHz here? Something is wrong but I do not know is it U-Boot or Linux?
Success:
+ /delete-property/ cdns,read-delay;
+ spi-max-frequency = <100000000>;
Success:
+ cdns,read-delay = <2>; - /delete-property/ cdns,read-delay; + spi-max-frequency = <100000000>;
Failure:
+ cdns,read-delay = <2>;
+ spi-max-frequency = <50000000>;
The actual fix is going to need testing Linux and U-Boot on all the boards I do not have access to.
For the moment we can:
- /delete-property/ cdns,read-delay; + cdns,read-delay = <2>; + spi-max-frequency = <100000000>;
or do nothing (but yes please drop that 250Mhz line it is non-op I think).
What do you think? Or else we discuss here and follow with patches in future to fix the mess. I really do not want any /delete-property/ to be in dtsi but I don't know why it is so different between U-Boot and Linux and cannot personally test all the possible boards to verify a change.
Quoted 235 lines
arch/riscv/dts/jh7110-common-u-boot.dtsi new file +88
-0+ }; +}; + +&syscrg { + assigned-clocks = <&syscrg JH7110_SYSCLK_CPU_ROOT>, + <&syscrg JH7110_SYSCLK_BUS_ROOT>, + <&syscrg JH7110_SYSCLK_PERH_ROOT>, + <&syscrg JH7110_SYSCLK_QSPI_REF>; + assigned-clock-parents = <&pllclk JH7110_PLLCLK_PLL0_OUT>, + <&pllclk JH7110_PLLCLK_PLL2_OUT>, + <&pllclk JH7110_PLLCLK_PLL2_OUT>, + <&syscrg JH7110_SYSCLK_QSPI_REF_SRC>; + assigned-clock-rates = <0>, <0>, <0>, <0>; +}; + +&sysgpio { + bootph-pre-ram; +}; + +&mmc0_pins { + bootph-pre-ram; + rst-pins { + bootph-pre-ram; + }; +}; + +&mmc1_pins { + bootph-pre-ram; + clk-pins { + bootph-pre-ram; + }; + + mmc-pins { + bootph-pre-ram; + }; +}; + +&i2c5_pins { + bootph-pre-ram; + i2c-pins { + bootph-pre-ram; + }; +}; + +&i2c5 { + bootph-pre-ram; + eeprom@50 { + bootph-pre-ram; + compatible = "atmel,24c04"; + reg = <0x50>; + pagesize = <16>; + }; +}; + +&binman { + itb { + fit { + images { + fdt-1 { + description = "NAME"; + load = <0x40400000>; + compression = "none"; + + uboot_fdt_blob: blob-ext { + filename = "u-boot.dtb"; + }; + }; + }; + + configurations { + conf-1 { + fdt = "fdt-1"; + }; + }; + }; + }; + + spl-img { + filename = "spl/u-boot-spl.bin.normal.out"; + + mkimage { + args = "-T sfspl"; + + u-boot-spl { + }; + }; + }; +};arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsi +1
-138@@ -3,140 +3,4 @@ * Copyright (C) 2023 StarFive Technology Co., Ltd. */ -#include "binman.dtsi" -#include "jh7110-u-boot.dtsi" -/ { - aliases { - spi0 = &qspi; - }; - - chosen { - bootph-pre-ram; - }; - - firmware { - spi0 = &qspi; - bootph-pre-ram; - }; - - config { - bootph-pre-ram; - u-boot,spl-payload-offset = <0x100000>; - }; - - memory@40000000 { - bootph-pre-ram; - }; -}; - -&uart0 { - bootph-pre-ram; - reg-offset = <0>; - current-speed = <115200>; - clock-frequency = <24000000>; -}; - -&mmc0 { - bootph-pre-ram; -}; - -&mmc1 { - bootph-pre-ram; -}; - -&qspi { - bootph-pre-ram; - spi-max-frequency = <250000000>; - - flash@0 { - bootph-pre-ram; - /delete-property/ cdns,read-delay; - spi-max-frequency = <100000000>; - }; -}; - -&syscrg { - assigned-clocks = <&syscrg JH7110_SYSCLK_CPU_ROOT>, - <&syscrg JH7110_SYSCLK_BUS_ROOT>, - <&syscrg JH7110_SYSCLK_PERH_ROOT>, - <&syscrg JH7110_SYSCLK_QSPI_REF>; - assigned-clock-parents = <&pllclk JH7110_PLLCLK_PLL0_OUT>, - <&pllclk JH7110_PLLCLK_PLL2_OUT>, - <&pllclk JH7110_PLLCLK_PLL2_OUT>, - <&syscrg JH7110_SYSCLK_QSPI_REF_SRC>; - assigned-clock-rates = <0>, <0>, <0>, <0>; -}; - -&sysgpio { - bootph-pre-ram; -}; - -&mmc0_pins { - bootph-pre-ram; - rst-pins { - bootph-pre-ram; - }; -}; - -&mmc1_pins { - bootph-pre-ram; - clk-pins { - bootph-pre-ram; - }; - - mmc-pins { - bootph-pre-ram; - }; -}; - -&i2c5_pins { - bootph-pre-ram; - i2c-pins { - bootph-pre-ram; - }; -}; - -&i2c5 { - bootph-pre-ram; - eeprom@50 { - bootph-pre-ram; - compatible = "atmel,24c04"; - reg = <0x50>; - pagesize = <16>; - }; -}; - -&binman { - itb { - fit { - images { - fdt-1 { - description = "NAME"; - load = <0x40400000>; - compression = "none"; - - uboot_fdt_blob: blob-ext { - filename = "u-boot.dtb"; - }; - }; - }; - - configurations { - conf-1 { - fdt = "fdt-1"; - }; - }; - }; - }; - - spl-img { - filename = "spl/u-boot-spl.bin.normal.out"; - - mkimage { - args = "-T sfspl"; - - u-boot-spl { - }; - }; - }; -}; +#include "jh7110-common-u-boot.dtsi" --
Quoted 2 lines
2.43.2
-E
Hal Feng
maintainerRE: [PATCH v7 05/12] riscv: dts: jh7110: Move common code to the new jh7110-common-u-boot.dtsi
Quoted 74 lines · E Shattow
Quoted 10 lines · Hal Feng
To support JH7110 based boards besides v1.3B, add a common dtsi and add common code to it.
Tested-by Anand Moon <[email protected]>Tested-by E Shattow <[email protected]>Reviewed-by E Shattow <[email protected]>Signed-off-by Hal Feng <[email protected]>--- arch/riscv/dts/jh7110-common-u-boot.dtsi | 142++++++++++++++++++
Quoted 59 lines
...10-starfive-visionfive-2-v1.3b-u-boot.dtsi | 138 +---------------- 2 files changed, 143 insertions(+), 137 deletions(-) create mode100644
arch/riscv/dts/jh7110-common-u-boot.dtsiarch/riscv/dts/jh7110-common-u-boot.dtsi new file +48
-0@@ -0,0 +1,142 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2023 StarFive Technology Co., Ltd. + */ + +#include "binman.dtsi" +#include "jh7110-u-boot.dtsi" +/ { + aliases { + spi0 = &qspi; + }; + + chosen { + bootph-pre-ram; + }; + + firmware { + spi0 = &qspi; + bootph-pre-ram; + }; + + config { + bootph-pre-ram; + u-boot,spl-payload-offset = <0x100000>; + }; + + memory@40000000 { + bootph-pre-ram; + }; +}; + +&uart0 { + bootph-pre-ram; + reg-offset = <0>; + current-speed = <115200>; + clock-frequency = <24000000>; +}; + +&mmc0 { + bootph-pre-ram; +}; + +&mmc1 { + bootph-pre-ram; +}; + +&qspi { + bootph-pre-ram;
Quoted 4 lines
arch/riscv/dts/jh7110-common-u-boot.dtsi line 49
Quoted 1 line
arch/riscv/dts/jh7110-common-u-boot.dtsi new file +1
-0+ spi-max-frequency = <250000000>;Drop this line spi-max-frequency 250Mhz. The driver expects spi-max- frequency in any sub-node, and not here?
Yes, this property is used in sub-node, we can drop this later.
Quoted 52 lines
arch/riscv/dts/jh7110-common-u-boot.dtsi line 53
Quoted 6 lines
arch/riscv/dts/jh7110-common-u-boot.dtsi new file +4
-0+ + flash@0 { + bootph-pre-ram; + /delete-property/ cdns,read-delay;Drop this line /delete-property/ because it is a problem for the parser if we need to re-define 'cdns,read-delay' later in dts files downstream of jh7110-
common-u-boot.dtsiIf you want drivers/spi/cadence_qspi.c:spi_calibration() to do this work then it needs to be the same upstream. In my testing on 4GB
Star64 the calibration (via /delete-property/ cdns,read-delay) method with spi-max-frequency less than exactly 49.8MHz results in a failure to write SPI- NOR correctly. When spi-max-frequency is approximately 25MHz up to 49.799999MHz and written with a known good tool then the boot may be successful but "Main section boot fail,use backup section"
or other errors on boot after using that unstable configuration of U-Boot to write U-Boot image to the SPI-NOR. No problems writing and boot during testing with spi-max-frequency 49.8MHz up to 100MHz (not tested above 100MHz).The upstream dts has spi-max-frequency 12MHz which is not successful with any of the read-delay values I tested: 0 1 2 3 4 5
Quoted 1 line
+ spi-max-frequency = <100000000>;
Why 12MHz upstream and 100MHz here? Something is wrong but I do not know is it U-Boot or Linux?
Success:
arch/riscv/dts/jh7110-common-u-boot.dtsi new file +2
-0+ /delete-property/ cdns,read-delay; + spi-max-frequency = <100000000>;Success:
(quoted diff) +2
-1+ cdns,read-delay = <2>; - /delete-property/ cdns,read-delay; + spi-max-frequency = <100000000>;Failure:
(quoted diff) +2
-0+ cdns,read-delay = <2>; + spi-max-frequency = <50000000>;The actual fix is going to need testing Linux and U-Boot on all the boards I do not have access to.
For the moment we can:
(quoted diff) +2
-1- /delete-property/ cdns,read-delay; + cdns,read-delay = <2>; + spi-max-frequency = <100000000>;
Quoted 6 lines
or do nothing (but yes please drop that 250Mhz line it is non-op I think).
What do you think? Or else we discuss here and follow with patches in future to fix the mess. I really do not want any /delete-property/ to be in dtsi but I don't know why it is so different between U-Boot and Linux and cannot personally test all the possible boards to verify a change.
I don't know the cause of this problem either. But all properties added in this patch already existed in U-Boot DT before. I tried my best to keep the U-Boot DT the same as the one before OF_UPSTREAM applied.
I tested and found that the qspi flash can work successfully in Linux and U-Boot with the settings you suggested above.
cdns,read-delay = <2>;
spi-max-frequency = <100000000>;
If /delete-property/ is really not suitable to exist in this dtsi, we can modify as above in U-Boot and upstream this change to Liunx. After this change is accepted by Linux, I will drop these two properties in U-Boot.
Best regards,
Hal
Re: [PATCH v7 05/12] riscv: dts: jh7110: Move common code to the new jh7110-common-u-boot.dtsi
Quoted 145 lines · Hal Feng
Quoted 75 lines · E Shattow
Quoted 10 lines · Hal Feng
To support JH7110 based boards besides v1.3B, add a common dtsi and add common code to it.
Tested-by Anand Moon <[email protected]>Tested-by E Shattow <[email protected]>Reviewed-by E Shattow <[email protected]>Signed-off-by Hal Feng <[email protected]>--- arch/riscv/dts/jh7110-common-u-boot.dtsi | 142++++++++++++++++++
Quoted 59 lines
...10-starfive-visionfive-2-v1.3b-u-boot.dtsi | 138 +---------------- 2 files changed, 143 insertions(+), 137 deletions(-) create mode100644
arch/riscv/dts/jh7110-common-u-boot.dtsiarch/riscv/dts/jh7110-common-u-boot.dtsi new file +48
-0@@ -0,0 +1,142 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2023 StarFive Technology Co., Ltd. + */ + +#include "binman.dtsi" +#include "jh7110-u-boot.dtsi" +/ { + aliases { + spi0 = &qspi; + }; + + chosen { + bootph-pre-ram; + }; + + firmware { + spi0 = &qspi; + bootph-pre-ram; + }; + + config { + bootph-pre-ram; + u-boot,spl-payload-offset = <0x100000>; + }; + + memory@40000000 { + bootph-pre-ram; + }; +}; + +&uart0 { + bootph-pre-ram; + reg-offset = <0>; + current-speed = <115200>; + clock-frequency = <24000000>; +}; + +&mmc0 { + bootph-pre-ram; +}; + +&mmc1 { + bootph-pre-ram; +}; + +&qspi { + bootph-pre-ram;Quoted 4 lines
arch/riscv/dts/jh7110-common-u-boot.dtsi line 49
Quoted 1 line
arch/riscv/dts/jh7110-common-u-boot.dtsi new file +1
-0+ spi-max-frequency = <250000000>;Drop this line spi-max-frequency 250Mhz. The driver expects spi-max- frequency in any sub-node, and not here?
Yes, this property is used in sub-node, we can drop this later.
Quoted 52 lines
arch/riscv/dts/jh7110-common-u-boot.dtsi line 53
Quoted 6 lines
arch/riscv/dts/jh7110-common-u-boot.dtsi new file +4
-0+ + flash@0 { + bootph-pre-ram; + /delete-property/ cdns,read-delay;Drop this line /delete-property/ because it is a problem for the parser if we need to re-define 'cdns,read-delay' later in dts files downstream of jh7110-
common-u-boot.dtsiIf you want drivers/spi/cadence_qspi.c:spi_calibration() to do this work then it needs to be the same upstream. In my testing on 4GB
Star64 the calibration (via /delete-property/ cdns,read-delay) method with spi-max-frequency less than exactly 49.8MHz results in a failure to write SPI- NOR correctly. When spi-max-frequency is approximately 25MHz up to 49.799999MHz and written with a known good tool then the boot may be successful but "Main section boot fail,use backup section"
or other errors on boot after using that unstable configuration of U-Boot to write U-Boot image to the SPI-NOR. No problems writing and boot during testing with spi-max-frequency 49.8MHz up to 100MHz (not tested above 100MHz).The upstream dts has spi-max-frequency 12MHz which is not successful with any of the read-delay values I tested: 0 1 2 3 4 5
Quoted 1 line
+ spi-max-frequency = <100000000>;
Why 12MHz upstream and 100MHz here? Something is wrong but I do not know is it U-Boot or Linux?
Success:
arch/riscv/dts/jh7110-common-u-boot.dtsi new file +2
-0+ /delete-property/ cdns,read-delay; + spi-max-frequency = <100000000>;Success:
(quoted diff) +2
-1+ cdns,read-delay = <2>; - /delete-property/ cdns,read-delay; + spi-max-frequency = <100000000>;Failure:
(quoted diff) +2
-0+ cdns,read-delay = <2>; + spi-max-frequency = <50000000>;The actual fix is going to need testing Linux and U-Boot on all the boards I do not have access to.
For the moment we can:
(quoted diff) +2
-1- /delete-property/ cdns,read-delay; + cdns,read-delay = <2>; + spi-max-frequency = <100000000>;Quoted 6 lines
or do nothing (but yes please drop that 250Mhz line it is non-op I think).
What do you think? Or else we discuss here and follow with patches in future to fix the mess. I really do not want any /delete-property/ to be in dtsi but I don't know why it is so different between U-Boot and Linux and cannot personally test all the possible boards to verify a change.
I don't know the cause of this problem either. But all properties added in this patch already existed in U-Boot DT before. I tried my best to keep the U-Boot DT the same as the one before
OF_UPSTREAMapplied.
Quoted 5 lines
I tested and found that the qspi flash can work successfully in Linux and U-Boot with the settings you suggested above.
cdns,read-delay = <2>;
spi-max-frequency = <100000000>;
Good report on testing Linux and U-Boot, thank you Hal.
Quoted 7 lines
If /delete-property/ is really not suitable to exist in this dtsi, we can modify as above in U-Boot and upstream this change to Liunx. After this change is accepted by Linux, I will drop these two properties in U-Boot.
Best regards,
Hal
Yes let's do that. So long as it all works on VF2 1.2a, VF 1.3b, Mars, and Star64. I have tested Star64. You have tested I guess VF2 1.3b? And if we miss some, it's okay even if there is a problem for some board we did not test, the workaround is easy in u-boot specific dtsi per-board because we have avoided '/delete-property/' in the common dtsi.
-E
Hal Feng
maintainerRE: [PATCH v7 05/12] riscv: dts: jh7110: Move common code to the new jh7110-common-u-boot.dtsi
Quoted 165 lines · E Shattow
Quoted 75 lines · Hal Feng
Quoted 75 lines · E Shattow
Quoted 10 lines · Hal Feng
To support JH7110 based boards besides v1.3B, add a common dtsi and add common code to it.
Tested-by Anand Moon <[email protected]>Tested-by E Shattow <[email protected]>Reviewed-by E Shattow <[email protected]>Signed-off-by Hal Feng <[email protected]>--- arch/riscv/dts/jh7110-common-u-boot.dtsi | 142++++++++++++++++++
Quoted 59 lines
...10-starfive-visionfive-2-v1.3b-u-boot.dtsi | 138 +---------------- 2 files changed, 143 insertions(+), 137 deletions(-) create mode100644
arch/riscv/dts/jh7110-common-u-boot.dtsiarch/riscv/dts/jh7110-common-u-boot.dtsi new file +47
-0@@ -0,0 +1,142 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2023 StarFive Technology Co., Ltd. + */ + +#include "binman.dtsi" +#include "jh7110-u-boot.dtsi" +/ { + aliases { + spi0 = &qspi; + }; + + chosen { + bootph-pre-ram; + }; + + firmware { + spi0 = &qspi; + bootph-pre-ram; + }; + + config { + bootph-pre-ram; + u-boot,spl-payload-offset = <0x100000>; + }; + + memory@40000000 { + bootph-pre-ram; + }; +}; + +&uart0 { + bootph-pre-ram; + reg-offset = <0>; + current-speed = <115200>; + clock-frequency = <24000000>; }; + +&mmc0 { + bootph-pre-ram; +}; + +&mmc1 { + bootph-pre-ram; +}; + +&qspi { + bootph-pre-ram;Quoted 24 lines
Quoted 4 lines
arch/riscv/dts/jh7110-common-u-boot.dtsi line 49
Quoted 1 line
arch/riscv/dts/jh7110-common-u-boot.dtsi new file +1
-0+ spi-max-frequency = <250000000>;Drop this line spi-max-frequency 250Mhz. The driver expects spi-max- frequency in any sub-node, and not here?
Yes, this property is used in sub-node, we can drop this later.
Quoted 17 lines
arch/riscv/dts/jh7110-common-u-boot.dtsi line 53
Quoted 6 lines
arch/riscv/dts/jh7110-common-u-boot.dtsi new file +4
-0+ + flash@0 { + bootph-pre-ram; + /delete-property/ cdns,read-delay;Drop this line /delete-property/ because it is a problem for the parser if we need to re-define 'cdns,read-delay' later in dts files downstream of jh7110-
common-u-boot.dtsiIf you want drivers/spi/cadence_qspi.c:spi_calibration() to do this work then it needs to be the same upstream. In my testing on 4GB Star64 the calibration (via /delete-property/ cdns,read-delay) method with spi-max-frequency less than exactly 49.8MHz results in a failure to write SPI- NOR correctly. When spi-max-frequency is approximately 25MHz up to 49.799999MHz and written with a known
good
Quoted 1 line
Quoted 1 line
tool then the boot may be successful but "Main section boot fail,use
backup section"
Quoted 34 lines
Quoted 34 lines
or other errors on boot after using that unstable configuration of U-Boot to write U-Boot image to the SPI-NOR. No problems writing and boot during testing with spi-max-frequency 49.8MHz up to 100MHz (not tested above 100MHz).
The upstream dts has spi-max-frequency 12MHz which is not successful with any of the read-delay values I tested: 0 1 2 3 4 5
Quoted 1 line
+ spi-max-frequency = <100000000>;
Why 12MHz upstream and 100MHz here? Something is wrong but I do not know is it U-Boot or Linux?
Success:
arch/riscv/dts/jh7110-common-u-boot.dtsi new file +2
-0+ /delete-property/ cdns,read-delay; + spi-max-frequency = <100000000>;Success:
(quoted diff) +2
-1+ cdns,read-delay = <2>; - /delete-property/ cdns,read-delay; + spi-max-frequency = <100000000>;Failure:
(quoted diff) +2
-0+ cdns,read-delay = <2>; + spi-max-frequency = <50000000>;The actual fix is going to need testing Linux and U-Boot on all the boards I do not have access to.
For the moment we can:
(quoted diff) +2
-1- /delete-property/ cdns,read-delay; + cdns,read-delay = <2>; + spi-max-frequency = <100000000>;Quoted 6 lines
Quoted 6 lines
or do nothing (but yes please drop that 250Mhz line it is non-op I think).
What do you think? Or else we discuss here and follow with patches in future to fix the mess. I really do not want any /delete-property/ to be in dtsi but I don't know why it is so different between U-Boot and Linux and cannot personally test all the
possible boards to verify a change.
Quoted 4 lines
I don't know the cause of this problem either. But all properties added in this patch already existed in U-Boot DT before. I tried my best to keep the U-Boot DT the same as the one before
OF_UPSTREAMapplied.
Quoted 6 lines
I tested and found that the qspi flash can work successfully in Linux and U-Boot with the settings you suggested above.
cdns,read-delay = <2>;
spi-max-frequency = <100000000>;Good report on testing Linux and U-Boot, thank you Hal.
Quoted 5 lines
If /delete-property/ is really not suitable to exist in this dtsi, we can modify as above in U-Boot and upstream this change to Liunx. After this change is accepted by Linux, I will drop these two properties in U-Boot.
Quoted 8 lines
Quoted 2 lines
Best regards,
HalYes let's do that. So long as it all works on VF2 1.2a, VF 1.3b, Mars, and Star64. I have tested Star64. You have tested I guess VF2 1.3b? And if we miss some, it's okay even if there is a problem for some board we did not test, the workaround is easy in u-boot specific dtsi per-board because we have avoided '/delete-property/' in the common dtsi.
OK. Yeah, I tested on VF2 1.3b and VF2 1.2a is very similar to VF2 1.3b.
Best regards,
Hal
Hal Feng
maintainerPATCH v7 6/12 riscv: dts: jh7110: Add u-boot device tree for JH7110 based boards
In reply to Hal FengTo support the other JH7110 based boards, add u-boot device tree for them.
--- arch/riscv/dts/jh7110-milkv-mars-u-boot.dtsi | 6 ++++++ arch/riscv/dts/jh7110-pine64-star64-u-boot.dtsi | 6 ++++++ .../dts/jh7110-starfive-visionfive-2-v1.2a-u-boot.dtsi | 6 ++++++ 3 files changed, 18 insertions(+) create mode 100644 arch/riscv/dts/jh7110-milkv-mars-u-boot.dtsi create mode 100644 arch/riscv/dts/jh7110-pine64-star64-u-boot.dtsi create mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-v1.2a-u-boot.dtsi
arch/riscv/dts/jh7110-milkv-mars-u-boot.dtsi new file +6 -0
@@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2024 StarFive Technology Co., Ltd. + */ + +#include "jh7110-common-u-boot.dtsi"
arch/riscv/dts/jh7110-pine64-star64-u-boot.dtsi new file +6 -0
@@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2024 StarFive Technology Co., Ltd. + */ + +#include "jh7110-common-u-boot.dtsi"
arch/riscv/dts/jh7110-starfive-visionfive-2-v1.2a-u-boot.dtsi new file +6 -0
@@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2024 StarFive Technology Co., Ltd. + */ + +#include "jh7110-common-u-boot.dtsi"
Signature · 1 line
2.43.2
Hal Feng
maintainerPATCH v7 7/12 board: starfive: spl: Drop the unneeded DT modification code
In reply to Hal FengAs OF_UPSTREAM is implemented, these code are redundant.
--- board/starfive/visionfive2/spl.c | 356 ------------------------------- 1 file changed, 356 deletions(-)
board/starfive/visionfive2/spl.c +0 -356
@@ -20,364 +20,8 @@ DECLARE_GLOBAL_DATA_PTR;#define JH7110_CLK_CPU_ROOT_SHIFT 24#define JH7110_CLK_CPU_ROOT_MASK GENMASK(29, 24) -struct starfive_vf2_pro { -const char *path; -const char *name; -const char *value; -}; - -static const struct starfive_vf2_pro milk_v_mars[] = { - {"/soc/ethernet@16030000" ,"starfive,tx-use-rgmii-clk" ,NULL }, - {"/soc/ethernet@16040000" ,"starfive,tx-use-rgmii-clk" ,NULL }, - - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,tx-clk-adj-enabled" ,NULL }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,tx-clk-100-inverted" ,NULL }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,tx-clk-1000-inverted" ,NULL }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,rx-clk-drv-microamp" ,"3970" }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,rx-data-drv-microamp" ,"2910" }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"rx-internal-delay-ps" ,"1500" }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"tx-internal-delay-ps" ,"1500" }, -}; - -static const struct starfive_vf2_pro starfive_vera[] = { - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" ,"rx-internal-delay-ps" , -"1900" }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" ,"tx-internal-delay-ps" , -"1350" } -}; - -static const struct starfive_vf2_pro starfive_verb[] = { - {"/soc/ethernet@16030000" ,"starfive,tx-use-rgmii-clk" ,NULL }, - {"/soc/ethernet@16040000" ,"starfive,tx-use-rgmii-clk" ,NULL }, - - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,tx-clk-adj-enabled" ,NULL }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,tx-clk-100-inverted" ,NULL }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,tx-clk-1000-inverted" ,NULL }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,rx-clk-drv-microamp" ,"3970" }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,rx-data-drv-microamp" ,"2910" }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"rx-internal-delay-ps" ,"1500" }, - - {"/soc/ethernet@16040000/mdio/ethernet-phy@1" , -"motorcomm,tx-clk-adj-enabled" ,NULL }, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1" , -"motorcomm,tx-clk-100-inverted" ,NULL }, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1" , -"motorcomm,rx-clk-drv-microamp" ,"3970" }, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1" , -"motorcomm,rx-data-drv-microamp" ,"2910" }, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1" , -"rx-internal-delay-ps" ,"0" }, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1" , -"tx-internal-delay-ps" ,"0" }, -}; - -static const struct starfive_vf2_pro star64_pine64[] = { - {"/soc/ethernet@16030000" ,"starfive,tx-use-rgmii-clk" ,NULL }, - {"/soc/ethernet@16040000" ,"starfive,tx-use-rgmii-clk" ,NULL }, - - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,tx-clk-adj-enabled" ,NULL }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,tx-clk-10-inverted" ,NULL }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,tx-clk-100-inverted" ,NULL }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,tx-clk-1000-inverted" ,NULL }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,rx-clk-drv-microamp" ,"2910" }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"motorcomm,rx-data-drv-microamp" ,"2910" }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"rx-internal-delay-ps" ,"1900" }, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0" , -"tx-internal-delay-ps" ,"1500" }, - - {"/soc/ethernet@16040000/mdio/ethernet-phy@1" , -"motorcomm,tx-clk-adj-enabled" ,NULL }, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1" , -"motorcomm,tx-clk-10-inverted" ,NULL }, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1" , -"motorcomm,tx-clk-100-inverted" ,NULL }, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1" , -"motorcomm,rx-clk-drv-microamp" ,"2910" }, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1" , -"motorcomm,rx-data-drv-microamp" ,"2910" }, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1" , -"rx-internal-delay-ps" ,"0" }, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1" , -"tx-internal-delay-ps" ,"300" }, -}; - -void spl_fdt_fixup_mars (void *fdt) -{ -static const char compat[] ="milkv,mars\0starfive,jh7110" ; -u32 phandle; -u8 i; -int offset; -int ret; - -fdt_setprop (fdt,fdt_path_offset (fdt,"/" ),"compatible" , compat,sizeof (compat)); -fdt_setprop_string (fdt,fdt_path_offset (fdt,"/" ),"model" , -"Milk-V Mars" ); - -/* gmac0 */ - offset =fdt_path_offset (fdt,"/soc/clock-controller@17000000" ); - phandle =fdt_get_phandle (fdt, offset); - offset =fdt_path_offset (fdt,"/soc/ethernet@16030000" ); - -fdt_setprop_u32 (fdt, offset,"assigned-clocks" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clocks" ,JH7110_AONCLK_GMAC0_TX ); -fdt_setprop_u32 (fdt, offset,"assigned-clock-parents" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clock-parents" , -JH7110_AONCLK_GMAC0_RMII_RTX ); - -/* gmac1 */ -fdt_setprop_string (fdt,fdt_path_offset (fdt,"/soc/ethernet@16040000" ), -"status" ,"disabled" ); - -for (i =0 ; i <ARRAY_SIZE (milk_v_mars); i++) { - offset =fdt_path_offset (fdt, milk_v_mars[i].path); - -if (milk_v_mars[i].value) - ret =fdt_setprop_u32 (fdt, offset, milk_v_mars[i].name, -dectoul (milk_v_mars[i].value,NULL )); -else - ret =fdt_setprop_empty (fdt, offset, milk_v_mars[i].name); - -if (ret) { -pr_err ("%s set prop %s fail.\n" , __func__, milk_v_mars[i].name); -break ; - } - } -} - -void spl_fdt_fixup_mars_cm (void *fdt) -{ -const char *compat; -const char *model; -int compat_size; - -spl_fdt_fixup_mars (fdt); - -if (!get_mmc_size_from_eeprom ()) { -int offset; -static const char - compat_cm_lite[] ="milkv,mars-cm-lite\0starfive,jh7110" ; - - model ="Milk-V Mars CM Lite" ; - compat = compat_cm_lite; - compat_size =sizeof (compat_cm_lite); - - offset =fdt_path_offset (fdt,"/soc/pinctrl/mmc0-pins/mmc0-pins-rest" ); -/* GPIOMUX(22, GPOUT_SYS_SDIO0_RST, GPOEN_ENABLE, GPI_NONE) */ -fdt_setprop_u32 (fdt, offset,"pinmux" ,0xff130016 ); - }else { -static const char - compat_cm[] ="milkv,mars-cm\0starfive,jh7110" ; - - model ="Milk-V Mars CM" ; - compat = compat_cm; - compat_size =sizeof (compat_cm); - } -fdt_setprop (fdt,fdt_path_offset (fdt,"/" ), -"compatible" , compat, compat_size); -fdt_setprop_string (fdt,fdt_path_offset (fdt,"/" ),"model" , model); -} - -void spl_fdt_fixup_version_a (void *fdt) -{ -static const char compat[] ="starfive,visionfive-2-v1.2a\0starfive,jh7110" ; -u32 phandle; -u8 i; -int offset; -int ret; - -fdt_setprop (fdt,fdt_path_offset (fdt,"/" ),"compatible" , compat,sizeof (compat)); -fdt_setprop_string (fdt,fdt_path_offset (fdt,"/" ),"model" , -"StarFive VisionFive 2 v1.2A" ); - - offset =fdt_path_offset (fdt,"/soc/clock-controller@13020000" ); - phandle =fdt_get_phandle (fdt, offset); - offset =fdt_path_offset (fdt,"/soc/ethernet@16040000" ); - -fdt_setprop_u32 (fdt, offset,"assigned-clocks" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clocks" ,JH7110_SYSCLK_GMAC1_TX ); -fdt_appendprop_u32 (fdt, offset,"assigned-clocks" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clocks" ,JH7110_SYSCLK_GMAC1_RX ); - -fdt_setprop_u32 (fdt, offset,"assigned-clock-parents" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clock-parents" , -JH7110_SYSCLK_GMAC1_RMII_RTX ); -fdt_appendprop_u32 (fdt, offset,"assigned-clock-parents" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clock-parents" , -JH7110_SYSCLK_GMAC1_RMII_RTX ); - -fdt_setprop_string (fdt,fdt_path_offset (fdt,"/soc/ethernet@16040000" ), -"phy-mode" ,"rmii" ); - -for (i =0 ; i <ARRAY_SIZE (starfive_vera); i++) { - offset =fdt_path_offset (fdt, starfive_vera[i].path); - -if (starfive_vera[i].value) - ret =fdt_setprop_u32 (fdt, offset, starfive_vera[i].name, -dectoul (starfive_vera[i].value,NULL )); -else - ret =fdt_setprop_empty (fdt, offset, starfive_vera[i].name); - -if (ret) { -pr_err ("%s set prop %s fail.\n" , __func__, starfive_vera[i].name); -break ; - } - } -} - -void spl_fdt_fixup_version_b (void *fdt) -{ -static const char compat[] ="starfive,visionfive-2-v1.3b\0starfive,jh7110" ; -u32 phandle; -u8 i; -int offset; -int ret; - -fdt_setprop (fdt,fdt_path_offset (fdt,"/" ),"compatible" , compat,sizeof (compat)); -fdt_setprop_string (fdt,fdt_path_offset (fdt,"/" ),"model" , -"StarFive VisionFive 2 v1.3B" ); - -/* gmac0 */ - offset =fdt_path_offset (fdt,"/soc/clock-controller@17000000" ); - phandle =fdt_get_phandle (fdt, offset); - offset =fdt_path_offset (fdt,"/soc/ethernet@16030000" ); - -fdt_setprop_u32 (fdt, offset,"assigned-clocks" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clocks" ,JH7110_AONCLK_GMAC0_TX ); -fdt_setprop_u32 (fdt, offset,"assigned-clock-parents" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clock-parents" , -JH7110_AONCLK_GMAC0_RMII_RTX ); - -/* gmac1 */ - offset =fdt_path_offset (fdt,"/soc/clock-controller@13020000" ); - phandle =fdt_get_phandle (fdt, offset); - offset =fdt_path_offset (fdt,"/soc/ethernet@16040000" ); - -fdt_setprop_u32 (fdt, offset,"assigned-clocks" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clocks" ,JH7110_SYSCLK_GMAC1_TX ); -fdt_setprop_u32 (fdt, offset,"assigned-clock-parents" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clock-parents" , -JH7110_SYSCLK_GMAC1_RMII_RTX ); - -for (i =0 ; i <ARRAY_SIZE (starfive_verb); i++) { - offset =fdt_path_offset (fdt, starfive_verb[i].path); - -if (starfive_verb[i].value) - ret =fdt_setprop_u32 (fdt, offset, starfive_verb[i].name, -dectoul (starfive_verb[i].value,NULL )); -else - ret =fdt_setprop_empty (fdt, offset, starfive_verb[i].name); - -if (ret) { -pr_err ("%s set prop %s fail.\n" , __func__, starfive_verb[i].name); -break ; - } - } -} - -void spl_fdt_fixup_star64 (void *fdt) -{ -static const char compat[] ="pine64,star64\0starfive,jh7110" ; -u32 phandle; -u8 i; -int offset; -int ret; - -fdt_setprop (fdt,fdt_path_offset (fdt,"/" ),"compatible" , compat,sizeof (compat)); -fdt_setprop_string (fdt,fdt_path_offset (fdt,"/" ),"model" , -"Pine64 Star64" ); - -/* gmac0 */ - offset =fdt_path_offset (fdt,"/soc/clock-controller@17000000" ); - phandle =fdt_get_phandle (fdt, offset); - offset =fdt_path_offset (fdt,"/soc/ethernet@16030000" ); - -fdt_setprop_u32 (fdt, offset,"assigned-clocks" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clocks" ,JH7110_AONCLK_GMAC0_TX ); -fdt_setprop_u32 (fdt, offset,"assigned-clock-parents" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clock-parents" , -JH7110_AONCLK_GMAC0_RMII_RTX ); - -/* gmac1 */ - offset =fdt_path_offset (fdt,"/soc/clock-controller@13020000" ); - phandle =fdt_get_phandle (fdt, offset); - offset =fdt_path_offset (fdt,"/soc/ethernet@16040000" ); - -fdt_setprop_u32 (fdt, offset,"assigned-clocks" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clocks" ,JH7110_SYSCLK_GMAC1_TX ); -fdt_setprop_u32 (fdt, offset,"assigned-clock-parents" , phandle); -fdt_appendprop_u32 (fdt, offset,"assigned-clock-parents" , -JH7110_SYSCLK_GMAC1_RMII_RTX ); - -for (i =0 ; i <ARRAY_SIZE (star64_pine64); i++) { - offset =fdt_path_offset (fdt, star64_pine64[i].path); - -if (star64_pine64[i].value) - ret =fdt_setprop_u32 (fdt, offset, star64_pine64[i].name, -dectoul (star64_pine64[i].value,NULL )); -else - ret =fdt_setprop_empty (fdt, offset, star64_pine64[i].name); - -if (ret) { -pr_err ("%s set prop %s fail.\n" , __func__, star64_pine64[i].name); -break ; - } - } -} -void spl_perform_fixups (struct spl_image_info *spl_image) { -u8 version; -const char *product_id; - - product_id =get_product_id_from_eeprom (); -if (!product_id) { -pr_err ("Can't read EEPROM\n" ); -return ; - } -if (!strncmp (product_id,"MARC" ,4 )) { -spl_fdt_fixup_mars_cm (spl_image->fdt_addr); - }else if (!strncmp (product_id,"MARS" ,4 )) { -spl_fdt_fixup_mars (spl_image->fdt_addr); - }else if (!strncmp (product_id,"VF7110" ,6 )) { - version =get_pcb_revision_from_eeprom (); -switch (version) { -case 'a' : -case 'A' : -spl_fdt_fixup_version_a (spl_image->fdt_addr); -break ; - -case 'b' : -case 'B' : -default : -spl_fdt_fixup_version_b (spl_image->fdt_addr); -break ; - }; - }else if (!strncmp (product_id,"STAR64" ,6 )) { -spl_fdt_fixup_star64 (spl_image->fdt_addr); - }else { -pr_err ("Unknown product %s\n" , product_id); - }; -/* Update the memory size which read from eeprom or DT */ fdt_fixup_memory (spl_image->fdt_addr,0x40000000 , gd->ram_size); }
Signature · 1 line
2.43.2
Hal Feng
maintainerPATCH v7 8/12 configs: visionfive2: Enable MULTI_DTB_FIT for JH7110 based board DT
In reply to Hal FengSo JH7110 based boards can select their own DT at runtime.
--- configs/starfive_visionfive2_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/starfive_visionfive2_defconfig +2 -0
@@ -82,6 +82,8 @@ CONFIG_CMD_WDT=y CONFIG_CMD_TFTPPUT=y CONFIG_CMD_BOOTSTAGE=y CONFIG_OF_BOARD=y +CONFIG_OF_LIST="starfive/jh7110-milkv-mars starfive/jh7110-pine64-star64 starfive/jh7110-starfive-visionfive-2-v1.2a starfive/jh7110-starfive-visionfive-2-v1.3b" +CONFIG_MULTI_DTB_FIT=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_SECT_SIZE_AUTO=y
Signature · 1 line
2.43.2
Hal Feng
maintainerPATCH v7 9/12 riscv: dts: jh7110: Support multiple DTBs in a Fit image
In reply to Hal FengSupport multiple DTBs for JH7110 based boards, so they can select the correct DT at runtime.
--- arch/riscv/dts/jh7110-common-u-boot.dtsi | 66 +++++++++++++++++++++--- 1 file changed, 60 insertions(+), 6 deletions(-)
arch/riscv/dts/jh7110-common-u-boot.dtsi +60 -6
@@ -110,20 +110,74 @@ itb { fit { images { - fdt-1 { - description = "NAME"; + fdt-jh7110-milkv-mars { + description = "jh7110-milkv-mars"; load = <0x40400000>; compression = "none"; - uboot_fdt_blob: blob-ext { - filename = "u-boot.dtb"; + blob-ext { + filename = "dts/upstream/src/riscv/starfive/jh7110-milkv-mars.dtb"; + }; + }; + + fdt-jh7110-pine64-star64 { + description = "jh7110-pine64-star64"; + load = <0x40400000>; + compression = "none"; + + blob-ext { + filename = "dts/upstream/src/riscv/starfive/jh7110-pine64-star64.dtb"; + }; + }; + + fdt-jh7110-starfive-visionfive-2-v1.2a { + description = "jh7110-starfive-visionfive-2-v1.2a"; + load = <0x40400000>; + compression = "none"; + + blob-ext { + filename = "dts/upstream/src/riscv/starfive/jh7110-starfive-visionfive-2-v1.2a.dtb"; + }; + }; + + fdt-jh7110-starfive-visionfive-2-v1.3b { + description = "jh7110-starfive-visionfive-2-v1.3b"; + load = <0x40400000>; + compression = "none"; + + blob-ext { + filename = "dts/upstream/src/riscv/starfive/jh7110-starfive-visionfive-2-v1.3b.dtb"; }; }; }; configurations { - conf-1 { - fdt = "fdt-1"; + conf-jh7110-milkv-mars { + description = "jh7110-milkv-mars"; + firmware = "opensbi"; + loadables = "uboot"; + fdt = "fdt-jh7110-milkv-mars"; + }; + + conf-jh7110-pine64-star64 { + description = "jh7110-pine64-star64"; + firmware = "opensbi"; + loadables = "uboot"; + fdt = "fdt-jh7110-pine64-star64"; + }; + + conf-jh7110-starfive-visionfive-2-v1.2a { + description = "jh7110-starfive-visionfive-2-v1.2a"; + firmware = "opensbi"; + loadables = "uboot"; + fdt = "fdt-jh7110-starfive-visionfive-2-v1.2a"; + }; + + conf-jh7110-starfive-visionfive-2-v1.3b { + description = "jh7110-starfive-visionfive-2-v1.3b"; + firmware = "opensbi"; + loadables = "uboot"; + fdt = "fdt-jh7110-starfive-visionfive-2-v1.3b"; }; }; };
Signature · 1 line
2.43.2
Hal Feng
maintainerPATCH v7 10/12 board: starfive: spl: Fix the wrong use of CONFIG_IS_ENABLED()
In reply to Hal FengThe prefix "SPL_" is not needed when using CONFIG_IS_ENABLED().
--- board/starfive/visionfive2/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/starfive/visionfive2/spl.c +1 -1
@@ -110,7 +110,7 @@ void board_init_f(ulong dummy) } } -#if CONFIG_IS_ENABLED (SPL_LOAD_FIT ) +#if CONFIG_IS_ENABLED (LOAD_FIT )int board_fit_config_name_match (const char *name) {/* boot using first FIT config */
Signature · 1 line
2.43.2
Hal Feng
maintainerPATCH v7 11/12 board: starfive: spl: Support multiple DTBs for JH7110 based boards
In reply to Hal FengGet product ID and the other information from EEPROM, use them to select the correct DTB.
--- board/starfive/visionfive2/spl.c | 33 ++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-)
board/starfive/visionfive2/spl.c +31 -2
@@ -113,7 +113,36 @@ void board_init_f(ulong dummy)#if CONFIG_IS_ENABLED (LOAD_FIT )int board_fit_config_name_match (const char *name) { -/* boot using first FIT config */ -return 0 ; +const char *product_id; +u8 version; + + product_id =get_product_id_from_eeprom (); + +if (!strncmp (product_id,"VF7110" ,6 )) { + version =get_pcb_revision_from_eeprom (); +if ((version =='b' || version =='B' ) && + !strcmp (name,"jh7110-starfive-visionfive-2-v1.3b" )) +return 0 ; + +if ((version =='a' || version =='A' ) && + !strcmp (name,"jh7110-starfive-visionfive-2-v1.2a" )) +return 0 ; + }else if (!strncmp (product_id,"MARS" ,4 ) && + !strcmp (name,"jh7110-milkv-mars" )) { +return 0 ; + }else if (!strncmp (product_id,"MARC" ,4 )) { +if (!get_mmc_size_from_eeprom ()) { +if (!strcmp (name,"jh7110-milkv-mars-cm-lite" )) +return 0 ; + }else { +if (!strcmp (name,"jh7110-milkv-mars-cm" )) +return 0 ; + } + }else if (!strncmp (product_id,"STAR64" ,6 ) && + !strcmp (name,"jh7110-pine64-star64" )) { +return 0 ; + } + +return -EINVAL ; }#endif
Signature · 1 line
2.43.2
Hal Feng
maintainerPATCH v7 12/12 riscv: cpu: jh7110: Sort the list of imply statements
In reply to Hal FengThe imply statements should be sorted in the sequence of appearance in .config.
--- arch/riscv/cpu/jh7110/Kconfig | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
arch/riscv/cpu/jh7110/Kconfig +10 -10
@@ -16,17 +16,17 @@ config STARFIVE_JH7110 select SYS_CACHE_SHIFT_6 select SPL_ZERO_MEM_BEFORE_USE select PINCTRL_STARFIVE_JH7110 + imply SMP + imply SPL_RISCV_ACLINT + imply SIFIVE_CACHE + imply SPL_SYS_MALLOC_CLEAR_ON_INIT + imply SPL_LOAD_FIT + imply SPL_CPU + imply SPL_OPENSBI + imply OF_UPSTREAM + imply SIFIVE_CCACHE imply MMC imply MMC_BROKEN_CD imply MMC_SPI - imply OF_UPSTREAM - imply RISCV_TIMER if (RISCV_SMODE || SPL_RISCV_SMODE) - imply SIFIVE_CACHE - imply SIFIVE_CCACHE - imply SMP imply SPI - imply SPL_CPU - imply SPL_LOAD_FIT - imply SPL_OPENSBI - imply SPL_RISCV_ACLINT - imply SPL_SYS_MALLOC_CLEAR_ON_INIT + imply RISCV_TIMER if (RISCV_SMODE || SPL_RISCV_SMODE)
Signature · 1 line
2.43.2