linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] virtio: Parse virtio-device nodes from DT
@ 2021-07-13 10:50 Viresh Kumar
  2021-07-13 10:50 ` [PATCH 5/5] dt-bindings: gpio: Add bindings for gpio-virtio Viresh Kumar
  0 siblings, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2021-07-13 10:50 UTC (permalink / raw)
  To: Jason Wang, Michael S. Tsirkin, Rob Herring, Arnd Bergmann,
	Jean-Philippe Brucker, Bartosz Golaszewski, Linus Walleij,
	Viresh Kumar
  Cc: Vincent Guittot, Bill Mills, Alex Bennée,
	Enrico Weigelt, metux IT consult, Jie Deng, devicetree,
	linux-kernel, virtualization, linux-gpio, linux-i2c, Wolfram Sang

Hi,

Currently the DT only provides support for following node types for virtio-mmio
nodes:

	virtio_mmio@a000000 {
		dma-coherent;
		interrupts = <0x00 0x10 0x01>;
		reg = <0x00 0xa000000 0x00 0x200>;
		compatible = "virtio,mmio";
	};

And each virtio-mmio corresponds to a virtio-device. But there is no way for
other users in the DT to show their dependency on virtio devices.

This patchset provides that support.

The first patch update virtio,mmio bindings to allow for device subnodes to be
present and the second patch updates the virtio-mmio driver to update the
of_node.

Other patches add bindings for i2c and gpio virtio devices (they have some
dependencies, mentioned in the patches).

Tested on x86 with qemu for arm64.

--
Viresh

Viresh Kumar (5):
  dt-bindings: virtio: mmio: Add support for device subnode
  virtio_mmio: Bind virtio device to device-tree node
  dt-bindings: i2c: Add bindings for i2c-virtio
  i2c: virtio: Update i2c-adapter's of_node
  dt-bindings: gpio: Add bindings for gpio-virtio

 .../devicetree/bindings/gpio/gpio-virtio.yaml | 67 +++++++++++++++++++
 .../devicetree/bindings/i2c/i2c-virtio.yaml   | 59 ++++++++++++++++
 .../devicetree/bindings/virtio/mmio.yaml      | 41 ++++++++++++
 drivers/i2c/busses/i2c-virtio.c               |  1 +
 drivers/virtio/virtio_mmio.c                  | 44 ++++++++++++
 include/dt-bindings/virtio/virtio_ids.h       |  1 +
 6 files changed, 213 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-virtio.yaml
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-virtio.yaml
 create mode 120000 include/dt-bindings/virtio/virtio_ids.h

-- 
2.31.1.272.g89b43f80a514


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 5/5] dt-bindings: gpio: Add bindings for gpio-virtio
  2021-07-13 10:50 [PATCH 0/5] virtio: Parse virtio-device nodes from DT Viresh Kumar
@ 2021-07-13 10:50 ` Viresh Kumar
  2021-07-13 14:03   ` Rob Herring
  2021-07-13 14:46   ` Rob Herring
  0 siblings, 2 replies; 4+ messages in thread
From: Viresh Kumar @ 2021-07-13 10:50 UTC (permalink / raw)
  To: Jason Wang, Michael S. Tsirkin, Rob Herring, Arnd Bergmann,
	Jean-Philippe Brucker, Linus Walleij, Bartosz Golaszewski,
	Viresh Kumar
  Cc: Vincent Guittot, Bill Mills, Alex Bennée,
	Enrico Weigelt, metux IT consult, Jie Deng, devicetree,
	linux-kernel, virtualization, linux-gpio

gpio-virtio represents a virtio GPIO controller and this patch adds
binding for the same. The gpio-virtio subnode can be part of a
virtio,mmio node and is based on its binding.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
Depends on:

https://lore.kernel.org/lkml/7c716c2eb7ace5b5a560d8502af93101dbb53d24.1626170146.git.viresh.kumar@linaro.org/
---
 .../devicetree/bindings/gpio/gpio-virtio.yaml | 67 +++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-virtio.yaml

