diff mbox series

ramips: replace obsolete mx25l25635f hack

Message ID 20210121042142.23889-1-dqfext@gmail.com
State Changes Requested
Headers show
Series ramips: replace obsolete mx25l25635f hack | expand

Commit Message

DENG Qingfang Jan. 21, 2021, 4:21 a.m. UTC
The kernel bump to 5.4 removed the mx25l25635f hack, and the upstream
property "broken-flash-reset" should be used instead.

Signed-off-by: DENG Qingfang <dqfext@gmail.com>
---
 target/linux/ramips/dts/mt7620a_youku_yk1.dts        | 3 ++-
 target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts  | 3 ++-
 target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts | 3 ++-
 target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts | 3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

Comments

David Bauer Jan. 21, 2021, 9:37 a.m. UTC | #1
Hi,

On 1/21/21 5:21 AM, DENG Qingfang wrote:
> The kernel bump to 5.4 removed the mx25l25635f hack, and the upstream
> property "broken-flash-reset" should be used instead.

Is this dependent on board design? The need for the old hack should be fixed by
this upstream commit [0]. Given that commit adds SNOR_F_4B_OPCODES for the
mx25l25635f, it should in turn disable the hack enabled by broken-flash-reset, as
this is dependend on 4B opcodes not being supported. [1]

Or am i missing something here?

[0] https://github.com/torvalds/linux/commit/2bffa65da43e399079dad5947c6aa9ab3cfa4ad4
[1] https://github.com/torvalds/linux/blob/master/drivers/mtd/spi-nor/core.c#L3270

Best wishes
David

