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_nodelabel_has_prop,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_VOLUME_NAME
24	string "SDMMC Disk mount point or drive name"
25	default "SD" if FAT_FILESYSTEM_ELM
26	default "SDMMC"
27	help
28	  Disk name as per file system naming guidelines.
29
30config SDMMC_SUBSYS
31	bool "SDMMC access via SD subsystem"
32	select SDMMC_STACK
33	default y
34	depends on DT_HAS_ZEPHYR_SDMMC_DISK_ENABLED
35	help
36	  Enable SDMMC access via SD subsystem.
37
38config SDMMC_STM32
39	bool "STM32 SDMMC driver"
40	default y
41	depends on DT_HAS_ST_STM32_SDMMC_ENABLED
42	select USE_STM32_HAL_SD if !SDMMC_STM32_EMMC
43	select USE_STM32_HAL_SD_EX if !SDMMC_STM32_EMMC && SOC_SERIES_STM32L4X
44	select USE_STM32_HAL_MMC if SDMMC_STM32_EMMC
45	select USE_STM32_HAL_MMC_EX if SDMMC_STM32_EMMC && SOC_SERIES_STM32L4X
46	select USE_STM32_LL_SDMMC
47	select USE_STM32_HAL_DMA if (SOC_SERIES_STM32L4X || SOC_SERIES_STM32F7X || SOC_SERIES_STM32F4X)
48	select DMA if ($(DT_STM32_SDMMC_HAS_DMA) && SOC_SERIES_STM32F4X)
49	select RESET
50	help
51	  File system on sdmmc accessed through stm32 sdmmc.
52
53config SDMMC_STM32_HWFC
54	bool "STM32 SDMMC Hardware Flow control"
55	depends on SDMMC_STM32
56	depends on SOC_SERIES_STM32H5X || \
57		   SOC_SERIES_STM32H7X || \
58		   SOC_SERIES_STM32F7X || \
59		   SOC_SERIES_STM32L4X || \
60		   SOC_SERIES_STM32L5X
61	help
62	  Enable SDMMC Hardware Flow Control to avoid FIFO underrun (TX mode) and
63	  overrun (RX mode) errors.
64
65config SDMMC_STM32_EMMC
66	bool "STM32 SDMMC eMMC mode"
67	depends on SDMMC_STM32
68	help
69	  Use eMMC instead of SDIO (SD card) protocol. These are similar, but not entirely the same.
70
71config SDMMC_STM32_CLOCK_CHECK
72	bool "Runtime SDMMC 48MHz clock check"
73	depends on SDMMC_STM32
74	default y
75	help
76	  Enable SDMMC clock 48MHz configuration runtime check.
77	  In specific cases, this check might provide wrong verdict and should
78	  be disabled.
79
80module = SDMMC
81module-str = sdmmc
82source "subsys/logging/Kconfig.template.log_config"
83
84endif # DISK_DRIVER_SDMMC
85