public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/5] virtio: Add virtio-device bindings
@ 2021-07-22  9:56 Viresh Kumar
  2021-07-22  9:56 ` [PATCH V2 2/5] dt-bindings: i2c: Add bindings for i2c-virtio Viresh Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2021-07-22  9:56 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";
        };

Here, 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 adds virtio-device bindings to allow for device sub-nodes to be
present and the second patch updates the virtio core to update the of_node.

Other patches add bindings for i2c and gpio devices.

Tested on x86 with qemu for arm64.

V1->V2:
- The changes (both binding and code) are made at virtio level, instead of
  virtio-mmio. This allows the same to be used by all device types, irrespective
  of the transport mechanism.

- Dropped the reg property and used compatible in the form "virtio,<DID>".

- Dropped dt-bindings/virtio/virtio_ids.h.

- Add a patch to sync virtio-ids from spec, required for the last patch.

--
Viresh

Viresh Kumar (5):
  dt-bindings: virtio: Add binding for virtio devices
  dt-bindings: i2c: Add bindings for i2c-virtio
  dt-bindings: gpio: Add bindings for gpio-virtio
  uapi: virtio_ids: Sync ids with specification
  virtio: Bind virtio device to device-tree node

 .../devicetree/bindings/gpio/gpio-virtio.yaml | 60 +++++++++++++++++
 .../devicetree/bindings/i2c/i2c-virtio.yaml   | 51 ++++++++++++++
 .../devicetree/bindings/virtio/mmio.yaml      |  2 +-
 .../bindings/virtio/virtio-device.yaml        | 47 +++++++++++++
 drivers/virtio/virtio.c                       | 67 ++++++++++++++++++-
 include/uapi/linux/virtio_ids.h               | 12 ++++
 6 files changed, 235 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-virtio.yaml
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-virtio.yaml
 create mode 100644 Documentation/devicetree/bindings/virtio/virtio-device.yaml

-- 
2.31.1.272.g89b43f80a514


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

* [PATCH V2 2/5] dt-bindings: i2c: Add bindings for i2c-virtio
  2021-07-22  9:56 [PATCH V2 0/5] virtio: Add virtio-device bindings Viresh Kumar
@ 2021-07-22  9:56 ` Viresh Kumar
  2021-07-22 14:45   ` Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2021-07-22  9:56 UTC (permalink / raw)
  To: Jason Wang, Michael S. Tsirkin, Rob Herring, Arnd Bergmann,
	Jean-Philippe Brucker, Viresh Kumar
  Cc: Vincent Guittot, Bill Mills, Alex Bennée,
	Enrico Weigelt, metux IT consult, Jie Deng, devicetree,
	linux-kernel, virtualization, Wolfram Sang, linux-i2c

This patch adds binding for virtio I2C device, it is based on
virtio-device bindings.

Cc: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 .../devicetree/bindings/i2c/i2c-virtio.yaml   | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-virtio.yaml

diff --git a/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml b/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml
new file mode 100644
index 000000000000..0381d9065287
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/i2c-virtio.yaml
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i2c/i2c-virtio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Virtio I2C Adapter
+
+maintainers:
+  - Viresh Kumar <viresh.kumar@linaro.org>
+
+allOf:
+  - $ref: /schemas/i2c/i2c-controller.yaml#
+  - $ref: /schemas/virtio/virtio-device.yaml#
+
+description:
+  Virtio I2C device, see /schemas/virtio/virtio-device.yaml for more details.
+
+properties:
+  $nodename:
+    pattern: '^i2c-virtio(-[a-z0-9]+)?$'
+
+  compatible:
+    const: virtio,22
+
+required:
+  - compatible
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    virtio@3000 {
+        compatible = "virtio,mmio";
+        reg = <0x3000 0x100>;
+        interrupts = <41>;
+
+        i2c-virtio {
+            compatible = "virtio,22";
+
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            light-sensor@1c {
+                compatible = "dynaimage,al3320a";
+                reg = <0x20>;
+            };
+        };
+    };
+
+...
-- 
2.31.1.272.g89b43f80a514


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

* Re: [PATCH V2 2/5] dt-bindings: i2c: Add bindings for i2c-virtio
  2021-07-22  9:56 ` [PATCH V2 2/5] dt-bindings: i2c: Add bindings for i2c-virtio Viresh Kumar
@ 2021-07-22 14:45   ` Wolfram Sang
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2021-07-22 14:45 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Jason Wang, Michael S. Tsirkin, Rob Herring, Arnd Bergmann,
	Jean-Philippe Brucker, Vincent Guittot, Bill Mills,
	Alex Bennée, Enrico Weigelt, metux IT consult, Jie Deng,
	devicetree, linux-kernel, virtualization, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 401 bytes --]

On Thu, Jul 22, 2021 at 03:26:40PM +0530, Viresh Kumar wrote:
> This patch adds binding for virtio I2C device, it is based on
> virtio-device bindings.
> 
> Cc: Wolfram Sang <wsa@kernel.org>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

I'll leave the review for Rob. I suppose the series should go in via
some other tree, so for that:

Acked-by: Wolfram Sang <wsa@kernel.org>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-22  9:56 [PATCH V2 0/5] virtio: Add virtio-device bindings Viresh Kumar
2021-07-22  9:56 ` [PATCH V2 2/5] dt-bindings: i2c: Add bindings for i2c-virtio Viresh Kumar
2021-07-22 14:45   ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox