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

From: Arnd Bergmann
Date: Mon Jun 14 2021 - 16:56:45 EST


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.

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.

Arnd