Skip to content

Commit 5d9075e

Browse files
committed
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: #5835 Signed-off-by: Phil Elwell <[email protected]>
1 parent 280d1a9 commit 5d9075e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/spi/spi-bcm2835.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,7 @@ static int bcm2835_spi_setup(struct spi_device *spi)
12221222
struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
12231223
struct bcm2835_spidev *slv = spi_get_ctldata(spi);
12241224
struct gpio_chip *chip;
1225+
int len;
12251226
int ret;
12261227
u32 cs;
12271228

@@ -1287,6 +1288,10 @@ static int bcm2835_spi_setup(struct spi_device *spi)
12871288
goto err_cleanup;
12881289
}
12891290

1291+
/* Skip forced CS conversion if controller has an empty cs-gpios property */
1292+
if (of_find_property(ctlr->dev.of_node, "cs-gpios", &len) && len == 0)
1293+
return 0;
1294+
12901295
/*
12911296
* Translate native CS to GPIO
12921297
*

0 commit comments

Comments
 (0)