Skip to contentSkip to conversation

Add Bitstream configuration support for Versal

PATCH Superseded Nava kishore Manne 4 participants 11 messages Apr 29, 2021 – May 12, 2021

Subsystems (3)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add Bitstream configuration support for Versal

This series Adds FPGA manager driver support for Xilinx Versal SoC. it uses the firmware interface to configure the programmable logic.

Changes for v4:
-Rebase the patch series on linux-next.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

Appana Durga Kedareswara rao (1):
dt-bindings: fpga: Add binding doc for versal fpga manager

Nava kishore Manne (3):
dt-bindings: firmware: Add bindings for xilinx firmware
drivers: firmware: Add PDI load API support
fpga: versal-fpga: Add versal fpga manager driver

 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml |  63 ++++++++++
 .../bindings/fpga/xlnx,versal-fpga.yaml       |  33 +++++
 drivers/firmware/xilinx/zynqmp.c              |  17 +++
 drivers/fpga/Kconfig                          |   9 ++
 drivers/fpga/Makefile                         |   1 +
 drivers/fpga/versal-fpga.c                    | 117 ++++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h          |  10 ++
 7 files changed, 250 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
 create mode 100644 Documentation/devicetree/bindings/fpga/xlnx,versal-fpga.yaml
 create mode 100644 drivers/fpga/versal-fpga.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH v4 1/4 dt-bindings: firmware: Add bindings for xilinx firmware

Add documentation to describe Xilinx firmware driver bindings. Firmware driver provides an interface to firmware APIs. Interface APIs can be used by any driver to communicate to Platform Management Unit.

---
Changes for v4:
-Added new yaml file for xilinx firmware
as suggested by Rob.

 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml new file +63 -0
new file mode 100644
index 000000000000..4b97f005bed7
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware/xilinx/xlnx,zynqmp-firmware.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Xilinx firmware driver
+
+maintainers:
+  - Nava kishore Manne <[email protected]>
+
+description:
+  The zynqmp-firmware node describes the interface to platform firmware.
+  ZynqMP has an interface to communicate with secure firmware. Firmware
+  driver provides an interface to firmware APIs. Interface APIs can be
+  used by any driver to communicate to PMUFW(Platform Management Unit).
+  These requests include clock management, pin control, device control,
+  power management service, FPGA service and other platform management
+  services.
+
+properties:
+  compatible:
+    oneOf:
+      - description:
+          For implementations complying for Zynq Ultrascale+ MPSoC.
+        const: xlnx,zynqmp-firmware
+
+      - description:
+          For implementations complying for Versal.
+        const: xlnx,versal-firmware
+
+  method:
+    description: The method of calling the PM-API firmware layer.
+                #  Permitted values are:
+                #  - "smc" : SMC #0, following the SMCCC
+                #  - "hvc" : HVC #0, following the SMCCC
+    $ref: /schemas/types.yaml#/definitions/string-array
+    enum:
+      - smc
+      - hvc
+
+patternProperties:
+  "fpga":
+    description: Compatible of the FPGA device.
+    type: object
+
+    required:
+      - compatible
+
+required:
+  - compatible
+
+examples:
+  - |
+    versal-firmware {
+      compatible = "xlnx,versal-firmware";
+      method = "smc";
+      fpga {
+        compatible = "xlnx,versal-fpga";
+      };
+    };
+
+additionalProperties: false
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH v4 1/4] dt-bindings: firmware: Add bindings for xilinx firmware

Quoted 6 lines · Nava kishore Manne

Add documentation to describe Xilinx firmware driver bindings. Firmware driver provides an interface to firmware APIs. Interface APIs can be used by any driver to communicate to Platform Management Unit.

Quoted 9 lines

