U-boot Archive mirror
 help / color / mirror / Atom feed
From: lukas.funke-oss@weidmueller.com
To: u-boot@lists.denx.de
Cc: Michal Simek <michal.simek@amd.com>,
	Lukas Funke <lukas.funke@weidmueller.com>,
	Algapally Santosh Sagar <santoshsagar.algapally@amd.com>,
	Ashok Reddy Soma <ashok.reddy.soma@amd.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Qu Wenruo <wqu@suse.com>,
	Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>,
	Stefan Roese <sr@denx.de>, Tanmay Shah <tanmay.shah@amd.com>,
	Tom Rini <trini@konsulko.com>,
	Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Subject: [PATCH 1/3] firmware: zynqmp: Add support to access efuses
Date: Tue, 14 May 2024 16:04:14 +0200	[thread overview]
Message-ID: <20240514140416.156747-2-lukas.funke-oss@weidmueller.com> (raw)
In-Reply-To: <20240514140416.156747-1-lukas.funke-oss@weidmueller.com>

From: Lukas Funke <lukas.funke@weidmueller.com>

Add functions to access efuses through PMU firmware
interface.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
---

 drivers/firmware/firmware-zynqmp.c | 31 ++++++++++++++++++++++++++++++
 include/zynqmp_firmware.h          |  2 ++
 2 files changed, 33 insertions(+)

diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c
index f99507d86c6..7483f2a8709 100644
--- a/drivers/firmware/firmware-zynqmp.c
+++ b/drivers/firmware/firmware-zynqmp.c
@@ -210,6 +210,37 @@ int zynqmp_pm_feature(const u32 api_id)
 	return ret_payload[1] & FIRMWARE_VERSION_MASK;
 }
 
+int zynqmp_pm_get_chipid(u32 *idcode, u32 *version)
+{
+	int ret;
+	u32 ret_payload[PAYLOAD_ARG_CNT];
+
+	if (!idcode || !version)
+		return -EINVAL;
+
+	ret = xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload);
+	*idcode = ret_payload[1];
+	*version = ret_payload[2];
+
+	return ret;
+}
+
+int zynqmp_pm_efuse_access(const u64 address, u32 *out)
+{
+	int ret;
+	u32 ret_payload[PAYLOAD_ARG_CNT];
+
+	if (!out)
+		return -EINVAL;
+
+	ret = xilinx_pm_request(PM_EFUSE_ACCESS, upper_32_bits(address),
+				lower_32_bits(address), 0, 0, ret_payload);
+
+	*out = ret_payload[1];
+
+	return ret;
+}
+
 int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id)
 {
 	int ret;
diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h
index 73198a6a6ea..7f18b4d59bf 100644
--- a/include/zynqmp_firmware.h
+++ b/include/zynqmp_firmware.h
@@ -453,6 +453,8 @@ int xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2,
 int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value);
 int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config,
 			     u32 value);
+int zynqmp_pm_get_chipid(u32 *idcode, u32 *version);
+int zynqmp_pm_efuse_access(const u64 address, u32 *out);
 int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id);
 int zynqmp_mmio_read(const u32 address, u32 *value);
 int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
-- 
2.30.2


  reply	other threads:[~2024-05-14 14:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14 14:04 [PATCH 0/3] Add eFuse access for ZynqMP lukas.funke-oss
2024-05-14 14:04 ` lukas.funke-oss [this message]
2024-05-15  6:04   ` [PATCH 1/3] firmware: zynqmp: Add support to access efuses Stefan Roese
2024-05-14 14:04 ` [PATCH 2/3] amd64: zynqmp: Add command to program efuses lukas.funke-oss
2024-05-14 14:04 ` [PATCH 3/3] drivers: misc: Add driver to access ZynqMP efuses lukas.funke-oss
2024-05-15  6:12   ` Stefan Roese
2024-05-15  6:33     ` Lukas Funke
2024-05-15  9:19       ` Stefan Roese
2024-05-15  7:08 ` [PATCH 0/3] Add eFuse access for ZynqMP Marek Behún

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=20240514140416.156747-2-lukas.funke-oss@weidmueller.com \
    --to=lukas.funke-oss@weidmueller.com \
    --cc=ashok.reddy.soma@amd.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=lukas.funke@weidmueller.com \
    --cc=michal.simek@amd.com \
    --cc=neil.armstrong@linaro.org \
    --cc=santoshsagar.algapally@amd.com \
    --cc=sr@denx.de \
    --cc=stefan.herbrechtsmeier@weidmueller.com \
    --cc=tanmay.shah@amd.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=venkatesh.abbarapu@amd.com \
    --cc=wqu@suse.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 read-only IMAP folder(s) and NNTP newsgroup(s).