1# Copyright (c) 2016 Intel Corporation
2# Copyright (c) 2021 Nordic Semiconductor ASA
3# SPDX-License-Identifier: Apache-2.0
4
5DT_STM32_SDMMC_HAS_DMA := $(dt_compat_any_has_prop,$(DT_COMPAT_ST_STM32_SDMMC),dmas)
6
7config DISK_DRIVER_SDMMC
8	bool "SDMMC card driver"
9	depends on DT_HAS_ZEPHYR_SDMMC_DISK_ENABLED || \
10			DT_HAS_ST_STM32_SDMMC_ENABLED
11	default y
12	help
13	  SDMMC card driver.
14
15if DISK_DRIVER_SDMMC
16
17config SD_INIT_PRIORITY
18	int "Init priority"
19	default 90
20	help
21	  SDMMC controller driver initialization priority.
22
23config SDMMC_SUBSYS
24	bool "SDMMC access via SD subsystem"
25	select SDMMC_STACK
26	default y
27	depends on DT_HAS_ZEPHYR_SDMMC_DISK_ENABLED
28	help
29	  Enable SDMMC access via SD subsystem.
30
31config SDMMC_STM32
32	bool "STM32 SDMMC driver"
33	default y
34	depends on DT_HAS_ST_STM32_SDMMC_ENABLED
35	select USE_STM32_HAL_SD if !SDMMC_STM32_EMMC
36	select USE_STM32_HAL_SD_EX if !SDMMC_STM32_EMMC && SOC_SERIES_STM32L4X
37	select USE_STM32_HAL_MMC if SDMMC_STM32_EMMC
38	select USE_STM32_HAL_MMC_EX if SDMMC_STM32_EMMC && SOC_SERIES_STM32L4X
39	select USE_STM32_LL_SDMMC
40	select USE_STM32_HAL_DMA if (SOC_SERIES_STM32L4X || SOC_SERIES_STM32F7X || SOC_SERIES_STM32F4X)
41	select DMA if $(DT_STM32_SDMMC_HAS_DMA) && (SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X)
42	select PINCTRL
43	select RESET
44	help
45	  File system on sdmmc accessed through stm32 sdmmc.
46
47config SDMMC_STM32_HWFC
48	bool "STM32 SDMMC Hardware Flow control"
49	depends on SDMMC_STM32
50	depends on SOC_SERIES_STM32H5X || \
51		   SOC_SERIES_STM32H7X || \
52		   SOC_SERIES_STM32F7X || \
53		   SOC_SERIES_STM32L4X || \
54		   SOC_SERIES_STM32L5X
55	help
56	  Enable SDMMC Hardware Flow Control to avoid FIFO underrun (TX mode) and
57	  overrun (RX mode) errors.
58
59config SDMMC_STM32_EMMC
60	bool "STM32 SDMMC eMMC mode"
61	depends on SDMMC_STM32
62	help
63	  Use eMMC instead of SDIO (SD card) protocol. These are similar, but not entirely the same.
64
65config SDMMC_STM32_CLOCK_CHECK
66	bool "Runtime SDMMC 48MHz clock check"
67	depends on SDMMC_STM32
68	default y
69	help
70	  Enable SDMMC clock 48MHz configuration runtime check.
71	  In specific cases, this check might provide wrong verdict and should
72	  be disabled.
73
74module = SDMMC
75module-str = sdmmc
76source "subsys/logging/Kconfig.template.log_config"
77
78endif # DISK_DRIVER_SDMMC
79