---
Changes for v4:
-Added new yaml file for xilinx firmware
as suggested by Rob.

 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.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:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/clock/xlnx,versal-clk.example.dt.yaml: zynqmp-firmware: 'clock-controller' does not match any of the regexes: 'fpga', 'pinctrl-[0-9]+'
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/crypto/xlnx,zynqmp-aes.example.dt.yaml: zynqmp-firmware: 'zynqmp-aes' does not match any of the regexes: 'fpga', 'pinctrl-[0-9]+'
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.example.dt.yaml:0:0: /example-0/versal-firmware/fpga: failed to match any schema with compatible: ['xlnx,versal-fpga']

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

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.

maintainer
#3 lore raw

Re: [PATCH v4 1/4] dt-bindings: firmware: Add bindings for xilinx firmware

In reply to Nava kishore Manne
Quoted 6 lines · Nava kishore Manne

Add documentation to describe Xilinx firmware driver bindings. Firmware driver provides an interface to firmware APIs. Interface APIs can be used by any driver to communicate to Platform Management Unit.

Quoted 8 lines

---
Changes for v4:
-Added new yaml file for xilinx firmware
as suggested by Rob.

 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml

What about the old doc?:

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.txt

Quoted 33 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml new file +26 -0
new file mode 100644
index 000000000000..4b97f005bed7
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/firmware/xilinx/xlnx,zynqmp-firmware.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Xilinx firmware driver
+
+maintainers:
+  - Nava kishore Manne <[email protected]>
+
+description:
+  The zynqmp-firmware node describes the interface to platform firmware.
+  ZynqMP has an interface to communicate with secure firmware. Firmware
+  driver provides an interface to firmware APIs. Interface APIs can be
+  used by any driver to communicate to PMUFW(Platform Management Unit).
+  These requests include clock management, pin control, device control,
+  power management service, FPGA service and other platform management
+  services.
+
+properties:
+  compatible:
+    oneOf:
+      - description:
+          For implementations complying for Zynq Ultrascale+ MPSoC.
+        const: xlnx,zynqmp-firmware

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml line 36

Quoted 10 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml new file +10 -0
+
+      - description:
+          For implementations complying for Versal.
+        const: xlnx,versal-firmware
+
+  method:
+    description: The method of calling the PM-API firmware layer.
+                #  Permitted values are:
+                #  - "smc" : SMC #0, following the SMCCC
+                #  - "hvc" : HVC #0, following the SMCCC

Drop the '#'. If you want to maintain the formatting, then use '|' after 'description:' for a literal block.

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml line 43

Quoted 7 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml new file +7 -0
+    $ref: /schemas/types.yaml#/definitions/string-array
+    enum:
+      - smc
+      - hvc
+
+patternProperties:
+  "fpga":

So 'foofpgabar' is valid?

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml line 48

Quoted 5 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml new file +5 -0
+    description: Compatible of the FPGA device.
+    type: object
+
+    required:
+      - compatible

This belongs in the fpga schema which should have a $ref here. (Which means this patch needs to come 2nd.)

Quoted 18 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml new file +15 -0
+
+required:
+  - compatible
+
+examples:
+  - |
+    versal-firmware {
+      compatible = "xlnx,versal-firmware";
+      method = "smc";
+      fpga {
+        compatible = "xlnx,versal-fpga";
+      };
+    };
+
+additionalProperties: false
Signature · 1 line
2.17.1
#4 lore raw

RE: [PATCH v4 1/4] dt-bindings: firmware: Add bindings for xilinx firmware

Hi Rob,

Please find my response inline.

Quoted 32 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Saturday, May 1, 2021 1:10 AM
To: Nava kishore Manne <[email protected]>
Cc: Michal Simek <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Rajan Vaja <[email protected]>; Amit Sunil Dhamne <[email protected]>; Manish Narani <[email protected]>; [email protected]; Sai Krishna Potthuri <[email protected]>; [email protected]; Jiaying Liang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH v4 1/4] dt-bindings: firmware: Add bindings for xilinx firmware

