From 1ccd24df770f24d5660885d264b3a2af51bf6d1e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 26 Mar 2016 13:22:05 +0100 Subject: [PATCH] generic: mtd: spi-nor: always disable software protection Fixes unwriteable flash when the bootloader leaves it protected. --- ...r-always-disable-software-protection.patch | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 patches/openwrt/0020-generic-mtd-spi-nor-always-disable-software-protection.patch diff --git a/patches/openwrt/0020-generic-mtd-spi-nor-always-disable-software-protection.patch b/patches/openwrt/0020-generic-mtd-spi-nor-always-disable-software-protection.patch new file mode 100644 index 00000000..abe68d72 --- /dev/null +++ b/patches/openwrt/0020-generic-mtd-spi-nor-always-disable-software-protection.patch @@ -0,0 +1,50 @@ +From: Matthias Schiffer +Date: Sat, 26 Mar 2016 13:20:41 +0100 +Subject: generic: mtd: spi-nor: always disable software protection + +Fixes unwriteable flash when the bootloader leaves it protected. + +diff --git a/target/linux/generic/patches-3.18/462-m25p80-always-disable-software-protection.patch b/target/linux/generic/patches-3.18/462-m25p80-always-disable-software-protection.patch +new file mode 100644 +index 0000000..7be7d0f +--- /dev/null ++++ b/target/linux/generic/patches-3.18/462-m25p80-always-disable-software-protection.patch +@@ -0,0 +1,22 @@ ++--- a/drivers/mtd/spi-nor/spi-nor.c +++++ b/drivers/mtd/spi-nor/spi-nor.c ++@@ -957,15 +957,11 @@ int spi_nor_scan(struct spi_nor *nor, co ++ ++ /* ++ * Atmel, SST and Intel/Numonyx serial nor tend to power ++- * up with the software protection bits set +++ * up with the software protection bits set; +++ * others may be left protected by the bootloader ++ */ ++- ++- if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL || ++- JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL || ++- JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) { ++- write_enable(nor); ++- write_sr(nor, 0); ++- } +++ write_enable(nor); +++ write_sr(nor, 0); ++ ++ if (!mtd->name) ++ mtd->name = dev_name(dev); +diff --git a/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch b/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch +deleted file mode 100644 +index d7d7eec..0000000 +--- a/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch ++++ /dev/null +@@ -1,10 +0,0 @@ +---- 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);