[PATCH 4/6] riscv: dts: spacemit: enable QSPI and add SPI NOR on Milk-V Jupiter

Aurelien Jarno posted 6 patches 1 week, 5 days ago
[PATCH 4/6] riscv: dts: spacemit: enable QSPI and add SPI NOR on Milk-V Jupiter
Posted by Aurelien Jarno 1 week, 5 days ago
Add the QSPI controller node for the Milk-V Jupiter board and describe
the attached SPI NOR flash (GD25Q64E).

The flash supports a frequency up to 133MHz (80 MHz for reads), and the
SoC supports a frequency up to 104 MHz. However tests have shown that
the flash is not reliably detected above 26.5 MHz, consistent with
frequency used in the vendor kernel. Therefore, use this frequency.

The m25p,fast-read properties is taken from the vendor kernel.

Add a corresponding flash partition layout, matching the layout and the
names used in the vendor U-Boot.

Also add the bootph-pre-ram property to make the device tree usable by
early firmware/bootloaders without modification, as U-Boot is stored on
this NOR flash.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 .../boot/dts/spacemit/k1-milkv-jupiter.dts    | 44 ++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts b/arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts
index 836311c3f035c..05ab5df50be51 100644
--- a/arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts
@@ -173,7 +173,7 @@ buck3_1v8: buck3 {
 				regulator-always-on;
 			};
 
-			buck4 {
+			buck4_3v3: buck4 {
 				regulator-min-microvolt = <500000>;
 				regulator-max-microvolt = <3300000>;
 				regulator-ramp-delay = <5000>;
@@ -256,6 +256,48 @@ dldo7 {
 	};
 };
 
+&qspi {
+	pinctrl-names = "default";
+	pinctrl-0 = <&qspi_cfg>;
+	status = "okay";
+
+	flash@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <26500000>;
+		spi-rx-bus-width = <4>;
+		spi-tx-bus-width = <4>;
+		vcc-supply = <&buck4_3v3>; /* QSPI_VCC1833 */
+		m25p,fast-read;
+		bootph-pre-ram;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			bootinfo@0 {
+				reg = <0x0 0x10000>;
+			};
+			private@10000 {
+				reg = <0x10000 0x10000>;
+			};
+			fsbl@20000 {
+				reg = <0x20000 0x40000>;
+			};
+			env@60000 {
+				reg = <0x60000 0x10000>;
+			};
+			opensbi@70000 {
+				reg = <0x70000 0x30000>;
+			};
+			uboot@a00000 {
+				reg = <0xa0000 0x760000>;
+			};
+		};
+	};
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_2_cfg>;
-- 
2.51.0
Re: [PATCH 4/6] riscv: dts: spacemit: enable QSPI and add SPI NOR on Milk-V Jupiter
Posted by Yixun Lan 1 week, 3 days ago
Hi Aurelien,

On 21:28 Sun 22 Mar     , Aurelien Jarno wrote:
> Add the QSPI controller node for the Milk-V Jupiter board and describe
> the attached SPI NOR flash (GD25Q64E).
> 
> The flash supports a frequency up to 133MHz (80 MHz for reads), and the
> SoC supports a frequency up to 104 MHz. However tests have shown that
> the flash is not reliably detected above 26.5 MHz, consistent with
> frequency used in the vendor kernel. Therefore, use this frequency.
> 
..
> The m25p,fast-read properties is taken from the vendor kernel.
> 
So long as this is verified and works fine on board?

> Add a corresponding flash partition layout, matching the layout and the
> names used in the vendor U-Boot.
> 
..
> Also add the bootph-pre-ram property to make the device tree usable by
> early firmware/bootloaders without modification, as U-Boot is stored on
> this NOR flash.
Is the dtb file actually used by U-Boot? I'd highly doubt about this,
if not the case or has not been tested, I'd suggest then not to add
this property..