Quoted 11 lines · Nava kishore Manne

Add documentation to describe Xilinx firmware driver bindings. Firmware driver provides an interface to firmware APIs. Interface APIs can be used by any driver to communicate to Platform Management Unit.

---
Changes for v4:
-Added new yaml file for xilinx firmware
as suggested by Rob.

Quoted 5 lines
 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml | 63
+++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-

Quoted 5 lines

firmware

Quoted 1 line

.yaml

What about the old doc?:

As you suggested i have added only the fpga node relevant info here so it's not representing the complete firmware file with other sub node like clk, Aes, ...etc. Once it completely mature we can deprecate the Old doc.

Quoted 55 lines

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp- firmware.txt

Quoted 3 lines

diff --git a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-

firmwa

Quoted 2 lines

re.yaml b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-

firmwa

Quoted 11 lines

re.yaml
new file mode 100644
index 000000000000..4b97f005bed7

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi new file +5 -0
+++ rmware.yaml
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2
+---
+$id:
+http://devicetree.org/schemas/firmware/xilinx/xlnx,zynqmp-firmware.ya

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi line 14

Quoted 10 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi new file +10 -0
+ml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Xilinx firmware driver
+
+maintainers:
+  - Nava kishore Manne <[email protected]>
+
+description:
+  The zynqmp-firmware node describes the interface to platform

firmware.

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi line 19

Quoted 5 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi new file +5 -0
+  ZynqMP has an interface to communicate with secure firmware.
+Firmware
+  driver provides an interface to firmware APIs. Interface APIs can
+be
+  used by any driver to communicate to PMUFW(Platform Management

Unit).

Quoted 17 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi new file +17 -0
+  These requests include clock management, pin control, device
+control,
+  power management service, FPGA service and other platform
+management
+  services.
+
+properties:
+  compatible:
+    oneOf:
+      - description:
+          For implementations complying for Zynq Ultrascale+ MPSoC.
+        const: xlnx,zynqmp-firmware
+
+      - description:
+          For implementations complying for Versal.
+        const: xlnx,versal-firmware
+
Quoted 9 lines

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi line 41

Quoted 5 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi new file +5 -0
+  method:
+    description: The method of calling the PM-API firmware layer.
+                #  Permitted values are:
+                #  - "smc" : SMC #0, following the SMCCC
+                #  - "hvc" : HVC #0, following the SMCCC

Drop the '#'. If you want to maintain the formatting, then use '|' after 'description:' for a literal block.

Will fix in v5.

Quoted 10 lines

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi line 48

Quoted 7 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi new file +7 -0
+    $ref: /schemas/types.yaml#/definitions/string-array
+    enum:
+      - smc
+      - hvc
+
+patternProperties:
+  "fpga":

So 'foofpgabar' is valid?

Yes, it's a valid for fpga node.

Quoted 9 lines

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi line 53

Quoted 5 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi new file +5 -0
+    description: Compatible of the FPGA device.
+    type: object
+
+    required:
+      - compatible

This belongs in the fpga schema which should have a $ref here. (Which means this patch needs to come 2nd.)

Will fix in v5.

Regards,
Navakishore.

maintainer
#5 lore raw

Re: [PATCH v4 1/4] dt-bindings: firmware: Add bindings for xilinx firmware

Quoted 124 lines · Nava kishore Manne

Hi Rob,

Please find my response inline.

Quoted 32 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Saturday, May 1, 2021 1:10 AM
To: Nava kishore Manne <[email protected]>
Cc: Michal Simek <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Rajan Vaja <[email protected]>; Amit Sunil Dhamne <[email protected]>; Manish Narani <[email protected]>; [email protected]; Sai Krishna Potthuri <[email protected]>; [email protected]; Jiaying Liang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH v4 1/4] dt-bindings: firmware: Add bindings for xilinx firmware

Quoted 11 lines · Nava kishore Manne

