Nikolaus, On Tue, Dec 1, 2020 at 9:38 AM H. Nikolaus Schaller <h...@goldelico.com> wrote: > > Let's work on a fix for the fix now.
I tested spi-gpio on my system, by converting a built-in or hardware spi, to a spi-gpio. Interestingly, the patch has the opposite effect on my system: before the patch, spi-gpio did not work, but after it's applied, it does work. Can you tell me the idle status of your chip-select gpio in debugfs? # mount -t debugfs none /sys/kernel/debug # cat /sys/kernel/debug/gpio Look for something like this: gpiochip0: GPIOs 0-31, parent: platform/209c000.gpio, 209c000.gpio: gpio-17 ( |spi5 CS0 ) out hi ACTIVE LOW Also, apply the following patch, and tell me a) does this dev_err() get called on your system, and b) what is the value when your chip is de-selected diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 7e8804b02be9..b2f4cf5c9ffb 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -813,11 +813,12 @@ static void spi_set_cs(struct spi_device *spi, bool enable) if (spi->cs_gpiod || gpio_is_valid(spi->cs_gpio)) { if (!(spi->mode & SPI_NO_CS)) { - if (spi->cs_gpiod) + if (spi->cs_gpiod) { + dev_err(&spi->dev, "gpiod %s", enable1 ? "enable" : "disable"); /* polarity handled by gpiolib */ gpiod_set_value_cansleep(spi->cs_gpiod, enable1); - else + } else /* * invert the enable line, as active low is * default for SPI.