All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: lukas.funke-oss@weidmueller.com, 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>,
	Tanmay Shah <tanmay.shah@amd.com>, Tom Rini <trini@konsulko.com>,
	Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Subject: Re: [PATCH 1/3] firmware: zynqmp: Add support to access efuses
Date: Wed, 15 May 2024 08:04:10 +0200	[thread overview]
Message-ID: <d2e15688-bb50-45dc-9e43-3317e8c7c762@denx.de> (raw)
In-Reply-To: <20240514140416.156747-2-lukas.funke-oss@weidmueller.com>

Hi Lukas,

On 5/14/24 16:04, lukas.funke-oss@weidmueller.com wrote:
> 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];

Reverse x-mas tree ordering looks better IMHO.

> +
> +	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];

You don't check ret for an error above but still pass the return values
here. Perhaps it makes sense to return with error above instead?

> +
> +	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);

Same here.

Thanks,
Stefan

> +
> +	*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);

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

  reply	other threads:[~2024-05-15  6: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 ` [PATCH 1/3] firmware: zynqmp: Add support to access efuses lukas.funke-oss
2024-05-15  6:04   ` Stefan Roese [this message]
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=d2e15688-bb50-45dc-9e43-3317e8c7c762@denx.de \
    --to=sr@denx.de \
    --cc=ashok.reddy.soma@amd.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=lukas.funke-oss@weidmueller.com \
    --cc=lukas.funke@weidmueller.com \
    --cc=michal.simek@amd.com \
    --cc=neil.armstrong@linaro.org \
    --cc=santoshsagar.algapally@amd.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.