drivers: eeprom_at2x: respect devicetree cs-gpios flags

Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2020-07-06 15:07:38 -05:00 committed by Kumar Gala
parent 0f7acb1dc3
commit ceb5c751b3

View file

@ -39,7 +39,8 @@ struct eeprom_at2x_config {
uint16_t bus_addr;
uint32_t max_freq;
const char *spi_cs_dev_name;
uint8_t spi_cs_pin;
gpio_pin_t spi_cs_pin;
gpio_dt_flags_t spi_cs_dt_flags;
gpio_pin_t wp_gpio_pin;
gpio_dt_flags_t wp_gpio_flags;
const char *wp_gpio_name;
@ -510,6 +511,7 @@ static int eeprom_at2x_init(struct device *dev)
}
data->spi_cs.gpio_pin = config->spi_cs_pin;
data->spi_cs.gpio_dt_flags = config->spi_cs_dt_flags;
data->spi_cfg.cs = &data->spi_cs;
}
#endif /* CONFIG_EEPROM_AT25 */
@ -576,6 +578,9 @@ static const struct eeprom_driver_api eeprom_at2x_api = {
.spi_cs_pin = UTIL_AND( \
DT_SPI_DEV_HAS_CS_GPIOS(INST_DT_AT2X(n, t)), \
DT_SPI_DEV_CS_GPIOS_PIN(INST_DT_AT2X(n, t))), \
.spi_cs_dt_flags = UTIL_AND( \
DT_SPI_DEV_HAS_CS_GPIOS(INST_DT_AT2X(n, t)), \
DT_SPI_DEV_CS_GPIOS_DT_FLAGS(INST_DT_AT2X(n, t))), \
.wp_gpio_pin = UTIL_AND( \
DT_NODE_HAS_PROP(INST_DT_AT2X(n, t), wp_gpios), \
DT_GPIO_PIN(INST_DT_AT2X(n, t), wp_gpios)), \