mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nava kishore Manne <nava.kishore.manne@amd.com>
To: <git@amd.com>, <robh+dt@kernel.org>,
	<krzysztof.kozlowski+dt@linaro.org>, <michal.simek@xilinx.com>,
	<nava.kishore.manne@amd.com>, <mdf@kernel.org>,
	<hao.wu@intel.com>, <yilun.xu@intel.com>, <trix@redhat.com>,
	<p.zabel@pengutronix.de>, <gregkh@linuxfoundation.org>,
	<ronak.jain@xilinx.com>, <rajan.vaja@xilinx.com>,
	<abhyuday.godhasara@xilinx.com>, <piyush.mehta@xilinx.com>,
	<lakshmi.sai.krishna.potthuri@xilinx.com>,
	<harsha.harsha@xilinx.com>, <linus.walleij@linaro.org>,
	<nava.manne@xilinx.com>, <devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-fpga@vger.kernel.org>
Subject: [PATCH 1/4] firmware: xilinx: Add afi ioctl support
Date: Wed, 24 Aug 2022 09:25:39 +0530	[thread overview]
Message-ID: <20220824035542.706433-2-nava.kishore.manne@amd.com> (raw)
In-Reply-To: <20220824035542.706433-1-nava.kishore.manne@amd.com>

Adds afi ioctl to support dynamic PS-PL bus width settings.

Signed-off-by: Nava kishore Manne <nava.kishore.manne@amd.com>
---
 drivers/firmware/xilinx/zynqmp.c     | 14 +++++++++++
 include/linux/firmware/xlnx-zynqmp.h | 36 ++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index d1f652802181..cbd84c96a66a 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -843,6 +843,20 @@ int zynqmp_pm_read_pggs(u32 index, u32 *value)
 }
 EXPORT_SYMBOL_GPL(zynqmp_pm_read_pggs);
 
+/**
+ * zynqmp_pm_afi() - PM API for setting the PS-PL bus width
+ * @config_id:	Register index value
+ * @bus_width:	Afi interface bus width value.
+ *
+ * Return:	Returns status, either success or error+reason
+ */
+int zynqmp_pm_afi(u32 config_id, u32 bus_width)
+{
+	return zynqmp_pm_invoke_fn(PM_IOCTL, 0, IOCTL_AFI,
+				   config_id, bus_width, NULL);
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_afi);
+
 /**
  * zynqmp_pm_set_boot_health_status() - PM API for setting healthy boot status
  * @value:	Status value to be written
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index 9f50dacbf7d6..7d0d98303acc 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -78,6 +78,16 @@
 #define EVENT_ERROR_PSM_ERR1	(0x28108000U)
 #define EVENT_ERROR_PSM_ERR2	(0x2810C000U)
 
+#define AFIFM_BUS_WIDTH_128_CONFIG_VAL	0x0U
+#define AFIFM_BUS_WIDTH_64_CONFIG_VAL	0x1U
+#define AFIFM_BUS_WIDTH_32_CONFIG_VAL	0x2U
+
+#define AFIFS_SS0_SS2_BUS_WIDTH_128_CONFIG_VAL	0x200U
+#define AFIFS_SS0_SS2_BUS_WIDTH_64_CONFIG_VAL	0x100U
+#define AFIFS_SS1_BUS_WIDTH_128_CONFIG_VAL	0x800U
+#define AFIFS_SS1_BUS_WIDTH_64_CONFIG_VAL	0x400U
+#define AFIFS_SS_BUS_WIDTH_32_CONFIG_VAL	0x0U
+
 enum pm_api_cb_id {
 	PM_INIT_SUSPEND_CB = 30,
 	PM_ACKNOWLEDGE_CB = 31,
@@ -147,6 +157,7 @@ enum pm_ioctl_id {
 	IOCTL_READ_PGGS = 15,
 	/* Set healthy bit value */
 	IOCTL_SET_BOOT_HEALTH_STATUS = 17,
+	IOCTL_AFI = 18,
 	IOCTL_OSPI_MUX_SELECT = 21,
 	/* Register SGI to ATF */
 	IOCTL_REGISTER_SGI = 25,
@@ -155,6 +166,25 @@ enum pm_ioctl_id {
 	IOCTL_GET_FEATURE_CONFIG = 27,
 };
 
