gpio: mcp23s17: Add chip select flags

Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
Jordan Yates 2020-06-18 18:13:05 +10:00 committed by Kumar Gala
commit ede1448b75
2 changed files with 5 additions and 0 deletions

View file

@ -380,6 +380,7 @@ static int mcp23s17_init(struct device *dev)
}
drv_data->mcp23s17_cs_ctrl.gpio_pin = config->cs_pin;
drv_data->mcp23s17_cs_ctrl.gpio_dt_flags = config->cs_flags;
drv_data->mcp23s17_cs_ctrl.delay = 0;
drv_data->spi_cfg.cs = &drv_data->mcp23s17_cs_ctrl;
@ -415,6 +416,9 @@ static int mcp23s17_init(struct device *dev)
IF_ENABLED(DT_INST_SPI_DEV_HAS_CS_GPIOS(inst), \
(.cs_pin = \
DT_INST_SPI_DEV_CS_GPIOS_PIN(inst),)) \
IF_ENABLED(DT_INST_SPI_DEV_HAS_CS_GPIOS(inst), \
(.cs_flags = \
DT_INST_SPI_DEV_CS_GPIOS_FLAGS(inst),)) \
}; \
\
static struct mcp23s17_drv_data mcp23s17_##inst##_drvdata = { \

View file

@ -55,6 +55,7 @@ struct mcp23s17_config {
const uint32_t freq;
const char *const cs_dev;
const uint32_t cs_pin;
const uint8_t cs_flags;
};
/** Runtime driver data */