forked from espressif/esp-idf
Merge branch 'feature/sdmmc_test_p4_updates' into 'master'
change(sdmmc,sdspi): add P4 board defs, enable LDO in sdspi tests, simplify LDO in sdmmc tests See merge request espressif/esp-idf!30042
This commit is contained in:
@@ -29,6 +29,10 @@ menu "SDMMC Test Board Configuration"
|
||||
bool "ESP32-C3 breakout board"
|
||||
depends on IDF_TARGET_ESP32C3
|
||||
|
||||
config SDMMC_BOARD_ESP32P4_EV_BOARD
|
||||
bool "ESP32-P4 Function EV Board"
|
||||
depends on IDF_TARGET_ESP32P4
|
||||
|
||||
config SDMMC_BOARD_CUSTOM_SD
|
||||
depends on SOC_SDMMC_HOST_SUPPORTED
|
||||
bool "Custom SD (choose pins)"
|
||||
|
@@ -35,18 +35,6 @@ void sdmmc_test_board_get_config_sdmmc(int slot_index, sdmmc_host_t *out_host_co
|
||||
out_host_config->max_freq_khz = slot->max_freq_khz;
|
||||
}
|
||||
|
||||
#if SOC_SDMMC_IO_POWER_EXTERNAL
|
||||
#define SDMMC_PWR_LDO_CHANNEL 4
|
||||
|
||||
sd_pwr_ctrl_ldo_config_t ldo_config = {
|
||||
.ldo_chan_id = SDMMC_PWR_LDO_CHANNEL,
|
||||
};
|
||||
sd_pwr_ctrl_handle_t pwr_ctrl_handle = NULL;
|
||||
|
||||
TEST_ESP_OK(sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &pwr_ctrl_handle));
|
||||
out_host_config->pwr_ctrl_handle = pwr_ctrl_handle;
|
||||
#endif
|
||||
|
||||
#if SOC_SDMMC_USE_GPIO_MATRIX
|
||||
out_slot_config->clk = slot->clk;
|
||||
out_slot_config->cmd = slot->cmd_mosi;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -318,6 +318,34 @@ static const sdmmc_test_board_info_t s_board_info = {
|
||||
.card_power_set = card_power_set_esp32c3_breakout
|
||||
};
|
||||
|
||||
#elif CONFIG_SDMMC_BOARD_ESP32P4_EV_BOARD
|
||||
|
||||
static const sdmmc_test_board_info_t s_board_info = {
|
||||
.name = "ESP32-P4 Function EV Board",
|
||||
.slot = {
|
||||
{
|
||||
.slot_exists = false
|
||||
},
|
||||
{
|
||||
.slot_exists = true,
|
||||
.bus_width = 4,
|
||||
.clk = 43,
|
||||
.cmd_mosi = 44,
|
||||
.d0_miso = 39,
|
||||
.d1 = 40,
|
||||
.d2 = 41,
|
||||
.d3_cs = 42,
|
||||
.d4 = GPIO_NUM_NC,
|
||||
.d5 = GPIO_NUM_NC,
|
||||
.d6 = GPIO_NUM_NC,
|
||||
.d7 = GPIO_NUM_NC,
|
||||
.cd = GPIO_NUM_NC,
|
||||
.wp = GPIO_NUM_NC,
|
||||
.unused_pin = 2,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
#elif CONFIG_SDMMC_BOARD_CUSTOM_SD
|
||||
|
||||
static const sdmmc_test_board_info_t s_board_info = {
|
||||
|
@@ -30,15 +30,9 @@ void sdmmc_test_sd_skip_if_board_incompatible(int slot, int width, int freq_khz,
|
||||
|
||||
int board_max_freq_khz = sdmmc_test_board_get_slot_info(slot)->max_freq_khz;
|
||||
if (board_max_freq_khz > 0 && board_max_freq_khz < freq_khz) {
|
||||
#if SOC_SDMMC_IO_POWER_EXTERNAL
|
||||
TEST_ESP_OK(sd_pwr_ctrl_del_on_chip_ldo(config.pwr_ctrl_handle));
|
||||
#endif
|
||||
TEST_IGNORE_MESSAGE("Board doesn't support required max_freq_khz");
|
||||
}
|
||||
if (slot_config.width < width) {
|
||||
#if SOC_SDMMC_IO_POWER_EXTERNAL
|
||||
TEST_ESP_OK(sd_pwr_ctrl_del_on_chip_ldo(config.pwr_ctrl_handle));
|
||||
#endif
|
||||
TEST_IGNORE_MESSAGE("Board doesn't support required bus width");
|
||||
}
|
||||
}
|
||||
@@ -84,6 +78,17 @@ void sdmmc_test_sd_begin(int slot, int width, int freq_khz, int ddr, sdmmc_card_
|
||||
config.flags |= SDMMC_HOST_FLAG_DDR;
|
||||
}
|
||||
|
||||
#if SOC_SDMMC_IO_POWER_EXTERNAL
|
||||
#define SDMMC_PWR_LDO_CHANNEL 4
|
||||
sd_pwr_ctrl_ldo_config_t ldo_config = {
|
||||
.ldo_chan_id = SDMMC_PWR_LDO_CHANNEL,
|
||||
};
|
||||
sd_pwr_ctrl_handle_t pwr_ctrl_handle = NULL;
|
||||
|
||||
TEST_ESP_OK(sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &pwr_ctrl_handle));
|
||||
config.pwr_ctrl_handle = pwr_ctrl_handle;
|
||||
#endif
|
||||
|
||||
sdmmc_test_board_card_power_set(true);
|
||||
TEST_ESP_OK(sdmmc_host_init());
|
||||
TEST_ESP_OK(sdmmc_host_init_slot(slot, &slot_config));
|
||||
@@ -123,7 +128,7 @@ void sdmmc_test_sd_end(sdmmc_card_t *card)
|
||||
}
|
||||
esp_log_level_set("gpio", old_level);
|
||||
|
||||
//Need to reset GPIO first, otherrwise cannot discharge VDD of card completely.
|
||||
//Need to reset GPIO first, otherwise cannot discharge VDD of card completely.
|
||||
sdmmc_test_board_card_power_set(false);
|
||||
#if SOC_SDMMC_IO_POWER_EXTERNAL
|
||||
TEST_ESP_OK(sd_pwr_ctrl_del_on_chip_ldo(card->host.pwr_ctrl_handle));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "sd_protocol_defs.h"
|
||||
#include "sdmmc_cmd.h"
|
||||
#include "sdmmc_test_begin_end_spi.h"
|
||||
#include "sd_pwr_ctrl.h"
|
||||
#include "sd_pwr_ctrl_by_on_chip_ldo.h"
|
||||
|
||||
void sdmmc_test_spi_skip_if_board_incompatible(int slot, int freq_khz)
|
||||
{
|
||||
@@ -59,6 +61,17 @@ void sdmmc_test_spi_begin(int slot, int freq_khz, sdmmc_card_t *out_card)
|
||||
|
||||
config.max_freq_khz = freq_khz;
|
||||
|
||||
#if SOC_SDMMC_IO_POWER_EXTERNAL
|
||||
#define SDMMC_PWR_LDO_CHANNEL 4
|
||||
sd_pwr_ctrl_ldo_config_t ldo_config = {
|
||||
.ldo_chan_id = SDMMC_PWR_LDO_CHANNEL,
|
||||
};
|
||||
sd_pwr_ctrl_handle_t pwr_ctrl_handle = NULL;
|
||||
|
||||
TEST_ESP_OK(sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &pwr_ctrl_handle));
|
||||
config.pwr_ctrl_handle = pwr_ctrl_handle;
|
||||
#endif
|
||||
|
||||
sdmmc_test_board_card_power_set(true);
|
||||
TEST_ESP_OK(spi_bus_initialize(dev_config.host_id, &bus_config, SPI_DMA_CH_AUTO));
|
||||
TEST_ESP_OK(sdspi_host_init());
|
||||
@@ -91,4 +104,8 @@ void sdmmc_test_spi_end(int slot, sdmmc_card_t *card)
|
||||
esp_log_level_set("gpio", old_level);
|
||||
|
||||
sdmmc_test_board_card_power_set(false);
|
||||
|
||||
#if SOC_SDMMC_IO_POWER_EXTERNAL
|
||||
TEST_ESP_OK(sd_pwr_ctrl_del_on_chip_ldo(card->host.pwr_ctrl_handle));
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user