riscv: dts: spacemit: mark K1 boot nodes bootph-pre-ram
Subsystems (3)
v3 cover riscv: dts: spacemit: mark K1 boot nodes bootph-pre-ram
On the SpacemiT K1 the BootROM loads the next boot stage into SRAM, and that stage sets up DRAM. This series marks the nodes it needs for that
bootph-pre-ram: the SoC clocks, UART, boot media and the two I2C buses in k1.dtsi, and the board EEPROM (which holds the DRAM configuration), the PMIC rails and the SPI NOR in the board files.
The vendor confirmed that the BootROM itself does not access the EEPROM [1]. It is tagged because bootph-pre-ram covers the phase that sets up SDRAM, and DRAM cannot be trained without it.
Testing: all K1 DTBs build, and dtbs_check is clean for them with and without this series.
I used Claude to help read the U-Boot SPL and the device trees. I checked the changes and ran dtbs_check myself.
Changes in v3:
- Reword both commit messages to describe the hardware instead of what
an SPL does, and drop the U-Boot paragraph from patch 1 (E)
- Tag i2c2 in k1.dtsi too, as every K1 board has the EEPROM there
- Tag eeprom@50 on the OrangePi RV2 and R2S, missed in v2 (Sashiko)
- Drop the Assisted-by tags, see commit 1e035297ffda
- Keep E's Reviewed-by on both patches, as the changes are the ones discussed on v2
- Link to v2: https://lore.kernel.org/all/[email protected]/
Changes in v2:
- Tag i2c8 in k1.dtsi instead of in every board file (Yixun)
- Rebase onto the spacemit dt-for-next branch
- Link to v1: https://lore.kernel.org/all/[email protected]/
[1] https://lore.kernel.org/all/[email protected]/
Hung-Chun Tseng (2):
riscv: dts: spacemit: k1: mark boot-critical SoC nodes bootph-pre-ram
riscv: dts: spacemit: mark K1 board boot devices bootph-pre-ram
arch/riscv/boot/dts/spacemit/k1-bananapi-cm6.dtsi | 5 +++++ arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 5 +++++ arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts | 6 ++++++ arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts | 6 ++++++ arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts | 5 +++++ arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts | 6 ++++++ arch/riscv/boot/dts/spacemit/k1.dtsi | 14 ++++++++++++++ 7 files changed, 47 insertions(+)
base-commit: d05c6236496071916e19012cda7149465f15e66e
Signature · 1 line
2.43.0
PATCH v3 1/2 riscv: dts: spacemit: k1: mark boot-critical SoC nodes bootph-pre-ram
The K1 BootROM loads the next boot stage from SD, eMMC or SPI NOR into SRAM, and that stage brings up DRAM. To do so it needs the fixed clocks, the clock and reset controllers, the console UART, the boot media controllers (sdhci0, eMMC and QSPI), and two I2C buses that every K1 board wires the same way: i2c2 to the EEPROM that holds the DRAM configuration, and i2c8 to the PMIC that supplies the SoC.
Mark these nodes bootph-pre-ram, the phase that sets up SDRAM.
--- arch/riscv/boot/dts/spacemit/k1.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/riscv/boot/dts/spacemit/k1.dtsi +14 -0
@@ -322,6 +322,7 @@ cluster1_l2_cache: l2-cache1 { clocks { vctcxo_1m: clock-1m { compatible = "fixed-clock"; + bootph-pre-ram; clock-frequency = <1000000>; clock-output-names = "vctcxo_1m"; #clock-cells = <0>;
@@ -329,6 +330,7 @@ vctcxo_1m: clock-1m { vctcxo_24m: clock-24m { compatible = "fixed-clock"; + bootph-pre-ram; clock-frequency = <24000000>; clock-output-names = "vctcxo_24m"; #clock-cells = <0>;
@@ -336,6 +338,7 @@ vctcxo_24m: clock-24m { vctcxo_3m: clock-3m { compatible = "fixed-clock"; + bootph-pre-ram; clock-frequency = <3000000>; clock-output-names = "vctcxo_3m"; #clock-cells = <0>;
@@ -343,6 +346,7 @@ vctcxo_3m: clock-3m { osc_32k: clock-32k { compatible = "fixed-clock"; + bootph-pre-ram; clock-frequency = <32768>; clock-output-names = "osc_32k"; #clock-cells = <0>;
@@ -544,6 +548,7 @@ i2c1: i2c@d4011000 { i2c2: i2c@d4012000 { compatible = "spacemit,k1-i2c"; reg = <0x0 0xd4012000 0x0 0x38>; + bootph-pre-ram; #address-cells = <1>; #size-cells = <0>; clocks = <&syscon_apbc CLK_TWSI2>,
@@ -586,6 +591,7 @@ i2c5: i2c@d4013800 { syscon_apbc: system-controller@d4015000 { compatible = "spacemit,k1-syscon-apbc"; reg = <0x0 0xd4015000 0x0 0x1000>; + bootph-pre-ram; clocks = <&osc_32k>, <&vctcxo_1m>, <&vctcxo_3m>, <&vctcxo_24m>; clock-names = "osc", "vctcxo_1m", "vctcxo_3m",
@@ -726,6 +732,7 @@ i2c7: i2c@d401d000 { i2c8: i2c@d401d800 { compatible = "spacemit,k1-i2c"; reg = <0x0 0xd401d800 0x0 0x38>; + bootph-pre-ram; #address-cells = <1>; #size-cells = <0>; clocks = <&syscon_apbc CLK_TWSI8>,
@@ -857,6 +864,7 @@ pwm19: pwm@d4022c00 { syscon_mpmu: system-controller@d4050000 { compatible = "spacemit,k1-syscon-mpmu"; reg = <0x0 0xd4050000 0x0 0x209c>; + bootph-pre-ram; clocks = <&osc_32k>, <&vctcxo_1m>, <&vctcxo_3m>, <&vctcxo_24m>; clock-names = "osc", "vctcxo_1m", "vctcxo_3m",
@@ -869,6 +877,7 @@ syscon_mpmu: system-controller@d4050000 { pll: clock-controller@d4090000 { compatible = "spacemit,k1-pll"; reg = <0x0 0xd4090000 0x0 0x1000>; + bootph-pre-ram; clocks = <&vctcxo_24m>; spacemit,mpmu = <&syscon_mpmu>; #clock-cells = <1>;
@@ -877,6 +886,7 @@ pll: clock-controller@d4090000 { syscon_apmu: system-controller@d4282800 { compatible = "spacemit,k1-syscon-apmu"; reg = <0x0 0xd4282800 0x0 0x400>; + bootph-pre-ram; clocks = <&osc_32k>, <&vctcxo_1m>, <&vctcxo_3m>, <&vctcxo_24m>; clock-names = "osc", "vctcxo_1m", "vctcxo_3m",
@@ -956,6 +966,7 @@ uart0: serial@d4017000 { compatible = "spacemit,k1-uart", "intel,xscale-uart"; reg = <0x0 0xd4017000 0x0 0x100>; + bootph-pre-ram; clocks = <&syscon_apbc CLK_UART0>, <&syscon_apbc CLK_UART0_BUS>; clock-names = "core", "bus";
@@ -1085,6 +1096,7 @@ qspi: spi@d420c000 { reg = <0x0 0xd420c000 0x0 0x1000>, <0x0 0xb8000000 0x0 0xc00000>; reg-names = "QuadSPI", "QuadSPI-memory"; + bootph-pre-ram; clocks = <&syscon_apmu CLK_QSPI_BUS>, <&syscon_apmu CLK_QSPI>; clock-names = "qspi_en", "qspi";
@@ -1328,6 +1340,7 @@ usb_dwc3: usb@c0a00000 { sdhci0: mmc@d4280000 { compatible = "spacemit,k1-sdhci"; reg = <0x0 0xd4280000 0x0 0x200>; + bootph-pre-ram; clocks = <&syscon_apmu CLK_SDH_AXI>, <&syscon_apmu CLK_SDH0>; clock-names = "core", "io";
@@ -1341,6 +1354,7 @@ sdhci0: mmc@d4280000 { emmc: mmc@d4281000 { compatible = "spacemit,k1-sdhci"; reg = <0x0 0xd4281000 0x0 0x200>; + bootph-pre-ram; clocks = <&syscon_apmu CLK_SDH_AXI>, <&syscon_apmu CLK_SDH2>; clock-names = "core", "io";
Signature · 1 line
2.43.0
Re: [PATCH v3 1/2] riscv: dts: spacemit: k1: mark boot-critical SoC nodes bootph-pre-ram
Hi Hung-Chun,
Quoted 8 lines · Hung-Chun Tseng
The K1 BootROM loads the next boot stage from SD, eMMC or SPI NOR into SRAM, and that stage brings up DRAM. To do so it needs the fixed clocks, the clock and reset controllers, the console UART, the boot media controllers (sdhci0, eMMC and QSPI), and two I2C buses that every K1 board wires the same way: i2c2 to the EEPROM that holds the DRAM configuration, and i2c8 to the PMIC that supplies the SoC.
Quoted 4 lines
Mark these nodes bootph-pre-ram, the phase that sets up SDRAM.
Reviewed-by E Shattow <[email protected]>Signed-off-by Hung-Chun Tseng <[email protected]>
Thanks for these changes. It helped me a lot.
Could you update the pinctrl and GPIO configurations, including all necessary pin
assignments, to bring up the SD card, PCIe, and Ethernet nodes?
Please ensure that the required bootph-pre-ram properties are applied to the relevant
pinctrl, GPIO, and other dependent nodes wherever necessary for SD card boot and SPL initialization.
Additionally, could you update the regulator-name properties for vdd_core, vdd_1v8,
and vdd_1v8_mmc? On all the boards, the SPL code requires these regulator names to locate and enable the corresponding regulators during early boot.
I am verifying the changes against the existing U-Boot board device tree and configuration to ensure
that SD card, eMMC, PCIe, and Ethernet initialization work correctly.
Thanks
-Anand
Re: [PATCH v3 1/2] riscv: dts: spacemit: k1: mark boot-critical SoC nodes bootph-pre-ram
Hi Anand,
Quoted 8 lines · Anand Moon
Could you update the pinctrl and GPIO configurations, including all necessary pin
assignments, to bring up the SD card, PCIe, and Ethernet nodes?Please ensure that the required bootph-pre-ram properties are applied to the relevant
pinctrl, GPIO, and other dependent nodes wherever necessary for SD card boot and SPL initialization.
I'd like to keep this series to what is needed before DRAM is up. PCIe and Ethernet are not used in that phase, and their pinctrl-0 entries are already in the board files.
For the boot media, the BootROM has already set up the pins of the device it loaded the SPL from. U-Boot's spacemit_k1_defconfig does not enable SPL_PINCTRL or SPL_GPIO either, so the tags would have no user today. SD boot on a Milk-V Jupiter works without them.
E also asked on the cover letter to keep the BootROM part and the DRAM part apart, so I'd rather not widen it.
Quoted 4 lines
Additionally, could you update the regulator-name properties for
vdd_core,vdd_1v8,
andvdd_1v8_mmc? On all the boards, the SPL code requires these regulator names to locate and enable the corresponding regulators during early boot.
These names come from the U-Boot SPL code, not from the board schematics, and U-Boot already sets them in arch/riscv/dts/k1-bananapi-f3-u-boot.dtsi and k1-musepi-pro-u-boot.dtsi. I think that is the right place for them.
Quoted 3 lines
I am verifying the changes against the existing U-Boot board device tree and configuration to ensure
that SD card, eMMC, PCIe, and Ethernet initialization work correctly.
Thanks for testing. Please let me know how it goes.
Thanks,
Hung-Chun
Re: [PATCH v3 1/2] riscv: dts: spacemit: k1: mark boot-critical SoC nodes bootph-pre-ram
Hi Hung-Chun,
Quoted 13 lines · Hung-Chun Tseng
Hi Anand,
Quoted 8 lines · Anand Moon
Could you update the pinctrl and GPIO configurations, including all necessary pin
assignments, to bring up the SD card, PCIe, and Ethernet nodes?Please ensure that the required bootph-pre-ram properties are applied to the relevant
pinctrl, GPIO, and other dependent nodes wherever necessary for SD card boot and SPL initialization.
Quoted 9 lines
I'd like to keep this series to what is needed before DRAM is up. PCIe and Ethernet are not used in that phase, and their pinctrl-0 entries are already in the board files.
For the boot media, the BootROM has already set up the pins of the device it loaded the SPL from. U-Boot's
spacemit_k1_defconfigdoes not enableSPL_PINCTRLorSPL_GPIOeither, so the tags would have no user today. SD boot on a Milk-V Jupiter works without them.
It is partially working, but the current approach is not ideal. I have made some driver and configuration changes to get it working on my Banana Pi BPI-F3.
The main issue is that SPL_PINCTRL and SPL_GPIO support are required for board bring-up,
but these options are currently missing from the U-Boot configuration.
Here is my u-boot logs with some debug prints.
[1] https://gist.github.com/moonlinux/a491bf56bfa914e4bf5f661635eefe9c
Quoted 8 lines
E also asked on the cover letter to keep the BootROM part and the DRAM part apart, so I'd rather not widen it.
Quoted 4 lines
Additionally, could you update the regulator-name properties for
vdd_core,vdd_1v8,
andvdd_1v8_mmc? On all the boards, the SPL code requires these regulator names to locate and enable the corresponding regulators during early boot.
Quoted 5 lines
These names come from the U-Boot SPL code, not from the board schematics, and U-Boot already sets them in
arch/riscv/dts/k1-bananapi-f3-u-boot.dtsiandk1-musepi-pro-u-boot.dtsi. I think that is the right place for them.
I have made some changes while integrating this patch series into U-Boot. I am following the approach used in configs/starfive_visionfive2_defconfig to keep arch/riscv/dts/spacemit-k1-u-boot.dtsi as minimal and generic as possible,
focusing only on the essential SPL bring-up requirements.
Quoted 5 lines
Quoted 3 lines
I am verifying the changes against the existing U-Boot board device tree and configuration to ensure
that SD card, eMMC, PCIe, and Ethernet initialization work correctly.Thanks for testing. Please let me know how it goes.
The goal is to move most board bring-up configuration into the upstream device tree,
allowing each board to enable its peripherals using the existing upstream configuration.
Once this patch series is merged into U-Boot's dts/upstream/, we can keep the board-specific
configuration minimal, avoid duplication, and reduce the maintenance burden.
Quoted 3 lines
Thanks,
Hung-Chun
Thanks
-Anand
Re: [PATCH v3 1/2] riscv: dts: spacemit: k1: mark boot-critical SoC nodes bootph-pre-ram
Hi Anand,
Quoted 3 lines · Anand Moon
The main issue is that
SPL_PINCTRLandSPL_GPIOsupport are required for board bring-up,
but these options are currently missing from the U-Boot configuration.
Thanks for the log. You're right that the SPL can load the next stage from a different device than the one the BootROM used. In your log the BootROM boots from SD and the SPL then fails to find the SPI NOR, maybe because nothing has set up those pins.
So tagging the pin groups of the boot devices makes sense to me, as jh7110-common.dtsi does for its i2c5 pins. I'd do that once U-Boot enables SPL_PINCTRL for K1, so that the tags have a user. It would also go in the add-on patch rather than the BootROM one, following E's split. PCIe and Ethernet I'd still leave out, as the SPL does not use them.
Quoted 3 lines
I am following the approach used in configs/starfive_visionfive2_defconfig to keep
arch/riscv/dts/spacemit-k1-u-boot.dtsias minimal and generic as possible,
I agree with that goal. For the regulators, I think the board files should use the names from each board's schematic, and the SPL should find the rails some other way than by a fixed name. Otherwise every new board has to use the same names.
Would you like to send the U-Boot side (SPL_PINCTRL/SPL_GPIO)? I'm happy to test it on a Milk-V Jupiter.
Thanks,
Hung-Chun
PATCH v3 2/2 riscv: dts: spacemit: mark K1 board boot devices bootph-pre-ram
In reply to Hung-Chun TsengThe board EEPROM at 0x50 holds the DRAM configuration (number of chip selects, data rate and type), which has to be read before DRAM can be trained. The P1 PMIC at 0x41 supplies the CPU core (buck1), the 1.8 V rail of the EEPROM (buck3) and the SD card I/O (aldo1), which have to be set up before that. Boards that boot from SPI NOR also need the flash.
Mark these board devices bootph-pre-ram on the boards that have them.
--- arch/riscv/boot/dts/spacemit/k1-bananapi-cm6.dtsi | 5 +++++ arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 5 +++++ arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts | 6 ++++++ arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts | 6 ++++++ arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts | 5 +++++ arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts | 6 ++++++ 6 files changed, 33 insertions(+)
arch/riscv/boot/dts/spacemit/k1-bananapi-cm6.dtsi +5 -0
@@ -71,6 +71,7 @@ &i2c2 { eeprom@50 { compatible = "atmel,24c02"; reg = <0x50>; + bootph-pre-ram; vcc-supply = <&buck3_1v8>; pagesize = <16>; read-only;
@@ -100,6 +101,7 @@ &i2c8 { pmic@41 { compatible = "spacemit,p1"; reg = <0x41>; + bootph-pre-ram; interrupts = <64>; vin1-supply = <®_vcc_4v>; vin2-supply = <®_vcc_4v>;
@@ -113,6 +115,7 @@ pmic@41 { regulators { buck1 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <1050000>; regulator-ramp-delay = <5000>;
@@ -127,6 +130,7 @@ buck2 { }; buck3_1v8: buck3 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <1800000>; regulator-ramp-delay = <5000>;
@@ -155,6 +159,7 @@ buck6 { }; aldo1: aldo1 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <3400000>; regulator-boot-on;
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +5 -0
@@ -194,6 +194,7 @@ &i2c2 { eeprom@50 { compatible = "atmel,24c02"; reg = <0x50>; + bootph-pre-ram; vcc-supply = <&buck3_1v8>; /* EEPROM_VCC1V8 */ pagesize = <16>; read-only;
@@ -223,6 +224,7 @@ &i2c8 { pmic@41 { compatible = "spacemit,p1"; reg = <0x41>; + bootph-pre-ram; interrupts = <64>; vin1-supply = <®_vcc_4v>; vin2-supply = <®_vcc_4v>;
@@ -236,6 +238,7 @@ pmic@41 { regulators { buck1_0v9: buck1 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <1050000>; regulator-ramp-delay = <5000>;
@@ -250,6 +253,7 @@ buck2 { }; buck3_1v8: buck3 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <1800000>; regulator-ramp-delay = <5000>;
@@ -278,6 +282,7 @@ buck6 { }; aldo1: aldo1 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <3400000>; regulator-boot-on;
arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts +6 -0
@@ -208,6 +208,7 @@ &i2c2 { eeprom@50 { compatible = "atmel,24c04"; reg = <0x50>; + bootph-pre-ram; vcc-supply = <&buck3_1v8>; /* EEPROM_VCC18 */ pagesize = <16>; read-only;
@@ -230,6 +231,7 @@ &i2c8 { pmic@41 { compatible = "spacemit,p1"; reg = <0x41>; + bootph-pre-ram; interrupts = <64>; vin1-supply = <®_vcc_4v>; vin2-supply = <®_vcc_4v>;
@@ -243,6 +245,7 @@ pmic@41 { regulators { buck1_0v9: buck1 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <1050000>; regulator-ramp-delay = <5000>;
@@ -257,6 +260,7 @@ buck2 { }; buck3_1v8: buck3 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <1800000>; regulator-ramp-delay = <5000>;
@@ -285,6 +289,7 @@ buck6 { }; aldo1: aldo1 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <3400000>; regulator-boot-on;
@@ -386,6 +391,7 @@ &qspi { flash@0 { compatible = "jedec,spi-nor"; reg = <0>; + bootph-pre-ram; spi-max-frequency = <26500000>; spi-rx-bus-width = <4>; spi-tx-bus-width = <4>;
arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts +6 -0
@@ -167,6 +167,7 @@ &i2c2 { eeprom@50 { compatible = "atmel,24c02"; reg = <0x50>; + bootph-pre-ram; vcc-supply = <&buck3_1v8>; /* EEPROM_VCC1V8 */ pagesize = <8>; read-only;
@@ -199,6 +200,7 @@ &i2c8 { pmic@41 { compatible = "spacemit,p1"; reg = <0x41>; + bootph-pre-ram; interrupts = <64>; vin1-supply = <®_vcc_4v>; vin2-supply = <®_vcc_4v>;
@@ -212,6 +214,7 @@ pmic@41 { regulators { buck1_0v9: buck1 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <1050000>; regulator-ramp-delay = <5000>;
@@ -226,6 +229,7 @@ buck2 { }; buck3_1v8: buck3 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <1800000>; regulator-ramp-delay = <5000>;
@@ -254,6 +258,7 @@ buck6 { }; aldo1: aldo1 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <3400000>; regulator-boot-on;
@@ -353,6 +358,7 @@ &qspi { flash@0 { compatible = "jedec,spi-nor"; reg = <0>; + bootph-pre-ram; spi-max-frequency = <26500000>; spi-rx-bus-width = <4>; spi-tx-bus-width = <4>;
arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts +5 -0
@@ -158,6 +158,7 @@ &i2c2 { eeprom@50 { compatible = "atmel,24c02"; reg = <0x50>; + bootph-pre-ram; pagesize = <16>; size = <256>; read-only;
@@ -187,6 +188,7 @@ &i2c8 { pmic@41 { compatible = "spacemit,p1"; reg = <0x41>; + bootph-pre-ram; interrupts = <64>; vin1-supply = <&vcc4v0>; vin2-supply = <&vcc4v0>;
@@ -200,6 +202,7 @@ pmic@41 { regulators { buck1_0v9: buck1 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <1050000>; regulator-ramp-delay = <5000>;
@@ -214,6 +217,7 @@ buck2 { }; buck3_1v8: buck3 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <1800000>; regulator-ramp-delay = <5000>;
@@ -242,6 +246,7 @@ buck6 { }; aldo1_3v3: aldo1 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <3400000>; regulator-boot-on;
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts +6 -0
@@ -185,6 +185,7 @@ &i2c2 { eeprom@50 { compatible = "atmel,24c02"; reg = <0x50>; + bootph-pre-ram; pagesize = <16>; size = <256>; read-only;
@@ -214,6 +215,7 @@ &i2c8 { pmic@41 { compatible = "spacemit,p1"; reg = <0x41>; + bootph-pre-ram; interrupts = <64>; vin1-supply = <&vcc4v0>; vin2-supply = <&vcc4v0>;
@@ -227,6 +229,7 @@ pmic@41 { regulators { buck1_0v9: buck1 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <1050000>; regulator-ramp-delay = <5000>;
@@ -241,6 +244,7 @@ buck2 { }; buck3_1v8: buck3 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <1800000>; regulator-ramp-delay = <5000>;
@@ -269,6 +273,7 @@ buck6 { }; aldo1: aldo1 { + bootph-pre-ram; regulator-min-microvolt = <500000>; regulator-max-microvolt = <3400000>; regulator-boot-on;
@@ -366,6 +371,7 @@ &qspi { flash@0 { compatible = "jedec,spi-nor"; reg = <0>; + bootph-pre-ram; spi-max-frequency = <26500000>; spi-rx-bus-width = <4>; spi-tx-bus-width = <4>;
Signature · 1 line
2.43.0
Hi Hung-Chun,
Quoted 47 lines · Hung-Chun Tseng
On the SpacemiT K1 the BootROM loads the next boot stage into SRAM, and that stage sets up DRAM. This series marks the nodes it needs for that
bootph-pre-ram: the SoC clocks, UART, boot media and the two I2C buses ink1.dtsi, and the board EEPROM (which holds the DRAM configuration), the PMIC rails and the SPI NOR in the board files.The vendor confirmed that the BootROM itself does not access the EEPROM [1]. It is tagged because bootph-pre-ram covers the phase that sets up SDRAM, and DRAM cannot be trained without it.
Testing: all K1 DTBs build, and
dtbs_checkis clean for them with and without this series.I used Claude to help read the U-Boot SPL and the device trees. I checked the changes and ran
dtbs_checkmyself.Changes in v3:
- Reword both commit messages to describe the hardware instead of what
an SPL does, and drop the U-Boot paragraph from patch 1 (E)
- Tag i2c2 ink1.dtsitoo, as every K1 board has the EEPROM there
- Tag eeprom@50 on the OrangePi RV2 and R2S, missed in v2 (Sashiko)
- Drop the Assisted-by tags, see commit1e035297ffda
- Keep E's Reviewed-by on both patches, as the changes are the ones discussed on v2
- Link to v2: https://lore.kernel.org/all/[email protected]/Changes in v2:
- Tag i2c8 ink1.dtsiinstead of in every board file (Yixun)
- Rebase onto the spacemit dt-for-next branch
- Link to v1: https://lore.kernel.org/all/[email protected]/[1] https://lore.kernel.org/all/[email protected]/
Hung-Chun Tseng (2):
riscv: dts: spacemit: k1: mark boot-critical SoC nodes bootph-pre-ram
riscv: dts: spacemit: mark K1 board boot devices bootph-pre-ramarch/riscv/boot/dts/spacemit/k1-bananapi-cm6.dtsi | 5 +++++ arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 5 +++++ arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts | 6 ++++++ arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts | 6 ++++++ arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts | 5 +++++ arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts | 6 ++++++ arch/riscv/boot/dts/spacemit/k1.dtsi | 14 ++++++++++++++ 7 files changed, 47 insertions(+)
Quoted 1 line
base-commit:
d05c6236496071916e19012cda7149465f15e66e
The series is looking good although I now have a nitpick about patch organization since it is acknowledged that BootROM does not setup or access DRAM. BootROM may load code that does not setup or access DRAM. At the moment the patches are strictly split on "K1 SoC" and "Per-board" while the one stated intention is DRAM initialization after some of the peripherals BootROM may have configured also; that makes sense not knowing the split between BootROM and other things and so I ask to change this.
Split the patches in this series so we have a clearly defined initial changeset that does "Extend the BootROM configured peripherals to device tree bootph-pre-ram hints for any SPL loaded by that BootROM in SD, eMMC, and SPI NOR boot modes". Capture all the BootROM SPL loader flows that we can understand (USB missing currently? please add this) from documentation, and with active participation from the vendor for any questions. If that is an excessive burden then please let me know I will look more closely at and give specific suggestions to be more helpful.
If you choose to keep patches for anything else that you want to add (e.g. DRAM setup) extra beyond the basis of "BootROM" extension, defer to the maintainer preference if they want it or not. I'm okay with "DRAM setup" being an add-on with this series, but just as well for my interest it certainly belongs in U-Boot if not in Linux. There may be different requirements for linuxboot, oreboot, etc.
Aside, if the add-on patch is rejected by the maintainer here, it will be then the basis for import to U-Boot (this is a different discussion) and we can refer to the mailing list archive link; for the accepted patches anyways these can be imported early to U-Boot and dropped there when devicetree-rebasing will receive the changes.
I do not wish to delay anything but it seems to me to be important that there is a distinction between describing the environment in which we find ourselves subsequent to hardware BootROM, and any other extra additions that we have for the most likely use (U-Boot SPL, linuxboot, oreboot, whatever it is that wants DRAM initialized).
-E
Hi E,
Quoted 4 lines · E Shattow
Split the patches in this series so we have a clearly defined initial changeset that does "Extend the BootROM configured peripherals to device tree bootph-pre-ram hints for any SPL loaded by that BootROM in SD, eMMC, and SPI NOR boot modes".
Thanks, that makes sense. For v4 I plan this split:
1. BootROM: the fixed clocks, the clock and reset controllers, uart0, sdhci0, emmc and qspi in k1.dtsi, and the SPI NOR flash@0 in the board files.
2. DRAM setup, as an add-on for Yixun to take or leave: i2c2 and i2c8 in k1.dtsi, and the EEPROM, the PMIC and its buck1, buck3 and aldo1 in the board files.
Quoted 2 lines
Capture all the BootROM SPL loader flows
that we can understand (USB missing currently? please add this)
USB download mode goes through the OTG port (FDL button, then "fastboot stage"), but mainline has no node for the USB2 OTG controller behind it yet. The DWC3 is a different controller. So there is nothing to tag for USB today, and I'd add it once that node lands.
Yixun, could you confirm that the BootROM uses that OTG controller for USB download, and that it does not touch the DWC3?
Does this split look right to you? I'll send v4 after the merge window.
Thanks,
Hung-Chun
Quoted 18 lines · Hung-Chun Tseng
Hi E,
Quoted 4 lines · E Shattow
Split the patches in this series so we have a clearly defined initial changeset that does "Extend the BootROM configured peripherals to device tree bootph-pre-ram hints for any SPL loaded by that BootROM in SD, eMMC, and SPI NOR boot modes".
Thanks, that makes sense. For v4 I plan this split:
1. BootROM: the fixed clocks, the clock and reset controllers, uart0, sdhci0, emmc and qspi in
k1.dtsi, and the SPI NOR flash@0 in the board files.2. DRAM setup, as an add-on for Yixun to take or leave: i2c2 and i2c8 in
k1.dtsi, and the EEPROM, the PMIC and its buck1, buck3 and aldo1 in the board files.
Quoted 7 lines
Quoted 2 lines
Capture all the BootROM SPL loader flows
that we can understand (USB missing currently? please add this)USB download mode goes through the OTG port (FDL button, then "fastboot stage"), but mainline has no node for the USB2 OTG controller behind it yet. The DWC3 is a different controller. So there is nothing to tag for USB today, and I'd add it once that node lands.
Is "[PATCH v4 0/8] Add SpacemiT K1 USB2.0 controllers support" what you refer to?:
https://lore.kernel.org/lkml/20261009-b4-spacemit-k1-usb2-v4-0-2d98e5324d9a@linux.spacemit.com/
"The SpacemiT K1 SoC has two USB2.0 controllers, one has Dual-Role support, but the hardware has no internal OTG registers, the other is Host only. These controllers are compatible with Chipidea USB2 driver with some flags set and reset control support."
Looking briefly at the design guide section 1.4.1 "USB 2.0"
https://cdn-resource.spacemit.com/file/chip/K1/K1_Hardware_Design_Guide_en.pdf
quote "USB2.0-0 serves as the Download interface." and "A self-powered USB device/hub is needed to test the host function of the dual-role controller on Banana Pi F3, a MINI-PCIe USB2.0 module (a cellular module e.g.) is needed to test the host only controller."
That looks to me like the target to hint. You could ask for the hints to be added on that (USB 2.0) series, or note as a dependency for this series and do so here.
Note also "[PATCH] riscv: dts: spacemit: enable USB2.0 controllers on Milk-V Jupiter"
https://lore.kernel.org/all/[email protected]/
"On Milk-V Jupiter boards, usb2_0 is connected to a Type-C connector which cannot act as a power source."
More of the same, I think, adding bootph-pre-ram hints to phy@c0940000 and usb@c0900000 or by label references per-board whatever shape of that is best. Per-board is more useful to potential users of this at SPL phase but may introduce inaccuracies (as it pertains to describing hardware) as the decisions to default to "host" mode and not "otg" are common sense things that are (looking at history of these decisions) permissible to be different than default hardware state after possible BootROM configuration. I do wonder if the SPL environment directly following BootROM is something we should perhaps be describing in Linux devicetree as its own distinct thing. Well, don't forget about USB anyway I think there's an actionable there and it's just a coordination issue which series should take that change.
Quoted 4 lines
Yixun, could you confirm that the BootROM uses that OTG controller for USB download, and that it does not touch the DWC3?
...
Quoted 3 lines
Does this split look right to you? I'll send v4 after the merge window.> Thanks,
Hung-Chun
Yes, thank you -E
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Hi Hung-Chun,
Quoted 31 lines · Hung-Chun Tseng
On the SpacemiT K1 the BootROM loads the next boot stage into SRAM, and that stage sets up DRAM. This series marks the nodes it needs for that
bootph-pre-ram: the SoC clocks, UART, boot media and the two I2C buses ink1.dtsi, and the board EEPROM (which holds the DRAM configuration), the PMIC rails and the SPI NOR in the board files.The vendor confirmed that the BootROM itself does not access the EEPROM [1]. It is tagged because bootph-pre-ram covers the phase that sets up SDRAM, and DRAM cannot be trained without it.
Testing: all K1 DTBs build, and
dtbs_checkis clean for them with and without this series.I used Claude to help read the U-Boot SPL and the device trees. I checked the changes and ran
dtbs_checkmyself.Changes in v3:
- Reword both commit messages to describe the hardware instead of what
an SPL does, and drop the U-Boot paragraph from patch 1 (E)
- Tag i2c2 ink1.dtsitoo, as every K1 board has the EEPROM there
- Tag eeprom@50 on the OrangePi RV2 and R2S, missed in v2 (Sashiko)
- Drop the Assisted-by tags, see commit1e035297ffda
- Keep E's Reviewed-by on both patches, as the changes are the ones discussed on v2
- Link to v2: https://lore.kernel.org/all/[email protected]/Changes in v2:
- Tag i2c8 ink1.dtsiinstead of in every board file (Yixun)
- Rebase onto the spacemit dt-for-next branch
- Link to v1: https://lore.kernel.org/all/[email protected]/
Quoted 6 lines
[1] https://lore.kernel.org/all/[email protected]/
Hung-Chun Tseng (2):
riscv: dts: spacemit: k1: mark boot-critical SoC nodes bootph-pre-ram
riscv: dts: spacemit: mark K1 board boot devices bootph-pre-ram
I'd not put this series on hold, we generally could address other remains of issue/improvement later. so with
Quoted 14 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-cm6.dtsi | 5 +++++ arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 5 +++++ arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts | 6 ++++++ arch/riscv/boot/dts/spacemit/k1-musepi-pro.dts | 6 ++++++ arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts | 5 +++++ arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts | 6 ++++++ arch/riscv/boot/dts/spacemit/k1.dtsi | 14 ++++++++++++++ 7 files changed, 47 insertions(+)base-commit:
d05c6236496071916e19012cda7149465f15e66eSignature · 1 line
2.43.0
Signature · 1 line
Yixun Lan (dlan)
Hi Yixun,
Quoted 36 lines · Yixun Lan
Hi Hung-Chun,
Quoted 33 lines · Hung-Chun Tseng
On the SpacemiT K1 the BootROM loads the next boot stage into SRAM, and that stage sets up DRAM. This series marks the nodes it needs for that
bootph-pre-ram: the SoC clocks, UART, boot media and the two I2C buses ink1.dtsi, and the board EEPROM (which holds the DRAM configuration), the PMIC rails and the SPI NOR in the board files.The vendor confirmed that the BootROM itself does not access the EEPROM [1]. It is tagged because bootph-pre-ram covers the phase that sets up SDRAM, and DRAM cannot be trained without it.
Testing: all K1 DTBs build, and
dtbs_checkis clean for them with and without this series.I used Claude to help read the U-Boot SPL and the device trees. I checked the changes and ran
dtbs_checkmyself.Changes in v3:
- Reword both commit messages to describe the hardware instead of what
an SPL does, and drop the U-Boot paragraph from patch 1 (E)
- Tag i2c2 ink1.dtsitoo, as every K1 board has the EEPROM there
- Tag eeprom@50 on the OrangePi RV2 and R2S, missed in v2 (Sashiko)
- Drop the Assisted-by tags, see commit1e035297ffda
- Keep E's Reviewed-by on both patches, as the changes are the ones discussed on v2
- Link to v2: https://lore.kernel.org/all/[email protected]/Changes in v2:
- Tag i2c8 ink1.dtsiinstead of in every board file (Yixun)
- Rebase onto the spacemit dt-for-next branch
- Link to v1: https://lore.kernel.org/all/[email protected]/
Quoted 8 lines
Quoted 4 lines
Hung-Chun Tseng (2):
riscv: dts: spacemit: k1: mark boot-critical SoC nodes bootph-pre-ram
riscv: dts: spacemit: mark K1 board boot devices bootph-pre-ramI'd not put this series on hold, we generally could address other remains of issue/improvement later. so with
Reviewed-by Yixun Lan <[email protected]>
With regard to mainline U-Boot use of devicetree-rebasing there is a robust method in U-Boot build system for overrides such that we may adopt these proposed changes there before they are accepted in Linux.
With changes-requested all addressed for v4 I expect the shape of this will be good and it is not holding back anything in Linux kernel. The hold is only due having to ask for what the closed-source BootROM is doing and waiting for this confirmation now instead of having access to see its code directly. There are intellectual property warnings published by SpacemiT prohibiting reverse-engineering the BootROM so it cannot be expected to proceed any more quickly than asking and waiting for a reply.
If you would like to abandon the approach I suggest of considering the effects of BootROM peripheral configuration as a hardware environment needing device tree description and bootph-pre-ram hints for constrained-memory SPL, then that topic can also be discussed. Please be clear what your expectations are, thanks!
-E
[...]