dt-bindings: fpga: zynq: Document ICAP on boot
Subsystems (3)
PATCH 1/2 dt-bindings: fpga: zynq: Document ICAP on boot
From: Sam Winchenbach <[email protected]>
Documents the ability to enable the ICAP interface on boot.
--- .../devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml | 7 +++++++ 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml +7 -0
@@ -31,6 +31,13 @@ properties: description: Phandle to syscon block which provide access to SLCR registers + enable-icap-on-load: + type: boolean + description: If present, the ICAP controller will be enabled when + the driver probes. This is useful if the fabric is loaded + during the boot process and contains a core, such as the SEM, + that requires access to ICAP interface to operate properly. + required: - compatible - reg
Signature · 1 line
2.49.0
PATCH 2/2 fpga: zynq-fpga: Allow ICAP enable on probe
From: Sam Winchenbach <[email protected]>
Adds an option to enable the ICAP interface when driver is probed. This is useful when the fabric is loaded as part of the first or second stage of the boot process and contains an IP core that requires access to the ICAP interface, such as Soft Error Mitigation (SEM) core.
--- drivers/fpga/zynq-fpga.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/fpga/zynq-fpga.c +24 -2
@@ -20,6 +20,7 @@#include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/pm.h> +#include <linux/property.h> #include <linux/regmap.h> #include <linux/string.h> #include <linux/scatterlist.h>
@@ -482,8 +483,7 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr, struct sg_table *sgt)return err; } -static int zynq_fpga_ops_write_complete (struct fpga_manager *mgr, -struct fpga_image_info *info) +static int zynq_fpga_enable_icap (struct fpga_manager *mgr) {struct zynq_fpga_priv *priv = mgr->priv;int err;
@@ -504,6 +504,18 @@ static int zynq_fpga_ops_write_complete(struct fpga_manager *mgr,clk_disable (priv->clk); +return err; +} + +static int zynq_fpga_ops_write_complete (struct fpga_manager *mgr, +struct fpga_image_info *info) +{ +struct zynq_fpga_priv *priv = mgr->priv; +int err; +u32 intr_status; + + err =zynq_fpga_enable_icap (mgr); +if (err)return err;
@@ -615,6 +627,16 @@ static int zynq_fpga_probe(struct platform_device *pdev)platform_set_drvdata (pdev, mgr); +if (device_property_read_bool (dev,"enable-icap-on-load" )) { + err =zynq_fpga_enable_icap (mgr); +if (err) { +dev_err (dev,"unable to enable ICAP interface\n" ); +fpga_mgr_unregister (mgr); +clk_unprepare (priv->clk); +return err; + } + } +return 0 ; }
Signature · 1 line
2.49.0
Quoted 14 lines · Sam Winchenbach
From: Sam Winchenbach <[email protected]>
Documents the ability to enable the ICAP interface on boot.
Signed-off-by Sam Winchenbach <[email protected]>--- .../devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml +0
-0
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml properties: · line 34
Quoted 4 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml +1
-0@@ -31,6 +31,13 @@ properties: description: Phandle to syscon block which provide access to SLCR registers + enable-icap-on-load:
Missing vendor prefix.
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml properties: · line 38
Quoted 4 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml +4
-0+ type: boolean + description: If present, the ICAP controller will be enabled when + the driver probes. This is useful if the fabric is loaded + during the boot process and contains a core, such as the SEM,
I don't get how this is suitable for DT. If you decide to load the fabric from driver, that's driver decision so not DT.
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml properties: · line 43
Quoted 5 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml +2
-0+ that requires access to ICAP interface to operate properly. + required: - compatible - reg
Best regards,
Krzysztof
Quoted 18 lines · Krzysztof Kozlowski
Quoted 17 lines · Sam Winchenbach
From: Sam Winchenbach <[email protected]>
Documents the ability to enable the ICAP interface on boot.
Signed-off-by Sam Winchenbach <[email protected]>--- .../devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml +0
-0@@ -31,6 +31,13 @@ properties: description: Phandle to syscon block which provide access to SLCR registers
Quoted 3 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml properties: · line 34
Quoted 1 line
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml +1
-0+ enable-icap-on-load:Missing vendor prefix.
I will add this to a v2 patch, assuming we come to an agreement on the suitability of this approach.
Quoted 8 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml properties: · line 38
Quoted 5 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml +4
-0+ type: boolean + description: If present, the ICAP controller will be enabled when + the driver probes. This is useful if the fabric is loaded + during the boot process and contains a core, such as the SEM,I don't get how this is suitable for DT. If you decide to load the fabric from driver, that's driver decision so not DT.
Before writing the fabric to the FPGA the driver disables the ICAP, enabling the PCAP. Once writing is complete it unconditionally disables the PCAP, enabling the ICAP. This patch just makes it so, depending on the use case, the ICAP can be enabled at boot. This will not prevent the system from being able to load a fabric through the driver. I added in this boolean so existing behavior would be maintained.
Do you recommend another approach such as writing to a sysfs attribute to switch from PCAP to ICAP?
Quoted 10 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml properties: · line 43
Quoted 6 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml +2
-0+ that requires access to ICAP interface to operate properly. + required: - compatible - regBest regards,
Krzysztof
Quoted 16 lines · Sam Winchenbach
Quoted 8 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml properties: · line 38
Quoted 5 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml +4
-0+ type: boolean + description: If present, the ICAP controller will be enabled when + the driver probes. This is useful if the fabric is loaded + during the boot process and contains a core, such as the SEM,I don't get how this is suitable for DT. If you decide to load the fabric from driver, that's driver decision so not DT.
Before writing the fabric to the FPGA the driver disables the ICAP, enabling the PCAP. Once writing is complete it unconditionally disables the PCAP, enabling the ICAP. This patch just makes it so, depending on the use case, the ICAP can be enabled at boot. This will not prevent the system from being able to load a fabric through the driver. I added in this boolean so existing behavior would be maintained.
Quoted 2 lines
Do you recommend another approach such as writing to a sysfs attribute to switch from PCAP to ICAP?
Not sure yet. Can't you check the status of ICAP before programming and then enable it only if was enabled before?
Best regards,
Krzysztof
Quoted 17 lines · Krzysztof Kozlowski
Quoted 16 lines · Sam Winchenbach
Quoted 8 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml properties: · line 38
Quoted 5 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml +4
-0+ type: boolean + description: If present, the ICAP controller will be enabled when + the driver probes. This is useful if the fabric is loaded + during the boot process and contains a core, such as the SEM,I don't get how this is suitable for DT. If you decide to load the fabric from driver, that's driver decision so not DT.
Before writing the fabric to the FPGA the driver disables the ICAP, enabling the PCAP. Once writing is complete it unconditionally disables the PCAP, enabling the ICAP. This patch just makes it so, depending on the use case, the ICAP can be enabled at boot. This will not prevent the system from being able to load a fabric through the driver. I added in this boolean so existing behavior would be maintained.
Quoted 4 lines
Quoted 2 lines
Do you recommend another approach such as writing to a sysfs attribute to switch from PCAP to ICAP?
Not sure yet. Can't you check the status of ICAP before programming and then enable it only if was enabled before?
I am having a bit of difficulty understanding this so let's talk about cases where the ICAP is enabled/disabled -
1. When writing the fabric from the driver
In this situation it might make sense to read the state of the ICAP interface when preparing the fabric, before enabling PCAP. When the write completes you could re-enable the ICAP if it was previously enabled.
This might be outside the scope of this change - and I am not comfortable enough with this use-case to understand potential side effects from doing this. Logically it makes sense, but there may be a very specific reason that the ICAP must be enabled after doing a fabric load or partial reconfiguration.
2. When the FPGA driver loads and is probed by the DTS
In this situation, which is covered by this patch, the FPGA is loaded by BootROM/FSBL but contains functionality that requires the ICAP. Unless the user has made modifications to the FSBL or 3rd stage bootloader there is no clear way to enable the ICAP interface. Checking to see if it had been enabled prior to loading this driver does not (in my opinion) make a lot of sense here.
Perhaps the name of the DTS is confusing? The suffix '-on-load' was meant to indicate when the driver was loaded, not the fabric. Would the suffix '-on-probe' be more clear?
Let me know your thoughts,
-Sam
Quoted 3 lines
Best regards,
Krzysztof
Quoted 26 lines · Sam Winchenbach
Quoted 2 lines · Krzysztof Kozlowski
Not sure yet. Can't you check the status of ICAP before programming and then enable it only if was enabled before?
I am having a bit of difficulty understanding this so let's talk about cases where the ICAP is enabled/disabled -
1. When writing the fabric from the driver
In this situation it might make sense to read the state of the ICAP interface when preparing the fabric, before enabling PCAP. When the write completes you could re-enable the ICAP if it was previously enabled.This might be outside the scope of this change - and I am not comfortable enough with this use-case to understand potential side effects from doing this. Logically it makes sense, but there may be a very specific reason that the ICAP must be enabled after doing a fabric load or partial reconfiguration.
2. When the FPGA driver loads and is probed by the DTS
In this situation, which is covered by this patch, the FPGA is loaded by BootROM/FSBL but contains functionality that requires the ICAP. Unless the user has made modifications to the FSBL or 3rd stage bootloader there is no clear way to enable the ICAP interface. Checking to see if it had been enabled prior to loading this driver does not (in my opinion) make a lot of sense here.
Quoted 3 lines
Perhaps the name of the DTS is confusing? The suffix '-on-load' was meant to indicate when the driver was loaded, not the fabric. Would the suffix '-on-probe' be more clear?
Neither on-load nor on-probe, because again you instruct the OS what it should do. You should instead describe the hardware (or other parts of software stack). Describe the condition, the hardware feature, the characteristic observed. With proper phrasing the property should be fine, but I still do not see that its name and description match actual hardware.
Best regards,
Krzysztof
Quoted 34 lines · Sam Winchenbach
Quoted 11 lines
Quoted 9 lines
Before writing the fabric to the FPGA the driver disables the ICAP, enabling the PCAP. Once writing is complete it unconditionally disables the PCAP, enabling the ICAP. This patch just makes it so, depending on the use case, the ICAP can be enabled at boot. This will not prevent the system from being able to load a fabric through the driver. I added in this boolean so existing behavior would be maintained.
Do you recommend another approach such as writing to a sysfs attribute to switch from PCAP to ICAP?
Not sure yet. Can't you check the status of ICAP before programming and then enable it only if was enabled before?
I am having a bit of difficulty understanding this so let's talk about cases where the ICAP is enabled/disabled -
1. When writing the fabric from the driver
In this situation it might make sense to read the state of the ICAP interface when preparing the fabric, before enabling PCAP. When the write completes you could re-enable the ICAP if it was previously enabled.This might be outside the scope of this change - and I am not comfortable enough with this use-case to understand potential side effects from doing this. Logically it makes sense, but there may be a very specific reason that the ICAP must be enabled after doing a fabric load or partial reconfiguration.
2. When the FPGA driver loads and is probed by the DTS
In this situation, which is covered by this patch, the FPGA is loaded by BootROM/FSBL but contains functionality that requires the ICAP. Unless the user has made modifications to the FSBL or 3rd stage bootloader there is no clear way to enable the ICAP interface. Checking to see if it had been enabled prior to loading this driver does not (in my opinion) make a lot of sense here.
Quoted 3 lines
Perhaps the name of the DTS is confusing? The suffix '-on-load' was meant to indicate when the driver was loaded, not the fabric. Would the suffix '-on-probe' be more clear?
None of these two, because you refer to software. Property is fine but you need to describe the actual state of hardware or system or entire stack, e.g. "fpga-with-sem".
Best regards,
Krzysztof
Quoted 37 lines · Sam Winchenbach
Quoted 17 lines · Krzysztof Kozlowski
Quoted 16 lines · Sam Winchenbach
Quoted 8 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml properties: · line 38
Quoted 5 lines
Documentation/devicetree/bindings/fpga/xilinx-zynq-fpga-mgr.yaml +4
-0+ type: boolean + description: If present, the ICAP controller will be enabled when + the driver probes. This is useful if the fabric is loaded + during the boot process and contains a core, such as the SEM,I don't get how this is suitable for DT. If you decide to load the fabric from driver, that's driver decision so not DT.
Before writing the fabric to the FPGA the driver disables the ICAP, enabling the PCAP. Once writing is complete it unconditionally disables the PCAP, enabling the ICAP. This patch just makes it so, depending on the use case, the ICAP can be enabled at boot. This will not prevent the system from being able to load a fabric through the driver. I added in this boolean so existing behavior would be maintained.
Quoted 4 lines
Quoted 2 lines
Do you recommend another approach such as writing to a sysfs attribute to switch from PCAP to ICAP?
Not sure yet. Can't you check the status of ICAP before programming and then enable it only if was enabled before?
I am having a bit of difficulty understanding this so let's talk about cases where the ICAP is enabled/disabled -
1. When writing the fabric from the driver
In this situation it might make sense to read the state of the ICAP interface when preparing the fabric, before enabling PCAP. When the write completes you could re-enable the ICAP if it was previously enabled.This might be outside the scope of this change - and I am not comfortable enough with this use-case to understand potential side effects from doing this. Logically it makes sense, but there may be a very specific reason that the ICAP must be enabled after doing a fabric load or partial reconfiguration.
Quoted 5 lines
2. When the FPGA driver loads and is probed by the DTS
In this situation, which is covered by this patch, the FPGA is loaded by BootROM/FSBL but contains functionality that requires the ICAP. Unless the user has made modifications to the FSBL or 3rd stage bootloader there is no clear way to enable the ICAP interface. Checking to see if it had been
I don't think this should be a property for fpga_mgr device. It is for FPGA reprogramming. You insmod the reprograming driver not for reprogramming, just to enable the already programmed functionality.
My idea is, to load the fpga_region with an image tagged "external-fpga-config".
Thanks,
Yilun
Quoted 14 lines
enabled prior to loading this driver does not (in my opinion) make a lot of sense here.
Perhaps the name of the DTS is confusing? The suffix '-on-load' was meant to indicate when the driver was loaded, not the fabric. Would the suffix '-on-probe' be more clear?
Let me know your thoughts,
-SamQuoted 3 lines
Best regards,
Krzysztof