1# Copyright 2022 NXP
2# SPDX-License-Identifier: Apache-2.0
3
4# SD stack configuration options
5
6menu "SD"
7
8config MMC_STACK
9	bool "MMC protocol support"
10	help
11	  Enable MMC protocol support. Required for eMMC cards to function.
12
13config SDMMC_STACK
14	bool "SDMMC protocol support"
15	help
16	  Enable SDMMC protocol support. Required for SD memory cards to
17	  function.
18
19config SDIO_STACK
20	bool "SDIO protocol support"
21	help
22	  Enable SDIO protocol support. Required for SD I/O cards to function.
23
24config SD_STACK
25	bool
26	default y if MMC_STACK || SDMMC_STACK || SDIO_STACK
27	select SDHC
28	help
29	  Enable SD card support.
30
31if SD_STACK
32
33module = SD
34module-str = SD stack
35source "subsys/logging/Kconfig.template.log_config"
36
37config SD_INIT_TIMEOUT
38	int "Timeout while initializing SD card"
39	default 1500
40	help
41	  Maximum time to wait, in milliseconds, for the SD card to initialize.
42
43config SD_RETRY_COUNT
44	int "Number of times to retry initialization commands"
45	default 10
46	help
47	  Number of times to retry initialization commands in case of failure
48
49config SD_OCR_RETRY_COUNT
50	int "Number of times to retry SD OCR read"
51	default 1000
52	help
53	  Number of times to retry SD OCR read command. OCR reads typically
54	  require more retries than general SD commands
55
56config SD_CMD_TIMEOUT
57	int "Timeout for SD commands (in ms)"
58	default 200
59	help
60	  Default timeout in milliseconds for SD commands
61
62config SD_DATA_TIMEOUT
63	int "Timeout for SD data transfer (in ms)"
64	default 10000
65	help
66	  Default timeout in milliseconds for SD data transfer commands
67
68config SD_BUFFER_SIZE
69	int
70	# If SDHC required buffer alignment, we need a full block size in
71	# internal buffer
72	default 512 if SDHC_BUFFER_ALIGNMENT != 1
73	# If MMC is being used, need 512 bytes to read EXT_CSD
74	default 512 if MMC_STACK
75	# If SDIO is being used, need 512 bytes to read FUNC0 CIS
76	default 512 if SDIO_STACK
77	# Otherwise, we only need 64 bytes to read SD switch function
78	default 64
79	help
80	  Size in bytes of internal buffer SD card uses for unaligned reads and
81	  internal data reads during initialization
82
83config SD_CMD_RETRIES
84	int "Number of times to retry sending command to card"
85	default 0
86	help
87	  Number of times to retry sending command to SD card in case of failure
88
89config SD_DATA_RETRIES
90	int "Number of times to retry sending data to card"
91	default 3
92	help
93	  Number of times to retry sending data to SD card in case of failure
94
95
96config SD_UHS_PROTOCOL
97	bool "Ultra high speed SD card protocol support"
98	default y if SDHC_SUPPORTS_UHS
99	help
100	  Enable support for ultra high speed SD cards. This can be disabled to
101	  reduce code size, at the cost of data transfer speeds.
102
103config MMC_RCA
104	hex "MMC Relative card address"
105	default 2
106	help
107	  Relative card address to publish to MMC card.
108
109endif # SD_STACK
110
111endmenu
112