mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-31 22:24:28 +00:00
soc: add esp32s3 sdmmc support
* sync the latest struct header file from ESP32 * add soc_caps.h macros to distinguish between IO MUX and GPIO Matrix support in SDMMC on different chips. * store GPIO matrix signal numbers in sdmmc_slot_info_t
This commit is contained in:
@@ -14,22 +14,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define SDMMC_SLOT0_IOMUX_PIN_NUM_CLK 6
|
||||
#define SDMMC_SLOT0_IOMUX_PIN_NUM_CMD 11
|
||||
#define SDMMC_SLOT0_IOMUX_PIN_NUM_D0 7
|
||||
#define SDMMC_SLOT0_IOMUX_PIN_NUM_D1 8
|
||||
#define SDMMC_SLOT0_IOMUX_PIN_NUM_D2 9
|
||||
#define SDMMC_SLOT0_IOMUX_PIN_NUM_D3 10
|
||||
#define SDMMC_SLOT0_IOMUX_PIN_NUM_D4 16
|
||||
#define SDMMC_SLOT0_IOMUX_PIN_NUM_D5 17
|
||||
#define SDMMC_SLOT0_IOMUX_PIN_NUM_D6 5
|
||||
#define SDMMC_SLOT0_IOMUX_PIN_NUM_D7 18
|
||||
#define SDMMC_SLOT0_FUNC 0
|
||||
|
||||
#define SDMMC_SLOT1_IOMUX_PIN_NUM_CLK 14
|
||||
#define SDMMC_SLOT1_IOMUX_PIN_NUM_CMD 15
|
||||
#define SDMMC_SLOT1_IOMUX_PIN_NUM_D0 2
|
||||
#define SDMMC_SLOT1_IOMUX_PIN_NUM_D1 4
|
||||
#define SDMMC_SLOT1_IOMUX_PIN_NUM_D2 12
|
||||
#define SDMMC_SLOT1_IOMUX_PIN_NUM_D3 13
|
||||
#define SDMMC_SLOT1_FUNC 4
|
||||
/* SDMMC pins on ESP32-S3 are configurable through GPIO matrix.
|
||||
* This file is kept for compatibility only.
|
||||
*/
|
||||
|
@@ -19,7 +19,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
typedef struct sdmmc_desc_s {
|
||||
uint32_t reserved1: 1;
|
||||
uint32_t disable_int_on_completion: 1;
|
||||
uint32_t last_descriptor: 1;
|
||||
@@ -32,10 +32,10 @@ typedef struct {
|
||||
uint32_t buffer1_size: 13;
|
||||
uint32_t buffer2_size: 13;
|
||||
uint32_t reserved3: 6;
|
||||
void *buffer1_ptr;
|
||||
void* buffer1_ptr;
|
||||
union {
|
||||
void *buffer2_ptr;
|
||||
void *next_desc_ptr;
|
||||
void* buffer2_ptr;
|
||||
void* next_desc_ptr;
|
||||
};
|
||||
} sdmmc_desc_t;
|
||||
|
||||
@@ -44,7 +44,7 @@ typedef struct {
|
||||
_Static_assert(sizeof(sdmmc_desc_t) == 16, "invalid size of sdmmc_desc_t structure");
|
||||
|
||||
|
||||
typedef struct {
|
||||
typedef struct sdmmc_hw_cmd_s {
|
||||
uint32_t cmd_index: 6; ///< Command index
|
||||
uint32_t response_expect: 1; ///< set if response is expected
|
||||
uint32_t response_long: 1; ///< 0: short response expected, 1: long response expected
|
||||
@@ -73,7 +73,7 @@ typedef struct {
|
||||
_Static_assert(sizeof(sdmmc_hw_cmd_t) == 4, "invalid size of sdmmc_cmd_t structure");
|
||||
|
||||
|
||||
typedef volatile struct {
|
||||
typedef volatile struct sdmmc_dev_s {
|
||||
union {
|
||||
struct {
|
||||
uint32_t controller_reset: 1;
|
||||
@@ -282,7 +282,12 @@ typedef volatile struct {
|
||||
uint32_t usrid; ///< user ID
|
||||
uint32_t verid; ///< IP block version
|
||||
uint32_t hcon; ///< compile-time IP configuration
|
||||
uint32_t uhs; ///< TBD
|
||||
union {
|
||||
struct {
|
||||
uint32_t voltage: 16; ///< voltage control for slots; no-op on ESP32.
|
||||
uint32_t ddr: 16; ///< bit N enables DDR mode for card N
|
||||
};
|
||||
} uhs; ///< UHS related settings
|
||||
|
||||
union {
|
||||
struct {
|
||||
@@ -306,7 +311,7 @@ typedef volatile struct {
|
||||
} bmod;
|
||||
|
||||
uint32_t pldmnd; ///< set any bit to resume IDMAC FSM from suspended state
|
||||
sdmmc_desc_t *dbaddr; ///< descriptor list base
|
||||
sdmmc_desc_t* dbaddr; ///< descriptor list base
|
||||
|
||||
union {
|
||||
struct {
|
||||
@@ -347,7 +352,16 @@ typedef volatile struct {
|
||||
uint32_t bufaddrl; ///< unused
|
||||
uint32_t bufaddru; ///< unused
|
||||
uint32_t reserved_a8[22];
|
||||
uint32_t cardthrctl;
|
||||
union {
|
||||
struct {
|
||||
uint32_t read_thr_en : 1; ///< initiate transfer only if FIFO has more space than the read threshold
|
||||
uint32_t busy_clr_int_en : 1; ///< enable generation of busy clear interrupts
|
||||
uint32_t write_thr_en : 1; ///< equivalent of read_thr_en for writes
|
||||
uint32_t reserved1 : 13;
|
||||
uint32_t card_threshold : 12; ///< threshold value for reads/writes, in bytes
|
||||
};
|
||||
uint32_t val;
|
||||
} cardthrctl;
|
||||
uint32_t back_end_power;
|
||||
uint32_t uhs_reg_ext;
|
||||
uint32_t emmc_ddr_reg;
|
||||
@@ -361,6 +375,8 @@ typedef volatile struct {
|
||||
uint32_t div_factor_p: 4; ///< controls clock period; it will be (div_factor_p + 1) / 160MHz
|
||||
uint32_t div_factor_h: 4; ///< controls length of high pulse; it will be (div_factor_h + 1) / 160MHz
|
||||
uint32_t div_factor_m: 4; ///< should be equal to div_factor_p
|
||||
uint32_t reserved1 : 2;
|
||||
uint32_t clk_sel : 1; ///< clock source select (0: XTAL, 1: 160 MHz from PLL)
|
||||
};
|
||||
uint32_t val;
|
||||
} clock;
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#define SOC_HMAC_SUPPORTED 1
|
||||
#define SOC_ASYNC_MEMCPY_SUPPORTED 1
|
||||
#define SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS 3
|
||||
#define SOC_SDMMC_HOST_SUPPORTED 1
|
||||
|
||||
|
||||
/*-------------------------- ADC CAPS ----------------------------------------*/
|
||||
@@ -214,3 +215,13 @@
|
||||
#define SOC_SPI_MEM_SUPPORT_SW_SUSPEND (1)
|
||||
/*-------------------------- COEXISTENCE HARDWARE PTI CAPS -------------------------------*/
|
||||
#define SOC_COEX_HW_PTI (1)
|
||||
|
||||
/*-------------------------- SDMMC CAPS -----------------------------------------*/
|
||||
|
||||
/* Card detect, write protect, interrupt use GPIO Matrix on all chips.
|
||||
* On ESP32-S3, clock/cmd/data pins use GPIO Matrix as well.
|
||||
*/
|
||||
#define SOC_SDMMC_USE_GPIO_MATRIX 1
|
||||
#define SOC_SDMMC_NUM_SLOTS 2
|
||||
/* Indicates that there is an option to use XTAL clock instead of PLL for SDMMC */
|
||||
#define SOC_SDMMC_SUPPORT_XTAL_CLOCK 1
|
||||
|
Reference in New Issue
Block a user