[PATCH 1/5] drivers: firmware: xilinx: Relocate PDI library APIs to new file

From: Jay Buddhabhatti

Date: Fri Nov 27 2026 - 06:49:25 EST


From: Ronak Jain <ronak.jain@xxxxxxx>

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@xxxxxxx>
Co-developed-by: Jay Buddhabhatti <jay.buddhabhatti@xxxxxxx>
Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@xxxxxxx>
---
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@xxxxxxx>
+L: git@xxxxxxx
+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@xxxxxxx>
R: Srinivas Neeli <srinivas.neeli@xxxxxxx>
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