On 25-12-19, Fabian Pflug wrote: > Extend the helper for imx_fuse_burn with support for i.MX6 devices. > Create a helper function for i.MX8 and i.MX6 rom the old i.MX8M > function, as they all share the same pattern. > > Signed-off-by: Fabian Pflug <[email protected]> > --- > drivers/hab/hab.c | 22 +++++++++++++++------- > include/mach/imx/ocotp-fusemap.h | 1 + > 2 files changed, 16 insertions(+), 7 deletions(-) > > diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c > index 1c747e8a3e..3c9739871b 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
Nit: I would like to keep this define close to the imx8m_hab_field_return_ocotp(). Reviewed-by: Marco Felsch <[email protected]> > -static int imx8m_hab_field_return_ocotp(void) > +static int imx_hab_field_return_ocotp(unint32_t field, unsigned int value) > { > int ret; > > @@ -274,13 +274,20 @@ static int imx8m_hab_field_return_ocotp(void) > if (ret == 1) > return -EINVAL; > > - if (cpu_is_mx8mp()) > - ret = imx_ocotp_write_field(MX8MP_OCOTP_FIELD_RETURN, > - MX8MP_FIELD_RETURN_PATTERN); > - else > - ret = imx_ocotp_write_field(MX8M_OCOTP_FIELD_RETURN, 1); > + return imx_ocotp_write_field(field, value); > +} > > - return ret; > +static int imx6_hab_field_return_ocotp(void) > +{ > + return imx_hab_field_return_ocotp(MX6_OCOTP_FIELD_RETURN, 1); > +} > + > +static int imx8m_hab_field_return_ocotp(void) > +{ > + if (cpu_is_mx8mp()) > + return imx_hab_field_return_ocotp(MX8MP_OCOTP_FIELD_RETURN, > + MX8MP_FIELD_RETURN_PATTERN); > + return imx_hab_field_return_ocotp(MX8M_OCOTP_FIELD_RETURN, 1); > } > > struct imx_hab_ops { > @@ -310,6 +317,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 = imx6_hab_field_return_ocotp, > }; > > static struct imx_hab_ops imx8m_hab_ops_ocotp = { > 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 |
