Add a new binding to describe remoteproc-provided virtio devices; while
these are discovered through a resource table parsed by the remoteproc
infrastructure at runtime, their description can be needed to probe
non-discoverable buses (such as I2C) or to link consumers and suppliers.

Each vdev is described by a dedicated "group" node, which then includes
a virtio-device node, which binding is already existent and used by
virtio-mmio. Each vdev shall be stattically linked to a "group" node
using its index inside the resource table as the reg property of the
node; this permits to have multiple instances of the same type of
device.

The binding is intended to be generic and adopted by any remoteproc
provider.

Signed-off-by: Francesco Valla <[email protected]>
---
 .../bindings/remoteproc/remoteproc-virtio.yaml     | 89 ++++++++++++++++++++++
 1 file changed, 89 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/remoteproc/remoteproc-virtio.yaml 
b/Documentation/devicetree/bindings/remoteproc/remoteproc-virtio.yaml
new file mode 100644
index 000000000000..c4a0d84b1460
--- /dev/null
+++ b/Documentation/devicetree/bindings/remoteproc/remoteproc-virtio.yaml
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/remoteproc/remoteproc-virtio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Virtio devices over remoteproc
+
+description: |
+  Virtio devices ("vdevs") can be exposed using the remoteproc infrastructure
+  and its resource table. For some of them, a device tree node might be needed
+  to describe remote undiscoverable hardware and/or connect consumers and
+  providers.
+
+maintainers:
+  - Francesco Valla <[email protected]>
+
+properties:
+  virtio:
+    description: Contains a group of Virtio devices exposed by the remoteproc.
+
+    properties:
+      '#address-cells':
+        const: 1
+
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^vdev@[0-9a-f]+$":
+        type: object
+
+        properties:
+          reg:
+            description: Virtio device index inside the resource table.
+            maxItems: 1
+
+        additionalProperties:
+          type: object
+          $ref: /schemas/virtio/virtio-device.yaml
+          maxItems: 1
+
+        required:
+          - reg
+
+    additionalProperties: false
+
+    required:
+      - '#address-cells'
+      - '#size-cells'
+
+additionalProperties: true
+
+examples:
+  - |
+    remoteproc-cm33 {
+      virtio {
+          #address-cells = <1>;
+          #size-cells = <0>;
+
+          vdev@0 {
+              reg = <0>;
+
+              gpio {
+                  compatible = "virtio,device29";
+
+                  gpio-controller;
+                  #gpio-cells = <2>;
+              };
+          };
+
+          vdev@1 {
+              reg = <1>;
+
+              i2c {
+                  compatible = "virtio,device22";
+
+                  #address-cells = <1>;
+                  #size-cells = <0>;
+
+                  eeprom@50 {
+                      compatible = "atmel,24c1025";
+                      reg = <0x50>;
+                  };
+              };
+          };
+      };
+    };
+...

-- 
2.55.0


Reply via email to