linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Update firmware dt-binding
@ 2025-12-12 10:05 Ronak Jain
  2025-12-12 10:05 ` [PATCH v2 1/2] dt-bindings: firmware: xilinx: Add xlnx,zynqmp-firmware compatible Ronak Jain
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ronak Jain @ 2025-12-12 10:05 UTC (permalink / raw)
  To: robh, krzk+dt, conor+dt, michal.simek, nava.kishore.manne
  Cc: devicetree, linux-arm-kernel, linux-kernel, Ronak Jain

The patch fixes/enhances below problems,
    1. Add missing compatible property under the example section for
    zynqmp_firmware node.
    2. Add conditional pinctrl schema

Changes in v2:
- Added acked-by signature in patch #1
- Following up on the queries again in patch #2. No code changes in
the patch itself
- Dropped off patch #3

Ronak Jain (2):
  dt-bindings: firmware: xilinx: Add xlnx,zynqmp-firmware compatible
  dt-bindings: firmware: xilinx: Add conditional pinctrl schema

 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml | 21 ++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

-- 
2.34.1



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

* [PATCH v2 1/2] dt-bindings: firmware: xilinx: Add xlnx,zynqmp-firmware compatible
  2025-12-12 10:05 [PATCH v2 0/2] Update firmware dt-binding Ronak Jain
@ 2025-12-12 10:05 ` Ronak Jain
  2025-12-12 10:05 ` [PATCH v2 2/2] dt-bindings: firmware: xilinx: Add conditional pinctrl schema Ronak Jain
  2025-12-16 22:28 ` [PATCH v2 0/2] Update firmware dt-binding Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Ronak Jain @ 2025-12-12 10:05 UTC (permalink / raw)
  To: robh, krzk+dt, conor+dt, michal.simek, nava.kishore.manne
  Cc: devicetree, linux-arm-kernel, linux-kernel, Ronak Jain

The absence of a compatible property caused dt_binding_check to skip
the zynqmp_firmware node.

To address this, add "xlnx,zynqmp-firmware" to the compatible property
in the example section for the zynqmp_firmware node.

Signed-off-by: Ronak Jain <ronak.jain@amd.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
---
Changes in v2:
- Added acked-by signature
- No functional changes
---
 .../bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml           | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
