mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
To: Michal Simek <michal.simek@amd.com>
Cc: Ronak Jain <ronak.jain@amd.com>,
	Aravind Thokala <Aravind.Thokala@amd.com>,
	Harsh Jain <h.jain@amd.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <git@amd.com>,
	Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Subject: [PATCH 1/5] drivers: firmware: xilinx: Relocate PDI library APIs to new file
Date: Fri, 27 Nov 2026 17:18:35 +0530	[thread overview]
Message-ID: <20261127114839.1428778-2-jay.buddhabhatti@amd.com> (raw)
In-Reply-To: <20261127114839.1428778-1-jay.buddhabhatti@amd.com>

From: Ronak Jain <ronak.jain@amd.com>

Move the PDI library APIs into a dedicated file and header to improve
maintainability and reduce complexity in the firmware driver. Keep the
existing behavior unchanged.

Add a MAINTAINERS entry for the FPGA and PDI firmware files. List the
new PDI files in that entry.

Signed-off-by: Ronak Jain <ronak.jain@amd.com>
Co-developed-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
---
 MAINTAINERS                              |  7 +++++
 drivers/firmware/xilinx/Makefile         |  3 ++-
 drivers/firmware/xilinx/zynqmp-pdi.c     | 27 +++++++++++++++++++
 drivers/firmware/xilinx/zynqmp.c         | 16 -----------
 include/linux/firmware/xlnx-zynqmp-pdi.h | 34 ++++++++++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h     | 13 ++-------
 6 files changed, 72 insertions(+), 28 deletions(-)
 create mode 100644 drivers/firmware/xilinx/zynqmp-pdi.c
 create mode 100644 include/linux/firmware/xlnx-zynqmp-pdi.h

diff --git a/MAINTAINERS b/MAINTAINERS
index c72a281a8167..9dfdb7ade5f6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -30666,6 +30666,13 @@ S:	Maintained
 F:	drivers/soc/xilinx/xlnx_event_manager.c
 F:	include/linux/firmware/xlnx-event-manager.h
 
+XILINX FPGA AND PDI FIRMWARE DRIVER
+M:	Aravind Thokala <Aravind.Thokala@amd.com>
+L:	git@amd.com
+S:	Maintained
+F:	drivers/firmware/xilinx/zynqmp-pdi.c
+F:	include/linux/firmware/xlnx-zynqmp-pdi.h
+
 XILINX GPIO DRIVER
 M:	Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
 R:	Srinivas Neeli <srinivas.neeli@amd.com>
diff --git a/drivers/firmware/xilinx/Makefile b/drivers/firmware/xilinx/Makefile
index 8db0e66b6b7e..684c3d43744e 100644
--- a/drivers/firmware/xilinx/Makefile
+++ b/drivers/firmware/xilinx/Makefile
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 # Makefile for Xilinx firmwares
 
-obj-$(CONFIG_ZYNQMP_FIRMWARE) += zynqmp.o zynqmp-ufs.o zynqmp-crypto.o
+obj-$(CONFIG_ZYNQMP_FIRMWARE) += zynqmp-crypto.o zynqmp-pdi.o \
+				 zynqmp-ufs.o zynqmp.o
 obj-$(CONFIG_ZYNQMP_FIRMWARE_DEBUG) += zynqmp-debug.o
