Skip to contentSkip to conversation

mmc: sophgo: milkv_duo: Add SD card support for Milk-V Duo board

PATCH Superseded Kongyang Liu 1 participant 5 messages Feb 2, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover mmc: sophgo: milkv_duo: Add SD card support for Milk-V Duo board

This series add sdhci driver for cv1800b SoC and enable SD card support for Sophgo Milk-V Duo board.

Kongyang Liu (4):
mmc: cv1800b: Add sdhci driver support for cv1800b SoC
riscv: dts: sophgo: Add clk node
riscv: dts: sophgo: Add sdhci node
configs: milkv_duo: Add SD card configs

 arch/riscv/dts/cv1800b.dtsi |  27 ++++
 arch/riscv/dts/cv18xx.dtsi  |   6 +
 configs/milkv_duo_defconfig |  16 ++-
 drivers/mmc/Kconfig         |  13 ++
 drivers/mmc/Makefile        |   1 +
 drivers/mmc/cv1800b_sdhci.c | 243 ++++++++++++++++++++++++++++++++++++
 6 files changed, 303 insertions(+), 3 deletions(-)
 create mode 100644 drivers/mmc/cv1800b_sdhci.c
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/4 mmc: cv1800b: Add sdhci driver support for cv1800b SoC

Add sdhci driver for cv1800b SoC.

---

 drivers/mmc/Kconfig         |  13 ++
 drivers/mmc/Makefile        |   1 +
 drivers/mmc/cv1800b_sdhci.c | 243 ++++++++++++++++++++++++++++++++++++
 3 files changed, 257 insertions(+)
 create mode 100644 drivers/mmc/cv1800b_sdhci.c
drivers/mmc/Kconfig +13 -0
index 17618c3bdc..6d5b997fa5 100644
@@ -568,6 +568,19 @@ config MMC_SDHCI_CADENCE
 
 	  If unsure, say N.
 
+config MMC_SDHCI_CV1800B
+	bool "SDHCI support for the CV1800B SD/SDIO/eMMC controller"
+	depends on BLK && DM_MMC
+	depends on MMC_SDHCI
+	depends on OF_CONTROL
+	help
+	  This selects the CV1800B SD/SDIO/eMMC driver.
+
+	  If you have a controller with this interface,
+	  say Y here.
+
+	  If unsure, say N.
+
 config MMC_SDHCI_AM654
 	bool "SDHCI Controller on TI's Am654 devices"
 	depends on ARCH_K3
drivers/mmc/Makefile +1 -0
index e9cf1fcc64..3374321e29 100644
@@ -60,6 +60,7 @@ obj-$(CONFIG_MMC_SDHCI_ATMEL)		+= atmel_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_BCM2835)		+= bcm2835_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_BCMSTB)		+= bcmstb_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_CADENCE)		+= sdhci-cadence.o
+obj-$(CONFIG_MMC_SDHCI_CV1800B)		+= cv1800b_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_AM654)		+= am654_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_IPROC)		+= iproc_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_KONA)		+= kona_sdhci.o
drivers/mmc/cv1800b_sdhci.c new file +243 -0

243 lines not on this page · raw message

Signature · 1 line
2.41.0
#2 lore raw

PATCH 2/4 riscv: dts: sophgo: Add clk node

In reply to Kongyang Liu

Add clk node for cv18xx SoCs according to patch from Linux kernel.

---

 arch/riscv/dts/cv1800b.dtsi | 4 ++++
 arch/riscv/dts/cv18xx.dtsi  | 6 ++++++
 2 files changed, 10 insertions(+)
arch/riscv/dts/cv1800b.dtsi +4 -0
index 165e9e320a..baf641829e 100644
@@ -16,3 +16,7 @@
 &clint {
 	compatible = "sophgo,cv1800b-clint", "thead,c900-clint";
 };
+
+&clk {
+	compatible = "sophgo,cv1800-clk";
+};
arch/riscv/dts/cv18xx.dtsi +6 -0
index 2d6f4a4b1e..6ea1b2784d 100644
@@ -53,6 +53,12 @@
 		dma-noncoherent;
 		ranges;
 
+		clk: clock-controller@3002000 {
+			reg = <0x03002000 0x1000>;
+			clocks = <&osc>;
+			#clock-cells = <1>;
+		};
+
 		gpio0: gpio@3020000 {
 			compatible = "snps,dw-apb-gpio";
 			reg = <0x3020000 0x1000>;
Signature · 1 line
2.41.0
#3 lore raw

PATCH 3/4 riscv: dts: sophgo: Add sdhci node

In reply to Kongyang Liu

Add sdhci node for cv1800b SoC.

---

 arch/riscv/dts/cv1800b.dtsi | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/riscv/dts/cv1800b.dtsi +23 -0
index baf641829e..11b84b5e79 100644
@@ -7,6 +7,29 @@
 
 / {
 	compatible = "sophgo,cv1800b";
+
+	sd: sdhci@4310000 {
+		compatible = "sophgo,cv1800b-sdhci";
+		reg = <0x4310000 0x1000>;
+		reg-names = "core_mem";
+		bus-width = <4>;
+		cap-sd-highspeed;
+		cap-mmc-highspeed;
+		sd-uhs-sdr12;
+		sd-uhs-sdr25;
+		sd-uhs-sdr50;
+		sd-uhs-sdr104;
+		no-sdio;
+		no-mmc;
+		no-1-8-v;
+		src-frequency = <375000000>;
+		min-frequency = <400000>;
+		max-frequency = <200000000>;
+		reset_tx_rx_phy;
+		reset-names = "sdhci";
+		pll_index = <0x6>;
+		pll_reg = <0x3002070>;
+	};
 };
 
 &plic {
Signature · 1 line
2.41.0
#4 lore raw

PATCH 4/4 configs: milkv_duo: Add SD card configs

In reply to Kongyang Liu

Add configs related to sdhci and mmc for Sophgo Milk-V Duo board

---

 configs/milkv_duo_defconfig | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
configs/milkv_duo_defconfig +13 -3
index 9eca6abfbc..60eff78ae3 100644
@@ -11,13 +11,23 @@ CONFIG_TARGET_MILKV_DUO=y
 CONFIG_ARCH_RV64I=y
 CONFIG_RISCV_SMODE=y
 CONFIG_FIT=y
+CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SUPPORT_RAW_INITRD=y
+CONFIG_SYS_CBSIZE=512
+CONFIG_SYS_PBSIZE=544
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="milkv_duo# "
 CONFIG_SYS_MAXARGS=64
-CONFIG_SYS_CBSIZE=512
-CONFIG_SYS_PBSIZE=544
-CONFIG_SYS_BOOTM_LEN=0x4000000
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
 CONFIG_ENV_OVERWRITE=y
+CONFIG_MMC=y
+CONFIG_MMC_IO_VOLTAGE=y
+CONFIG_MMC_UHS_SUPPORT=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ADMA=y
+CONFIG_MMC_SDHCI_CV1800B=y
 CONFIG_SYS_NS16550=y
 CONFIG_SYS_NS16550_MEM32=y
Signature · 1 line
2.41.0