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	# Otherwise, we only need 64 bytes to read SD switch function
76	default 64
77	help
78	  Size in bytes of internal buffer SD card uses for unaligned reads and
79	  internal data reads during initialization
80
81config SD_DATA_RETRIES
82	int "Number of times to retry sending data to card"
83	default 3
84	help
85	  Number of times to retry sending data to SD card in case of failure
86
87
88config SD_UHS_PROTOCOL
89	bool "Ultra high speed SD card protocol support"
90	default y if SDHC_SUPPORTS_UHS
91	help
92	  Enable support for ultra high speed SD cards. This can be disabled to
93	  reduce code size, at the cost of data transfer speeds.
94
95config MMC_RCA
96	hex "MMC Relative card address"
97	default 2
98	help
99	  Relative card address to publish to MMC card.
100
101endif # SD_STACK
102
103endmenu
104