Skip to contentSkip to conversation

riscv: dts: spacemit: improve Milk-V Jupiter device tree

PATCH Applied Aurelien Jarno 3 participants 10 messages May 19 – May 21

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

v2 cover riscv: dts: spacemit: improve Milk-V Jupiter device tree

This patchset updates the Milk-V Jupiter device tree to align with the changes recently done for other SpacemiT K1 based boards, including enabling SD card support.

Changes in v2:
- Rebase on linux-next, which includes the SD card support series for
the K1 SoC
- Mark the eMMC as non-removable
- Add patch to fix uboot partition offset
- Link to v1: https://lore.kernel.org/linux-riscv/[email protected]/

Aurelien Jarno (5):
riscv: dts: spacemit: set console baud rate on Milk-V Jupiter
riscv: dts: spacemit: sort aliases on Milk-V Jupiter
riscv: dts: spacemit: enable eMMC on Milk-V Jupiter
riscv: dts: spacemit: enable SD card support on Milk-V Jupiter
riscv: dts: spacemit: fix uboot partition offset on Milk-V Jupiter

 .../boot/dts/spacemit/k1-milkv-jupiter.dts    | 38 +++++++++++++++++--
 1 file changed, 34 insertions(+), 4 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

PATCH v2 1/5 riscv: dts: spacemit: set console baud rate on Milk-V Jupiter

Because the default console's baud rate is not set, defconfig kernels do not have any serial output on this platform. Set the baud rate to 115200, matching what is used by U-Boot etc on this platform.

See-also: 24c12ca43b12c ("dts: spacemit: set console baud rate on bpif3")

Fixes 5b90a3d6092d9 ("riscv: dts: spacemit: Add Milk-V Jupiter board device tree")
---
 arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

v2: no changes

arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts +1 -1
index 95c35154da96d..9b1dfddf2bac5 100644
@@ -21,7 +21,7 @@ aliases {
 	};
 
 	chosen {
-		stdout-path = "serial0";
+		stdout-path = "serial0:115200n8";
 	};
 
 	leds {
Signature · 1 line
2.53.0
#2 lore raw

PATCH v2 2/5 riscv: dts: spacemit: sort aliases on Milk-V Jupiter

In reply to Aurelien Jarno

Before adding more aliases, just sort them.

---
 arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

v2: no changes

arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts +1 -1
index 9b1dfddf2bac5..450d28e438293 100644
@@ -15,9 +15,9 @@ / {
 	aliases {
 		ethernet0 = &eth0;
 		ethernet1 = &eth1;
-		serial0 = &uart0;
 		i2c2 = &i2c2;
 		i2c8 = &i2c8;
+		serial0 = &uart0;
 	};
 
 	chosen {
Signature · 1 line
2.53.0
#3 lore raw

PATCH v2 3/5 riscv: dts: spacemit: enable eMMC on Milk-V Jupiter

In reply to Aurelien Jarno

The Milk-V Jupiter board has a connector for an eMMC module. Add an entry for it in the device tree and alias it mmc0.

Mark the device as non-removable as eMMC modules have no CD pin and are not supposed to be inserted or removed while the system is running. On systems without an eMMC module installed, the kernel emits the following informational message during boot:

mmc0: SDHCI controller on d4281000.mmc [d4281000.mmc] using ADMA
mmc0: Failed to initialize a non-removable card

---
 arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)

v2: Mark the eMMC as non-removable

arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts +11 -0
index 450d28e438293..eb53198b95061 100644
@@ -17,6 +17,7 @@ aliases {
 		ethernet1 = &eth1;
 		i2c2 = &i2c2;
 		i2c8 = &i2c8;
+		mmc0 = &emmc;
 		serial0 = &uart0;
 	};
 
@@ -138,6 +139,16 @@ &cpu_7 {
 	cpu-supply = <&buck1_3v45>;
 };
 
+&emmc {
+	bus-width = <8>;
+	mmc-hs400-1_8v;
+	mmc-hs400-enhanced-strobe;
+	non-removable;
+	no-sd;
+	no-sdio;
+	status = "okay";
+};
+
 &eth0 {
 	phy-handle = <&rgmii0>;
 	phy-mode = "rgmii-id";
Signature · 1 line
2.53.0
Tested-by on v2 3/5
#4 lore raw

Re: [PATCH v2 3/5] riscv: dts: spacemit: enable eMMC on Milk-V Jupiter

Hi Aurelien,
Thanks for your work.

Quoted 8 lines · Aurelien Jarno

The Milk-V Jupiter board has a connector for an eMMC module. Add an entry for it in the device tree and alias it mmc0.

Mark the device as non-removable as eMMC modules have no CD pin and are not supposed to be inserted or removed while the system is running. On systems without an eMMC module installed, the kernel emits the following informational message during boot:

Quoted 4 lines

mmc0: SDHCI controller on d4281000.mmc [d4281000.mmc] using ADMA
mmc0: Failed to initialize a non-removable card

Signature · 2 lines
Best regards,
Junhui Liu
#5 lore raw

PATCH v2 4/5 riscv: dts: spacemit: enable SD card support on Milk-V Jupiter

In reply to Aurelien Jarno

Add complete SD card controller support with UHS high-speed modes.

- Enable sdhci0 controller with 4-bit bus width
- Configure card detect GPIO with pull-up
- Connect vmmc-supply to buck4 for 3.3V card power
- Connect vqmmc-supply to aldo1 for 1.8V/3.3V I/O switching
- Add dual pinctrl states for voltage-dependent pin configuration
- Support UHS-I SDR25, SDR50, and SDR104 modes
- Alias it as mmc1

---
 .../boot/dts/spacemit/k1-milkv-jupiter.dts    | 21 ++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

v2: no changes

arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts +20 -1
index eb53198b95061..0c13b7a401c3f 100644
@@ -18,6 +18,7 @@ aliases {
 		i2c2 = &i2c2;
 		i2c8 = &i2c8;
 		mmc0 = &emmc;
+		mmc1 = &sdhci0;
 		serial0 = &uart0;
 	};
 
@@ -283,7 +284,7 @@ buck6 {
 				regulator-always-on;
 			};
 
-			aldo1 {
+			aldo1: aldo1 {
 				regulator-min-microvolt = <500000>;
 				regulator-max-microvolt = <3400000>;
 				regulator-boot-on;
@@ -418,6 +419,24 @@ uboot@a00000 {
 	};
 };
 
+&sdhci0 {
+	pinctrl-names = "default", "uhs";
+	pinctrl-0 = <&mmc1_cfg>;
+	pinctrl-1 = <&mmc1_uhs_cfg>;
+	bus-width = <4>;
+	cd-gpios = <&gpio K1_GPIO(80) (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+	no-mmc;
+	no-sdio;
+	disable-wp;
+	cap-sd-highspeed;
+	vmmc-supply = <&buck4_3v3>;
+	vqmmc-supply = <&aldo1>;
+	sd-uhs-sdr25;
+	sd-uhs-sdr50;
+	sd-uhs-sdr104;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_2_cfg>;
Signature · 1 line
2.53.0
Tested-by on v2 4/5
#6 lore raw

Re: [PATCH v2 4/5] riscv: dts: spacemit: enable SD card support on Milk-V Jupiter

Hi Aurelien,
Thanks for your work.

Quoted 11 lines · Aurelien Jarno

Add complete SD card controller support with UHS high-speed modes.

- Enable sdhci0 controller with 4-bit bus width
- Configure card detect GPIO with pull-up
- Connect vmmc-supply to buck4 for 3.3V card power
- Connect vqmmc-supply to aldo1 for 1.8V/3.3V I/O switching
- Add dual pinctrl states for voltage-dependent pin configuration
- Support UHS-I SDR25, SDR50, and SDR104 modes
- Alias it as mmc1

Both UHS-I and standard high-speed cards are tested successfully.

Signature · 2 lines
Best regards,
Junhui Liu
#7 lore raw

PATCH v2 5/5 riscv: dts: spacemit: fix uboot partition offset on Milk-V Jupiter

In reply to Aurelien Jarno

Correct the uboot partition node name to match its actual offset.

Fixes 2829823956f0 ("riscv: dts: spacemit: enable QSPI and add SPI NOR on Milk-V Jupiter")
---
 arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

v2: new patch

arch/riscv/boot/dts/spacemit/k1-milkv-jupiter.dts +1 -1
index 0c13b7a401c3f..4e5f5dc69d060 100644
@@ -412,7 +412,7 @@ env@60000 {
 			opensbi@70000 {
 				reg = <0x70000 0x30000>;
 			};
-			uboot@a00000 {
+			uboot@a0000 {
 				reg = <0xa0000 0x760000>;
 			};
 		};
Signature · 1 line
2.53.0
maintainer Reviewed-by on the v2 series
#8 lore raw
In reply to Aurelien Jarno

Hi Aurelien,

Quoted 11 lines · Aurelien Jarno

This patchset updates the Milk-V Jupiter device tree to align with the changes recently done for other SpacemiT K1 based boards, including enabling SD card support.

Changes in v2:
- Rebase on linux-next, which includes the SD card support series for
the K1 SoC
- Mark the eMMC as non-removable
- Add patch to fix uboot partition offset
- Link to v1: https://lore.kernel.org/linux-riscv/[email protected]/

Looks good to me, thanks

Quoted 13 lines

Aurelien Jarno (5):
riscv: dts: spacemit: set console baud rate on Milk-V Jupiter
riscv: dts: spacemit: sort aliases on Milk-V Jupiter
riscv: dts: spacemit: enable eMMC on Milk-V Jupiter
riscv: dts: spacemit: enable SD card support on Milk-V Jupiter
riscv: dts: spacemit: fix uboot partition offset on Milk-V Jupiter

 .../boot/dts/spacemit/k1-milkv-jupiter.dts    | 38 +++++++++++++++++--
 1 file changed, 34 insertions(+), 4 deletions(-)
Signature · 1 line
2.53.0
Signature · 1 line
Yixun Lan (dlan)
maintainer Applied
#9 lore raw
In reply to Aurelien Jarno

Hi Aurelien,

Quoted 18 lines · Aurelien Jarno

This patchset updates the Milk-V Jupiter device tree to align with the changes recently done for other SpacemiT K1 based boards, including enabling SD card support.

Changes in v2:
- Rebase on linux-next, which includes the SD card support series for
the K1 SoC
- Mark the eMMC as non-removable
- Add patch to fix uboot partition offset
- Link to v1: https://lore.kernel.org/linux-riscv/[email protected]/

Aurelien Jarno (5):
riscv: dts: spacemit: set console baud rate on Milk-V Jupiter
riscv: dts: spacemit: sort aliases on Milk-V Jupiter
riscv: dts: spacemit: enable eMMC on Milk-V Jupiter
riscv: dts: spacemit: enable SD card support on Milk-V Jupiter
riscv: dts: spacemit: fix uboot partition offset on Milk-V Jupiter

Quoted 6 lines
 .../boot/dts/spacemit/k1-milkv-jupiter.dts    | 38 +++++++++++++++++--
 1 file changed, 34 insertions(+), 4 deletions(-)
Signature · 1 line
2.53.0

Applied all, thanks, please check
https://github.com/spacemit-com/linux/tree/dt-for-next

(P.S this series can't be applied cleanly on top of dt branch, so I resolved it manually which break the "b4 thankyou" command..)

Signature · 1 line
Yixun Lan (dlan)