drivers: spi: esp32xx: Add chip select setup and hold time
Added device tree bindings and implementaion for setting the spi controllers chip select setup and hold time settings. Signed-off-by: Dean Sellers <dsellers@evos.com.au>
This commit is contained in:
parent
bb0a85ae4b
commit
308cec45b0
|
@ -338,6 +338,13 @@ static int IRAM_ATTR spi_esp32_configure(const struct device *dev,
|
|||
hal_dev->mode |= BIT(1);
|
||||
}
|
||||
|
||||
/* Chip select setup and hold times */
|
||||
/* GPIO CS have their own delay parameter*/
|
||||
if (!spi_cs_is_gpio(spi_cfg)) {
|
||||
hal_dev->cs_hold = cfg->cs_hold;
|
||||
hal_dev->cs_setup = cfg->cs_setup;
|
||||
}
|
||||
|
||||
spi_hal_setup_device(hal, hal_dev);
|
||||
|
||||
/*
|
||||
|
@ -496,6 +503,8 @@ static const struct spi_driver_api spi_api = {
|
|||
.dma_enabled = DT_INST_PROP(idx, dma_enabled), \
|
||||
.dma_clk_src = DT_INST_PROP(idx, dma_clk), \
|
||||
.dma_host = DT_INST_PROP(idx, dma_host), \
|
||||
.cs_setup = DT_INST_PROP_OR(idx, cs_setup_time, 0), \
|
||||
.cs_hold = DT_INST_PROP_OR(idx, cs_hold_time, 0), \
|
||||
}; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(idx, &spi_esp32_init, \
|
||||
|
|
|
@ -36,6 +36,8 @@ struct spi_esp32_config {
|
|||
bool dma_enabled;
|
||||
int dma_clk_src;
|
||||
int dma_host;
|
||||
int cs_setup;
|
||||
int cs_hold;
|
||||
};
|
||||
|
||||
struct spi_esp32_data {
|
||||
|
|
|
@ -64,3 +64,15 @@ properties:
|
|||
|
||||
Refer to SoC's Technical Reference Manual to check which pins are
|
||||
allowed to use this routing path.
|
||||
|
||||
cs-setup-time:
|
||||
type: int
|
||||
description: |
|
||||
Chip select setup time setting, see TRF for SOC for details of
|
||||
timing applied.
|
||||
|
||||
cs-hold-time:
|
||||
type: int
|
||||
description: |
|
||||
Chip select hold time setting, see TRF for SOC for details of
|
||||
timing applied.
|
||||
|
|
Loading…
Reference in a new issue