Skip to content

Commit 7a874e8

Browse files
Luis de Arquerbroonie
authored andcommitted
spi-rockchip: Fix register out of bounds access
Do not write native chip select stuff for GPIO chip selects. GPIOs can be numbered much higher than native CS. Also, it makes no sense. Signed-off-by: Luis de Arquer <luis.dearquer@inertim.com> Link: https://patch.msgid.link/365ccddfba110549202b3520f4401a6a936e82a8.camel@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent ee2ecf2 commit 7a874e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/spi/spi-rockchip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ static int rockchip_spi_config(struct rockchip_spi *rs,
547547
cr0 |= (spi->mode & 0x3U) << CR0_SCPH_OFFSET;
548548
if (spi->mode & SPI_LSB_FIRST)
549549
cr0 |= CR0_FBM_LSB << CR0_FBM_OFFSET;
550-
if (spi->mode & SPI_CS_HIGH)
550+
if ((spi->mode & SPI_CS_HIGH) && !(spi_get_csgpiod(spi, 0)))
551551
cr0 |= BIT(spi_get_chipselect(spi, 0)) << CR0_SOI_OFFSET;
552552

553553
if (xfer->rx_buf && xfer->tx_buf)

0 commit comments

Comments
 (0)