Skip to contentSkip to conversation

spi: spi-rockchip: Fix unused chip select line when using gpio cs

PATCH In review Luis de Arquer 1 participant 2 messages Jan 26, 2024 – Jan 27, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 spi: spi-rockchip: Fix unused chip select line when using gpio cs

From: Luis de Arquer <[email protected]>

This change allows the DT to use native c1 for a device while leaving native cs0 reserved for allowing gpio cs operation

---
 drivers/spi/spi-rockchip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-rockchip.c +2 -2
index e1ecd96c7858..e1ae62e8765c 100644
@@ -247,13 +247,13 @@ static void rockchip_spi_set_cs(struct spi_device *spi, bool enable)
 		pm_runtime_get_sync(rs->dev);
 
 		if (spi_get_csgpiod(spi, 0))
-			ROCKCHIP_SPI_SET_BITS(rs->regs + ROCKCHIP_SPI_SER, 1);
+			ROCKCHIP_SPI_SET_BITS(rs->regs + ROCKCHIP_SPI_SER, ctlr->unused_native_cs);
 		else
 			ROCKCHIP_SPI_SET_BITS(rs->regs + ROCKCHIP_SPI_SER,
 					      BIT(spi_get_chipselect(spi, 0)));
 	} else {
 		if (spi_get_csgpiod(spi, 0))
-			ROCKCHIP_SPI_CLR_BITS(rs->regs + ROCKCHIP_SPI_SER, 1);
+			ROCKCHIP_SPI_CLR_BITS(rs->regs + ROCKCHIP_SPI_SER, ctlr->unused_native_cs);
 		else
 			ROCKCHIP_SPI_CLR_BITS(rs->regs + ROCKCHIP_SPI_SER,
 					      BIT(spi_get_chipselect(spi, 0)));
Signature · 1 line
2.34.1
#1 lore raw
Quoted 3 lines · Luis de Arquer

This change allows the DT to use native c1 for a device while leaving native cs0 reserved for allowing gpio cs operation

Actually, I think this comment is the other way around -reserve cs1 and use cs0 for device. Before, it was using cs0 for gpio operation always.

drivers/spi/spi-rockchip.c static void rockchip_spi_set_cs(struct spi_device *spi, bool enable) · line 250

Quoted 3 lines
drivers/spi/spi-rockchip.c +1 -1
-			ROCKCHIP_SPI_SET_BITS(rs->regs + ROCKCHIP_SPI_SER, 1);
+			ROCKCHIP_SPI_SET_BITS(rs->regs + ROCKCHIP_SPI_SER, ctlr->unused_native_cs);

s/ctlr->unused_native_cs/BIT(ctlr->unused_native_cs)/

I mixed up cs numbers and bitmask, sorry.
I'll fix for v2

Luis