Skip to content

Commit 0477386

Browse files
danieldegrassecarlescufi
authored andcommitted
drivers: sdhc: add SD host controller driver for LPC SDIF
add SD host controller driver for LPC SDIF IP block, using NXP SDIF HAL driver. Signed-off-by: Daniel DeGrasse <[email protected]>
1 parent 0365496 commit 0477386

File tree

6 files changed

+512
-0
lines changed

6 files changed

+512
-0
lines changed

drivers/clock_control/clock_control_mcux_syscon.c

+8
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ static int mcux_lpc_syscon_clock_control_get_subsys_rate(
113113
break;
114114
#endif
115115

116+
#if (defined(FSL_FEATURE_SOC_SDIF_COUNT) && \
117+
(FSL_FEATURE_SOC_SDIF_COUNT)) && \
118+
CONFIG_MCUX_SDIF
119+
case MCUX_SDIF_CLK:
120+
*rate = CLOCK_GetSdioClkFreq();
121+
break;
122+
#endif
123+
116124
#if defined(CONFIG_CAN_MCUX_MCAN)
117125
case MCUX_MCAN_CLK:
118126
*rate = CLOCK_GetMCanClkFreq();

drivers/sdhc/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ if (CONFIG_SDHC)
55
zephyr_library()
66
zephyr_library_sources_ifdef(CONFIG_IMX_USDHC imx_usdhc.c)
77
zephyr_library_sources_ifdef(CONFIG_SPI_SDHC sdhc_spi.c)
8+
zephyr_library_sources_ifdef(CONFIG_MCUX_SDIF mcux_sdif.c)
89
endif()

drivers/sdhc/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ if SDHC
1010

1111
source "drivers/sdhc/Kconfig.imx"
1212
source "drivers/sdhc/Kconfig.spi"
13+
source "drivers/sdhc/Kconfig.mcux_sdif"
1314

1415
config SDHC_INIT_PRIORITY
1516
int "SDHC driver init priority"

drivers/sdhc/Kconfig.mcux_sdif

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright 2022, NXP
2+
# SPDX -License-Identifier: Apache-2.0
3+
4+
config MCUX_SDIF
5+
bool "NXP MCUX SDIF Driver"
6+
default y
7+
depends on DT_HAS_NXP_LPC_SDIF_ENABLED
8+
select SDHC_SUPPORTS_NATIVE_MODE
9+
help
10+
Enable the NXP SDIF Host controller driver
11+
12+
if MCUX_SDIF
13+
14+
config MCUX_SDIF_DMA_SUPPORT
15+
bool "DMA support for MCUX SDIF driver"
16+
default y
17+
help
18+
Enable DMA support for MCUX SDIF driver. May be disabled to reduce
19+
footprint of driver.
20+
21+
if MCUX_SDIF_DMA_SUPPORT
22+
23+
# SDIF DMA needs 32 bit aligned buffers
24+
config SDHC_BUFFER_ALIGNMENT
25+
default 4
26+
27+
config MCUX_SDIF_DMA_BUFFER_SIZE
28+
int "Size of DMA descriptor buffer in bytes"
29+
default 256
30+
help
31+
Size of MCUX SDIF DMA descriptor buffer in bytes
32+
33+
endif #MCUX_SDIF_DMA_SUPPORT
34+
35+
endif #MCUX_SDIF

0 commit comments

Comments
 (0)