@@ -3081,7 +3081,7 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc)
struct brcmnand_controller *ctrl;
struct brcmnand_host *host;
struct resource *res;
- int ret;
+ int ret, wp_dt;
if (dn && !of_match_node(brcmnand_of_match, dn))
return -ENODEV;
@@ -3218,6 +3218,12 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc)
/* Disable XOR addressing */
brcmnand_rmw_reg(ctrl, BRCMNAND_CS_XOR, 0xff, 0, 0);
+ /* Not all boards support write protect (WP), check DT property */
+ if (of_property_read_u32(dn, "brcm,nand-use-wp", &wp_dt) == 0) {
+ if (wp_dt >= 0 && wp_dt <= 2)
+ wp_on = wp_dt;
+ }
+
if (ctrl->features & BRCMNAND_HAS_WP) {
/* Permanently disable write protection */
if (wp_on == 2)