Skip to content

Commit ca59096

Browse files
galakPeter Tönz
authored andcommitted
[sg fromtree] drivers: sdhc: Rework SPI config initialization
Move to using SPI_CONFIG_DT_INST macro to initialization the struct spi_config cfg_a. This fixes an issue with how the old code was initializing the deprecated fields of spi_cs_control. Signed-off-by: Kumar Gala <[email protected]> (cherry picked from commit 355da1d)
1 parent 4fd6791 commit ca59096

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

drivers/sdhc/sdhc_spi.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -742,21 +742,10 @@ static struct sdhc_driver_api sdhc_spi_api = {
742742
.spi_max_freq = DT_INST_PROP(n, spi_max_frequency), \
743743
}; \
744744
\
745-
IF_ENABLED(DT_INST_SPI_DEV_HAS_CS_GPIOS(n), \
746-
(struct spi_cs_control sdhc_spi_cs_##n = { \
747-
.gpio_dev = DEVICE_DT_GET(DT_INST_SPI_DEV_CS_GPIOS_CTLR(n)), \
748-
.gpio_pin = DT_INST_SPI_DEV_CS_GPIOS_PIN(n), \
749-
.gpio_dt_flags = DT_INST_SPI_DEV_CS_GPIOS_FLAGS(n), \
750-
};)) \
751745
struct sdhc_spi_data sdhc_spi_data_##n = { \
752-
.cfg_a = { \
753-
.operation = (SPI_LOCK_ON | \
754-
SPI_HOLD_ON_CS | \
755-
SPI_WORD_SET(8)), \
756-
COND_CODE_1(DT_INST_SPI_DEV_HAS_CS_GPIOS(n), \
757-
(.cs = &sdhc_spi_cs_##n), \
758-
(.cs = NULL)) \
759-
}, \
746+
.cfg_a = SPI_CONFIG_DT_INST(n, \
747+
(SPI_LOCK_ON | SPI_HOLD_ON_CS | SPI_WORD_SET(8)),\
748+
0), \
760749
}; \
761750
\
762751
DEVICE_DT_INST_DEFINE(n, \

0 commit comments

Comments
 (0)