index bd413b6aeaf4..7020eeeb4ec0 100644
--- a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
+++ b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
@@ -124,6 +124,7 @@ examples:
     #include <dt-bindings/power/xlnx-zynqmp-power.h>
     firmware {
       zynqmp_firmware: zynqmp-firmware {
+        compatible = "xlnx,zynqmp-firmware";
         #power-domain-cells = <1>;
         soc-nvmem {
           compatible = "xlnx,zynqmp-nvmem-fw";
-- 
2.34.1



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

* [PATCH v2 2/2] dt-bindings: firmware: xilinx: Add conditional pinctrl schema
  2025-12-12 10:05 [PATCH v2 0/2] Update firmware dt-binding Ronak Jain
  2025-12-12 10:05 ` [PATCH v2 1/2] dt-bindings: firmware: xilinx: Add xlnx,zynqmp-firmware compatible Ronak Jain
@ 2025-12-12 10:05 ` Ronak Jain
  2025-12-16 22:35   ` Rob Herring
  2025-12-16 22:28 ` [PATCH v2 0/2] Update firmware dt-binding Rob Herring
  2 siblings, 1 reply; 5+ messages in thread
From: Ronak Jain @ 2025-12-12 10:05 UTC (permalink / raw)
  To: robh, krzk+dt, conor+dt, michal.simek, nava.kishore.manne
  Cc: devicetree, linux-arm-kernel, linux-kernel, Ronak Jain

Updates the Device Tree bindings for Xilinx firmware by introducing
conditional schema references for the pinctrl node.

Previously, the pinctrl node directly referenced
xlnx,zynqmp-pinctrl.yaml. However, this patch modifies the schema to
conditionally apply the correct pinctrl schema based on the compatible
property. Specifically:
- If compatible contains "xlnx,zynqmp-pinctrl", reference
  xlnx,zynqmp-pinctrl.yaml.
- If compatible contains "xlnx,versal-pinctrl", reference
  xlnx,versal-pinctrl.yaml.

Additionally, an example entry for "xlnx,versal-pinctrl" has been
added under the examples section.

Signed-off-by: Ronak Jain <ronak.jain@amd.com>
---
Suggestion from Rob:

The somewhat preferred way to do this would be to do this in the top
level:

pinctrl:
  type: object
  additionalProperties: true
  properties:
    compatible:
      contains:
        enum:
          - xlnx,zynqmp-pinctrl
          - xlnx,versal-pinctrl
  required:
    - compatible

Otherwise, the pinctrl schema ends up being applied twice.


My response:

In your suggested code, the schema allows either xlnx,zynqmp-pinctrl
or xlnx,versal-pinctrl on any platform, which is incorrect. This
means that if a user mistakenly assigns xlnx,versal-pinctrl to a
ZynqMP platform or xlnx,zynqmp-pinctrl to a Versal platform, the
wrong reference will be used, but no error is reported. The
dt-binding check still passes instead of flagging this as an issue.

By using a conditional schema, we can enforce platform-specific
compatibility, ensuring that the correct compatible string is used
for the corresponding platform. This would also generate an error if
an incorrect compatible string is provided, preventing
misconfigurations.


Please review and let me know your thoughts.

---
 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml | 20 ++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
index 7020eeeb4ec0..c4a137f8e06e 100644
--- a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
+++ b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
@@ -79,7 +79,6 @@ properties:
     type: object
 
   pinctrl:
-    $ref: /schemas/pinctrl/xlnx,zynqmp-pinctrl.yaml#
     description: The pinctrl node provides access to pinconfig and pincontrol
       functionality available in firmware.
     type: object
@@ -114,6 +113,21 @@ properties:
     type: object
     deprecated: true
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: xlnx,zynqmp-firmware
+    then:
+      properties:
+        pinctrl:
+          $ref: /schemas/pinctrl/xlnx,zynqmp-pinctrl.yaml#
+    else:
+      properties:
+        pinctrl:
+          $ref: /schemas/pinctrl/xlnx,versal-pinctrl.yaml#
+
 required:
   - compatible
 
@@ -172,6 +186,10 @@ examples:
         compatible = "xlnx,versal-fpga";
       };
 
+      pinctrl {
+        compatible = "xlnx,versal-pinctrl";
+      };
+
       xlnx_aes: zynqmp-aes {
         compatible = "xlnx,zynqmp-aes";
       };
-- 
2.34.1



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

* Re: [PATCH v2 0/2] Update firmware dt-binding
  2025-12-12 10:05 [PATCH v2 0/2] Update firmware dt-binding Ronak Jain
  2025-12-12 10:05 ` [PATCH v2 1/2] dt-bindings: firmware: xilinx: Add xlnx,zynqmp-firmware compatible Ronak Jain
  2025-12-12 10:05 ` [PATCH v2 2/2] dt-bindings: firmware: xilinx: Add conditional pinctrl schema Ronak Jain
@ 2025-12-16 22:28 ` Rob Herring
  2 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2025-12-16 22:28 UTC (permalink / raw)
  To: Ronak Jain
  Cc: krzk+dt, conor+dt, michal.simek, nava.kishore.manne, devicetree,
	linux-arm-kernel, linux-kernel

On Fri, Dec 12, 2025 at 02:05:40AM -0800, Ronak Jain wrote:
> The patch fixes/enhances below problems,
>     1. Add missing compatible property under the example section for
>     zynqmp_firmware node.
>     2. Add conditional pinctrl schema
> 
> Changes in v2:
> - Added acked-by signature in patch #1
> - Following up on the queries again in patch #2. No code changes in
> the patch itself
> - Dropped off patch #3
> 
> Ronak Jain (2):
>   dt-bindings: firmware: xilinx: Add xlnx,zynqmp-firmware compatible
>   dt-bindings: firmware: xilinx: Add conditional pinctrl schema

Applied, thanks.

Rob


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

* Re: [PATCH v2 2/2] dt-bindings: firmware: xilinx: Add conditional pinctrl schema
  2025-12-12 10:05 ` [PATCH v2 2/2] dt-bindings: firmware: xilinx: Add conditional pinctrl schema Ronak Jain
@ 2025-12-16 22:35   ` Rob Herring
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2025-12-16 22:35 UTC (permalink / raw)
  To: Ronak Jain
  Cc: krzk+dt, conor+dt, michal.simek, nava.kishore.manne, devicetree,
	linux-arm-kernel, linux-kernel

On Fri, Dec 12, 2025 at 02:05:42AM -0800, Ronak Jain wrote:
> Updates the Device Tree bindings for Xilinx firmware by introducing
> conditional schema references for the pinctrl node.
> 
> Previously, the pinctrl node directly referenced
> xlnx,zynqmp-pinctrl.yaml. However, this patch modifies the schema to
> conditionally apply the correct pinctrl schema based on the compatible
> property. Specifically:
> - If compatible contains "xlnx,zynqmp-pinctrl", reference
>   xlnx,zynqmp-pinctrl.yaml.
> - If compatible contains "xlnx,versal-pinctrl", reference
>   xlnx,versal-pinctrl.yaml.
> 
> Additionally, an example entry for "xlnx,versal-pinctrl" has been
> added under the examples section.
> 
> Signed-off-by: Ronak Jain <ronak.jain@amd.com>
> ---
> Suggestion from Rob:
> 
> The somewhat preferred way to do this would be to do this in the top
> level:
> 
> pinctrl:
>   type: object
>   additionalProperties: true
>   properties:
>     compatible:
>       contains:
>         enum:
>           - xlnx,zynqmp-pinctrl
>           - xlnx,versal-pinctrl
>   required:
>     - compatible
> 
> Otherwise, the pinctrl schema ends up being applied twice.
> 
> 
> My response:
> 
> In your suggested code, the schema allows either xlnx,zynqmp-pinctrl
> or xlnx,versal-pinctrl on any platform, which is incorrect. This
> means that if a user mistakenly assigns xlnx,versal-pinctrl to a
> ZynqMP platform or xlnx,zynqmp-pinctrl to a Versal platform, the
> wrong reference will be used, but no error is reported. The
> dt-binding check still passes instead of flagging this as an issue.

True, but you can create a whole DT that's just random bindings from all 
sorts of different SoCs and the schema validation would be perfectly 
happy. We can't really ever check everything.

> By using a conditional schema, we can enforce platform-specific
> compatibility, ensuring that the correct compatible string is used
> for the corresponding platform. This would also generate an error if
> an incorrect compatible string is provided, preventing
> misconfigurations.

But what you have is fine too. It will validate the node twice as I 
pointed out and that slows things down some, but it's already slow...

Rob


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

end of thread, other threads:[~2025-12-16 22:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-12 10:05 [PATCH v2 0/2] Update firmware dt-binding Ronak Jain
2025-12-12 10:05 ` [PATCH v2 1/2] dt-bindings: firmware: xilinx: Add xlnx,zynqmp-firmware compatible Ronak Jain
2025-12-12 10:05 ` [PATCH v2 2/2] dt-bindings: firmware: xilinx: Add conditional pinctrl schema Ronak Jain
2025-12-16 22:35   ` Rob Herring
2025-12-16 22:28 ` [PATCH v2 0/2] Update firmware dt-binding 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).