[PATCH v3 0/3] Add SDHCI support for Canaan K230 SoC

Junhui Liu junhui.liu at pigmoral.tech
Wed Mar 11 01:29:48 PDT 2026


Hi Jiayu,
Thanks for your work.

On Tue Mar 10, 2026 at 2:45 PM CST, Jiayu Du wrote:
> 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@isrc.iscas.ac.cn/ [1]
> Link: https://github.com/kendryte/k230_docs/blob/main/en/00_hardware/K230_Hardware_Design_Guide.md#mmc-circuit [2]
>
> 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@isrc.iscas.ac.cn/
>
> 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@isrc.iscas.ac.cn/
>
> 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    |  56 ++++
>  .../dts/canaan/k230-canmv-module-dshanpi.dtsi |   7 +
>  arch/riscv/boot/dts/canaan/k230.dtsi          |  28 ++
>  drivers/mmc/host/sdhci-of-dwcmshc.c           | 287 ++++++++++++++++++
>  5 files changed, 406 insertions(+)

Tested-by: Junhui Liu <junhui.liu at pigmoral.tech>

Tested ok on CanMV-K230-V1.1 (k230-canmv.dts) with AP6212 (BCM43430)
SDIO WiFi module on MMC0 and MicroSD card on MMC1.

To be noted, a "broken-cd" property is needed to support SD card insert
and remove detect on CanMV board because the CD pin is not connected. I
am not sure if this is also needed on DShanPi as I don't have its
schematic.

-- 
Best regards,
Junhui Liu




More information about the linux-riscv mailing list