Skip to content

Commit

Permalink
spi: dw: Handle any number of gpiod CS lines
Browse files Browse the repository at this point in the history
Even when configured to use only gpiod CS lines, the DW SPI controller
still expects a bit to be set in the SER register, otherwise transfers
stall. For the csgpiod case, nominate bit 0 for the job.

See: #6159

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
  • Loading branch information
pelwell committed May 14, 2024
1 parent 1675224 commit 18f350d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/spi/spi-dw-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ void dw_spi_set_cs(struct spi_device *spi, bool enable)
* support active-high or active-low CS level.
*/
if (cs_high == enable)
dw_writel(dws, DW_SPI_SER, BIT(spi_get_chipselect(spi, 0)));
dw_writel(dws, DW_SPI_SER,
BIT(spi_get_csgpiod(spi, 0) ? 0 : spi_get_chipselect(spi, 0)));
else
dw_writel(dws, DW_SPI_SER, 0);
}
Expand Down

0 comments on commit 18f350d

Please sign in to comment.