diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 2f786584a1a..071b3395164 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -2844,8 +2844,17 @@ int brcmnand_probe(struct udevice *dev, struct brcmnand_soc *soc) /* Disable XOR addressing */ brcmnand_rmw_reg(ctrl, BRCMNAND_CS_XOR, 0xff, 0, 0); + /* Check if the board connects the WP pin */ +#ifndef __UBOOT__ + if (of_property_read_bool(dn, "brcm,wp-not-connected")) +#else + if (dev_read_bool(ctrl->dev, "brcm,wp-not-connected")) +#endif /* __UBOOT__ */ + wp_on = 0; + /* Read the write-protect configuration in the device tree */ - wp_on = dev_read_u32_default(dev, "write-protect", wp_on); + if (dev_read_bool(ctrl->dev, "write-protect")) + wp_on = dev_read_u32_default(dev, "write-protect", wp_on); if (ctrl->features & BRCMNAND_HAS_WP) { /* Permanently disable write protection */