linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sam Winchenbach <sam.winchenbach@framepointer.org>
To: linux-kernel@vger.kernel.org
Cc: mdf@kernel.org, hao.wu@intel.com, yilun.xu@intel.com,
	trix@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, michal.simek@amd.com,
	linux-fpga@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	sam.winchenbach@framepointer.org,
	Sam Winchenbach <swinchenbach@arka.org>
Subject: [PATCH 2/2] fpga: zynq-fpga: Allow ICAP enable on probe
Date: Fri, 28 Mar 2025 10:19:44 -0400	[thread overview]
Message-ID: <20250328141944.119504-2-sam.winchenbach@framepointer.org> (raw)
In-Reply-To: <20250328141944.119504-1-sam.winchenbach@framepointer.org>

From: Sam Winchenbach <swinchenbach@arka.org>

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.

Signed-off-by: Sam Winchenbach <swinchenbach@arka.org>
---
 drivers/fpga/zynq-fpga.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c
index f7e08f7ea9ef3..4a53a429d659f 100644
--- a/drivers/fpga/zynq-fpga.c
+++ b/drivers/fpga/zynq-fpga.c
@@ -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;
 }
 
-- 
2.49.0


  reply	other threads:[~2025-03-28 14:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28 14:19 [PATCH 1/2] dt-bindings: fpga: zynq: Document ICAP on boot Sam Winchenbach
2025-03-28 14:19 ` Sam Winchenbach [this message]
2025-03-29  4:59 ` Krzysztof Kozlowski
2025-03-31 12:30   ` Sam Winchenbach
2025-03-31 12:43     ` Krzysztof Kozlowski
2025-03-31 13:07       ` Sam Winchenbach
2025-04-01  6:17         ` Krzysztof Kozlowski
2025-04-09  6:03         ` Krzysztof Kozlowski
2025-04-24 10:02         ` Xu Yilun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250328141944.119504-2-sam.winchenbach@framepointer.org \
    --to=sam.winchenbach@framepointer.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hao.wu@intel.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdf@kernel.org \
    --cc=michal.simek@amd.com \
    --cc=robh@kernel.org \
    --cc=swinchenbach@arka.org \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).