[PATCH 3/4] i.MX: HAB: extend field_return support to imx6

Marco Felsch m.felsch at pengutronix.de
Thu Dec 18 11:23:25 PST 2025


On 25-12-18, Fabian Pflug wrote:
> Extend the helper for imx_fuse_burn with support for i.MX6 devices.
> 
> Signed-off-by: Fabian Pflug <f.pflug at pengutronix.de>
> ---
>  drivers/hab/hab.c                | 10 ++++++----
>  include/mach/imx/ocotp-fusemap.h |  1 +
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
> index 1c747e8a3e..281645f79e 100644
> --- a/drivers/hab/hab.c
> +++ b/drivers/hab/hab.c
> @@ -262,7 +262,7 @@ static int imx8m_hab_revoke_key_ocotp(unsigned key_idx)
>   */
>  #define MX8MP_FIELD_RETURN_PATTERN	0x28001401
>  
> -static int imx8m_hab_field_return_ocotp(void)
> +static int imx_hab_field_return_ocotp(void)
>  {
>  	int ret;
>  
> @@ -274,7 +274,9 @@ static int imx8m_hab_field_return_ocotp(void)
>  	if (ret == 1)
>  		return -EINVAL;
>  
> -	if (cpu_is_mx8mp())
> +	if (cpu_is_mx6())

The driver has hooks to abstract the different i.MX HAB SoC families.
Therefore please add a imx6_hab_field_return_ocotp() hook.

Regards,
  Marco

> +		ret = imx_ocotp_write_field(MX6_OCOTP_FIELD_RETURN, 1);
> +	else if (cpu_is_mx8mp())
>  		ret = imx_ocotp_write_field(MX8MP_OCOTP_FIELD_RETURN,
>  					    MX8MP_FIELD_RETURN_PATTERN);
>  	else
> @@ -282,7 +284,6 @@ static int imx8m_hab_field_return_ocotp(void)
>  
>  	return ret;
>  }
> -
>  struct imx_hab_ops {
>  	int (*write_srk_hash)(const u8 *srk, unsigned flags);
>  	int (*read_srk_hash)(u8 *srk);
> @@ -310,6 +311,7 @@ static struct imx_hab_ops imx6_hab_ops_ocotp = {
>  	.device_locked_down = imx6_hab_device_locked_down_ocotp,
>  	.permanent_write_enable = imx_hab_permanent_write_enable_ocotp,
>  	.print_status = imx6_hab_print_status,
> +	.field_return = imx_hab_field_return_ocotp,
>  };
>  
>  static struct imx_hab_ops imx8m_hab_ops_ocotp = {
> @@ -320,7 +322,7 @@ static struct imx_hab_ops imx8m_hab_ops_ocotp = {
>  	.permanent_write_enable = imx_hab_permanent_write_enable_ocotp,
>  	.print_status = imx8m_hab_print_status,
>  	.revoke_key = imx8m_hab_revoke_key_ocotp,
> -	.field_return = imx8m_hab_field_return_ocotp,
> +	.field_return = imx_hab_field_return_ocotp,
>  };
>  
>  static int imx_ahab_write_srk_hash(const u8 *__newsrk, unsigned flags)
> diff --git a/include/mach/imx/ocotp-fusemap.h b/include/mach/imx/ocotp-fusemap.h
> index ae10dcef2a..3fd9d6df24 100644
> --- a/include/mach/imx/ocotp-fusemap.h
> +++ b/include/mach/imx/ocotp-fusemap.h
> @@ -103,6 +103,7 @@
>  #define MX8M_OCOTP_TZASC_EN		(OCOTP_WORD(0x480) | OCOTP_BIT(11) | OCOTP_WIDTH(1))
>  #define MX8MP_OCOTP_ROM_NO_LOG		(OCOTP_WORD(0x480) | OCOTP_BIT(22) | OCOTP_WIDTH(1))
>  #define MX8M_OCOTP_RECOVERY_SDMMC_BOOT_DIS	(OCOTP_WORD(0x490) | OCOTP_BIT(23) | OCOTP_WIDTH(1))
> +#define MX6_OCOTP_FIELD_RETURN		(OCOTP_WORD(0x6E0) | OCOTP_BIT(0) | OCOTP_WIDTH(1))
>  #define MX8M_OCOTP_FIELD_RETURN		(OCOTP_WORD(0x630) | OCOTP_BIT(0) | OCOTP_WIDTH(1))
>  #define MX8MP_OCOTP_FIELD_RETURN	(OCOTP_WORD(0x630) | OCOTP_BIT(0) | OCOTP_WIDTH(32))
>  #define MX8M_OCOTP_SRK_REVOKE		(OCOTP_WORD(0x670) | OCOTP_BIT(0) | OCOTP_WIDTH(4))
> 
> -- 
> 2.47.3
> 
> 

-- 
#gernperDu 
#CallMeByMyFirstName

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



More information about the barebox mailing list