[PATCH] spi: bcm2835: clarify native chip-select fallback
From: Artem Novak
Date: Sun Nov 22 2026 - 03:23:14 EST
Document why the driver uses GPIO-controlled chip-select instead of
the hardware-controlled native chip-select.
Also explain how the temporary GPIO lookup table is used when the
device tree does not provide a CS GPIO descriptor, and document the
fallback's limitation regarding the alternate GPIOs 36/35.
Signed-off-by: Artem Novak <artem122novak@xxxxxxxxx>
---
drivers/spi/spi-bcm2835.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index cc5748973281..d4c938fa3a23 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -1310,13 +1310,16 @@ static int bcm2835_spi_setup(struct spi_device *spi)
return 0;
/*
- * TODO: The code below is a slightly better alternative to the utter
- * abuse of the GPIO API that I found here before. It creates a
- * temporary lookup table, assigns it to the SPI device, gets the GPIO
- * descriptor and then releases the lookup table.
+ * The hardware-controlled native chip-select can produce short
+ * glitches during transfers, so use GPIO-controlled chip-select
+ * instead.
*
- * More on the problem that it addresses:
- * https://www.spinics.net/lists/linux-gpio/msg36218.html
+ * If the device tree doesn't provide a CS GPIO descriptor, create a
+ * temporary lookup table to obtain the GPIO through the consumer API.
+ * This fallback assumes GPIOs 8/7 and doesn't detect whether the
+ * alternate GPIOs 36/35 are configured.
+ *
+ * See https://www.spinics.net/lists/linux-gpio/msg36218.html
*/
lookup = kzalloc_flex(*lookup, table, 2);
if (!lookup) {
--
2.56.1