Add documentation to describe Xilinx firmware driver bindings. Firmware driver provides an interface to firmware APIs. Interface APIs can be used by any driver to communicate to Platform Management Unit.

---
Changes for v4:
-Added new yaml file for xilinx firmware
as suggested by Rob.

Quoted 5 lines
 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml | 63
+++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-

Quoted 5 lines

firmware

Quoted 1 line

.yaml

What about the old doc?:

As you suggested i have added only the fpga node relevant info here so it's not representing the complete firmware file with other sub node like clk, Aes, ...etc. Once it completely mature we can deprecate the Old doc.

Quoted 55 lines

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp- firmware.txt

Quoted 3 lines

diff --git a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-

firmwa

Quoted 2 lines

re.yaml b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-

firmwa

Quoted 11 lines

re.yaml
new file mode 100644
index 000000000000..4b97f005bed7

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi new file +5 -0
+++ rmware.yaml
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2
+---
+$id:
+http://devicetree.org/schemas/firmware/xilinx/xlnx,zynqmp-firmware.ya

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi line 14

Quoted 10 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi new file +10 -0
+ml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Xilinx firmware driver
+
+maintainers:
+  - Nava kishore Manne <[email protected]>
+
+description:
+  The zynqmp-firmware node describes the interface to platform

firmware.

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi line 19

Quoted 5 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi new file +5 -0
+  ZynqMP has an interface to communicate with secure firmware.
+Firmware
+  driver provides an interface to firmware APIs. Interface APIs can
+be
+  used by any driver to communicate to PMUFW(Platform Management

Unit).

Quoted 17 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi new file +17 -0
+  These requests include clock management, pin control, device
+control,
+  power management service, FPGA service and other platform
+management
+  services.
+
+properties:
+  compatible:
+    oneOf:
+      - description:
+          For implementations complying for Zynq Ultrascale+ MPSoC.
+        const: xlnx,zynqmp-firmware
+
+      - description:
+          For implementations complying for Versal.
+        const: xlnx,versal-firmware
+
Quoted 9 lines

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi line 41

Quoted 5 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi new file +5 -0
+  method:
+    description: The method of calling the PM-API firmware layer.
+                #  Permitted values are:
+                #  - "smc" : SMC #0, following the SMCCC
+                #  - "hvc" : HVC #0, following the SMCCC

Drop the '#'. If you want to maintain the formatting, then use '|' after 'description:' for a literal block.

Will fix in v5.

Quoted 10 lines

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi line 48

Quoted 7 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi new file +7 -0
+    $ref: /schemas/types.yaml#/definitions/string-array
+    enum:
+      - smc
+      - hvc
+
+patternProperties:
+  "fpga":

So 'foofpgabar' is valid?

Quoted 1 line

Yes, it's a valid for fpga node.

No, please make the node name more specific.

Rob

#6 lore raw

RE: [PATCH v4 1/4] dt-bindings: firmware: Add bindings for xilinx firmware

Hi Rob,

Please find my response inline.

Quoted 149 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Tuesday, May 4, 2021 7:11 PM
To: Nava kishore Manne <[email protected]>
Cc: Michal Simek <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Rajan Vaja <[email protected]>; Amit Sunil Dhamne <[email protected]>; Manish Narani <[email protected]>; [email protected]; Sai Krishna Potthuri <[email protected]>; [email protected]; Jiaying Liang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH v4 1/4] dt-bindings: firmware: Add bindings for xilinx firmware

Quoted 39 lines · Nava kishore Manne

Hi Rob,

Please find my response inline.

Quoted 34 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Saturday, May 1, 2021 1:10 AM
To: Nava kishore Manne <[email protected]>
Cc: Michal Simek <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Rajan Vaja <[email protected]>; Amit Sunil Dhamne <[email protected]>; Manish Narani <[email protected]>; [email protected]; Sai Krishna Potthuri <[email protected]>; [email protected]; Jiaying Liang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH v4 1/4] dt-bindings: firmware: Add bindings for xilinx firmware