diff --git a/drivers/firmware/xilinx/zynqmp-pdi.c b/drivers/firmware/xilinx/zynqmp-pdi.c
new file mode 100644
index 000000000000..58085e9fdede
--- /dev/null
+++ b/drivers/firmware/xilinx/zynqmp-pdi.c
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Firmware layer for XilPDI APIs.
+ *
+ *  Copyright (C) 2014 - 2022 Xilinx, Inc.
+ *  Copyright (C) 2022 - 2026 Advanced Micro Devices, Inc.
+ */
+
+#include <linux/export.h>
+#include <linux/firmware/xlnx-zynqmp.h>
+#include <linux/kernel.h>
+
+/**
+ * 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, NULL, 3, src, lower_32_bits(address),
+				   upper_32_bits(address));
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_load_pdi);
diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index e89251dab9a0..bebd2bfe5744 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -1675,22 +1675,6 @@ 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, NULL, 3, src, lower_32_bits(address),
-				   upper_32_bits(address));
-}
-EXPORT_SYMBOL_GPL(zynqmp_pm_load_pdi);
-
 /**
  * zynqmp_pm_efuse_access - Provides access to efuse memory.
  * @address:	Address of the efuse params structure
diff --git a/include/linux/firmware/xlnx-zynqmp-pdi.h b/include/linux/firmware/xlnx-zynqmp-pdi.h
new file mode 100644
index 000000000000..c7e00c255d51
--- /dev/null
+++ b/include/linux/firmware/xlnx-zynqmp-pdi.h
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Firmware layer for XilPDI APIs.
+ *
+ *  Copyright (C) 2014 - 2021 Xilinx, Inc.
+ *  Copyright (C) 2022 - 2026 Advanced Micro Devices, Inc.
+ */
+
+#ifndef __FIRMWARE_ZYNQMP_PDI_H__
+#define __FIRMWARE_ZYNQMP_PDI_H__
+
+#ifndef __FIRMWARE_ZYNQMP_H__
+# error "Do not include this file directly, use <linux/firmware/xlnx-zynqmp.h>"
+#endif
+
+#include <linux/errno.h>
+#include <linux/types.h>
+
+/* Loader command */
+#define PM_LOAD_PDI	0x701
+
+/* PDI source identifier */
+#define PDI_SRC_DDR	0xF
+
+#if IS_REACHABLE(CONFIG_ZYNQMP_FIRMWARE)
+int zynqmp_pm_load_pdi(const u32 src, const u64 address);
+#else
+static inline int zynqmp_pm_load_pdi(const u32 src, const u64 address)
+{
+	return -ENODEV;
+}
+#endif
+
+#endif /* __FIRMWARE_ZYNQMP_PDI_H__ */
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index b489fbd21bd2..cffec74a0436 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -16,8 +16,9 @@
 #include <linux/types.h>
 
 #include <linux/err.h>
-#include <linux/firmware/xlnx-zynqmp-ufs.h>
 #include <linux/firmware/xlnx-zynqmp-crypto.h>
+#include <linux/firmware/xlnx-zynqmp-pdi.h>
+#include <linux/firmware/xlnx-zynqmp-ufs.h>
 
 #define ZYNQMP_PM_VERSION_MAJOR	1
 #define ZYNQMP_PM_VERSION_MINOR	0
@@ -101,10 +102,6 @@
 #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
@@ -626,7 +623,6 @@ 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);
 int zynqmp_pm_register_notifier(const u32 node, const u32 event,
 				const u32 wake, const u32 enable);
 int zynqmp_pm_feature(const u32 api_id);
@@ -881,11 +877,6 @@ 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;
-}
-
 static inline int zynqmp_pm_register_notifier(const u32 node, const u32 event,
 					      const u32 wake, const u32 enable)
 {
-- 
2.43.0


  reply	other threads:[~2026-11-27 11:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 11:48 [PATCH 0/5] drivers: firmware: xilinx: Split ZynqMP firmware driver into modular components Jay Buddhabhatti
2026-11-27 11:48 ` Jay Buddhabhatti [this message]
2026-11-27 11:48 ` [PATCH 2/5] drivers: firmware: xilinx: Relocate FPGA library APIs to new file Jay Buddhabhatti
2026-11-27 11:48 ` [PATCH 3/5] drivers: firmware: xilinx: Relocate NVM " Jay Buddhabhatti
2026-11-27 11:48 ` [PATCH 4/5] drivers: firmware: xilinx: Localize firmware version caches Jay Buddhabhatti
2026-11-27 11:48 ` [PATCH 5/5] drivers: firmware: xilinx: Split PM EEMI and core APIs in firmware Jay Buddhabhatti

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=20261127114839.1428778-2-jay.buddhabhatti@amd.com \
    --to=jay.buddhabhatti@amd.com \
    --cc=Aravind.Thokala@amd.com \
    --cc=git@amd.com \
    --cc=h.jain@amd.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=ronak.jain@amd.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®