diff options
author | Victor Shyba <victor1984@riseup.net> | 2016-12-20 05:19:08 -0300 |
---|---|---|
committer | Mathias Kresin <dev@kresin.me> | 2017-01-03 19:58:00 +0100 |
commit | d6c831e0e5a0ef97eb054dd3eb382d66b1bffc40 (patch) | |
tree | b5723cc59f2456cbda62eeee4556c8cf88b7c50f /target/linux/generic | |
parent | 799d0dddf608ff012b49282d5832ddd2ef1b916e (diff) | |
download | upstream-d6c831e0e5a0ef97eb054dd3eb382d66b1bffc40.tar.gz upstream-d6c831e0e5a0ef97eb054dd3eb382d66b1bffc40.tar.bz2 upstream-d6c831e0e5a0ef97eb054dd3eb382d66b1bffc40.zip |
generic: mtd: backport SPI_NOR_HAS_LOCK
This flag was added to 4.9 with upstream commit
76a4707de5e18dc32d9cb4e990686140c5664a15.
Signed-off-by: Victor Shyba <victor1984@riseup.net>
[refresh and adjust platform patches, fix commit message]
Signed-off-by: Mathias Kresin <dev@kresin.me>
Diffstat (limited to 'target/linux/generic')
6 files changed, 56 insertions, 7 deletions
diff --git a/target/linux/generic/patches-4.4/048-mtd-spi-nor-backport-SPI_NOR_HAS_LOCK-flag.patch b/target/linux/generic/patches-4.4/048-mtd-spi-nor-backport-SPI_NOR_HAS_LOCK-flag.patch new file mode 100644 index 0000000000..1966e32aaf --- /dev/null +++ b/target/linux/generic/patches-4.4/048-mtd-spi-nor-backport-SPI_NOR_HAS_LOCK-flag.patch @@ -0,0 +1,49 @@ +From 76a4707de5e18dc32d9cb4e990686140c5664a15 Mon Sep 17 00:00:00 2001 +From: Brian Norris <computersforpeace@gmail.com> +Date: Fri, 29 Jan 2016 11:25:35 -0800 +Subject: [PATCH] mtd: spi-nor: add SPI_NOR_HAS_LOCK flag + +We can't determine this purely by manufacturer type (see commit +67b9bcd36906 ("mtd: spi-nor: fix Spansion regressions (aliased with +Winbond)")), and it's not autodetectable by anything like SFDP. So make +a new flag for it. + +Signed-off-by: Brian Norris <computersforpeace@gmail.com> +Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> +Tested-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> +--- + drivers/mtd/spi-nor/spi-nor.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c +index 72d87c2..d1edafc 100644 +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -68,6 +68,7 @@ struct flash_info { + #define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */ + #define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */ + #define USE_FSR 0x80 /* use flag status register */ ++#define SPI_NOR_HAS_LOCK 0x100 /* Flash supports lock/unlock via SR */ + }; + + #define JEDEC_MFR(info) ((info)->id[0]) +@@ -1156,7 +1157,8 @@ int spi_nor_scan(struct spi_nor *nor, co + + if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || + JEDEC_MFR(info) == SNOR_MFR_INTEL || +- JEDEC_MFR(info) == SNOR_MFR_SST) { ++ JEDEC_MFR(info) == SNOR_MFR_SST || ++ info->flags & SPI_NOR_HAS_LOCK) { + write_enable(nor); + write_sr(nor, 0); + } +@@ -1172,7 +1174,8 @@ int spi_nor_scan(struct spi_nor *nor, co + mtd->_read = spi_nor_read; + + /* NOR protection support for STmicro/Micron chips and similar */ +- if (JEDEC_MFR(info) == SNOR_MFR_MICRON) { ++ if (JEDEC_MFR(info) == SNOR_MFR_MICRON || ++ info->flags & SPI_NOR_HAS_LOCK) { + nor->flash_lock = stm_lock; + nor->flash_unlock = stm_unlock; + nor->flash_is_locked = stm_is_locked; diff --git a/target/linux/generic/patches-4.4/150-mtd-spi-nor-add-support-for-ESMT_f25l32qa-and-ESMT_f.patch b/target/linux/generic/patches-4.4/150-mtd-spi-nor-add-support-for-ESMT_f25l32qa-and-ESMT_f.patch index 65f1b708a1..d6e577be8c 100644 --- a/target/linux/generic/patches-4.4/150-mtd-spi-nor-add-support-for-ESMT_f25l32qa-and-ESMT_f.patch +++ b/target/linux/generic/patches-4.4/150-mtd-spi-nor-add-support-for-ESMT_f25l32qa-and-ESMT_f.patch @@ -10,7 +10,7 @@ Signed-off-by: L. D. Pinney <ldpinney@gmail.com> --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -688,6 +688,8 @@ static const struct flash_info spi_nor_i +@@ -689,6 +689,8 @@ static const struct flash_info spi_nor_i /* ESMT */ { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K) }, diff --git a/target/linux/generic/patches-4.4/465-m25p80-mx-disable-software-protection.patch b/target/linux/generic/patches-4.4/465-m25p80-mx-disable-software-protection.patch index 070f4c6023..89bafa8387 100644 --- a/target/linux/generic/patches-4.4/465-m25p80-mx-disable-software-protection.patch +++ b/target/linux/generic/patches-4.4/465-m25p80-mx-disable-software-protection.patch @@ -4,11 +4,11 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1158,6 +1158,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1159,6 +1159,7 @@ int spi_nor_scan(struct spi_nor *nor, co if (JEDEC_MFR(info) == SNOR_MFR_ATMEL || JEDEC_MFR(info) == SNOR_MFR_INTEL || + JEDEC_MFR(info) == SNOR_MFR_MACRONIX || - JEDEC_MFR(info) == SNOR_MFR_SST) { + JEDEC_MFR(info) == SNOR_MFR_SST || + info->flags & SPI_NOR_HAS_LOCK) { write_enable(nor); - write_sr(nor, 0); diff --git a/target/linux/generic/patches-4.4/475-mtd-spi-nor-add-macronix-mx25u25635f.patch b/target/linux/generic/patches-4.4/475-mtd-spi-nor-add-macronix-mx25u25635f.patch index 3db4a41968..d868a7da25 100644 --- a/target/linux/generic/patches-4.4/475-mtd-spi-nor-add-macronix-mx25u25635f.patch +++ b/target/linux/generic/patches-4.4/475-mtd-spi-nor-add-macronix-mx25u25635f.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -724,6 +724,7 @@ static const struct flash_info spi_nor_i +@@ -725,6 +725,7 @@ static const struct flash_info spi_nor_i { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) }, diff --git a/target/linux/generic/patches-4.4/476-mtd-spi-nor-add-eon-en25q128.patch b/target/linux/generic/patches-4.4/476-mtd-spi-nor-add-eon-en25q128.patch index 38f3255b14..ab805b71d0 100644 --- a/target/linux/generic/patches-4.4/476-mtd-spi-nor-add-eon-en25q128.patch +++ b/target/linux/generic/patches-4.4/476-mtd-spi-nor-add-eon-en25q128.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -682,6 +682,7 @@ static const struct flash_info spi_nor_i +@@ -683,6 +683,7 @@ static const struct flash_info spi_nor_i { "en25q32b", INFO(0x1c3016, 0, 64 * 1024, 64, 0) }, { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, diff --git a/target/linux/generic/patches-4.4/477-mtd-add-spi-nor-add-mx25u3235f.patch b/target/linux/generic/patches-4.4/477-mtd-add-spi-nor-add-mx25u3235f.patch index eb99b28a55..fa1ab3fa06 100644 --- a/target/linux/generic/patches-4.4/477-mtd-add-spi-nor-add-mx25u3235f.patch +++ b/target/linux/generic/patches-4.4/477-mtd-add-spi-nor-add-mx25u3235f.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -721,6 +721,7 @@ static const struct flash_info spi_nor_i +@@ -722,6 +722,7 @@ static const struct flash_info spi_nor_i { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, SECT_4K) }, { "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) }, { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) }, |