Re: [Stratos-dev] [PATCH V3 1/3] gpio: Add virtio-gpio driver

From: Vincent Guittot
Date: Tue Jun 15 2021 - 03:30:31 EST


On Mon, 14 Jun 2021 at 22:56, Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>
> On Mon, Jun 14, 2021 at 3:24 PM Vincent Guittot
> <vincent.guittot@xxxxxxxxxx> wrote:
> > On Mon, 14 Jun 2021 at 15:00, Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
> > > On Mon, Jun 14, 2021 at 2:50 PM Vincent Guittot via Stratos-dev <stratos-dev@xxxxxxxxxxxxxxxxxxx> wrote:>
> > >
> > > But this example seem to be completely different from the ones I mentioned:
> > > The scmi node that you have here looks like it shows up under the root of the
> > > device tree, not below the virtio device that implements the scmi transport.
> >
> > I was thinking of something like below:
> >
> > deviceX: deviceX@YYYYYYY {
> > ...
> > gpio = <&virtio_gpio 0>;
> > ...
> > };
> >
> > virtio_mmio@a000000 {
> > dma-coherent;
> > interrupts = <0x0 0x10 0x1>;
> > reg = <0x0 0xa000000 0x0 0x200>;
> > compatible = "virtio,mmio";
> >
> > virtio_gpio: protocol@22 {
> > reg = <0x22>;
> > };
>
> Encoding the device ID as "reg" seems somewhat odd, especially since there
> can only be one child for each virtio device. The other bus types use the
> "compatible" property instead of "reg" for this purpose. This is still
> redundant,
> since the type is also known from the contents, but it seems less unusual.

At least this ensures to match directly the protocol id instead of
mapping a compatible string with the protocol id.

>
> The gpio node in the example is usually called "gpio" or "gpio-controller", and
> it would then need the "gpio-controller" and "#gpio-cells" properties so other
> nodes can refer to it by phandle.

yes, This short example is just to show what I mean.



>
> Arnd