> 
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> ---
>  .../boot/dts/spacemit/k1-milkv-jupiter.dts    | 44 ++++++++++++++++++-
>  1 file changed, 43 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts b/arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts
> index 836311c3f035c..05ab5df50be51 100644
> --- a/arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts
> +++ b/arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts
> @@ -173,7 +173,7 @@ buck3_1v8: buck3 {
>  				regulator-always-on;
>  			};
>  
> -			buck4 {
> +			buck4_3v3: buck4 {
>  				regulator-min-microvolt = <500000>;
>  				regulator-max-microvolt = <3300000>;
>  				regulator-ramp-delay = <5000>;
> @@ -256,6 +256,48 @@ dldo7 {
>  	};
>  };
>  
> +&qspi {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&qspi_cfg>;
> +	status = "okay";
> +
> +	flash@0 {
> +		compatible = "jedec,spi-nor";
> +		reg = <0>;
> +		spi-max-frequency = <26500000>;
> +		spi-rx-bus-width = <4>;
> +		spi-tx-bus-width = <4>;
> +		vcc-supply = <&buck4_3v3>; /* QSPI_VCC1833 */
> +		m25p,fast-read;
> +		bootph-pre-ram;
> +
> +		partitions {
> +			compatible = "fixed-partitions";
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +
> +			bootinfo@0 {
> +				reg = <0x0 0x10000>;
> +			};
> +			private@10000 {
> +				reg = <0x10000 0x10000>;
> +			};
> +			fsbl@20000 {
> +				reg = <0x20000 0x40000>;
> +			};
> +			env@60000 {
> +				reg = <0x60000 0x10000>;
> +			};
> +			opensbi@70000 {
> +				reg = <0x70000 0x30000>;
> +			};
> +			uboot@a00000 {
> +				reg = <0xa0000 0x760000>;
> +			};
> +		};
> +	};
> +};
> +
>  &uart0 {
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&uart0_2_cfg>;
> -- 
> 2.51.0
> 

-- 
Yixun Lan (dlan)
Re: [PATCH 4/6] riscv: dts: spacemit: enable QSPI and add SPI NOR on Milk-V Jupiter
Posted by Aurelien Jarno 1 week, 3 days ago
Hi Yixun,

On 2026-03-24 17:02, Yixun Lan wrote:
> Hi Aurelien,
> 
> On 21:28 Sun 22 Mar     , Aurelien Jarno wrote:
> > Add the QSPI controller node for the Milk-V Jupiter board and describe
> > the attached SPI NOR flash (GD25Q64E).
> > 
> > The flash supports a frequency up to 133MHz (80 MHz for reads), and the
> > SoC supports a frequency up to 104 MHz. However tests have shown that
> > the flash is not reliably detected above 26.5 MHz, consistent with
> > frequency used in the vendor kernel. Therefore, use this frequency.
> > 
> ..
> > The m25p,fast-read properties is taken from the vendor kernel.
> > 
> So long as this is verified and works fine on board?

Yes, it's works. And the datasheet also mentions fast read being 
supported.

> > Add a corresponding flash partition layout, matching the layout and the
> > names used in the vendor U-Boot.
> > 
> ..
> > Also add the bootph-pre-ram property to make the device tree usable by
> > early firmware/bootloaders without modification, as U-Boot is stored on
> > this NOR flash.
> Is the dtb file actually used by U-Boot? I'd highly doubt about this,
> if not the case or has not been tested, I'd suggest then not to add
> this property..

It is currently not used by U-Boot, currently SPL support is not 
available, but patches have been posted to added it. I just wanted to 
anticipate the addition of the Milk-V Jupiter board in U-boot, but if 
that hurt, i can remove it (or you can removed it when merging).

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net
Re: [PATCH 4/6] riscv: dts: spacemit: enable QSPI and add SPI NOR on Milk-V Jupiter
Posted by Yixun Lan 1 week, 3 days ago
Hi Aurelien, 

On 22:19 Tue 24 Mar     , Aurelien Jarno wrote:
> Hi Yixun,
> 
> On 2026-03-24 17:02, Yixun Lan wrote:
> > Hi Aurelien,
..
> > ..
> > > Also add the bootph-pre-ram property to make the device tree usable by
> > > early firmware/bootloaders without modification, as U-Boot is stored on
> > > this NOR flash.
> > Is the dtb file actually used by U-Boot? I'd highly doubt about this,
> > if not the case or has not been tested, I'd suggest then not to add
> > this property..
> 
> It is currently not used by U-Boot, currently SPL support is not 
> available, but patches have been posted to added it. I just wanted to 
> anticipate the addition of the Milk-V Jupiter board in U-boot, but if 
> that hurt, i can remove it (or you can removed it when merging).
Not hurt since it isn't really used in Kernel, but I just don't
want to add things without test..

I can remove it if there is no other changes, then no iteration needed.
Let's wait a few more days to see if people have additional comments for
this series

-- 
Yixun Lan (dlan)
Re: [PATCH 4/6] riscv: dts: spacemit: enable QSPI and add SPI NOR on Milk-V Jupiter
Posted by Yao Zi 1 week, 3 days ago
On Tue, Mar 24, 2026 at 05:02:20PM +0800, Yixun Lan wrote:
> Hi Aurelien,
> 
> On 21:28 Sun 22 Mar     , Aurelien Jarno wrote:
> > Add the QSPI controller node for the Milk-V Jupiter board and describe
> > the attached SPI NOR flash (GD25Q64E).
> > 
> > The flash supports a frequency up to 133MHz (80 MHz for reads), and the
> > SoC supports a frequency up to 104 MHz. However tests have shown that
> > the flash is not reliably detected above 26.5 MHz, consistent with
> > frequency used in the vendor kernel. Therefore, use this frequency.
> > 
> ..
> > The m25p,fast-read properties is taken from the vendor kernel.
> > 
> So long as this is verified and works fine on board?
> 
> > Add a corresponding flash partition layout, matching the layout and the
> > names used in the vendor U-Boot.
> > 
> ..
> > Also add the bootph-pre-ram property to make the device tree usable by
> > early firmware/bootloaders without modification, as U-Boot is stored on
> > this NOR flash.
> Is the dtb file actually used by U-Boot? I'd highly doubt about this,
> if not the case or has not been tested, I'd suggest then not to add
> this property..

Currently no, but it would be a bogus if we could do it at introduction
of the device, if it's really necessary in pre-DRAM stages of
bootloaders, e.g. U-Boot SPL. This would reduce the duplicated work of
downstream projects if they decide to switch to Linux upstream
devicetree.

As SpacemiT K1 supports booting from flash, the description of flash
nodes are likely useful for pre-DRAM bootloaders.

> > 
> > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Best regards,
Yao Zi
Re: [PATCH 4/6] riscv: dts: spacemit: enable QSPI and add SPI NOR on Milk-V Jupiter
Posted by Yixun Lan 1 week, 3 days ago
Hi Yao,

On 17:07 Tue 24 Mar     , Yao Zi wrote:
> On Tue, Mar 24, 2026 at 05:02:20PM +0800, Yixun Lan wrote:
> > Hi Aurelien,
> > 
> > On 21:28 Sun 22 Mar     , Aurelien Jarno wrote:
> > > Add the QSPI controller node for the Milk-V Jupiter board and describe
> > > the attached SPI NOR flash (GD25Q64E).
> > > 
> > > The flash supports a frequency up to 133MHz (80 MHz for reads), and the
> > > SoC supports a frequency up to 104 MHz. However tests have shown that
> > > the flash is not reliably detected above 26.5 MHz, consistent with
> > > frequency used in the vendor kernel. Therefore, use this frequency.
> > > 
> > ..
> > > The m25p,fast-read properties is taken from the vendor kernel.
> > > 
> > So long as this is verified and works fine on board?
> > 
> > > Add a corresponding flash partition layout, matching the layout and the
> > > names used in the vendor U-Boot.
> > > 
> > ..
> > > Also add the bootph-pre-ram property to make the device tree usable by
> > > early firmware/bootloaders without modification, as U-Boot is stored on
> > > this NOR flash.
> > Is the dtb file actually used by U-Boot? I'd highly doubt about this,
> > if not the case or has not been tested, I'd suggest then not to add
> > this property..
> 
> Currently no, but it would be a bogus if we could do it at introduction
> of the device, if it's really necessary in pre-DRAM stages of
> bootloaders, e.g. U-Boot SPL. This would reduce the duplicated work of
> downstream projects if they decide to switch to Linux upstream
> devicetree.
> 
All above arguments are based on assumption, I object to add things randomly
without real test proved.

Let's wait once U-Boot actually switch to use upstream devicetree.

> As SpacemiT K1 supports booting from flash, the description of flash
> nodes are likely useful for pre-DRAM bootloaders.
> 
This is still a 'likely' ..

> > > 
> > > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> 
> Best regards,
> Yao Zi

-- 
Yixun Lan (dlan)