bcm27xx: update 6.1 patches to latest version
[openwrt/staging/dangole.git] / target / linux / bcm27xx / patches-6.1 / 950-1236-spi-bcm2835-Support-spi0-0cs-and-SPI_NO_CS-mode.patch
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
5
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
10 flag at creation.
11
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.
14
15 See: https://github.com/raspberrypi/linux/issues/5835
16
17 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
18 ---
19 drivers/spi/spi-bcm2835.c | 5 +++++
20 1 file changed, 5 insertions(+)
21
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;
28 + int len;
29 int ret;
30 u32 cs;
31
32 @@ -1287,6 +1288,10 @@ static int bcm2835_spi_setup(struct spi_
33 goto err_cleanup;
34 }
35
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)
38 + return 0;
39 +
40 /*
41 * Translate native CS to GPIO
42 *