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 3/5] drivers: firmware: xilinx: Relocate NVM library APIs to new file
Date: Fri, 27 Nov 2026 17:18:37 +0530	[thread overview]
Message-ID: <20261127114839.1428778-4-jay.buddhabhatti@amd.com> (raw)
In-Reply-To: <20261127114839.1428778-1-jay.buddhabhatti@amd.com>

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

Move the NVM 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 crypto and NVM firmware files. Include
the new NVM files and the existing crypto 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                              |  9 ++++++
 drivers/firmware/xilinx/Makefile         |  2 +-
 drivers/firmware/xilinx/zynqmp-nvm.c     | 35 ++++++++++++++++++++++++
 drivers/firmware/xilinx/zynqmp.c         | 24 ----------------
 include/linux/firmware/xlnx-zynqmp-nvm.h | 28 +++++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h     |  7 +----
 6 files changed, 74 insertions(+), 31 deletions(-)
 create mode 100644 drivers/firmware/xilinx/zynqmp-nvm.c
 create mode 100644 include/linux/firmware/xlnx-zynqmp-nvm.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 8caad731367b..e010589c13e5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -30660,6 +30660,15 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/net/can/xilinx,can.yaml
 F:	drivers/net/can/xilinx_can.c
 
+XILINX CRYPTO AND NVM FIRMWARE DRIVER
+M:	Harsh Jain <h.jain@amd.com>
+L:	git@amd.com
+S:	Maintained
+F:	drivers/firmware/xilinx/zynqmp-crypto.c
+F:	drivers/firmware/xilinx/zynqmp-nvm.c
+F:	include/linux/firmware/xlnx-zynqmp-crypto.h
+F:	include/linux/firmware/xlnx-zynqmp-nvm.h
+
 XILINX EVENT MANAGEMENT DRIVER
 M:	Michal Simek <michal.simek@amd.com>
 S:	Maintained
diff --git a/drivers/firmware/xilinx/Makefile b/drivers/firmware/xilinx/Makefile
index edfba4110a7c..d23d41c6a8ac 100644
--- a/drivers/firmware/xilinx/Makefile
+++ b/drivers/firmware/xilinx/Makefile
@@ -2,5 +2,5 @@
 # Makefile for Xilinx firmwares
 
 obj-$(CONFIG_ZYNQMP_FIRMWARE) += zynqmp-crypto.o zynqmp-fpga.o \
-				 zynqmp-pdi.o zynqmp-ufs.o zynqmp.o
+				 zynqmp-nvm.o zynqmp-pdi.o zynqmp-ufs.o zynqmp.o
 obj-$(CONFIG_ZYNQMP_FIRMWARE_DEBUG) += zynqmp-debug.o
diff --git a/drivers/firmware/xilinx/zynqmp-nvm.c b/drivers/firmware/xilinx/zynqmp-nvm.c
new file mode 100644
index 000000000000..15c646273aee
--- /dev/null
+++ b/drivers/firmware/xilinx/zynqmp-nvm.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Firmware layer for XilNVM 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_efuse_access - Provides access to efuse memory.
+ * @address:	Address of the efuse params structure
+ * @out:	Returned output value
+ *
+ * Return:	Returns status, either success or error code.
+ */
+int zynqmp_pm_efuse_access(const u64 address, u32 *out)
+{
+	u32 ret_payload[PAYLOAD_ARG_CNT];
+	int ret;
+
+	if (!out)
+		return -EINVAL;
+
+	ret = zynqmp_pm_invoke_fn(PM_EFUSE_ACCESS, ret_payload, 2,
+				  upper_32_bits(address),
+				  lower_32_bits(address));
+	*out = ret_payload[1];
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(zynqmp_pm_efuse_access);
diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index fe887d5e9354..619ead2069c5 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -1597,30 +1597,6 @@ int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities,
 }
 EXPORT_SYMBOL_GPL(zynqmp_pm_set_requirement);
 
-/**
- * zynqmp_pm_efuse_access - Provides access to efuse memory.
- * @address:	Address of the efuse params structure
- * @out:		Returned output value
- *
- * Return:	Returns status, either success or error code.
- */
-int zynqmp_pm_efuse_access(const u64 address, u32 *out)
-{
-	u32 ret_payload[PAYLOAD_ARG_CNT];
-	int ret;
-
-	if (!out)
-		return -EINVAL;
-
-	ret = zynqmp_pm_invoke_fn(PM_EFUSE_ACCESS, ret_payload, 2,
-				  upper_32_bits(address),
-				  lower_32_bits(address));
-	*out = ret_payload[1];
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(zynqmp_pm_efuse_access);
-
 /**
  * zynqmp_pm_register_notifier() - PM API for register a subsystem
  *                                to be notified about specific
diff --git a/include/linux/firmware/xlnx-zynqmp-nvm.h b/include/linux/firmware/xlnx-zynqmp-nvm.h
new file mode 100644
index 000000000000..65dda350b66f
--- /dev/null
+++ b/include/linux/firmware/xlnx-zynqmp-nvm.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Firmware layer for XilNVM APIs.
+ *
+ *  Copyright (C) 2014 - 2021 Xilinx, Inc.
+ *  Copyright (C) 2022 - 2026 Advanced Micro Devices, Inc.
+ */
+
+#ifndef __FIRMWARE_ZYNQMP_NVM_H__
+#define __FIRMWARE_ZYNQMP_NVM_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>
+
+#if IS_REACHABLE(CONFIG_ZYNQMP_FIRMWARE)
+int zynqmp_pm_efuse_access(const u64 address, u32 *out);
+#else
+static inline int zynqmp_pm_efuse_access(const u64 address, u32 *out)
+{
+	return -ENODEV;
+}
+#endif
+
+#endif /* __FIRMWARE_ZYNQMP_NVM_H__ */
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index 5038c9051dca..852e952fc8e5 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -18,6 +18,7 @@
 #include <linux/err.h>
 #include <linux/firmware/xlnx-zynqmp-crypto.h>
 #include <linux/firmware/xlnx-zynqmp-fpga.h>
+#include <linux/firmware/xlnx-zynqmp-nvm.h>
 #include <linux/firmware/xlnx-zynqmp-pdi.h>
 #include <linux/firmware/xlnx-zynqmp-ufs.h>
 
@@ -594,7 +595,6 @@ int zynqmp_pm_release_node(const u32 node);
 int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities,
 			      const u32 qos,
 			      const enum zynqmp_pm_request_ack ack);
-int zynqmp_pm_efuse_access(const u64 address, u32 *out);
 int zynqmp_pm_write_ggs(u32 index, u32 value);
 int zynqmp_pm_read_ggs(u32 index, u32 *value);
 int zynqmp_pm_write_pggs(u32 index, u32 value);
@@ -775,11 +775,6 @@ static inline int zynqmp_pm_set_requirement(const u32 node,
 	return -ENODEV;
 }
 
-static inline int zynqmp_pm_efuse_access(const u64 address, u32 *out)
-{
-	return -ENODEV;
-}
-
 static inline int zynqmp_pm_write_ggs(u32 index, u32 value)
 {
 	return -ENODEV;
-- 
2.43.0


  parent 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 ` [PATCH 1/5] drivers: firmware: xilinx: Relocate PDI library APIs to new file Jay Buddhabhatti
2026-11-27 11:48 ` [PATCH 2/5] drivers: firmware: xilinx: Relocate FPGA " Jay Buddhabhatti
2026-11-27 11:48 ` Jay Buddhabhatti [this message]
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-4-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®