Skip to content

Commit

Permalink
spi: bcm2835: Support spi0-0cs and SPI_NO_CS mode
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pelwell committed Jan 8, 2024
1 parent 280d1a9 commit 5d9075e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/spi/spi-bcm2835.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,7 @@ static int bcm2835_spi_setup(struct spi_device *spi)
struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
struct bcm2835_spidev *slv = spi_get_ctldata(spi);
struct gpio_chip *chip;
int len;
int ret;
u32 cs;

Expand Down Expand Up @@ -1287,6 +1288,10 @@ static int bcm2835_spi_setup(struct spi_device *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
*
Expand Down

0 comments on commit 5d9075e

Please sign in to comment.