[openwrt/openwrt] ramips: fix reboot for remaining 32 MB boards

LEDE Commits lede-commits at lists.infradead.org
Mon Apr 11 13:08:07 PDT 2022


pepe2k pushed a commit to openwrt/openwrt.git, branch openwrt-21.02:
https://git.openwrt.org/169c9e3a88b7d4521a797864540657ef33554663

commit 169c9e3a88b7d4521a797864540657ef33554663
Author: Michael Pratt <mcpratt at pm.me>
AuthorDate: Fri Sep 10 22:06:10 2021 -0400

    ramips: fix reboot for remaining 32 MB boards
    
    The following devices have a Winbond W25Q256FV flash chip,
    which does not have the RESET pin enabled by default,
    and otherwise would require setting a bit in a status register.
    
    Before moving to Linux 5.4, we had the patch:
    0053-mtd-spi-nor-add-w25q256-3b-mode-switch.patch
    which kept specific flash chips with explicit 3-byte and 4-byte address modes
    to stay in 3-byte address mode while idle (after an erase or write)
    by using a custom flag SPI_NOR_4B_READ_OP that was part of the patch.
    
    this was obsoleted by the patch:
    481-mtd-spi-nor-rework-broken-flash-reset-support.patch
    which uses the newer upstream flag SNOR_F_BROKEN_RESET
    for devices with a flash chip that cannot be hardware reset with RESET pin
    and therefore must be left in 3-byte address mode when idle.
    
    The new patch requires that the DTS of affected devices
    have the property "broken-flash-reset", which was not yet added for most of them.
    
    This commit adds the property for remaining affected devices in ramips target,
    specifically because of the flash chip model.
    
    However, it is possible that there are other devices
    where the flash chip uses an explicit 4-byte address mode
    and the RESET pin is not connected to the SOC on the board,
    and those DTS would also need this property.
    
    Ref: 22d982ea0033 ("ramips: add support for switching between 3-byte and 4-byte addressing")
    Ref: dfa521f12953 ("generic: spi-nor: rework broken-flash-reset")
    Signed-off-by: Michael Pratt <mcpratt at pm.me>
    [pepe2k at gmail.com: backported to 21.02]
    Fixes: #9655, #9636, #9547
    Signed-off-by: Piotr Dymacz <pepe2k at gmail.com>
    (backported from commit 74516f4357d281f093f0daac01c4c5c239acc443)
---
 target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026-h-32m.dts | 4 ++++
 target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026.dtsi      | 2 +-
 target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-32m.dts    | 1 +
 target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-e.dts      | 1 +
 target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts          | 1 +
 target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts              | 1 +
 target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526-32m.dts    | 4 ++++
 target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi       | 2 +-
 target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts | 1 +
 target/linux/ramips/dts/mt7628an_hilink_hlk-7688a.dts        | 1 +
 target/linux/ramips/dts/mt7628an_jotale_js76x8-32m.dts       | 4 ++++
 target/linux/ramips/dts/mt7628an_jotale_js76x8.dtsi          | 2 +-
 target/linux/ramips/dts/mt7628an_onion_omega2.dtsi           | 2 +-
 target/linux/ramips/dts/mt7628an_onion_omega2p.dts           | 4 ++++
 target/linux/ramips/dts/mt7628an_widora_neo-32m.dts          | 1 +
 target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts        | 1 +
 target/linux/ramips/dts/mt7628an_wrtnode_wrtnode2.dtsi       | 1 +
 target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts | 1 +
 18 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026-h-32m.dts b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026-h-32m.dts
index 0fc8fc60e4..577e7e05e9 100644
--- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026-h-32m.dts
+++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026-h-32m.dts
@@ -8,6 +8,10 @@
 	model = "Zbtlink ZBT-WE1026-H (32M)";
 };
 
+&flash0 {
+	broken-flash-reset;
+};
+
 &firmware {
 	reg = <0x50000 0x1fb0000>;
 };
diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026.dtsi b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026.dtsi
index 91bbd4a044..3dae6d9515 100644
--- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026.dtsi
+++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we1026.dtsi
@@ -30,7 +30,7 @@
 &spi0 {
 	status = "okay";
 
-	flash at 0 {
+	flash0: flash at 0 {
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <10000000>;
diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-32m.dts b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-32m.dts
index 6f5bc41d5d..ad07682c98 100644
--- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-32m.dts
+++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-32m.dts
@@ -12,6 +12,7 @@
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <10000000>;
+		broken-flash-reset;
 
 		partitions {
 			compatible = "fixed-partitions";
diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-e.dts b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-e.dts
index bce6afe263..69502111fa 100644
--- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-e.dts
+++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-e.dts
@@ -40,6 +40,7 @@
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <10000000>;
+		broken-flash-reset;
 
 		partitions {
 			compatible = "fixed-partitions";
diff --git a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts
index 49eeb46d5f..a0fd3786ff 100644
--- a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts
+++ b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts
@@ -69,6 +69,7 @@
 		reg = <0>;
 		spi-max-frequency = <80000000>;
 		m25p,fast-read;
+		broken-flash-reset;
 
 		partitions {
 			compatible = "fixed-partitions";
diff --git a/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts b/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts
index b90ff92c70..a87bcd0727 100644
--- a/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts
+++ b/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts
@@ -47,6 +47,7 @@
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <25000000>;
+		broken-flash-reset;
 
 		partitions {
 			compatible = "fixed-partitions";
diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526-32m.dts b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526-32m.dts
index fe4bc72f39..66a762289d 100644
--- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526-32m.dts
+++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526-32m.dts
@@ -5,6 +5,10 @@
 	model = "Zbtlink ZBT-WG3526 (32M)";
 };
 
+&flash0 {
+	broken-flash-reset;
+};
+
 &firmware {
 	reg = <0x50000 0x1fb0000>;
 };
diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi
index 515d37ceaa..1e44945794 100644
--- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi
+++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi
@@ -49,7 +49,7 @@
 &spi0 {
 	status = "okay";
 
-	flash at 0 {
+	flash0: flash at 0 {
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <10000000>;
diff --git a/target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts b/target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts
index 2ef0422925..eaae0b9c5a 100644
--- a/target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts
+++ b/target/linux/ramips/dts/mt7628an_hak5_wifi-pineapple-mk7.dts
@@ -80,6 +80,7 @@
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <50000000>;
+		broken-flash-reset;
 
 		partitions {
 			compatible = "fixed-partitions";
diff --git a/target/linux/ramips/dts/mt7628an_hilink_hlk-7688a.dts b/target/linux/ramips/dts/mt7628an_hilink_hlk-7688a.dts
index 969488e416..1f878b0d9a 100644
--- a/target/linux/ramips/dts/mt7628an_hilink_hlk-7688a.dts
+++ b/target/linux/ramips/dts/mt7628an_hilink_hlk-7688a.dts
@@ -61,6 +61,7 @@
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <40000000>;
+		broken-flash-reset;
 
 		partitions {
 			compatible = "fixed-partitions";
diff --git a/target/linux/ramips/dts/mt7628an_jotale_js76x8-32m.dts b/target/linux/ramips/dts/mt7628an_jotale_js76x8-32m.dts
index 07e8be7848..75ee98836a 100644
--- a/target/linux/ramips/dts/mt7628an_jotale_js76x8-32m.dts
+++ b/target/linux/ramips/dts/mt7628an_jotale_js76x8-32m.dts
@@ -7,6 +7,10 @@
 	model = "Jotale JS76x8 (32M)";
 };
 
+&flash0 {
+	broken-flash-reset;
+};
+
 &firmware {
 	reg = <0x50000 0x1fb0000>;
 };
diff --git a/target/linux/ramips/dts/mt7628an_jotale_js76x8.dtsi b/target/linux/ramips/dts/mt7628an_jotale_js76x8.dtsi
index 3fd173914e..e4952d4adb 100644
--- a/target/linux/ramips/dts/mt7628an_jotale_js76x8.dtsi
+++ b/target/linux/ramips/dts/mt7628an_jotale_js76x8.dtsi
@@ -58,7 +58,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>;
 
-	flash at 0 {
+	flash0: flash at 0 {
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <40000000>;
diff --git a/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi b/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi
index b6d2df4756..460a563257 100644
--- a/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi
+++ b/target/linux/ramips/dts/mt7628an_onion_omega2.dtsi
@@ -95,7 +95,7 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>;
 
-	flash at 0 {
+	flash0: flash at 0 {
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <40000000>;
diff --git a/target/linux/ramips/dts/mt7628an_onion_omega2p.dts b/target/linux/ramips/dts/mt7628an_onion_omega2p.dts
index 4ec07dbd91..5694576974 100644
--- a/target/linux/ramips/dts/mt7628an_onion_omega2p.dts
+++ b/target/linux/ramips/dts/mt7628an_onion_omega2p.dts
@@ -5,6 +5,10 @@
 	model = "Onion Omega2+";
 };
 
+&flash0 {
+	broken-flash-reset;
+};
+
 &firmware {
 	reg = <0x50000 0x1fb0000>;
 };
diff --git a/target/linux/ramips/dts/mt7628an_widora_neo-32m.dts b/target/linux/ramips/dts/mt7628an_widora_neo-32m.dts
index adc74e6643..312e6a91d1 100644
--- a/target/linux/ramips/dts/mt7628an_widora_neo-32m.dts
+++ b/target/linux/ramips/dts/mt7628an_widora_neo-32m.dts
@@ -15,6 +15,7 @@
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <40000000>;
+		broken-flash-reset;
 
 		partitions {
 			compatible = "fixed-partitions";
diff --git a/target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts b/target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts
index 1246651204..08cf9ab160 100644
--- a/target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts
+++ b/target/linux/ramips/dts/mt7628an_wiznet_wizfi630s.dts
@@ -97,6 +97,7 @@
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <40000000>;
+		broken-flash-reset;
 
 		partitions {
 			compatible = "fixed-partitions";
diff --git a/target/linux/ramips/dts/mt7628an_wrtnode_wrtnode2.dtsi b/target/linux/ramips/dts/mt7628an_wrtnode_wrtnode2.dtsi
index a3330fb2eb..2f2b942a4d 100644
--- a/target/linux/ramips/dts/mt7628an_wrtnode_wrtnode2.dtsi
+++ b/target/linux/ramips/dts/mt7628an_wrtnode_wrtnode2.dtsi
@@ -28,6 +28,7 @@
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <10000000>;
+		broken-flash-reset;
 
 		partitions {
 			compatible = "fixed-partitions";
diff --git a/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts b/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts
index 5e92cd2126..7f21f1f908 100644
--- a/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts
+++ b/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts
@@ -86,6 +86,7 @@
 		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <10000000>;
+		broken-flash-reset;
 
 		partitions {
 			compatible = "fixed-partitions";




More information about the lede-commits mailing list