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	default y if DT_HAS_ZEPHYR_SDMMC_DISK_ENABLED || \
10			DT_HAS_ST_STM32_SDMMC_ENABLED
11	help
12	  SDMMC card driver.
13
14if DISK_DRIVER_SDMMC
15
16config SD_INIT_PRIORITY
17	int "Init priority"
18	default 90
19	help
20	  SDMMC controller driver initialization priority.
21
22config SDMMC_VOLUME_NAME
23	string "SDMMC Disk mount point or drive name"
24	default "SD" if FAT_FILESYSTEM_ELM
25	default "SDMMC"
26	help
27	  Disk name as per file system naming guidelines.
28
29config SDMMC_SUBSYS
30	bool "SDMMC access via SD subsystem"
31	select SDMMC_STACK
32	default y
33	depends on DT_HAS_ZEPHYR_SDMMC_DISK_ENABLED
34	help
35	  Enable SDMMC access via SD subsystem.
36
37config SDMMC_STM32
38	bool "STM32 SDMMC driver"
39	default y
40	depends on DT_HAS_ST_STM32_SDMMC_ENABLED
41	select USE_STM32_HAL_SD
42	select USE_STM32_HAL_SD_EX if SOC_SERIES_STM32L4X
43	select USE_STM32_LL_SDMMC
44	select USE_STM32_HAL_DMA if (SOC_SERIES_STM32L4X || SOC_SERIES_STM32F7X || SOC_SERIES_STM32F4X)
45	select DMA if ($(DT_STM32_SDMMC_HAS_DMA) && SOC_SERIES_STM32F4X)
46	select RESET
47	help
48	  File system on sdmmc accessed through stm32 sdmmc.
49
50config SDMMC_STM32_HWFC
51	bool "STM32 SDMMC Hardware Flow control"
52	depends on SDMMC_STM32
53	depends on SOC_SERIES_STM32H7X || \
54		   SOC_SERIES_STM32F7X || \
55		   SOC_SERIES_STM32L4X || \
56		   SOC_SERIES_STM32L5X
57	help
58	  Enable SDMMC Hardware Flow Control to avoid FIFO underrun (TX mode) and
59	  overrun (RX mode) errors.
60
61config SDMMC_STM32_CLOCK_CHECK
62	bool "Runtime SDMMC 48MHz clock check"
63	depends on SDMMC_STM32
64	default y
65	help
66	  Enable SDMMC clock 48MHz configuration runtime check.
67	  In specific cases, this check might provide wrong verdict and should
68	  be disabled.
69
70module = SDMMC
71module-str = sdmmc
72source "subsys/logging/Kconfig.template.log_config"
73
74endif # DISK_DRIVER_SDMMC
75