mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@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 09:35:25 +0200	[thread overview]
Message-ID: <20231004073525.GH637806@pengutronix.de> (raw)
In-Reply-To: <20231002092043.3097587-3-a.fatoum@pengutronix.de>

On Mon, Oct 02, 2023 at 11:20:43AM +0200, 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) {

The opening brace should be on the next line.

> +	if (cpu_is_mx6()) {
> +		return OCOTP_SEC_CONFIG_1;
> +	} else {
> +		return MX8M_OCOTP_SEC_CONFIG_1;
> +	}
> +}

Given that the i.MX8M defines have a SoC prefix I would find it more
natural to test with if (cpu_is_mx8m()) instead of if (cpu_is_mx6()).

> +
>  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()) {

Right now we only support i.MX6 and i.MX8MQ, so this is always true.

Have you considered creating a i.MX8MQ and a i.MX6 specific struct
imx_hab_ops {} entry? Given the amount of if(cpu_is_*()) expressions the
result may look cleaner.

BTW struct imx_hab_ops has a init() function pointer which seems unused.
Could you remove it along the way?

Sascha

-- 
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 |



      parent reply	other threads:[~2023-10-04  7:37 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
2023-10-04  7:35   ` Sascha Hauer [this message]

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=20231004073525.GH637806@pengutronix.de \
    --to=sha@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