[PATCH v5 0/3] Add SDHCI support for Canaan K230 SoC
From: Jiayu Du
Date: Thu Mar 19 2026 - 10:08:11 EST
This series is based on the k230 usbphy series[1].
This patch series adds SDHCI support for the Canaan K230 SoC,
which uses Synopsys DWCMSHC SDHCI controllers, include MMC0 and MMC1.
The hardware designs of these two controllers are different.
The MMC0 supports eMMC, while MMC1 only supports SDIO. Detailed
information can be found in the vendor's manual[2].
>From the vendor's K230 manual:
- MMC0 supports eMMC5.0 and SDIO3.0, usually for eMMC chips.
- MMC1 only does SDIO3.0 in 4/1-bit mode up to SDR104, and the manual
clearly says it can't handle eMMC because of pin count and limits.
Therefore, there are two separate compatibles and the driver treats them
differently.
Link: https://lore.kernel.org/all/20260121145526.14672-1-jiayu.riscv@xxxxxxxxxxxxxxxx/ [1]
Link: https://github.com/kendryte/k230_docs/blob/main/en/00_hardware/K230_Hardware_Design_Guide.md#mmc-circuit [2]
Changes in v5:
- Drop the unnecessary line wrapping.
- Drop k230_priv->k230_pdata.
- Make a macro to uses container_of for pointer type conversion.
- Add the tested-by tag.
- Link to v4: https://lore.kernel.org/all/20260315054426.18383-1-jiayu.riscv@xxxxxxxxxxxxxxxx/
Changes in v4:
- Drop the unnecessary line wrapping.
- Drop the extra match_data pointer that was added in v3.
- Add struct k230_pltfm_data which embeds struct dwcmshc_pltfm_data.
- Use container_of() to get k230_pltfm_data.
- Link to v3: https://lore.kernel.org/all/20260310064513.140093-1-jiayu.riscv@xxxxxxxxxxxxxxxx/
Changes in v3:
- Drop the clock maxItems.
- Add a const void *match_data to the struct dwcmshc_priv
- Copy the match_data pointer to dwcmshc_priv in the common dwcmshc_probe
- Link to v2: https://lore.kernel.org/all/20260226115923.75670-1-jiayu.riscv@xxxxxxxxxxxxxxxx/
Changes in v2:
- Change the clock minItems to 5.
- Add comments to explain the reason for setting SDHCI_PROG_CLOCK_MODE.
- Write the power selection logic in the phy init cleaner.
- Replace manual delay loop with read_poll_timeout.
- Drop unnecessarily braces where a single statement will do.
- Add the match_data pointer to dwcmshc_pltfm_data.
- Add dwcmshc_k230_match_data struct to separate eMMC/SDIO config data
- Split K230 into individual emmc/sdio platform data instances instead of
sharing one.
- Remove redundant have_phy member in k230_priv.
- Replace of_find_compatible_node with of_parse_phandle to get USB PHY
from DT phandle.
- Link to v1: https://lore.kernel.org/all/20260204082908.27501-1-jiayu.riscv@xxxxxxxxxxxxxxxx/
Jiayu Du (3):
dt-bindings: mmc: Add sdhci support for Canaan k230
mmc: sdhci-dwcmshc: Add Canaan K230 DWCMSHC controller support
riscv: dts: canaan: Add mmc nodes for K230
.../bindings/mmc/snps,dwcmshc-sdhci.yaml | 28 ++
.../boot/dts/canaan/k230-canmv-dshanpi.dts | 57 ++++
.../dts/canaan/k230-canmv-module-dshanpi.dtsi | 7 +
arch/riscv/boot/dts/canaan/k230.dtsi | 28 ++
drivers/mmc/host/sdhci-of-dwcmshc.c | 260 ++++++++++++++++++
5 files changed, 380 insertions(+)
--
2.53.0