Quoted 16 lines · Nava kishore Manne

Add documentation to describe Xilinx firmware driver bindings. Firmware driver provides an interface to firmware APIs. Interface APIs can be used by any driver to communicate to Platform Management Unit.

---
Changes for v4:
-Added new yaml file for xilinx firmware
as suggested by Rob.

 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml | 63
+++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-

Quoted 7 lines
Quoted 5 lines

firmware

Quoted 1 line

.yaml

What about the old doc?:

As you suggested i have added only the fpga node relevant info here so it's

not representing the complete firmware file with other sub node like clk, Aes, ...etc.

Quoted 37 lines

Once it completely mature we can deprecate the Old doc.

Quoted 35 lines

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp- firmware.txt

Quoted 3 lines

diff --git a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-

firmwa

Quoted 2 lines

re.yaml b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-

firmwa

Quoted 14 lines

re.yaml
new file mode 100644
index 000000000000..4b97f005bed7

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqm new file +8 -0
+++ p-fi
+++ rmware.yaml
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML
+1.2
+---
+$id:
+http://devicetree.org/schemas/firmware/xilinx/xlnx,zynqmp-firmwar
+e.ya

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqm line 16

Quoted 10 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqm new file +10 -0
+ml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Xilinx firmware driver
+
+maintainers:
+  - Nava kishore Manne <[email protected]>
+
+description:
+  The zynqmp-firmware node describes the interface to platform

firmware.

Quoted 5 lines
Quoted 5 lines

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqm line 21

Quoted 5 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqm new file +5 -0
+  ZynqMP has an interface to communicate with secure firmware.
+Firmware
+  driver provides an interface to firmware APIs. Interface APIs
+can be
+  used by any driver to communicate to PMUFW(Platform

Management

Quoted 41 lines
Quoted 18 lines

Unit).

Quoted 17 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqm new file +17 -0
+  These requests include clock management, pin control, device
+control,
+  power management service, FPGA service and other platform
+management
+  services.
+
+properties:
+  compatible:
+    oneOf:
+      - description:
+          For implementations complying for Zynq Ultrascale+ MPSoC.
+        const: xlnx,zynqmp-firmware
+
+      - description:
+          For implementations complying for Versal.
+        const: xlnx,versal-firmware
+
Quoted 9 lines

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqm line 43

Quoted 5 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqm new file +5 -0
+  method:
+    description: The method of calling the PM-API firmware layer.
+                #  Permitted values are:
+                #  - "smc" : SMC #0, following the SMCCC
+                #  - "hvc" : HVC #0, following the SMCCC

Drop the '#'. If you want to maintain the formatting, then use '|' after 'description:' for a literal block.

Will fix in v5.

Quoted 10 lines

Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqm line 50

Quoted 7 lines
Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqm new file +7 -0
+    $ref: /schemas/types.yaml#/definitions/string-array
+    enum:
+      - smc
+      - hvc
+
+patternProperties:
+  "fpga":

So 'foofpgabar' is valid?

Quoted 4 lines
Quoted 1 line

Yes, it's a valid for fpga node.

No, please make the node name more specific.

Will fix in v5.

Regards,
Navakishore.

#7 lore raw

PATCH v4 2/4 drivers: firmware: Add PDI load API support

In reply to Nava kishore Manne

This patch adds load PDI API support to enable full/partial PDI loading from linux. Programmable Device Image (PDI) is combination of headers, images and bitstream files to be loaded.

---
Changes for v2:
-Updated API Doc and commit msg.
No functional changes.
Changes for v3:

                -None.

Changes for v4:
-Rebased the changes on linux-next.
No functional changes

 drivers/firmware/xilinx/zynqmp.c     | 17 +++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h | 10 ++++++++++
 2 files changed, 27 insertions(+)
