[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240118195356.133391-8-dregan@broadcom.com>
Date: Thu, 18 Jan 2024 11:53:53 -0800
From: dregan@...adcom.com
To: dregan@...adcom.com,
dregan@...l.com,
miquel.raynal@...tlin.com,
richard@....at,
vigneshr@...com,
robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org,
conor+dt@...nel.org,
computersforpeace@...il.com,
kdasu.kdev@...il.com,
linux-mtd@...ts.infradead.org,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
joel.peshkin@...adcom.com,
tomer.yacoby@...adcom.com,
dan.beygelman@...adcom.com,
william.zhang@...adcom.com,
anand.gore@...adcom.com,
kursad.oney@...adcom.com,
florian.fainelli@...adcom.com,
rafal@...ecki.pl,
bcm-kernel-feedback-list@...adcom.com,
andre.przywara@....com,
baruch@...s.co.il,
linux-arm-kernel@...ts.infradead.org,
dan.carpenter@...aro.org
Subject: [PATCH v2 07/10] mtd: rawnand: brcmnand: Support write protection setting from dts
From: William Zhang <william.zhang@...adcom.com>
The write protection feature is controlled by the module parameter wp_on
with default set to enabled. But not all the board use this feature
especially in BCMBCA broadband board. And module parameter is not
sufficient as different board can have different option. Add a device
tree property and allow this feature to be configured through the board
dts on per board basis.
Signed-off-by: William Zhang <william.zhang@...adcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@...adcom.com>
Reviewed-by: Kamal Dasu <kamal.dasu@...adcom.com>
Reviewed-by: David Regan <dregan@...adcom.com>
---
Changes in v2: None
---
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 869ea64e9189..9a904c7c6dad 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -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)
--
2.37.3
Powered by blists - more mailing lists