diff options
| author | Tom Rini <trini@konsulko.com> | 2023-04-03 16:45:41 -0400 | 
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2023-04-03 16:45:41 -0400 | 
| commit | 288fe30a2367b8d0e3f416493150a38ebaa88459 (patch) | |
| tree | 1f841eb95d9ceeda4aa3255fb1132a0342f9b19a /drivers/misc/sentinel/fuse.c | |
| parent | fd4ed6b7e83ec3aea9a2ce21baea8ca9676f40dd (diff) | |
| parent | 9876c8c147144db2c120fcc9ffa6de27f6894441 (diff) | |
Merge branch 'next'
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'drivers/misc/sentinel/fuse.c')
| -rw-r--r-- | drivers/misc/sentinel/fuse.c | 32 | 
1 files changed, 31 insertions, 1 deletions
| diff --git a/drivers/misc/sentinel/fuse.c b/drivers/misc/sentinel/fuse.c index e2b68757664..99342d33c06 100644 --- a/drivers/misc/sentinel/fuse.c +++ b/drivers/misc/sentinel/fuse.c @@ -60,6 +60,11 @@ struct fsb_map_entry fsb_mapping_table[] = {  	{ 46, 8 },  }; +/* None ECC banks such like Redundancy or Bit protect */ +u32 nonecc_fuse_banks[] = { +	0, 1, 8, 12, 16, 22, 24, 25, 26, 27, 36, 41, 51, 56 +}; +  struct s400_map_entry s400_api_mapping_table[] = {  	{ 1, 8 },	/* LOCK */  	{ 2, 8 },	/* ECID */ @@ -67,6 +72,16 @@ struct s400_map_entry s400_api_mapping_table[] = {  	{ 15, 8 }, /* OEM SRK HASH */  	{ 23, 1, 4, 2 }, /* OTFAD */  	{ 25, 8 }, /* Test config2 */ +	{ 26, 8 }, /* PMU */ +	{ 27, 8 }, /* Test flow/USB */ +	{ 32, 8 }, /* GP1 */ +	{ 33, 8 }, /* GP2 */ +	{ 34, 8 }, /* GP3 */ +	{ 35, 8 }, /* GP4 */ +	{ 36, 8 }, /* GP5 */ +	{ 49, 8 }, /* GP8 */ +	{ 50, 8 }, /* GP9 */ +	{ 51, 8 }, /* GP10 */  };  #elif defined(CONFIG_ARCH_IMX9)  #define FSB_OTP_SHADOW	0x8000 @@ -270,11 +285,26 @@ int fuse_prog(u32 bank, u32 word, u32 val)  {  	u32 res;  	int ret; +	bool lock = false;  	if (bank >= FUSE_BANKS || word >= WORDS_PER_BANKS || !val)  		return -EINVAL; -	ret = ahab_write_fuse((bank * 8 + word), val, false, &res); +	/* Lock 8ULP ECC fuse word, so second programming will return failure. +	 * iMX9 OTP can protect ECC fuse, so not need it +	 */ +#if defined(CONFIG_IMX8ULP) +	u32 i; +	for (i = 0; i < ARRAY_SIZE(nonecc_fuse_banks); i++) { +		if (nonecc_fuse_banks[i] == bank) +			break; +	} + +	if (i == ARRAY_SIZE(nonecc_fuse_banks)) +		lock = true; +#endif + +	ret = ahab_write_fuse((bank * 8 + word), val, lock, &res);  	if (ret) {  		printf("ahab write fuse failed %d, 0x%x\n", ret, res);  		return ret; | 
