[PATCH 2/2] mtd: nand: raw: macronix: allow disabling block protection
Álvaro Fernández Rojas
noltari at gmail.com
Thu Mar 23 05:45:10 PDT 2023
Some devices hang when block protection is enabled, so let's add a boolean
property to allow disabling it.
Fixes: 03a539c7a118 ("mtd: rawnand: Macronix: Add support for block protection")
Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
drivers/mtd/nand/raw/nand_macronix.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/mtd/nand/raw/nand_macronix.c b/drivers/mtd/nand/raw/nand_macronix.c
index 1472f925f386..b9f0338ebdaf 100644
--- a/drivers/mtd/nand/raw/nand_macronix.c
+++ b/drivers/mtd/nand/raw/nand_macronix.c
@@ -219,9 +219,13 @@ static int mxic_nand_unlock(struct nand_chip *chip, loff_t ofs, uint64_t len)
static void macronix_nand_block_protection_support(struct nand_chip *chip)
{
+ struct device_node *dn = nand_get_flash_node(chip);
u8 feature[ONFI_SUBFEATURE_PARAM_LEN];
int ret;
+ if (of_property_read_bool(dn, "mxic,disable-block-protection"))
+ return;
+
bitmap_set(chip->parameters.get_feature_list,
ONFI_FEATURE_ADDR_MXIC_PROTECTION, 1);
--
2.30.2
More information about the linux-mtd
mailing list