+enum pm_afi_config_id {
+	AFIFM0_RDCTRL = 0,
+	AFIFM0_WRCTRL = 1,
+	AFIFM1_RDCTRL = 2,
+	AFIFM1_WRCTRL = 3,
+	AFIFM2_RDCTRL = 4,
+	AFIFM2_WRCTRL = 5,
+	AFIFM3_RDCTRL = 6,
+	AFIFM3_WRCTRL = 7,
+	AFIFM4_RDCTRL = 8,
+	AFIFM4_WRCTRL = 9,
+	AFIFM5_RDCTRL = 10,
+	AFIFM5_WRCTRL = 11,
+	AFIFM6_RDCTRL = 12,
+	AFIFM6_WRCTRL = 13,
+	AFIFS = 14,
+	AFIFS_SS2 = 15,
+};
+
 enum pm_query_id {
 	PM_QID_INVALID = 0,
 	PM_QID_CLOCK_GET_NAME = 1,
@@ -475,6 +505,7 @@ int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id);
 int zynqmp_pm_set_feature_config(enum pm_feature_config_id id, u32 value);
 int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, u32 *payload);
 int zynqmp_pm_register_sgi(u32 sgi_num, u32 reset);
+int zynqmp_pm_afi(u32 config_id, u32 bus_width);
 #else
 static inline int zynqmp_pm_get_api_version(u32 *version)
 {
@@ -745,6 +776,11 @@ static inline int zynqmp_pm_register_sgi(u32 sgi_num, u32 reset)
 {
 	return -ENODEV;
 }
+
+static inline int zynqmp_pm_afi(u32 config_id, u32 bus_width)
+{
+	return -ENODEV;
+}
 #endif
 
 #endif /* __FIRMWARE_ZYNQMP_H__ */
-- 
2.25.1


  reply	other threads:[~2022-08-24  3:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24  3:55 [PATCH 0/4]Add afi config drivers support Nava kishore Manne
2022-08-24  3:55 ` Nava kishore Manne [this message]
2022-08-27  6:21   ` [PATCH 1/4] firmware: xilinx: Add afi ioctl support Xu Yilun
2022-08-30  9:25     ` Manne, Nava kishore
2022-09-03 17:13       ` Xu Yilun
2022-08-24  3:55 ` [PATCH 2/4] bindings: fpga: Add binding doc for the zynqmp afi config driver Nava kishore Manne
2022-08-24 12:58   ` Krzysztof Kozlowski
2022-08-30  5:31     ` Manne, Nava kishore
2022-08-30 18:27       ` Rob Herring
2022-08-30 18:25   ` Rob Herring
2022-08-24  3:55 ` [PATCH 3/4] bindings: firmware: Update binding doc for the zynqmp afi config node Nava kishore Manne
2022-08-24 12:57   ` Krzysztof Kozlowski
2022-08-30  5:41     ` Manne, Nava kishore
2022-08-24  3:55 ` [PATCH 4/4] fpga: zynqmp: Add afi config driver Nava kishore Manne
2022-08-24 12:59   ` Krzysztof Kozlowski
2022-08-27 12:26   ` Xu Yilun
2022-08-30  9:19     ` Manne, Nava kishore
2022-09-01  9:53       ` Marco Pagani
2022-09-03 17:44         ` Xu Yilun
2022-09-12 20:02           ` Marco Pagani
2022-09-03 17:33       ` Xu Yilun
2022-08-27  6:02 ` [PATCH 0/4]Add afi config drivers support Xu Yilun
2022-08-30  6:05   ` Manne, Nava kishore

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=20220824035542.706433-2-nava.kishore.manne@amd.com \
    --to=nava.kishore.manne@amd.com \
    --cc=abhyuday.godhasara@xilinx.com \
    --cc=devicetree@vger.kernel.org \
    --cc=git@amd.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hao.wu@intel.com \
    --cc=harsha.harsha@xilinx.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lakshmi.sai.krishna.potthuri@xilinx.com \
    --cc=linus.walleij@linaro.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@xilinx.com \
    --cc=nava.manne@xilinx.com \
    --cc=p.zabel@pengutronix.de \
    --cc=piyush.mehta@xilinx.com \
    --cc=rajan.vaja@xilinx.com \
    --cc=robh+dt@kernel.org \
    --cc=ronak.jain@xilinx.com \
    --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

all inboxes | Powered by JetHome®