On Sat, Feb 6, 2021, at 12:06, Grr wrote:
> > No, you wouldn't need that. The device driver will receive a generic GPIO
> > handling
> > interface and it would simply assert/deassert CS line without knowing the
> > specifics
> > of the GPIO impementation on the given architecture.
>
>
> That's not what you said. You said:
>
> "In other words, make a SPI device driver _provide the select operation_
> (instead of the typical <arch>_spiNselect() at board logic level."
>
> "without knowing the specifics" and "provide the select operation" are
> mutually exclusive
>
They are not. Providing the operation means that the SPI device driver would do
something like:
static void spi_select(bool enable)
{
...
priv->cs_gpiodev->assert(enable);
}
The board would initialize this device as:
struct gpiodev* d = <arch>_gpiodev_init(cs_pincfg);
myspisensor_initialize(spi, d);
Where gpiodev is something like gpioexpander system. The <arch>_gpiodev_init
provides the lower-half
of this system, which is implemented only once per arch.
Matias