1 From 5d9075ed7e73dc6ccebf78710c78f39ddc2dd78e Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Mon, 8 Jan 2024 11:42:57 +0000
4 Subject: [PATCH] spi: bcm2835: Support spi0-0cs and SPI_NO_CS mode
6 The forced conversion of native CS lines into software CS lines is done
7 whether or not the controller has been given any CS lines to use. This
8 breaks the use of the spi0-0cs overlay to prevent SPI from claiming any
9 CS lines, particularly with spidev which doesn't pass in the SPI_NO_CS
12 Use the presence of an empty cs-gpios property as an indication that no
13 CS lines should be used, bypassing the native CS conversion code.
15 See: https://github.com/raspberrypi/linux/issues/5835
17 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
19 drivers/spi/spi-bcm2835.c | 5 +++++
20 1 file changed, 5 insertions(+)
22 --- a/drivers/spi/spi-bcm2835.c
23 +++ b/drivers/spi/spi-bcm2835.c
24 @@ -1222,6 +1222,7 @@ static int bcm2835_spi_setup(struct spi_
25 struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
26 struct bcm2835_spidev *slv = spi_get_ctldata(spi);
27 struct gpio_chip *chip;
32 @@ -1287,6 +1288,10 @@ static int bcm2835_spi_setup(struct spi_
36 + /* Skip forced CS conversion if controller has an empty cs-gpios property */
37 + if (of_find_property(ctlr->dev.of_node, "cs-gpios", &len) && len == 0)
41 * Translate native CS to GPIO