mtd: spinand: Enable HWP_EN for skyhigh devices

HWP_EN must be enabled first before block unlock region is set.

Change-Id: I6b107d97de48bb2644da865f353d2adace95224e
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
This commit is contained in:
Jon Lin
2023-08-14 14:52:36 +08:00
committed by Tao Huang
parent cb0b9bc78c
commit 72986913fc
2 changed files with 8 additions and 0 deletions

View File

@@ -1118,6 +1118,13 @@ static int spinand_reinit(struct mtd_info *mtd)
if (ret)
return ret;
/* HWP_EN must be enabled first before block unlock region is set */
if (spinand->id.data[0] == 0x01) {
ret = spinand_lock_block(spinand, HWP_EN);
if (ret)
return ret;
}
ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED);
if (ret)
return ret;

View File

@@ -149,6 +149,7 @@
/* feature register */
#define REG_BLOCK_LOCK 0xa0
#define BL_ALL_UNLOCKED 0x00
#define HWP_EN 0x02 /* Skyhigh feature, Hardware write protection */
/* configuration register */
#define REG_CFG 0xb0