Skip to contentSkip to conversation

schemas: pci-bus: make reg optional for Marvell PCI controllers

PATCH In review Andrew Lunn 2 participants 2 messages Aug 23, 2022 – Aug 29, 2022 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 schemas: pci-bus: make reg optional for Marvell PCI controllers

Marvell devices have PCE endpoints, but no PCI controller. The driver provides an emulated PCI controller. As such, it does not have a reg property.

---

I've not posted the conversion of the Marvell PCI driver from .txt to .yaml yet. When i do, i will need something like this.

dtschema/schemas/pci/pci-bus.yaml | 15 ++++++++++++++-

 1 file changed, 14 insertions(+), 1 deletion(-)
dtschema/schemas/pci/pci-bus.yaml +14 -1
index 31bc1b9..0481bf6 100644
@@ -178,10 +178,23 @@ patternProperties:
 required:
   - device_type
   - ranges
-  - reg
   - "#address-cells"
   - "#size-cells"
 
+if:
+  not:
+    properties:
+      compatible:
+        contains:
+          enum:
+            - marvell,armada-370-pcie
+            - marvell,armada-xp-pcie
+            - marvell,dove-pcie
+            - marvell,kirkwood-pcie
+then:
+  required:
+    - reg
+
 dependentRequired:
   msi-map-mask: [ msi-map ]
 
Signature · 1 line
2.37.2

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 20 lines · Andrew Lunn

Marvell devices have PCE endpoints, but no PCI controller. The driver provides an emulated PCI controller. As such, it does not have a reg property.

---

I've not posted the conversion of the Marvell PCI driver from .txt to .yaml yet. When i do, i will need something like this.

dtschema/schemas/pci/pci-bus.yaml | 15 ++++++++++++++-

 1 file changed, 14 insertions(+), 1 deletion(-)
dtschema/schemas/pci/pci-bus.yaml +0 -0
index 31bc1b9..0481bf6 100644
@@ -178,10 +178,23 @@ patternProperties:
 required:

dtschema/schemas/pci/pci-bus.yaml patternProperties: · line 187

Quoted 10 lines
dtschema/schemas/pci/pci-bus.yaml +4 -1
   - device_type
   - ranges
-  - reg
   - "#address-cells"
   - "#size-cells"
 
+if:
+  not:
+    properties:
+      compatible:

This will also be true if compatible is not present which makes the 'if' false.

I think I'd just skip all this and just drop reg as required. There's pending work to split pci-bus.yaml into host bridge,PCI-to-PCI bridge, and PCI device schemas, so we can make it required for PCI devices and bridges, but not host bridges which I think would work for you.

Quoted 16 lines
dtschema/schemas/pci/pci-bus.yaml +10 -1
+        contains:
+          enum:
+            - marvell,armada-370-pcie
+            - marvell,armada-xp-pcie
+            - marvell,dove-pcie
+            - marvell,kirkwood-pcie
+then:
+  required:
+    - reg
+
 dependentRequired:
   msi-map-mask: [ msi-map ]
 
--

2.37.2