mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
refactor(spi): move sleep retention config into driver layer
Move per-target GPSPI regdma retention descriptors out of esp_hal_gpspi and into esp_driver_spi so the driver owns its backup scope and restore sequence.
This commit is contained in:
@@ -38,48 +38,3 @@ const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = {
|
||||
.func = SPI2_FUNC_NUM_QUAD,
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Backup registers in Light sleep: (total cnt 29)
|
||||
*
|
||||
* cmd
|
||||
* addr
|
||||
* ctrl
|
||||
* clock
|
||||
* user
|
||||
* user1
|
||||
* user2
|
||||
* ms_dlen
|
||||
* misc
|
||||
* dma_conf
|
||||
* dma_int_ena
|
||||
* data_buf[0-15] // slave driver only
|
||||
* slave
|
||||
* slave1
|
||||
*/
|
||||
#define SPI_RETENTION_REGS_CNT 29
|
||||
static const uint32_t spi_regs_map[4] = {0x31ff, 0x33fffc0, 0x0, 0x0};
|
||||
#define SPI_REG_RETENTION_ENTRIES(num) { \
|
||||
[0] = { .config = REGDMA_LINK_ADDR_MAP_INIT(REGDMA_GPSPI_LINK(0), \
|
||||
REG_SPI_BASE(num), REG_SPI_BASE(num), \
|
||||
SPI_RETENTION_REGS_CNT, 0, 0, \
|
||||
spi_regs_map[0], spi_regs_map[1], \
|
||||
spi_regs_map[2], spi_regs_map[3]), \
|
||||
.owner = ENTRY(0) | ENTRY(2) }, \
|
||||
/* Additional interrupt setting is required by idf SPI drivers after register recovered */ \
|
||||
[1] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_GPSPI_LINK(1), \
|
||||
SPI_DMA_INT_SET_REG(num), \
|
||||
SPI_TRANS_DONE_INT_SET | SPI_DMA_SEG_TRANS_DONE_INT_SET | SPI_SLV_CMD7_INT_SET | SPI_SLV_CMD8_INT_SET , \
|
||||
UINT32_MAX, 1, 0), \
|
||||
.owner = ENTRY(0) | ENTRY(2) }, \
|
||||
}
|
||||
|
||||
static const regdma_entries_config_t spi2_regs_retention[] = SPI_REG_RETENTION_ENTRIES(2); // '2' for GPSPI2
|
||||
|
||||
const spi_reg_retention_info_t spi_reg_retention_info[SOC_SPI_PERIPH_NUM - 1] = { // '-1' to except mspi
|
||||
{
|
||||
.module_id = SLEEP_RETENTION_MODULE_GPSPI2,
|
||||
.entry_array = spi2_regs_retention,
|
||||
.array_size = ARRAY_SIZE(spi2_regs_retention),
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user