Hi Linus! > On 20.04.2019, at 13:08, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote: > > This converts the BCM2835 SPI master driver to use GPIO > descriptors for chip select handling. > > The BCM2835 driver was relying on the core to drive the > CS high/low so very small changes were needed for this > part. If it managed to request the CS from the device tree > node, all is pretty straight forward. > > However for native GPIOs this driver has a quite unorthodox > loopback to request some GPIOs from the SoC GPIO chip by > looking it up from the device tree using gpiochip_find() > and then offseting hard into its numberspace. This has > been augmented a bit by using gpiochip_request_own_desc() > but this code really needs to be verified. If "native CS" > is actually an SoC GPIO, why is it even done this way? > Should this GPIO not just be defined in the device tree > like any other CS GPIO? I'm confused. > > Cc: Lukas Wunner <lukas@xxxxxxxxx> > Cc: Stefan Wahren <stefan.wahren@xxxxxxxx> > Cc: Martin Sperl <kernel@xxxxxxxxxxxxxxxx> > Cc: Chris Boot <bootc@xxxxxxxxx> > Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> > --- > ChangeLog RFT->v2: > - Rebased on v5.1-rc1 > > I would very much appreciate if someone took this for > a ride on top of linux-next (there are some fixes in > the -rcs you need) and see if all still works as expected. Just applying this single patch gives me: CC [M] drivers/spi/spi-bcm2835.o drivers/spi/spi-bcm2835.c: In function ‘bcm2835_spi_setup’: drivers/spi/spi-bcm2835.c:883:6: warning: unused variable ‘err’ [-Wunused-variable] int err; ^~~ Then loading the module: [ 30.403459] spi spi0.0: FIXME: setting up native-CS0 as GPIO But when loading a spi-device driver it does not detect the device. One note: the logic analyzer shows that the CS line is inverted (high on SPI Clock running) With the un-patched version I get the following in dmesg: root@raspcm3:~# dmesg [ 27.987287] spi spi0.0: setting up native-CS0 as GPIO 2002 So you see that I am using the “original” DT that relies on the translation to gpio by the driver. Martin