mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] HAB: extend fuse information with i.MX8M
Date: Wed, 4 Oct 2023 06:56:00 +0200	[thread overview]
Message-ID: <20231004045600.oqs2k6eajti4kpzs@pengutronix.de> (raw)
In-Reply-To: <20231002092043.3097587-3-a.fatoum@pengutronix.de>

Hi Ahmad,

On 23-10-02, Ahmad Fatoum wrote:
> From: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> 
> The i.MX8M family of processors moved the SEC_CONFIG_1 fuse to a
> different location. Extend the hab driver with the new location and take
> care of the DIR_BT_DIS fuse which only needs to be burned on i.MX8MQ.
> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/hab/hab.c | 32 +++++++++++++++++++++++++++-----
>  1 file changed, 27 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
> index aa848979b467..ee402352f243 100644
> --- a/drivers/hab/hab.c
> +++ b/drivers/hab/hab.c
> @@ -150,23 +150,45 @@ static int imx_hab_permanent_write_enable_ocotp(int enable)
>  	return imx_ocotp_permanent_write(enable);
>  }
>  
> +static uint32_t get_sec_config_fuse(void) {
> +	if (cpu_is_mx6()) {
> +		return OCOTP_SEC_CONFIG_1;
> +	} else {
> +		return MX8M_OCOTP_SEC_CONFIG_1;
> +	}

Small nit: remove the {} from the one-liner if-else, same...
         
> +}
> +
>  static int imx_hab_lockdown_device_ocotp(void)
>  {
>  	int ret;
> +	uint32_t dis_fuse;
> +	uint32_t sec_fuse;
>  
> -	ret = imx_ocotp_write_field(OCOTP_DIR_BT_DIS, 1);
> -	if (ret < 0)
> -		return ret;
> +	if (cpu_is_mx6() || cpu_is_mx8mq()) {
> +		if (cpu_is_mx6()) {
> +			dis_fuse = OCOTP_DIR_BT_DIS;
> +		} else {
> +			dis_fuse = MX8MQ_OCOTP_DIR_BT_DIS;
> +		}

here.

Regards,
  Marco

> +		ret = imx_ocotp_write_field(dis_fuse, 1);
> +		if (ret < 0)
> +			return ret;
> +	}
>  
> -	return imx_ocotp_write_field(OCOTP_SEC_CONFIG_1, 1);
> +	sec_fuse = get_sec_config_fuse();
> +
> +	return imx_ocotp_write_field(sec_fuse, 1);
>  }
>  
>  static int imx_hab_device_locked_down_ocotp(void)
>  {
>  	int ret;
> +	uint32_t fuse;
>  	unsigned int v;
>  
> -	ret = imx_ocotp_read_field(OCOTP_SEC_CONFIG_1, &v);
> +	fuse = get_sec_config_fuse();
> +
> +	ret = imx_ocotp_read_field(fuse, &v);
>  	if (ret < 0)
>  		return ret;
>  
> -- 
> 2.39.2
> 
> 
> 



  reply	other threads:[~2023-10-04  4:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-02  9:20 [PATCH 0/2] HAB: i.MX8M: fix fuse location Ahmad Fatoum
2023-10-02  9:20 ` [PATCH 1/2] ARM: i.MX: fusemap-ocotp: add sec fuses for i.MX8M Ahmad Fatoum
2023-10-04  7:42   ` Sascha Hauer
2023-10-02  9:20 ` [PATCH 2/2] HAB: extend fuse information with i.MX8M Ahmad Fatoum
2023-10-04  4:56   ` Marco Felsch [this message]
2023-10-04  7:35   ` 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=20231004045600.oqs2k6eajti4kpzs@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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