Skip to content

Commit b8f7fc3

Browse files
xakep-amatopnashif
authored andcommitted
drivers: sdhc: add support of Renesas MMC driver
Add basic functionality of Renesas SD/MMC driver. It can be used for both gen3 and gen4 R-car boards, but tested only with H3ULCB, Salvator XS M3 and Spider boards. This driver working with SDHC subsystem. The driver supports regularal reading/writing throught SD/MMC controller buffer, DMA mode w/o interrupts and timing tuning. Add gpio5 and sd0 nodes to h3ulcb and salvator xs which are needed for working with SD cards. The GPIO node is needed for switching voltage on SD card through gpio regulator driver. Notes: * the driver doesn't support SPI mode; * SCC tuning and DMA mode based on IRQs are enabled by default; * an address of a data buffer has to be aligned to 128 bytes if it is not, driver will use non-DMA mode automatically; * Renesas MMC DMAC doesn't support 64-bit DMA addresses, so for case when we have 64-bit xref data address we use non-DMA mode; * SD/MMC controller supports block size between 512 and 1 with a lot of restrictions, more details you can find in code; * support of HS400 mode isn't implemented inside driver. Signed-off-by: Mykola Kvach <[email protected]>
1 parent 11eed84 commit b8f7fc3

File tree

7 files changed

+2596
-2
lines changed

7 files changed

+2596
-2
lines changed

drivers/sdhc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ zephyr_library()
66
zephyr_library_sources_ifdef(CONFIG_IMX_USDHC imx_usdhc.c)
77
zephyr_library_sources_ifdef(CONFIG_SPI_SDHC sdhc_spi.c)
88
zephyr_library_sources_ifdef(CONFIG_MCUX_SDIF mcux_sdif.c)
9+
zephyr_library_sources_ifdef(CONFIG_RCAR_MMC rcar_mmc.c)
910
zephyr_library_sources_ifdef(CONFIG_SAM_HSMCI sam_hsmci.c)
1011
zephyr_library_sources_ifdef(CONFIG_INTEL_EMMC_HOST intel_emmc_host.c)
1112
zephyr_library_sources_ifdef(CONFIG_SDHC_INFINEON_CAT1 ifx_cat1_sdio.c)

drivers/sdhc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ source "drivers/sdhc/Kconfig.ifx_cat1"
1212
source "drivers/sdhc/Kconfig.imx"
1313
source "drivers/sdhc/Kconfig.spi"
1414
source "drivers/sdhc/Kconfig.mcux_sdif"
15+
source "drivers/sdhc/Kconfig.rcar"
1516
source "drivers/sdhc/Kconfig.sam_hsmci"
1617
source "drivers/sdhc/Kconfig.intel"
1718
source "drivers/sdhc/Kconfig.sdhc_cdns"

drivers/sdhc/Kconfig.rcar

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (c) 2023 EPAM Systems
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config RCAR_MMC
5+
bool "Renesas Rcar MMC driver"
6+
default y
7+
depends on DT_HAS_RENESAS_RCAR_MMC_ENABLED
8+
select SDHC_SUPPORTS_NATIVE_MODE
9+
select REGULATOR
10+
select GPIO
11+
select SDHC_SUPPORTS_UHS if SDMMC_STACK
12+
help
13+
Renesas Rcar MMC driver.
14+
15+
if RCAR_MMC
16+
17+
config RCAR_MMC_DMA_SUPPORT
18+
bool "Internal DMA support for Renesas Rcar MMC driver"
19+
select CACHE_MANAGEMENT
20+
select DCACHE
21+
default y
22+
help
23+
Internal DMA support for Renesas Rcar MMC driver.
24+
25+
config RCAR_MMC_SCC_SUPPORT
26+
bool "Support of SCC"
27+
default y
28+
help
29+
Enable support of Sampling Clock Controller for Renesas Rcar MMC driver.
30+
31+
if RCAR_MMC_DMA_SUPPORT
32+
33+
config SDHC_BUFFER_ALIGNMENT
34+
default 128
35+
36+
config RCAR_MMC_DMA_IRQ_DRIVEN_SUPPORT
37+
bool "Internal DMA IRQ driven support for Renesas Rcar MMC driver"
38+
default y
39+
40+
endif # RCAR_MMC_DMA_SUPPORT
41+
42+
endif # RCAR_MMC

0 commit comments

Comments
 (0)