Files
openwrt-master/target/linux/bcm27xx/patches-6.6/950-0821-spi-bcm2835-Support-spi0-0cs-and-SPI_NO_CS-mode.patch
domenico c06fb25d1f
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Initial commit
2025-06-24 14:35:53 +02:00

43 lines
1.4 KiB
Diff

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