[PATCH v4 3/3] riscv: dts: canaan: Add mmc nodes for K230

Jiayu Du posted 3 patches 3 weeks, 2 days ago
There is a newer version of this series
[PATCH v4 3/3] riscv: dts: canaan: Add mmc nodes for K230
Posted by Jiayu Du 3 weeks, 2 days ago
Add MMC nodes to K230, including eMMC and SDIO. Enable HS200 eMMC
on the SoM and SDIO high-speed on the board.

Signed-off-by: Jiayu Du <jiayu.riscv@isrc.iscas.ac.cn>
---
 .../boot/dts/canaan/k230-canmv-dshanpi.dts    | 56 +++++++++++++++++++
 .../dts/canaan/k230-canmv-module-dshanpi.dtsi |  7 +++
 arch/riscv/boot/dts/canaan/k230.dtsi          | 28 ++++++++++
 3 files changed, 91 insertions(+)

diff --git a/arch/riscv/boot/dts/canaan/k230-canmv-dshanpi.dts b/arch/riscv/boot/dts/canaan/k230-canmv-dshanpi.dts
index 55197cfc25b4..1877b2049409 100644
--- a/arch/riscv/boot/dts/canaan/k230-canmv-dshanpi.dts
+++ b/arch/riscv/boot/dts/canaan/k230-canmv-dshanpi.dts
@@ -15,6 +15,8 @@ / {
 
 	aliases {
 		serial0 = &uart0;
+		mmc0 = &emmc;
+		mmc1 = &sdio;
 	};
 
 	chosen {
@@ -73,6 +75,60 @@ uart0-rxd-cfg {
 			input-schmitt-enable;
 		};
 	};
+
+	mmc1_pins: mmc1-pins {
+		mmc1-cmd-cfg {
+			pinmux = <K230_PINMUX(54, 2)>;
+			slew-rate = <0>;
+			drive-strength = <7>;
+			power-source = <K230_MSC_3V3>;
+			input-enable;
+			output-enable;
+			bias-pull-up;
+			input-schmitt-enable;
+		};
+
+		mmc1-clk-cfg {
+			pinmux = <K230_PINMUX(55, 2)>;
+			slew-rate = <0>;
+			drive-strength = <7>;
+			power-source = <K230_MSC_3V3>;
+			output-enable;
+			bias-disable;
+			input-schmitt-enable;
+		};
+
+		mmc1-data-cfg {
+			pinmux = <K230_PINMUX(56, 2)>, /* mmc1 data0 */
+				 <K230_PINMUX(57, 2)>, /* mmc1 data1 */
+				 <K230_PINMUX(58, 2)>, /* mmc1 data2 */
+				 <K230_PINMUX(59, 2)>; /* mmc1 data3 */
+			slew-rate = <0>;
+			drive-strength = <7>;
+			power-source = <K230_MSC_3V3>;
+			input-enable;
+			output-enable;
+			bias-pull-up;
+			input-schmitt-enable;
+		};
+	};
+};
+
+&emmc {
+	vmmc-supply = <&vdd_3v3>;
+	vqmmc-supply = <&vdd_1v8>;
+};
+
+&sdio {
+	bus-width = <4>;
+	max-frequency = <50000000>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc1_pins>;
+	vmmc-supply = <&vdd_3v3>;
+	vqmmc-supply = <&vdd_3v3>;
+	cap-sd-highspeed;
+	no-1-8-v;
+	status = "okay";
 };
 
 &uart0 {
diff --git a/arch/riscv/boot/dts/canaan/k230-canmv-module-dshanpi.dtsi b/arch/riscv/boot/dts/canaan/k230-canmv-module-dshanpi.dtsi
index 566665d39239..1db7569253fe 100644
--- a/arch/riscv/boot/dts/canaan/k230-canmv-module-dshanpi.dtsi
+++ b/arch/riscv/boot/dts/canaan/k230-canmv-module-dshanpi.dtsi
@@ -24,3 +24,10 @@ &sysclk {
 	clocks = <&osc24m>, <&timerx_pulse_in>;
 	clock-names = "osc24m", "timer-pulse-in";
 };
+
+&emmc {
+	bus-width = <8>;
+	max-frequency = <200000000>;
+	mmc-hs200-1_8v;
+	status = "okay";
+};
diff --git a/arch/riscv/boot/dts/canaan/k230.dtsi b/arch/riscv/boot/dts/canaan/k230.dtsi
index e1ec3e1f40a7..e3c6926dbadc 100644
--- a/arch/riscv/boot/dts/canaan/k230.dtsi
+++ b/arch/riscv/boot/dts/canaan/k230.dtsi
@@ -192,6 +192,34 @@ usb1: usb@91540000 {
 			status = "disabled";
 		};
 
+		emmc: mmc@91580000 {
+			compatible = "canaan,k230-emmc";
+			reg = <0x0 0x91580000 0x0 0x1000>;
+			clocks = <&sysclk K230_HS_SD0_CARD_GATE>,
+				 <&sysclk K230_HS_SD0_AHB_GATE>,
+				 <&sysclk K230_HS_SD0_AXI_GATE>,
+				 <&sysclk K230_HS_SD0_BASE_GATE>,
+				 <&sysclk K230_HS_SD0_TIMER_GATE>;
+			clock-names = "core", "bus", "axi", "block", "timer";
+			interrupts = <142 IRQ_TYPE_LEVEL_HIGH>;
+			canaan,usb-phy = <&usbphy>;
+			status = "disabled";
+		};
+
+		sdio: mmc@91581000 {
+			compatible = "canaan,k230-sdio";
+			reg = <0x0 0x91581000 0x0 0x1000>;
+			clocks = <&sysclk K230_HS_SD1_CARD_GATE>,
+				 <&sysclk K230_HS_SD1_AHB_GATE>,
+				 <&sysclk K230_HS_SD1_AXI_GATE>,
+				 <&sysclk K230_HS_SD1_BASE_GATE>,
+				 <&sysclk K230_HS_SD1_TIMER_GATE>;
+			clock-names = "core", "bus", "axi", "block", "timer";
+			interrupts = <144 IRQ_TYPE_LEVEL_HIGH>;
+			canaan,usb-phy = <&usbphy>;
+			status = "disabled";
+		};
+
 		usbphy: usb-phy@91585000 {
 			compatible = "canaan,k230-usb-phy";
 			reg = <0x0 0x91585000 0x0 0x400>;
-- 
2.53.0
Re: [PATCH v4 3/3] riscv: dts: canaan: Add mmc nodes for K230
Posted by Junhui Liu 3 weeks ago
Hi Jiayu,
Thanks for the new version. Just a friendly reminder.

On Sun Mar 15, 2026 at 1:44 PM CST, Jiayu Du wrote:
> Add MMC nodes to K230, including eMMC and SDIO. Enable HS200 eMMC
> on the SoM and SDIO high-speed on the board.
>
> Signed-off-by: Jiayu Du <jiayu.riscv@isrc.iscas.ac.cn>
> ---
>  .../boot/dts/canaan/k230-canmv-dshanpi.dts    | 56 +++++++++++++++++++
>  .../dts/canaan/k230-canmv-module-dshanpi.dtsi |  7 +++
>  arch/riscv/boot/dts/canaan/k230.dtsi          | 28 ++++++++++
>  3 files changed, 91 insertions(+)

[...]

> +
> +&sdio {
> +	bus-width = <4>;
> +	max-frequency = <50000000>;
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&mmc1_pins>;
> +	vmmc-supply = <&vdd_3v3>;
> +	vqmmc-supply = <&vdd_3v3>;
> +	cap-sd-highspeed;
> +	no-1-8-v;
> +	status = "okay";
>  };
>  

It seems the broken-cd property we discussed in the previous version is
not added, and also my Tested-by tag (for the whole series). Was this
intentional or just an oversight?

-- 
Best regards,
Junhui Liu
Re: [PATCH v4 3/3] riscv: dts: canaan: Add mmc nodes for K230
Posted by Jiayu Du 3 weeks ago
On Mon, Mar 16, 2026 at 10:15:27PM +0800, Junhui Liu wrote:
> Hi Jiayu,
> Thanks for the new version. Just a friendly reminder.
> 
> On Sun Mar 15, 2026 at 1:44 PM CST, Jiayu Du wrote:
> > Add MMC nodes to K230, including eMMC and SDIO. Enable HS200 eMMC
> > on the SoM and SDIO high-speed on the board.
> >
> > Signed-off-by: Jiayu Du <jiayu.riscv@isrc.iscas.ac.cn>
> > ---
> >  .../boot/dts/canaan/k230-canmv-dshanpi.dts    | 56 +++++++++++++++++++
> >  .../dts/canaan/k230-canmv-module-dshanpi.dtsi |  7 +++
> >  arch/riscv/boot/dts/canaan/k230.dtsi          | 28 ++++++++++
> >  3 files changed, 91 insertions(+)
> 
> [...]
> 
> > +
> > +&sdio {
> > +	bus-width = <4>;
> > +	max-frequency = <50000000>;
> > +	pinctrl-names = "default";
> > +	pinctrl-0 = <&mmc1_pins>;
> > +	vmmc-supply = <&vdd_3v3>;
> > +	vqmmc-supply = <&vdd_3v3>;
> > +	cap-sd-highspeed;
> > +	no-1-8-v;
> > +	status = "okay";
> >  };
> >  
> 
> It seems the broken-cd property we discussed in the previous version is
> not added, and also my Tested-by tag (for the whole series). Was this
> intentional or just an oversight?
> 

Sorry for that, It was a oversight. I will fix both.

And I will only add your Tested-by tags to patch [2/3] and [3/3].
Is this correct?

Kind regards,
Jiayu Du

> -- 
> Best regards,
> Junhui Liu
>
Re: [PATCH v4 3/3] riscv: dts: canaan: Add mmc nodes for K230
Posted by Junhui Liu 3 weeks ago
On Tue Mar 17, 2026 at 12:03 AM CST, Jiayu Du wrote:
> On Mon, Mar 16, 2026 at 10:15:27PM +0800, Junhui Liu wrote:
>> Hi Jiayu,
>> Thanks for the new version. Just a friendly reminder.
>> 
>> On Sun Mar 15, 2026 at 1:44 PM CST, Jiayu Du wrote:
>> > Add MMC nodes to K230, including eMMC and SDIO. Enable HS200 eMMC
>> > on the SoM and SDIO high-speed on the board.
>> >
>> > Signed-off-by: Jiayu Du <jiayu.riscv@isrc.iscas.ac.cn>
>> > ---
>> >  .../boot/dts/canaan/k230-canmv-dshanpi.dts    | 56 +++++++++++++++++++
>> >  .../dts/canaan/k230-canmv-module-dshanpi.dtsi |  7 +++
>> >  arch/riscv/boot/dts/canaan/k230.dtsi          | 28 ++++++++++
>> >  3 files changed, 91 insertions(+)
>> 
>> [...]
>> 
>> > +
>> > +&sdio {
>> > +	bus-width = <4>;
>> > +	max-frequency = <50000000>;
>> > +	pinctrl-names = "default";
>> > +	pinctrl-0 = <&mmc1_pins>;
>> > +	vmmc-supply = <&vdd_3v3>;
>> > +	vqmmc-supply = <&vdd_3v3>;
>> > +	cap-sd-highspeed;
>> > +	no-1-8-v;
>> > +	status = "okay";
>> >  };
>> >  
>> 
>> It seems the broken-cd property we discussed in the previous version is
>> not added, and also my Tested-by tag (for the whole series). Was this
>> intentional or just an oversight?
>> 
>
> Sorry for that, It was a oversight. I will fix both.
>
> And I will only add your Tested-by tags to patch [2/3] and [3/3].
> Is this correct?

That's fine, Thanks.

-- 
Best regards,
Junhui Liu