From 89b3dca8b5319657b37fa5ad736a65bef87f53e9 Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Fri, 26 Feb 2016 04:39:50 +0100
Subject: [PATCH] kernel: disable software protection bits for macronix flash
 chips at init

The bootloader of AirOS 5.6.x doesn't remove the flash protection for us,
so we have to do this ourselves.
---
 ...its-for-macronix-flash-chips-at-init.patch | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 patches/openwrt/0043-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch

diff --git a/patches/openwrt/0043-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch b/patches/openwrt/0043-kernel-disable-software-protection-bits-for-macronix-flash-chips-at-init.patch
new file mode 100644
index 000000000..2b16474af
--- /dev/null
+++ b/patches/openwrt/0043-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
++++ b/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);
-- 
GitLab