> 
> Signed-off-by: DENG Qingfang <dqfext@gmail.com>
> ---
>  target/linux/ramips/dts/mt7620a_youku_yk1.dts        | 3 ++-
>  target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts  | 3 ++-
>  target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts | 3 ++-
>  target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts | 3 ++-
>  4 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/target/linux/ramips/dts/mt7620a_youku_yk1.dts b/target/linux/ramips/dts/mt7620a_youku_yk1.dts
> index 86e2031aa6..a3e73e52a7 100644
> --- a/target/linux/ramips/dts/mt7620a_youku_yk1.dts
> +++ b/target/linux/ramips/dts/mt7620a_youku_yk1.dts
> @@ -67,10 +67,11 @@
>  	status = "okay";
>  
>  	flash@0 {
> -		compatible = "mx25l25635f", "jedec,spi-nor";
> +		compatible = "jedec,spi-nor";
>  		reg = <0>;
>  		spi-max-frequency = <25000000>;
>  		m25p,fast-read;
> +		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..e805454bf6 100644
> --- a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts
> +++ b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts
> @@ -65,10 +65,11 @@
>  	status = "okay";
>  
>  	flash@0 {
> -		compatible = "mx25l25635f", "jedec,spi-nor";
> +		compatible = "jedec,spi-nor";
>  		reg = <0>;
>  		spi-max-frequency = <80000000>;
>  		m25p,fast-read;
> +		broken-flash-reset;
>  
>  		partitions {
>  			compatible = "fixed-partitions";
> diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts b/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts
> index f5425ccfee..2454e640a9 100644
> --- a/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts
> +++ b/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts
> @@ -15,9 +15,10 @@
>  	status = "okay";
>  
>  	flash@0 {
> -		compatible = "mx25l25635f", "jedec,spi-nor";
> +		compatible = "jedec,spi-nor";
>  		reg = <0>;
>  		spi-max-frequency = <50000000>;
> +		broken-flash-reset;
>  
>  		partitions {
>  			compatible = "fixed-partitions";
> diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts b/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts
> index 401868362e..d5ed78d03f 100644
> --- a/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts
> +++ b/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts
> @@ -11,9 +11,10 @@
>  	status = "okay";
>  
>  	flash@0 {
> -		compatible = "mx25l25635f", "jedec,spi-nor";
> +		compatible = "jedec,spi-nor";
>  		reg = <0>;
>  		spi-max-frequency = <50000000>;
> +		broken-flash-reset;
>  
>  		partitions {
>  			compatible = "fixed-partitions";
>
DENG Qingfang Jan. 22, 2021, 3:25 a.m. UTC | #2
Hi,

On Thu, Jan 21, 2021 at 5:37 PM David Bauer <mail@david-bauer.net> wrote:
>
> Is this dependent on board design? The need for the old hack should be fixed by
> this upstream commit [0]. Given that commit adds SNOR_F_4B_OPCODES for the
> mx25l25635f, it should in turn disable the hack enabled by broken-flash-reset, as
> this is dependend on 4B opcodes not being supported. [1]

I'm aware of the upstream fix, but some Youku-YK1 users have reported
their routers cannot survive a reboot on kernel 5.4, but are fine on
4.14 (with the mx25l25635f dts hack) [0].
Maybe some batch of the routers or flash chips does not have the BFPT
table set properly.

So, adding broken-flash-reset serves as a fail-safe.

[0] https://github.com/coolsnowwolf/lede/issues/6059
Chuanhong Guo Jan. 22, 2021, 4:09 a.m. UTC | #3
Hi!

On Fri, Jan 22, 2021 at 11:28 AM DENG Qingfang <dqfext@gmail.com> wrote:
>
> Hi,
>
> On Thu, Jan 21, 2021 at 5:37 PM David Bauer <mail@david-bauer.net> wrote:
> >
> > Is this dependent on board design? The need for the old hack should be fixed by
> > this upstream commit [0]. Given that commit adds SNOR_F_4B_OPCODES for the
> > mx25l25635f, it should in turn disable the hack enabled by broken-flash-reset, as
> > this is dependend on 4B opcodes not being supported. [1]
>
> I'm aware of the upstream fix, but some Youku-YK1 users have reported
> their routers cannot survive a reboot on kernel 5.4, but are fine on
> 4.14 (with the mx25l25635f dts hack) [0].

Some Youku-YK1 uses Winbond W25Q256FV, and we used to have
a hack similar to current broken-flash-reset for all W25Q256FV in 4.14.
(It's called 4B_READ_OP or something)
You only need the broken-flash-reset for this specific model.

> So, adding broken-flash-reset serves as a fail-safe.

It's not added as a replacement for "mx25l25635f" compatible string,
so I think it should be dropped from this patch or moved into a
separated one.
diff mbox series

Patch

diff --git a/target/linux/ramips/dts/mt7620a_youku_yk1.dts b/target/linux/ramips/dts/mt7620a_youku_yk1.dts
index 86e2031aa6..a3e73e52a7 100644
--- a/target/linux/ramips/dts/mt7620a_youku_yk1.dts
+++ b/target/linux/ramips/dts/mt7620a_youku_yk1.dts
@@ -67,10 +67,11 @@ 
 	status = "okay";
 
 	flash@0 {
-		compatible = "mx25l25635f", "jedec,spi-nor";
+		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <25000000>;
 		m25p,fast-read;
+		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..e805454bf6 100644
--- a/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts
+++ b/target/linux/ramips/dts/mt7621_glinet_gl-mt1300.dts
@@ -65,10 +65,11 @@ 
 	status = "okay";
 
 	flash@0 {
-		compatible = "mx25l25635f", "jedec,spi-nor";
+		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <80000000>;
 		m25p,fast-read;
+		broken-flash-reset;
 
 		partitions {
 			compatible = "fixed-partitions";
diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts b/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts
index f5425ccfee..2454e640a9 100644
--- a/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts
+++ b/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts
@@ -15,9 +15,10 @@ 
 	status = "okay";
 
 	flash@0 {
-		compatible = "mx25l25635f", "jedec,spi-nor";
+		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <50000000>;
+		broken-flash-reset;
 
 		partitions {
 			compatible = "fixed-partitions";
diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts b/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts
index 401868362e..d5ed78d03f 100644
--- a/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts
+++ b/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts
@@ -11,9 +11,10 @@ 
 	status = "okay";
 
 	flash@0 {
-		compatible = "mx25l25635f", "jedec,spi-nor";
+		compatible = "jedec,spi-nor";
 		reg = <0>;
 		spi-max-frequency = <50000000>;
+		broken-flash-reset;
 
 		partitions {
 			compatible = "fixed-partitions";