lede/target/linux/bcm27xx/patches-6.12/950-0987-spi-bcm2835-Support-spi0-0cs-and-SPI_NO_CS-mode.patch
=?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= d81c03f05e bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-06-20 17:01:06 +08:00

43 lines
1.5 KiB
Diff

From 8a26058d84386858fc7999b0e472414fb55051d8 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 8 Jan 2024 11:42:57 +0000
Subject: [PATCH] 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
@@ -1231,6 +1231,7 @@ static int bcm2835_spi_setup(struct spi_
"brcm,bcm2711-gpio",
"brcm,bcm7211-gpio",
};
+ int len;
int ret, i;
u32 cs;
@@ -1304,6 +1305,10 @@ static int bcm2835_spi_setup(struct spi_
if (i == ARRAY_SIZE(pinctrl_compats))
return 0;
+ /* 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;
+
/*
* 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