Skip to content

Commit 2922d1c

Browse files
linuswbroonie
authored andcommitted
spi: gpio: Add SPI_MASTER_GPIO_SS flag
The GPIO SPI master has some code in its local CS callback to set the initial sck GPIO value. This was lost in the commit converting it to use SPI core GPIO handling as this callback isn't called if the internal GPIO handling is active. Add the special SPI_MASTER_GPIO_SS to ascertain it gets called anyway so we get the initial SCK setting right. There is some platform provided GPIO handling there as well but this will be skipped as the cs_gpios will be NULL. My test targets seem not to care about the initial SCK value so I am uncertain if this is a regression, but to preserve the previous semantic we better do this. Cc: Andrey Smirnov <[email protected]> Fixes: 249e263 ("spi: gpio: Don't request CS GPIO in DT use-case") Signed-off-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent d6b197a commit 2922d1c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/spi/spi-gpio.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,12 @@ static int spi_gpio_probe(struct platform_device *pdev)
410410

411411
bb = &spi_gpio->bitbang;
412412
bb->master = master;
413+
/*
414+
* There is some additional business, apart from driving the CS GPIO
415+
* line, that we need to do on selection. This makes the local
416+
* callback for chipselect always get called.
417+
*/
418+
master->flags |= SPI_MASTER_GPIO_SS;
413419
bb->chipselect = spi_gpio_chipselect;
414420
bb->set_line_direction = spi_gpio_set_direction;
415421

0 commit comments

Comments
 (0)