Skip to content

Commit ed8ec9d

Browse files
committed
Merge branch 'feat/sdmmc_uhs_tuning' into 'master'
sdmmc: UHS-I support for SDR50 (100MHz, 50MB/s), DDR50 (50MHz, 50MB/s) Closes IDF-10294, IDF-11447, and IDF-8886 See merge request espressif/esp-idf!34441
2 parents f8ddcee + 5bff669 commit ed8ec9d

File tree

34 files changed

+924
-186
lines changed

34 files changed

+924
-186
lines changed

components/esp_driver_sdmmc/include/driver/sdmmc_default_configs.h

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ extern "C" {
3131
.slot = SDMMC_HOST_SLOT_1, \
3232
.max_freq_khz = SDMMC_FREQ_DEFAULT, \
3333
.io_voltage = 3.3f, \
34+
.driver_strength = SDMMC_DRIVER_STRENGTH_B, \
35+
.current_limit = SDMMC_CURRENT_LIMIT_200MA, \
3436
.init = &sdmmc_host_init, \
3537
.set_bus_width = &sdmmc_host_set_bus_width, \
3638
.get_bus_width = &sdmmc_host_get_slot_width, \
@@ -48,29 +50,35 @@ extern "C" {
4850
.dma_aligned_buffer = NULL, \
4951
.pwr_ctrl_handle = NULL, \
5052
.get_dma_info = &sdmmc_host_get_dma_info, \
53+
.is_slot_set_to_uhs1 = &sdmmc_host_is_slot_set_to_uhs1, \
5154
}
5255

5356
#define SDMMC_SLOT_NO_CD GPIO_NUM_NC ///< indicates that card detect line is not used
5457
#define SDMMC_SLOT_NO_WP GPIO_NUM_NC ///< indicates that write protect line is not used
5558
#define SDMMC_SLOT_WIDTH_DEFAULT 0 ///< use the maximum possible width for the slot
5659

57-
#if SOC_SDMMC_USE_IOMUX && !SOC_SDMMC_USE_GPIO_MATRIX
5860
/**
5961
* Macro defining default configuration of SDMMC host slot
6062
*/
63+
#if CONFIG_IDF_TARGET_ESP32
6164
#define SDMMC_SLOT_CONFIG_DEFAULT() {\
65+
.clk = GPIO_NUM_6, \
66+
.cmd = GPIO_NUM_11, \
67+
.d0 = GPIO_NUM_7, \
68+
.d1 = GPIO_NUM_8, \
69+
.d2 = GPIO_NUM_9, \
70+
.d3 = GPIO_NUM_10, \
71+
.d4 = GPIO_NUM_16, \
72+
.d5 = GPIO_NUM_17, \
73+
.d6 = GPIO_NUM_5, \
74+
.d7 = GPIO_NUM_18, \
6275
.cd = SDMMC_SLOT_NO_CD, \
6376
.wp = SDMMC_SLOT_NO_WP, \
6477
.width = SDMMC_SLOT_WIDTH_DEFAULT, \
6578
.flags = 0, \
6679
}
6780

68-
#else
69-
70-
/**
71-
* Macro defining default configuration of SDMMC host slot
72-
*/
73-
#if CONFIG_IDF_TARGET_ESP32P4
81+
#elif CONFIG_IDF_TARGET_ESP32P4
7482
#define SDMMC_SLOT_CONFIG_DEFAULT() {\
7583
.clk = GPIO_NUM_43, \
7684
.cmd = GPIO_NUM_44, \
@@ -107,8 +115,6 @@ extern "C" {
107115
}
108116
#endif // GPIO Matrix chips
109117

110-
#endif
111-
112118
#ifdef __cplusplus
113119
}
114120
#endif

components/esp_driver_sdmmc/include/driver/sdmmc_host.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ extern "C" {
2424
* Extra configuration for SDMMC peripheral slot
2525
*/
2626
typedef struct {
27-
#ifdef SOC_SDMMC_USE_GPIO_MATRIX
2827
gpio_num_t clk; ///< GPIO number of CLK signal.
2928
gpio_num_t cmd; ///< GPIO number of CMD signal.
3029
gpio_num_t d0; ///< GPIO number of D0 signal.
@@ -35,7 +34,6 @@ typedef struct {
3534
gpio_num_t d5; ///< GPIO number of D5 signal. Ignored in 1- or 4- line mode.
3635
gpio_num_t d6; ///< GPIO number of D6 signal. Ignored in 1- or 4- line mode.
3736
gpio_num_t d7; ///< GPIO number of D7 signal. Ignored in 1- or 4- line mode.
38-
#endif // SOC_SDMMC_USE_GPIO_MATRIX
3937
union {
4038
gpio_num_t gpio_cd; ///< GPIO number of card detect signal
4139
gpio_num_t cd; ///< GPIO number of card detect signal; shorter name.
@@ -56,6 +54,8 @@ typedef struct {
5654
* 0 means "active low", i.e. card is protected when the GPIO is low;
5755
* 1 means "active high", i.e. card is protected when GPIO is high.
5856
*/
57+
#define SDMMC_SLOT_FLAG_UHS1 BIT(2)
58+
/**< Enable UHS-I mode for this slot */
5959
} sdmmc_slot_config_t;
6060

6161
/**
@@ -284,6 +284,18 @@ esp_err_t sdmmc_host_set_input_delay(int slot, sdmmc_delay_phase_t delay_phase);
284284
*/
285285
esp_err_t sdmmc_host_get_dma_info(int slot, esp_dma_mem_info_t *dma_mem_info);
286286

287+
/**
288+
* @brief Check if the slot is set to uhs1 or not
289+
*
290+
* @param[in] slot Slot id
291+
* @param[out] is_uhs1 Is uhs1 or not
292+
*
293+
* @return
294+
* - ESP_OK: on success
295+
* - ESP_ERR_INVALID_STATE: driver not in correct state
296+
*/
297+
esp_err_t sdmmc_host_is_slot_set_to_uhs1(int slot, bool *is_uhs1);
298+
287299
/**
288300
* @brief Get the state of SDMMC host
289301
*

0 commit comments

Comments
 (0)