diff mbox series

[U-Boot,09/18] drivers: nand: brcmnand: add an option to read the write-protect from device tree

Message ID 1552659287-11246-10-git-send-email-philippe.reynes@softathome.com
State Accepted
Delegated to: Tom Rini
Headers show
Series Initial support of driver brcmnand (from kernel 4.18) | expand

Commit Message

Philippe REYNES March 15, 2019, 2:14 p.m. UTC
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>
---
 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Tom Rini April 24, 2019, 1:25 p.m. UTC | #1
On Fri, Mar 15, 2019 at 03:14:38PM +0100, Philippe Reynes wrote:

> 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>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index e333320..faa6da4 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -2671,6 +2671,9 @@  int brcmnand_probe(struct udevice *dev, struct brcmnand_soc *soc)
 	/* Disable XOR addressing */
 	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) {
 		/* Permanently disable write protection */
 		if (wp_on == 2)