drivers/firmware/xilinx/zynqmp.c +17 -0
index 15b138326ecc..2db571da9ad8 100644
@@ -1011,6 +1011,23 @@ int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities,
 }
 EXPORT_SYMBOL_GPL(zynqmp_pm_set_requirement);
 
+/**
+ * zynqmp_pm_load_pdi - Load and process PDI
+ * @src:       Source device where PDI is located
+ * @address:   PDI src address
+ *
+ * This function provides support to load PDI from linux
+ *
+ * Return: Returns status, either success or error+reason
+ */
+int zynqmp_pm_load_pdi(const u32 src, const u64 address)
+{
+	return zynqmp_pm_invoke_fn(PM_LOAD_PDI, src,
+				   lower_32_bits(address),
+				   upper_32_bits(address), 0, NULL);
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_load_pdi);
+
 /**
  * zynqmp_pm_aes - Access AES hardware to encrypt/decrypt the data using
  * AES-GCM core.
include/linux/firmware/xlnx-zynqmp.h +10 -0
index 9d1a5c175065..56b426fe020c 100644
@@ -52,6 +52,10 @@
 #define	ZYNQMP_PM_CAPABILITY_WAKEUP	0x4U
 #define	ZYNQMP_PM_CAPABILITY_UNUSABLE	0x8U
 
+/* Loader commands */
+#define PM_LOAD_PDI	0x701
+#define PDI_SRC_DDR	0xF
+
 /*
  * Firmware FPGA Manager flags
  * XILINX_ZYNQMP_PM_FPGA_FULL:	FPGA full reconfiguration
@@ -411,6 +415,7 @@ int zynqmp_pm_pinctrl_get_config(const u32 pin, const u32 param,
 				 u32 *value);
 int zynqmp_pm_pinctrl_set_config(const u32 pin, const u32 param,
 				 u32 value);
+int zynqmp_pm_load_pdi(const u32 src, const u64 address);
 #else
 static inline int zynqmp_pm_get_api_version(u32 *version)
 {
@@ -622,6 +627,11 @@ static inline int zynqmp_pm_pinctrl_set_config(const u32 pin, const u32 param,
 {
 	return -ENODEV;
 }
+
+static inline int zynqmp_pm_load_pdi(const u32 src, const u64 address)
+{
+	return -ENODEV;
+}
 #endif
 
 #endif /* __FIRMWARE_ZYNQMP_H__ */
Signature · 1 line
2.17.1
#8 lore raw

PATCH v4 3/4 dt-bindings: fpga: Add binding doc for versal fpga manager

In reply to Nava kishore Manne

From: Appana Durga Kedareswara rao <[email protected]>

This patch adds binding doc for versal fpga manager driver.

---
Changes for v2:
-Fixed file format and syntax issues.
Changes for v3:
-Removed unwated extra spaces.
Changes for v4:
-Rebased the changes on linux-next.
No functional changes

 .../bindings/fpga/xlnx,versal-fpga.yaml       | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/fpga/xlnx,versal-fpga.yaml
Documentation/devicetree/bindings/fpga/xlnx,versal-fpga.yaml new file +33 -0
new file mode 100644
index 000000000000..fec6144766fe
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/fpga/xlnx,versal-fpga.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Xilinx Versal FPGA driver.
+
+maintainers:
+  - Nava kishore Manne <[email protected]>
+
+description: |
+  Device Tree Versal FPGA bindings for the Versal SoC, controlled
+  using firmware interface.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - xlnx,versal-fpga
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    versal_fpga: fpga {
+         compatible = "xlnx,versal-fpga";
+    };
+
+...
Signature · 1 line
2.17.1
#9 lore raw

PATCH v4 4/4 fpga: versal-fpga: Add versal fpga manager driver

In reply to Nava kishore Manne

Add support for Xilinx Versal FPGA manager.

