Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Opdenacker <michael.opdenacker@rootcommit.com>
To: Yixun Lan <dlan@gentoo.org>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
	 Binbin Zhou <zhoubinbin@loongson.cn>,
	linux-riscv@lists.infradead.org,  spacemit@lists.linux.dev,
	 Michael Opdenacker <michael.opdenacker@rootcommit.com>
Subject: [PATCH 2/2] riscv: dts: spacemit: Add MMC support on BPI-F3 and OrangePi RV2
Date: Mon, 15 Dec 2025 10:10:14 +0000 (UTC)	[thread overview]
Message-ID: <20251215-k1-boards-add-mmc-v1-2-d68dc87d4aab@rootcommit.com> (raw)
In-Reply-To: <20251215-k1-boards-add-mmc-v1-0-d68dc87d4aab@rootcommit.com>

This introduces a new sdhci0 node and enables it
for the BananaPI F3 and OrangePi RV2 boards.

Note that card detect is marked as broken in the driver
(SDHCI_QUIRK_BROKEN_CARD_DETECTION quirk), therefore removing the card
while the system is running won't have any effect.

Signed-off-by: Michael Opdenacker <michael.opdenacker@rootcommit.com>
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts  | 12 ++++++++++++
 arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts | 10 ++++++++++
 arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi     | 13 +++++++++++++
 arch/riscv/boot/dts/spacemit/k1.dtsi             | 10 ++++++++++
 4 files changed, 45 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
index 02f218a16318..1ff758115496 100644
--- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
@@ -16,6 +16,8 @@ aliases {
 		serial0 = &uart0;
 		i2c2 = &i2c2;
 		i2c8 = &i2c8;
+		mmc0 = &emmc;
+		mmc1 = &sdhci0;
 	};
 
 	chosen {
@@ -264,6 +266,16 @@ dldo7 {
 	};
 };
 
+&sdhci0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc1_cfg>;
+	bus-width = <4>;
+	cd-gpios = <&gpio K1_GPIO(80) GPIO_ACTIVE_HIGH>;
+	cd-inverted;
+	no-sdio;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_2_cfg>;
diff --git a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
index b9b760d7c398..7204f419c856 100644
--- a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
@@ -247,6 +247,16 @@ dldo7 {
 	};
 };
 
+&sdhci0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc1_cfg>;
+	bus-width = <4>;
+	cd-gpios = <&gpio K1_GPIO(80) GPIO_ACTIVE_HIGH>;
+	cd-inverted;
+	no-sdio;
+	status = "okay";
+};
+
 &pdma {
 	status = "okay";
 };
diff --git a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
index e922e05ff856..87e84a880fbc 100644
--- a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
@@ -537,4 +537,17 @@ pwm14-1-pins {
 			drive-strength = <32>;
 		};
 	};
+
+	mmc1_cfg: mmc1-cfg {
+		mmc1-pins {
+			pinmux = <K1_PADCONF(92, 0)>,   /* mmc1_d3 */
+				 <K1_PADCONF(91, 0)>,   /* mmc1_d2 */
+				 <K1_PADCONF(90, 0)>,   /* mmc1_d1 */
+				 <K1_PADCONF(89, 0)>,   /* mmc1_d0 */
+				 <K1_PADCONF(113, 0)>,  /* mmc1_cmd */
+				 <K1_PADCONF(114, 0)>;  /* mmc1_clk */
+			bias-pull-up = <1>;
+			drive-strength = <21>;
+		};
+	};
 };
diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi
index 7818ca4979b6..a5b7d7c8c066 100644
--- a/arch/riscv/boot/dts/spacemit/k1.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
@@ -987,6 +987,16 @@ emmc: mmc@d4281000 {
 				interrupts = <101>;
 				status = "disabled";
 			};
+
+			sdhci0: mmc@d4280000 {
+				compatible = "spacemit,k1-sdhci";
+				reg = <0x0 0xd4280000 0x0 0x200>;
+				clocks = <&syscon_apmu CLK_SDH_AXI>,
+					 <&syscon_apmu CLK_SDH0>;
+				clock-names = "core", "io";
+				interrupts = <99>;
+				status = "disabled";
+			};
 		};
 	};
 };

-- 
2.43.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2025-12-15 10:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 10:10 [PATCH 0/2] Attempt to enable MMC on SpacemiT K1 boards Michael Opdenacker
2025-12-15 10:10 ` [PATCH 1/2] riscv: dts: spacemit: Add i2c buses on OrangePi RV2 Michael Opdenacker
2025-12-15 12:58   ` Yao Zi
2025-12-15 15:00     ` Michael Opdenacker
2025-12-16  5:37       ` Yao Zi
2025-12-16 21:05         ` Michael Opdenacker
2025-12-17 15:26           ` Iker Pedrosa
2025-12-17 16:27             ` Michael Opdenacker
2025-12-17 22:10               ` Johannes Erdfelt
2025-12-18  5:19                 ` Michael Opdenacker
2025-12-18  5:25                   ` Michael Opdenacker
2025-12-18  9:49                     ` Iker Pedrosa
2025-12-19 11:29                       ` Yixun Lan
2025-12-20  2:22                         ` Yao Zi
2025-12-17 20:25             ` Javier Martinez Canillas
2025-12-16  8:58   ` Javier Martinez Canillas
2025-12-24 14:00   ` Chukun Pan
2025-12-15 10:10 ` Michael Opdenacker [this message]
2025-12-15 12:46   ` [PATCH 2/2] riscv: dts: spacemit: Add MMC support on BPI-F3 and " Yao Zi
2025-12-15 13:58     ` Michael Opdenacker
2025-12-24 15:00   ` Chukun Pan
2025-12-29 10:14     ` Javier Martinez Canillas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251215-k1-boards-add-mmc-v1-2-d68dc87d4aab@rootcommit.com \
    --to=michael.opdenacker@rootcommit.com \
    --cc=dan.carpenter@linaro.org \
    --cc=dlan@gentoo.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=spacemit@lists.linux.dev \
    --cc=zhoubinbin@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox