411-v6.9-mtd-rawnand-brcmnand-Support-write-protection-settin.patch 1.5 KB

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