diff --git a/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml b/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml
new file mode 100644
index 000000000000..c813cdfd60fd
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/gpio-virtio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Virtio memory mapped GPIO controller
+
+maintainers:
+  - Viresh Kumar <viresh.kumar@linaro.org>
+
+description:
+  Virtio GPIO controller, see /schemas/virtio/mmio.yaml for more details.
+
+allOf:
+  - $ref: /schemas/gpio/gpio.yaml#
+
+properties:
+  $nodename:
+    pattern: '^gpio-virtio@[0-9]+$'
+
+  reg:
+    description:
+      The cell is the device ID of the GPIO device (VIRTIO_ID_GPIO) as per
+      dt-bindings/virtio/virtio_ids.h.
+    const: 41
+    $ref: /schemas/virtio/mmio.yaml#/properties/reg
+
+  gpio-controller: true
+
+  "#gpio-cells":
+    const: 2
+
+  interrupt-controller: true
+
+  "#interrupt-cells":
+    const: 2
+
+required:
+  - reg
+  - gpio-controller
+  - "#gpio-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/virtio/virtio_ids.h>
+
+    virtio@3000 {
+        compatible = "virtio,mmio";
+        reg = <0x3000 0x100>;
+        interrupts = <41>;
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        gpio-virtio@0 {
+            reg = <VIRTIO_ID_GPIO>;
+            gpio-controller;
+            #gpio-cells = <2>;
+            interrupt-controller;
+            #interrupt-cells = <2>;
+        };
+    };
+
+...
-- 
2.31.1.272.g89b43f80a514


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 5/5] dt-bindings: gpio: Add bindings for gpio-virtio
  2021-07-13 10:50 ` [PATCH 5/5] dt-bindings: gpio: Add bindings for gpio-virtio Viresh Kumar
@ 2021-07-13 14:03   ` Rob Herring
  2021-07-13 14:46   ` Rob Herring
  1 sibling, 0 replies; 4+ messages in thread
From: Rob Herring @ 2021-07-13 14:03 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: virtualization, linux-kernel, Linus Walleij, Michael S. Tsirkin,
	Enrico Weigelt, metux IT consult, devicetree,
	Jean-Philippe Brucker, Jason Wang, Bill Mills, Vincent Guittot,
	Arnd Bergmann, Bartosz Golaszewski, Alex Bennée, Rob Herring,
	linux-gpio, Jie Deng

On Tue, 13 Jul 2021 16:20:34 +0530, Viresh Kumar wrote:
> gpio-virtio represents a virtio GPIO controller and this patch adds
> binding for the same. The gpio-virtio subnode can be part of a
> virtio,mmio node and is based on its binding.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> Depends on:
> 
> https://lore.kernel.org/lkml/7c716c2eb7ace5b5a560d8502af93101dbb53d24.1626170146.git.viresh.kumar@linaro.org/
> ---
>  .../devicetree/bindings/gpio/gpio-virtio.yaml | 67 +++++++++++++++++++
>  1 file changed, 67 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-virtio.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Unknown file referenced: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/dist-packages/dtschema/schemas/virtio/mmio.yaml'
xargs: dt-doc-validate: exited with status 255; aborting
Documentation/devicetree/bindings/gpio/gpio-virtio.example.dts:19:18: fatal error: dt-bindings/virtio/virtio_ids.h: No such file or directory
   19 |         #include <dt-bindings/virtio/virtio_ids.h>
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.lib:380: Documentation/devicetree/bindings/gpio/gpio-virtio.example.dt.yaml] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1416: dt_binding_check] Error 2
\ndoc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1504545

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5/5] dt-bindings: gpio: Add bindings for gpio-virtio
  2021-07-13 10:50 ` [PATCH 5/5] dt-bindings: gpio: Add bindings for gpio-virtio Viresh Kumar
  2021-07-13 14:03   ` Rob Herring
@ 2021-07-13 14:46   ` Rob Herring
  1 sibling, 0 replies; 4+ messages in thread
From: Rob Herring @ 2021-07-13 14:46 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Jason Wang, Michael S. Tsirkin, Arnd Bergmann,
	Jean-Philippe Brucker, Linus Walleij, Bartosz Golaszewski,
	Vincent Guittot, Bill Mills, Alex Bennée,
	Enrico Weigelt, metux IT consult, Jie Deng, devicetree,
	linux-kernel@vger.kernel.org,
	open list:DRM DRIVER FOR QEMU'S CIRRUS DEVICE,
	open list:GPIO SUBSYSTEM

On Tue, Jul 13, 2021 at 4:51 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> gpio-virtio represents a virtio GPIO controller and this patch adds
> binding for the same. The gpio-virtio subnode can be part of a
> virtio,mmio node and is based on its binding.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> Depends on:
>
> https://lore.kernel.org/lkml/7c716c2eb7ace5b5a560d8502af93101dbb53d24.1626170146.git.viresh.kumar@linaro.org/
> ---
>  .../devicetree/bindings/gpio/gpio-virtio.yaml | 67 +++++++++++++++++++
>  1 file changed, 67 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-virtio.yaml
>
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml b/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml
> new file mode 100644
> index 000000000000..c813cdfd60fd
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/gpio-virtio.yaml
> @@ -0,0 +1,67 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/gpio/gpio-virtio.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Virtio memory mapped GPIO controller
> +
> +maintainers:
> +  - Viresh Kumar <viresh.kumar@linaro.org>
> +
> +description:
> +  Virtio GPIO controller, see /schemas/virtio/mmio.yaml for more details.
> +
> +allOf:
> +  - $ref: /schemas/gpio/gpio.yaml#
> +
> +properties:
> +  $nodename:
> +    pattern: '^gpio-virtio@[0-9]+$'
> +
> +  reg:
> +    description:
> +      The cell is the device ID of the GPIO device (VIRTIO_ID_GPIO) as per
> +      dt-bindings/virtio/virtio_ids.h.
> +    const: 41
> +    $ref: /schemas/virtio/mmio.yaml#/properties/reg
> +
> +  gpio-controller: true
> +
> +  "#gpio-cells":
> +    const: 2
> +
> +  interrupt-controller: true
> +
> +  "#interrupt-cells":
> +    const: 2
> +
> +required:
> +  - reg
> +  - gpio-controller
> +  - "#gpio-cells"
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/virtio/virtio_ids.h>
> +
> +    virtio@3000 {
> +        compatible = "virtio,mmio";
> +        reg = <0x3000 0x100>;
> +        interrupts = <41>;
> +
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        gpio-virtio@0 {
> +            reg = <VIRTIO_ID_GPIO>;
> +            gpio-controller;
> +            #gpio-cells = <2>;
> +            interrupt-controller;
> +            #interrupt-cells = <2>;

Similar to I2C, all this can just be added to the parent node.

Rob

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-13 14:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-13 10:50 [PATCH 0/5] virtio: Parse virtio-device nodes from DT Viresh Kumar
2021-07-13 10:50 ` [PATCH 5/5] dt-bindings: gpio: Add bindings for gpio-virtio Viresh Kumar
2021-07-13 14:03   ` Rob Herring
2021-07-13 14:46   ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).