drivers: nand: brcmnand: add an option to read the write-protect from device tree

The option write-protect may only change on the kernel command line,
we add a property in the device tree to be more flexible.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
This commit is contained in:
Philippe Reynes 2019-03-15 15:14:38 +01:00 committed by Tom Rini
parent 317d40eb01
commit f917438772

View File

@ -2671,6 +2671,9 @@ int brcmnand_probe(struct udevice *dev, struct brcmnand_soc *soc)
/* Disable XOR addressing */ /* Disable XOR addressing */
brcmnand_rmw_reg(ctrl, BRCMNAND_CS_XOR, 0xff, 0, 0); brcmnand_rmw_reg(ctrl, BRCMNAND_CS_XOR, 0xff, 0, 0);
/* Read the write-protect configuration in the device tree */
wp_on = dev_read_u32_default(dev, "write-protect", wp_on);
if (ctrl->features & BRCMNAND_HAS_WP) { if (ctrl->features & BRCMNAND_HAS_WP) {
/* Permanently disable write protection */ /* Permanently disable write protection */
if (wp_on == 2) if (wp_on == 2)