bcm4908: use DT to mark NAND controller WP pin as not connected
authorRafał Miłecki <rafal@milecki.pl>
Thu, 28 Mar 2024 11:00:04 +0000 (12:00 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Thu, 28 Mar 2024 12:29:52 +0000 (13:29 +0100)
Use cleaner and more upstream-fit solution.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
target/linux/bcm4908/patches-5.15/130-arm64-dts-broadcom-bcmbca-bcm4908-set-brcm-wp-not-co.patch [new file with mode: 0644]
target/linux/bcm4908/patches-5.15/400-mtd-rawnand-brcmnand-disable-WP-on-BCM4908.patch [deleted file]
target/linux/bcm4908/patches-6.1/130-arm64-dts-broadcom-bcmbca-bcm4908-set-brcm-wp-not-co.patch [new file with mode: 0644]
target/linux/bcm4908/patches-6.1/400-mtd-rawnand-brcmnand-disable-WP-on-BCM4908.patch [deleted file]

diff --git a/target/linux/bcm4908/patches-5.15/130-arm64-dts-broadcom-bcmbca-bcm4908-set-brcm-wp-not-co.patch b/target/linux/bcm4908/patches-5.15/130-arm64-dts-broadcom-bcmbca-bcm4908-set-brcm-wp-not-co.patch
new file mode 100644 (file)
index 0000000..d43d6d8
--- /dev/null
@@ -0,0 +1,31 @@
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Thu, 28 Mar 2024 10:24:34 +0100
+Subject: [PATCH] arm64: dts: broadcom: bcmbca: bcm4908: set
+ brcm,wp-not-connected
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Every described BCM4908 board has WP pin not connected. This caused
+problems for drivers since day 0 but there was no property to describe
+that properly. Projects like OpenWrt were modifying Linux driver to deal
+with it.
+
+It's not clear if that is hardware limitation or just reference design
+being copied over and over but this applies to all known / supported
+BCM4908 boards. Handle it by marking WP as not connected by default.
+
+Fixes: 2961f69f151c ("arm64: dts: broadcom: add BCM4908 and Asus GT-AC5300 early DTS files")
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+---
+
+--- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi
++++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi
+@@ -596,6 +596,7 @@
+                       reg-names = "nand", "nand-int-base";
+                       interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "nand_ctlrdy";
++                      brcm,wp-not-connected;
+                       status = "okay";
+                       nandcs: nand@0 {
diff --git a/target/linux/bcm4908/patches-5.15/400-mtd-rawnand-brcmnand-disable-WP-on-BCM4908.patch b/target/linux/bcm4908/patches-5.15/400-mtd-rawnand-brcmnand-disable-WP-on-BCM4908.patch
deleted file mode 100644 (file)
index 6506623..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Thu, 21 Jan 2021 10:44:53 +0100
-Subject: [PATCH] mtd: rawnand: brcmnand: disable WP on BCM4908
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BCM4908 contains NAND controller version 0x0701 (v7.1). It means that
-NAND_WP should be available.
-
-For some reason setting #WP on doesn't result in clearing NAND_STATUS_WP
-status bit:
-[    1.077857] bcm63138_nand ff801800.nand: timeout on status poll (expected c0000040 got c00000c0)
-[    1.086832] bcm63138_nand ff801800.nand: nand #WP expected on
-
-For now try working without touching #WP.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
----
-
---- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
-+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
-@@ -38,7 +38,11 @@
-  * 1: NAND_WP is set by default, cleared for erase/write operations
-  * 2: NAND_WP is always cleared
-  */
-+#if IS_ENABLED(CONFIG_ARCH_BCM4908)
-+static int wp_on = 0;
-+#else
- static int wp_on = 1;
-+#endif
- module_param(wp_on, int, 0444);
- /***********************************************************************
diff --git a/target/linux/bcm4908/patches-6.1/130-arm64-dts-broadcom-bcmbca-bcm4908-set-brcm-wp-not-co.patch b/target/linux/bcm4908/patches-6.1/130-arm64-dts-broadcom-bcmbca-bcm4908-set-brcm-wp-not-co.patch
new file mode 100644 (file)
index 0000000..d43d6d8
--- /dev/null
@@ -0,0 +1,31 @@
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Thu, 28 Mar 2024 10:24:34 +0100
+Subject: [PATCH] arm64: dts: broadcom: bcmbca: bcm4908: set
+ brcm,wp-not-connected
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Every described BCM4908 board has WP pin not connected. This caused
+problems for drivers since day 0 but there was no property to describe
+that properly. Projects like OpenWrt were modifying Linux driver to deal
+with it.
+
+It's not clear if that is hardware limitation or just reference design
+being copied over and over but this applies to all known / supported
+BCM4908 boards. Handle it by marking WP as not connected by default.
+
+Fixes: 2961f69f151c ("arm64: dts: broadcom: add BCM4908 and Asus GT-AC5300 early DTS files")
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+---
+
+--- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi
++++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi
+@@ -596,6 +596,7 @@
+                       reg-names = "nand", "nand-int-base";
+                       interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
+                       interrupt-names = "nand_ctlrdy";
++                      brcm,wp-not-connected;
+                       status = "okay";
+                       nandcs: nand@0 {
diff --git a/target/linux/bcm4908/patches-6.1/400-mtd-rawnand-brcmnand-disable-WP-on-BCM4908.patch b/target/linux/bcm4908/patches-6.1/400-mtd-rawnand-brcmnand-disable-WP-on-BCM4908.patch
deleted file mode 100644 (file)
index ce20a55..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Thu, 21 Jan 2021 10:44:53 +0100
-Subject: [PATCH] mtd: rawnand: brcmnand: disable WP on BCM4908
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BCM4908 contains NAND controller version 0x0701 (v7.1). It means that
-NAND_WP should be available.
-
-For some reason setting #WP on doesn't result in clearing NAND_STATUS_WP
-status bit:
-[    1.077857] bcm63138_nand ff801800.nand: timeout on status poll (expected c0000040 got c00000c0)
-[    1.086832] bcm63138_nand ff801800.nand: nand #WP expected on
-
-For now try working without touching #WP.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
----
-
---- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
-+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
-@@ -39,7 +39,11 @@
-  * 1: NAND_WP is set by default, cleared for erase/write operations
-  * 2: NAND_WP is always cleared
-  */
-+#if IS_ENABLED(CONFIG_ARCH_BCMBCA)
-+static int wp_on = 0;
-+#else
- static int wp_on = 1;
-+#endif
- module_param(wp_on, int, 0444);
- /***********************************************************************