1 From 8e7daa85641c9559c113f6b217bdc923397de77c Mon Sep 17 00:00:00 2001
2 From: William Zhang <william.zhang@broadcom.com>
3 Date: Thu, 22 Feb 2024 19:47:58 -0800
4 Subject: [PATCH] mtd: rawnand: brcmnand: Support write protection setting from
7 The write protection feature is controlled by the module parameter wp_on
8 with default set to enabled. But not all the board use this feature
9 especially in BCMBCA broadband board. And module parameter is not
10 sufficient as different board can have different option. Add a device
11 tree property and allow this feature to be configured through the board
12 dts on per board basis.
14 Signed-off-by: William Zhang <william.zhang@broadcom.com>
15 Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
16 Reviewed-by: Kamal Dasu <kamal.dasu@broadcom.com>
17 Reviewed-by: David Regan <dregan@broadcom.com>
18 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
19 Link: https://lore.kernel.org/linux-mtd/20240223034758.13753-14-william.zhang@broadcom.com
21 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 4 ++++
22 1 file changed, 4 insertions(+)
24 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
25 +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
26 @@ -3189,6 +3189,10 @@ int brcmnand_probe(struct platform_devic
27 /* Disable XOR addressing */
28 brcmnand_rmw_reg(ctrl, BRCMNAND_CS_XOR, 0xff, 0, 0);
30 + /* Check if the board connects the WP pin */
31 + if (of_property_read_bool(dn, "brcm,wp-not-connected"))
34 if (ctrl->features & BRCMNAND_HAS_WP) {
35 /* Permanently disable write protection */