[v2] kernel: disable software protection bits for macronix flash chips at init

Submitted by Jan Kraus on March 15, 2016, 9:22 p.m.

Details

Message ID 1458076928-14154-2-git-send-email-mayosemmel@gmail.com
State Superseded, archived
Headers show

Commit Message

Jan Kraus March 15, 2016, 9:22 p.m.
The bootloader of AirOS 5.6.x doesn't remove the flash protection for us,
so we have to do this ourselves.

Signed-off-by: Jan Kraus <mayosemmel@gmail.com>
---
 ...ion-bits-for-macronix-flash-chips-at-init.patch | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 build_patches/0004-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch

Patch hide | download patch | download mbox

diff --git a/build_patches/0004-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch b/build_patches/0004-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch
new file mode 100644
index 0000000..a5b87ec
--- /dev/null
+++ b/build_patches/0004-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch
@@ -0,0 +1,22 @@ 
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Fri, 26 Feb 2016 04:24:06 +0100
+Subject: kernel: disable software protection bits for macronix flash chips at init
+
+Backport of r47626
+
+diff --git a/target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch b/target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch
+new file mode 100644
+index 0000000..d7d7eec
+--- /dev/null
++++ target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch
+@@ -0,0 +1,10 @@
++--- a/drivers/mtd/spi-nor/spi-nor.c
+++++ b/drivers/mtd/spi-nor/spi-nor.c
++@@ -962,6 +962,7 @@ int spi_nor_scan(struct spi_nor *nor, co
++ 
++ 	if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL ||
++ 	    JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL ||
+++	    JEDEC_MFR(info->jedec_id) == CFI_MFR_MACRONIX ||
++ 	    JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) {
++ 		write_enable(nor);
++ 		write_sr(nor, 0);

Comments

Tim Niemeyer March 15, 2016, 9:33 p.m.
Am Dienstag, den 15.03.2016, 22:22 +0100 schrieb Jan Kraus:
> The bootloader of AirOS 5.6.x doesn't remove the flash protection for us,
> so we have to do this ourselves.

Ok, wirst (wenn du mein Kommentar im anderen Patch einarbeitest) diesen
Patch rebasen müssen, aber bei der Gelegenheit kannst du dann mein 
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
dran schreiben.

Anmerkung am Rande: es wäre gut, einen Hinweis zu geben, wenn ein
Patchset auf einem anderem basiert.

Tim

> 
> Signed-off-by: Jan Kraus <mayosemmel@gmail.com>
> ---
>  ...ion-bits-for-macronix-flash-chips-at-init.patch | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>  create mode 100644 build_patches/0004-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch
> 
> diff --git a/build_patches/0004-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch b/build_patches/0004-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch
> new file mode 100644
> index 0000000..a5b87ec
> --- /dev/null
> +++ b/build_patches/0004-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch
> @@ -0,0 +1,22 @@
> +From: Matthias Schiffer <mschiffer@universe-factory.net>
> +Date: Fri, 26 Feb 2016 04:24:06 +0100
> +Subject: kernel: disable software protection bits for macronix flash chips at init
> +
> +Backport of r47626
> +
> +diff --git a/target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch b/target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch
> +new file mode 100644
> +index 0000000..d7d7eec
> +--- /dev/null
> ++++ target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch
> +@@ -0,0 +1,10 @@
> ++--- a/drivers/mtd/spi-nor/spi-nor.c
> +++++ b/drivers/mtd/spi-nor/spi-nor.c
> ++@@ -962,6 +962,7 @@ int spi_nor_scan(struct spi_nor *nor, co
> ++ 
> ++ 	if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL ||
> ++ 	    JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL ||
> +++	    JEDEC_MFR(info->jedec_id) == CFI_MFR_MACRONIX ||
> ++ 	    JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) {
> ++ 		write_enable(nor);
> ++ 		write_sr(nor, 0);
> -- 
> 2.1.4
>
Jan Kraus March 15, 2016, 9:48 p.m.
Hallo Tim,

zunächst mal nochmal sorry und danke fürs drüber schauen.
Da mein Laptop immer recht lange zum bauen braucht, habe ich mich halt
mal drauf verlassen, das der Patch nachdem er ins OpenWrt Applied ist
einfach funktioniert.
Nein tut er nicht! Er ist auch schon im Upstream.

Ich muss sagen ich bin grad gewaltig angenervt, weil die Jungs von Gluon
das alles so geschrieben haben als ob es von ihnen stammen würde. War
aber am Ende doch alles nur ein Backport.

Somit funktioniert das in unserem aktuellen Release schon alles und ich
hätte mir ne Menge Arbeit sparen können.

Grüße Jan

Am Dienstag, den 15.03.2016, 22:33 +0100 schrieb Tim Niemeyer:
> Am Dienstag, den 15.03.2016, 22:22 +0100 schrieb Jan Kraus:
> > The bootloader of AirOS 5.6.x doesn't remove the flash protection for us,
> > so we have to do this ourselves.
> 
> Ok, wirst (wenn du mein Kommentar im anderen Patch einarbeitest) diesen
> Patch rebasen müssen, aber bei der Gelegenheit kannst du dann mein 
> Reviewed-by: Tim Niemeyer <tim@tn-x.org>
> dran schreiben.
> 
> Anmerkung am Rande: es wäre gut, einen Hinweis zu geben, wenn ein
> Patchset auf einem anderem basiert.
> 
> Tim
> 
> > 
> > Signed-off-by: Jan Kraus <mayosemmel@gmail.com>
> > ---
> >  ...ion-bits-for-macronix-flash-chips-at-init.patch | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >  create mode 100644 build_patches/0004-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch
> > 
> > diff --git a/build_patches/0004-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch b/build_patches/0004-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch
> > new file mode 100644
> > index 0000000..a5b87ec
> > --- /dev/null
> > +++ b/build_patches/0004-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch
> > @@ -0,0 +1,22 @@
> > +From: Matthias Schiffer <mschiffer@universe-factory.net>
> > +Date: Fri, 26 Feb 2016 04:24:06 +0100
> > +Subject: kernel: disable software protection bits for macronix flash chips at init
> > +
> > +Backport of r47626
> > +
> > +diff --git a/target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch b/target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch
> > +new file mode 100644
> > +index 0000000..d7d7eec
> > +--- /dev/null
> > ++++ target/linux/generic/patches-3.18/465-m25p80-mx-disable-software-protection.patch
> > +@@ -0,0 +1,10 @@
> > ++--- a/drivers/mtd/spi-nor/spi-nor.c
> > +++++ b/drivers/mtd/spi-nor/spi-nor.c
> > ++@@ -962,6 +962,7 @@ int spi_nor_scan(struct spi_nor *nor, co
> > ++ 
> > ++ 	if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL ||
> > ++ 	    JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL ||
> > +++	    JEDEC_MFR(info->jedec_id) == CFI_MFR_MACRONIX ||
> > ++ 	    JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) {
> > ++ 		write_enable(nor);
> > ++ 		write_sr(nor, 0);
> > -- 
> > 2.1.4
> > 
>