PDI source type can be DDR, OCM, QSPI flash etc..
But driver allocates memory always from DDR, Since driver supports only DDR source type.

---
Changes for v2:
-Updated the Fpga Mgr registrations call's
to 5.11
-Fixed some minor coding issues as suggested by
Moritz.
Changes for v3:
-Rewritten the Versal fpga Kconfig contents.
Changes for v4:
-Rebased the changes on linux-next.
No functional changes.

 drivers/fpga/Kconfig       |   9 +++
 drivers/fpga/Makefile      |   1 +
 drivers/fpga/versal-fpga.c | 117 +++++++++++++++++++++++++++++++++++++
 3 files changed, 127 insertions(+)
 create mode 100644 drivers/fpga/versal-fpga.c
drivers/fpga/Kconfig +9 -0
index 33e15058d0dc..92c20b92357a 100644
@@ -234,4 +234,13 @@ config FPGA_MGR_ZYNQMP_FPGA
 	  to configure the programmable logic(PL) through PS
 	  on ZynqMP SoC.
 
+config FPGA_MGR_VERSAL_FPGA
+	tristate "Xilinx Versal FPGA"
+	depends on ARCH_ZYNQMP || COMPILE_TEST
+	help
+	  Select this option to enable FPGA manager driver support for
+	  Xilinx Versal SoC. This driver uses the firmware interface to
+	  configure the programmable logic(PL).
+
+	  To compile this as a module, choose M here.
 endif # FPGA
drivers/fpga/Makefile +1 -0
index 18dc9885883a..0bff783d1b61 100644
@@ -18,6 +18,7 @@ obj-$(CONFIG_FPGA_MGR_TS73XX)		+= ts73xx-fpga.o
 obj-$(CONFIG_FPGA_MGR_XILINX_SPI)	+= xilinx-spi.o
 obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA)	+= zynq-fpga.o
 obj-$(CONFIG_FPGA_MGR_ZYNQMP_FPGA)	+= zynqmp-fpga.o
+obj-$(CONFIG_FPGA_MGR_VERSAL_FPGA)      += versal-fpga.o
 obj-$(CONFIG_ALTERA_PR_IP_CORE)         += altera-pr-ip-core.o
 obj-$(CONFIG_ALTERA_PR_IP_CORE_PLAT)    += altera-pr-ip-core-plat.o
 
drivers/fpga/versal-fpga.c new file +117 -0

117 lines not on this page · raw message

Signature · 1 line
2.17.1
maintainer
#10 lore raw
In reply to Nava kishore Manne

Hi,

Quoted 15 lines · Nava kishore Manne

This series Adds FPGA manager driver support for Xilinx Versal SoC. it uses the firmware interface to configure the programmable logic.

Changes for v4:
-Rebase the patch series on linux-next.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

Appana Durga Kedareswara rao (1):
dt-bindings: fpga: Add binding doc for versal fpga manager

Nava kishore Manne (3):
dt-bindings: firmware: Add bindings for xilinx firmware
drivers: firmware: Add PDI load API support
fpga: versal-fpga: Add versal fpga manager driver

Quoted 15 lines
 .../firmware/xilinx/xlnx,zynqmp-firmware.yaml |  63 ++++++++++
 .../bindings/fpga/xlnx,versal-fpga.yaml       |  33 +++++
 drivers/firmware/xilinx/zynqmp.c              |  17 +++
 drivers/fpga/Kconfig                          |   9 ++
 drivers/fpga/Makefile                         |   1 +
 drivers/fpga/versal-fpga.c                    | 117 ++++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h          |  10 ++
 7 files changed, 250 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware.yaml
 create mode 100644 Documentation/devicetree/bindings/fpga/xlnx,versal-fpga.yaml
 create mode 100644 drivers/fpga/versal-fpga.c
Signature · 1 line
2.17.1

Series looks good, will wait for Rob's Acks on the DT part.

Thanks,
Moritz