diff options
| author | Amit Kumar Mahapatra via Alsa-devel <[email protected]> | 2023-03-10 17:32:03 +0000 |
|---|---|---|
| committer | Mark Brown <[email protected]> | 2023-03-11 12:34:01 +0000 |
| commit | 9e264f3f85a56cc109cc2d6010a48aa89d5c1ff1 (patch) | |
| tree | f4625d50e5c6c4190d20daa8cb770f84f51d540b /drivers/spi/spi-microchip-core.c | |
| parent | spi: mpc5xxx-psc: Remove goto to the unexisted label (diff) | |
| download | kernel-9e264f3f85a56cc109cc2d6010a48aa89d5c1ff1.tar.gz kernel-9e264f3f85a56cc109cc2d6010a48aa89d5c1ff1.zip | |
spi: Replace all spi->chip_select and spi->cs_gpiod references with function call
Supporting multi-cs in spi drivers would require the chip_select & cs_gpiod
members of struct spi_device to be an array. But changing the type of these
members to array would break the spi driver functionality. To make the
transition smoother introduced four new APIs to get/set the
spi->chip_select & spi->cs_gpiod and replaced all spi->chip_select and
spi->cs_gpiod references with get or set API calls.
While adding multi-cs support in further patches the chip_select & cs_gpiod
members of the spi_device structure would be converted to arrays & the
"idx" parameter of the APIs would be used as array index i.e.,
spi->chip_select[idx] & spi->cs_gpiod[idx] respectively.
Signed-off-by: Amit Kumar Mahapatra <[email protected]>
Acked-by: Heiko Stuebner <[email protected]> # Rockchip drivers
Reviewed-by: Michal Simek <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]> # Aspeed driver
Reviewed-by: Dhruva Gole <[email protected]> # SPI Cadence QSPI
Reviewed-by: Patrice Chotard <[email protected]> # spi-stm32-qspi
Acked-by: William Zhang <[email protected]> # bcm63xx-hsspi driver
Reviewed-by: Serge Semin <[email protected]> # DW SSI part
Link: https://lore.kernel.org/r/167847070432.26.15076794204368669839@mailman-core.alsa-project.org
Signed-off-by: Mark Brown <[email protected]>
Diffstat (limited to 'drivers/spi/spi-microchip-core.c')
| -rw-r--r-- | drivers/spi/spi-microchip-core.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/spi/spi-microchip-core.c b/drivers/spi/spi-microchip-core.c index e6cf6ff08061..b59e8a0c5b97 100644 --- a/drivers/spi/spi-microchip-core.c +++ b/drivers/spi/spi-microchip-core.c @@ -247,8 +247,8 @@ static void mchp_corespi_set_cs(struct spi_device *spi, bool disable) struct mchp_corespi *corespi = spi_master_get_devdata(spi->master); reg = mchp_corespi_read(corespi, REG_SLAVE_SELECT); - reg &= ~BIT(spi->chip_select); - reg |= !disable << spi->chip_select; + reg &= ~BIT(spi_get_chipselect(spi, 0)); + reg |= !disable << spi_get_chipselect(spi, 0); mchp_corespi_write(corespi, REG_SLAVE_SELECT, reg); } @@ -265,7 +265,7 @@ static int mchp_corespi_setup(struct spi_device *spi) */ if (spi->mode & SPI_CS_HIGH) { reg = mchp_corespi_read(corespi, REG_SLAVE_SELECT); - reg |= BIT(spi->chip_select); + reg |= BIT(spi_get_chipselect(spi, 0)); mchp_corespi_write(corespi, REG_SLAVE_SELECT, reg); } return 0; |
