mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH] ARM: i.MX93: ele: start TRNG on i.MX93 rev a1
Date: Mon, 11 Mar 2024 09:20:07 +0100	[thread overview]
Message-ID: <f01a0d63-1377-4532-8122-d924bbcb9c0e@pengutronix.de> (raw)
In-Reply-To: <20240311080624.1836184-1-s.hauer@pengutronix.de>

Hello Sascha,

On 11.03.24 09:06, Sascha Hauer wrote:
> On i.MX93 a0 the TRNG seems to be started automatically. On rev a1 it's
> not and OP-TEE panics with "Cannot retrieve random data from ELE". Start
> the TRNG to let OP-TEE startup successfully.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  arch/arm/mach-imx/ele.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/ele.c b/arch/arm/mach-imx/ele.c
> index ab3958cbd3..f8093fc694 100644
> --- a/arch/arm/mach-imx/ele.c
> +++ b/arch/arm/mach-imx/ele.c
> @@ -165,6 +165,23 @@ int ele_get_info(struct ele_get_info_data *info)
>  	return ret;
>  }
>  
> +static int ele_get_start_trng(void)
> +{
> +        struct ele_msg msg = {

strange indentation.

> +		.version = ELE_VERSION,
> +		.tag = ELE_CMD_TAG,
> +		.size = 1,
> +		.command = ELE_START_RNG,
> +	};
> +	int ret;
> +
> +	ret = ele_call(&msg);
> +	if (ret)
> +		pr_err("Could not start TRNG, response 0x%x\n", msg.data[0]);
> +
> +	return ret;
> +}
> +
>  int imx93_ele_load_fw(void *bl33)
>  {
>  	struct ele_get_info_data info = {};
> @@ -204,6 +221,9 @@ int imx93_ele_load_fw(void *bl33)
>  		pr_err("Could not start ELE firmware: ret %d, response 0x%x\n",
>  			ret, msg.data[0]);
>  
> +	if (rev == 0xa1)
> +		ele_get_start_trng();

Does it hurt to start it unconditionally, even if it's already enabled?
At the least, I'd prefer this to be rev >= 0xa1, so it need not be debugged
again in the future.

Thoughts?

Ahmad

> +
>  	return 0;
>  }
>  

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2024-03-11  8:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-11  8:06 Sascha Hauer
2024-03-11  8:20 ` Ahmad Fatoum [this message]
2024-03-11 10:29   ` Sascha Hauer
2024-03-11 10:45 ` Sascha Hauer

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=f01a0d63-1377-4532-8122-d924bbcb9c0e@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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