openwrt/target/linux/bcm27xx/patches-6.6/950-1087-spi-dw-Handle-any-number-of-gpiod-CS-lines.patch
Álvaro Fernández Rojas 8c405cdccc bcm27xx: add 6.6 kernel patches
The patches were generated from the RPi repo with the following command:
git format-patch v6.6.34..rpi-6.1.y

Some patches needed rebasing and, as usual, the applied and reverted, wireless
drivers, Github workflows, READMEs and defconfigs patches were removed.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-06-18 18:52:49 +02:00

29 lines
1.0 KiB
Diff

From f0537b9db29afd851323e4b7d7ae3156d6bfb1b6 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 13 May 2024 15:40:02 +0100
Subject: [PATCH 1087/1135] spi: dw: Handle any number of gpiod CS lines
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: https://github.com/raspberrypi/linux/issues/6159
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/spi/spi-dw-core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/drivers/spi/spi-dw-core.c
+++ b/drivers/spi/spi-dw-core.c
@@ -98,7 +98,8 @@ void dw_spi_set_cs(struct spi_device *sp
* 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);
}