aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--target/linux/bcm53xx/patches-4.4/405-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch2
-rw-r--r--target/linux/brcm63xx/patches-4.4/000-4.5-03-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch2
-rw-r--r--target/linux/generic/patches-4.4/048-mtd-spi-nor-backport-SPI_NOR_HAS_LOCK-flag.patch49
-rw-r--r--target/linux/generic/patches-4.4/150-mtd-spi-nor-add-support-for-ESMT_f25l32qa-and-ESMT_f.patch2
-rw-r--r--target/linux/generic/patches-4.4/465-m25p80-mx-disable-software-protection.patch6
-rw-r--r--target/linux/generic/patches-4.4/475-mtd-spi-nor-add-macronix-mx25u25635f.patch2
-rw-r--r--target/linux/generic/patches-4.4/476-mtd-spi-nor-add-eon-en25q128.patch2
-rw-r--r--target/linux/generic/patches-4.4/477-mtd-add-spi-nor-add-mx25u3235f.patch2
-rw-r--r--target/linux/layerscape/patches-4.4/1074-mtd-nand-spi-nor-assign-MTD-of_node.patch2
-rw-r--r--target/linux/layerscape/patches-4.4/1075-mtd-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch2
-rw-r--r--target/linux/layerscape/patches-4.4/1078-mtd-spi-nor-drop-flash_node-field.patch2
-rw-r--r--target/linux/layerscape/patches-4.4/1079-mtd-spi-nor-remove-unnecessary-leading-space-from-db.patch2
-rw-r--r--target/linux/layerscape/patches-4.4/1081-mtd-spi-nor-provide-default-erase_sector-implementat.patch8
-rw-r--r--target/linux/layerscape/patches-4.4/1083-mtd-spi-nor-Fix-error-message-with-unrecognized-JEDE.patch2
-rw-r--r--target/linux/layerscape/patches-4.4/1084-mtd-spi-nor-fix-error-handling-in-spi_nor_erase.patch2
-rw-r--r--target/linux/layerscape/patches-4.4/1085-mtd-spi-nor-Check-the-return-value-from-read_sr.patch6
-rw-r--r--target/linux/layerscape/patches-4.4/1086-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch8
-rw-r--r--target/linux/layerscape/patches-4.4/1090-mtd-spi-nor-Add-SPI-NOR-layer-PM-support.patch9
-rw-r--r--target/linux/layerscape/patches-4.4/1093-mtd-spi-nor-check-return-value-from-read-write.patch12
-rw-r--r--target/linux/layerscape/patches-4.4/1094-mtd-spi-nor-stop-passing-around-retlen.patch14
-rw-r--r--target/linux/layerscape/patches-4.4/1095-mtd-spi-nor-simplify-write-loop.patch4
-rw-r--r--target/linux/layerscape/patches-4.4/1096-mtd-spi-nor-add-read-loop.patch2
-rw-r--r--target/linux/layerscape/patches-4.4/1100-mtd-spi_nor-Disable-Micron-flash-HW-protection.patch2
-rw-r--r--target/linux/layerscape/patches-4.4/1103-mtd-spi-nor-Support-R-W-for-S25FS-S-family-flash.patch8
-rw-r--r--target/linux/layerscape/patches-4.4/1105-mtd-spi-nor-add-DDR-quad-read-support.patch16
-rw-r--r--target/linux/layerscape/patches-4.4/1109-drivers-mtd-spi-nor-Enable-QSPI-Flash-in-Kernel.patch4
-rw-r--r--target/linux/layerscape/patches-4.4/1110-mtd-spi-nor-fsl-quad-add-flash-S25FS-extra-support.patch6
-rw-r--r--target/linux/layerscape/patches-4.4/1111-mtd-spi-nor-disable-4kb-sector-erase-for-s25fl128.patch2
-rw-r--r--target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch62
-rw-r--r--target/linux/oxnas/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch62
-rw-r--r--target/linux/oxnas/patches-4.4/0074-mtd-nand-import-nand_hw_control_init.patch51
-rw-r--r--target/linux/ramips/patches-4.4/0054-mtd-add-chunked-read-io-to-m25p80.patch6
32 files changed, 178 insertions, 183 deletions
diff --git a/target/linux/bcm53xx/patches-4.4/405-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch b/target/linux/bcm53xx/patches-4.4/405-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch
index a93dfb0d18..184d7a2d89 100644
--- a/target/linux/bcm53xx/patches-4.4/405-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch
+++ b/target/linux/bcm53xx/patches-4.4/405-mtd-spi-nor-detect-JEDEC-incompatible-w25q128-using-.patch
@@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -874,6 +874,18 @@ static const struct flash_info *spi_nor_
+@@ -875,6 +875,18 @@ static const struct flash_info *spi_nor_
}
dev_err(nor->dev, "unrecognized JEDEC id bytes: %02x, %2x, %2x\n",
id[0], id[1], id[2]);
diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-03-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-03-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch
index 79af8a6360..74af24bbad 100644
--- a/target/linux/brcm63xx/patches-4.4/000-4.5-03-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch
+++ b/target/linux/brcm63xx/patches-4.4/000-4.5-03-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch
@@ -68,7 +68,7 @@ Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
spifi->nor.write = nxp_spifi_write;
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1112,7 +1112,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1113,7 +1113,7 @@ int spi_nor_scan(struct spi_nor *nor, co
const struct flash_info *info = NULL;
struct device *dev = nor->dev;
struct mtd_info *mtd = &nor->mtd;
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) },
diff --git a/target/linux/layerscape/patches-4.4/1074-mtd-nand-spi-nor-assign-MTD-of_node.patch b/target/linux/layerscape/patches-4.4/1074-mtd-nand-spi-nor-assign-MTD-of_node.patch
index 450d7057c2..e383347895 100644
--- a/target/linux/layerscape/patches-4.4/1074-mtd-nand-spi-nor-assign-MTD-of_node.patch
+++ b/target/linux/layerscape/patches-4.4/1074-mtd-nand-spi-nor-assign-MTD-of_node.patch
@@ -21,7 +21,7 @@ Signed-off-by: Yuan Yao <yao.yuan@nxp.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1218,6 +1218,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1221,6 +1221,7 @@ int spi_nor_scan(struct spi_nor *nor, co
mtd->flags |= MTD_NO_ERASE;
mtd->dev.parent = dev;
diff --git a/target/linux/layerscape/patches-4.4/1075-mtd-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch b/target/linux/layerscape/patches-4.4/1075-mtd-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch
index 1b19d2d4d4..596cc6fcb7 100644
--- a/target/linux/layerscape/patches-4.4/1075-mtd-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch
+++ b/target/linux/layerscape/patches-4.4/1075-mtd-spi-nor-convert-to-spi_nor_-get-set-_flash_node.patch
@@ -69,7 +69,7 @@ Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
spifi->nor.write = nxp_spifi_write;
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1112,7 +1112,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1113,7 +1113,7 @@ int spi_nor_scan(struct spi_nor *nor, co
const struct flash_info *info = NULL;
struct device *dev = nor->dev;
struct mtd_info *mtd = &nor->mtd;
diff --git a/target/linux/layerscape/patches-4.4/1078-mtd-spi-nor-drop-flash_node-field.patch b/target/linux/layerscape/patches-4.4/1078-mtd-spi-nor-drop-flash_node-field.patch
index 08fe44253a..45c69a85cd 100644
--- a/target/linux/layerscape/patches-4.4/1078-mtd-spi-nor-drop-flash_node-field.patch
+++ b/target/linux/layerscape/patches-4.4/1078-mtd-spi-nor-drop-flash_node-field.patch
@@ -14,7 +14,7 @@ Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1218,7 +1218,6 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1221,7 +1221,6 @@ int spi_nor_scan(struct spi_nor *nor, co
mtd->flags |= MTD_NO_ERASE;
mtd->dev.parent = dev;
diff --git a/target/linux/layerscape/patches-4.4/1079-mtd-spi-nor-remove-unnecessary-leading-space-from-db.patch b/target/linux/layerscape/patches-4.4/1079-mtd-spi-nor-remove-unnecessary-leading-space-from-db.patch
index 713c1c9031..13b30cf7e3 100644
--- a/target/linux/layerscape/patches-4.4/1079-mtd-spi-nor-remove-unnecessary-leading-space-from-db.patch
+++ b/target/linux/layerscape/patches-4.4/1079-mtd-spi-nor-remove-unnecessary-leading-space-from-db.patch
@@ -16,7 +16,7 @@ Cc: Cyrille Pitchen <cyrille.pitchen@atmel.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -861,7 +861,7 @@ static const struct flash_info *spi_nor_
+@@ -862,7 +862,7 @@ static const struct flash_info *spi_nor_
tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN);
if (tmp < 0) {
diff --git a/target/linux/layerscape/patches-4.4/1081-mtd-spi-nor-provide-default-erase_sector-implementat.patch b/target/linux/layerscape/patches-4.4/1081-mtd-spi-nor-provide-default-erase_sector-implementat.patch
index 85f6cc6da9..c5029b87a2 100644
--- a/target/linux/layerscape/patches-4.4/1081-mtd-spi-nor-provide-default-erase_sector-implementat.patch
+++ b/target/linux/layerscape/patches-4.4/1081-mtd-spi-nor-provide-default-erase_sector-implementat.patch
@@ -26,7 +26,7 @@ Signed-off-by: Brian Norris <computersforpeace@gmail.com>
struct flash_info {
char *name;
-@@ -313,6 +314,29 @@ static void spi_nor_unlock_and_unprep(st
+@@ -314,6 +315,29 @@ static void spi_nor_unlock_and_unprep(st
}
/*
@@ -56,7 +56,7 @@ Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* Erase an address range on the nor chip. The address range may extend
* one or more erase sectors. Return an error is there is a problem erasing.
*/
-@@ -371,10 +395,9 @@ static int spi_nor_erase(struct mtd_info
+@@ -372,10 +396,9 @@ static int spi_nor_erase(struct mtd_info
while (len) {
write_enable(nor);
@@ -69,7 +69,7 @@ Signed-off-by: Brian Norris <computersforpeace@gmail.com>
addr += mtd->erasesize;
len -= mtd->erasesize;
-@@ -1099,7 +1122,7 @@ static int set_quad_mode(struct spi_nor
+@@ -1100,7 +1123,7 @@ static int set_quad_mode(struct spi_nor
static int spi_nor_check(struct spi_nor *nor)
{
if (!nor->dev || !nor->read || !nor->write ||
@@ -78,7 +78,7 @@ Signed-off-by: Brian Norris <computersforpeace@gmail.com>
pr_err("spi-nor: please fill all the necessary fields!\n");
return -EINVAL;
}
-@@ -1300,6 +1323,12 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1303,6 +1326,12 @@ int spi_nor_scan(struct spi_nor *nor, co
nor->addr_width = 3;
}
diff --git a/target/linux/layerscape/patches-4.4/1083-mtd-spi-nor-Fix-error-message-with-unrecognized-JEDE.patch b/target/linux/layerscape/patches-4.4/1083-mtd-spi-nor-Fix-error-message-with-unrecognized-JEDE.patch
index d53942df84..6ebbdb417d 100644
--- a/target/linux/layerscape/patches-4.4/1083-mtd-spi-nor-Fix-error-message-with-unrecognized-JEDE.patch
+++ b/target/linux/layerscape/patches-4.4/1083-mtd-spi-nor-Fix-error-message-with-unrecognized-JEDE.patch
@@ -20,7 +20,7 @@ Signed-off-by: Brian Norris <computersforpeace@gmail.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -895,7 +895,7 @@ static const struct flash_info *spi_nor_
+@@ -896,7 +896,7 @@ static const struct flash_info *spi_nor_
return &spi_nor_ids[tmp];
}
}
diff --git a/target/linux/layerscape/patches-4.4/1084-mtd-spi-nor-fix-error-handling-in-spi_nor_erase.patch b/target/linux/layerscape/patches-4.4/1084-mtd-spi-nor-fix-error-handling-in-spi_nor_erase.patch
index 3930028d97..53501315e9 100644
--- a/target/linux/layerscape/patches-4.4/1084-mtd-spi-nor-fix-error-handling-in-spi_nor_erase.patch
+++ b/target/linux/layerscape/patches-4.4/1084-mtd-spi-nor-fix-error-handling-in-spi_nor_erase.patch
@@ -17,7 +17,7 @@ Signed-off-by: Brian Norris <computersforpeace@gmail.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -410,17 +410,13 @@ static int spi_nor_erase(struct mtd_info
+@@ -411,17 +411,13 @@ static int spi_nor_erase(struct mtd_info
write_disable(nor);
diff --git a/target/linux/layerscape/patches-4.4/1085-mtd-spi-nor-Check-the-return-value-from-read_sr.patch b/target/linux/layerscape/patches-4.4/1085-mtd-spi-nor-Check-the-return-value-from-read_sr.patch
index 96d9309e4b..cca7ac1797 100644
--- a/target/linux/layerscape/patches-4.4/1085-mtd-spi-nor-Check-the-return-value-from-read_sr.patch
+++ b/target/linux/layerscape/patches-4.4/1085-mtd-spi-nor-Check-the-return-value-from-read_sr.patch
@@ -17,7 +17,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -478,11 +478,13 @@ static int stm_is_locked_sr(struct spi_n
+@@ -479,11 +479,13 @@ static int stm_is_locked_sr(struct spi_n
static int stm_lock(struct spi_nor *nor, loff_t ofs, uint64_t len)
{
struct mtd_info *mtd = &nor->mtd;
@@ -32,7 +32,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
/* SPI NOR always locks to the end */
if (ofs + len != mtd->size) {
-@@ -528,11 +530,13 @@ static int stm_lock(struct spi_nor *nor,
+@@ -529,11 +531,13 @@ static int stm_lock(struct spi_nor *nor,
static int stm_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
{
struct mtd_info *mtd = &nor->mtd;
@@ -47,7 +47,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
/* Cannot unlock; would unlock larger region than requested */
if (stm_is_locked_sr(nor, ofs - mtd->erasesize, mtd->erasesize,
-@@ -1037,6 +1041,8 @@ static int macronix_quad_enable(struct s
+@@ -1038,6 +1042,8 @@ static int macronix_quad_enable(struct s
int ret, val;
val = read_sr(nor);
diff --git a/target/linux/layerscape/patches-4.4/1086-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch b/target/linux/layerscape/patches-4.4/1086-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch
index 7bcfd515da..47f2c8326b 100644
--- a/target/linux/layerscape/patches-4.4/1086-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch
+++ b/target/linux/layerscape/patches-4.4/1086-mtd-spi-nor-wait-until-lock-unlock-operations-are-re.patch
@@ -24,7 +24,7 @@ Signed-off-by: Brian Norris <computersforpeace@gmail.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -481,6 +481,7 @@ static int stm_lock(struct spi_nor *nor,
+@@ -482,6 +482,7 @@ static int stm_lock(struct spi_nor *nor,
int status_old, status_new;
u8 mask = SR_BP2 | SR_BP1 | SR_BP0;
u8 shift = ffs(mask) - 1, pow, val;
@@ -32,7 +32,7 @@ Signed-off-by: Brian Norris <computersforpeace@gmail.com>
status_old = read_sr(nor);
if (status_old < 0)
-@@ -519,7 +520,10 @@ static int stm_lock(struct spi_nor *nor,
+@@ -520,7 +521,10 @@ static int stm_lock(struct spi_nor *nor,
return -EINVAL;
write_enable(nor);
@@ -44,7 +44,7 @@ Signed-off-by: Brian Norris <computersforpeace@gmail.com>
}
/*
-@@ -533,6 +537,7 @@ static int stm_unlock(struct spi_nor *no
+@@ -534,6 +538,7 @@ static int stm_unlock(struct spi_nor *no
int status_old, status_new;
u8 mask = SR_BP2 | SR_BP1 | SR_BP0;
u8 shift = ffs(mask) - 1, pow, val;
@@ -52,7 +52,7 @@ Signed-off-by: Brian Norris <computersforpeace@gmail.com>
status_old = read_sr(nor);
if (status_old < 0)
-@@ -569,7 +574,10 @@ static int stm_unlock(struct spi_nor *no
+@@ -570,7 +575,10 @@ static int stm_unlock(struct spi_nor *no
return -EINVAL;
write_enable(nor);
diff --git a/target/linux/layerscape/patches-4.4/1090-mtd-spi-nor-Add-SPI-NOR-layer-PM-support.patch b/target/linux/layerscape/patches-4.4/1090-mtd-spi-nor-Add-SPI-NOR-layer-PM-support.patch
index 10be8072fc..65a6633453 100644
--- a/target/linux/layerscape/patches-4.4/1090-mtd-spi-nor-Add-SPI-NOR-layer-PM-support.patch
+++ b/target/linux/layerscape/patches-4.4/1090-mtd-spi-nor-Add-SPI-NOR-layer-PM-support.patch
@@ -24,7 +24,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1140,6 +1140,26 @@ static int spi_nor_check(struct spi_nor
+@@ -1141,6 +1141,26 @@ static int spi_nor_check(struct spi_nor
return 0;
}
@@ -51,7 +51,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
{
const struct flash_info *info = NULL;
-@@ -1187,18 +1207,9 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1188,19 +1208,9 @@ int spi_nor_scan(struct spi_nor *nor, co
mutex_init(&nor->lock);
@@ -63,7 +63,8 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
- 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);
- }
@@ -73,7 +74,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
if (!mtd->name)
mtd->name = dev_name(dev);
-@@ -1364,6 +1375,45 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1367,6 +1377,45 @@ int spi_nor_scan(struct spi_nor *nor, co
}
EXPORT_SYMBOL_GPL(spi_nor_scan);
diff --git a/target/linux/layerscape/patches-4.4/1093-mtd-spi-nor-check-return-value-from-read-write.patch b/target/linux/layerscape/patches-4.4/1093-mtd-spi-nor-check-return-value-from-read-write.patch
index 79c71b271d..85a231515f 100644
--- a/target/linux/layerscape/patches-4.4/1093-mtd-spi-nor-check-return-value-from-read-write.patch
+++ b/target/linux/layerscape/patches-4.4/1093-mtd-spi-nor-check-return-value-from-read-write.patch
@@ -14,7 +14,7 @@ Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -923,7 +923,10 @@ static int spi_nor_read(struct mtd_info
+@@ -924,7 +924,10 @@ static int spi_nor_read(struct mtd_info
ret = nor->read(nor, from, len, retlen, buf);
spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_READ);
@@ -26,7 +26,7 @@ Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
}
static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
-@@ -949,10 +952,14 @@ static int sst_write(struct mtd_info *mt
+@@ -950,10 +953,14 @@ static int sst_write(struct mtd_info *mt
nor->program_opcode = SPINOR_OP_BP;
/* write one byte. */
@@ -43,7 +43,7 @@ Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
}
to += actual;
-@@ -961,10 +968,14 @@ static int sst_write(struct mtd_info *mt
+@@ -962,10 +969,14 @@ static int sst_write(struct mtd_info *mt
nor->program_opcode = SPINOR_OP_AAI_WP;
/* write two bytes. */
@@ -60,7 +60,7 @@ Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
to += 2;
nor->sst_write_second = true;
}
-@@ -973,21 +984,24 @@ static int sst_write(struct mtd_info *mt
+@@ -974,21 +985,24 @@ static int sst_write(struct mtd_info *mt
write_disable(nor);
ret = spi_nor_wait_till_ready(nor);
if (ret)
@@ -90,7 +90,7 @@ Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE);
return ret;
}
-@@ -1016,14 +1030,18 @@ static int spi_nor_write(struct mtd_info
+@@ -1017,14 +1031,18 @@ static int spi_nor_write(struct mtd_info
/* do all the bytes fit onto one page? */
if (page_offset + len <= nor->page_size) {
@@ -112,7 +112,7 @@ Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
page_size = len - i;
if (page_size > nor->page_size)
page_size = nor->page_size;
-@@ -1034,7 +1052,11 @@ static int spi_nor_write(struct mtd_info
+@@ -1035,7 +1053,11 @@ static int spi_nor_write(struct mtd_info
write_enable(nor);
diff --git a/target/linux/layerscape/patches-4.4/1094-mtd-spi-nor-stop-passing-around-retlen.patch b/target/linux/layerscape/patches-4.4/1094-mtd-spi-nor-stop-passing-around-retlen.patch
index 772eb9e706..f72bc2c820 100644
--- a/target/linux/layerscape/patches-4.4/1094-mtd-spi-nor-stop-passing-around-retlen.patch
+++ b/target/linux/layerscape/patches-4.4/1094-mtd-spi-nor-stop-passing-around-retlen.patch
@@ -113,7 +113,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
u8 cmd = nor->read_opcode;
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -920,12 +920,13 @@ static int spi_nor_read(struct mtd_info
+@@ -921,12 +921,13 @@ static int spi_nor_read(struct mtd_info
if (ret)
return ret;
@@ -128,7 +128,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
return 0;
}
-@@ -952,7 +953,7 @@ static int sst_write(struct mtd_info *mt
+@@ -953,7 +954,7 @@ static int sst_write(struct mtd_info *mt
nor->program_opcode = SPINOR_OP_BP;
/* write one byte. */
@@ -137,7 +137,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
if (ret < 0)
goto sst_write_err;
WARN(ret != 1, "While writing 1 byte written %i bytes\n",
-@@ -968,7 +969,7 @@ static int sst_write(struct mtd_info *mt
+@@ -969,7 +970,7 @@ static int sst_write(struct mtd_info *mt
nor->program_opcode = SPINOR_OP_AAI_WP;
/* write two bytes. */
@@ -146,7 +146,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
if (ret < 0)
goto sst_write_err;
WARN(ret != 2, "While writing 2 bytes written %i bytes\n",
-@@ -991,7 +992,7 @@ static int sst_write(struct mtd_info *mt
+@@ -992,7 +993,7 @@ static int sst_write(struct mtd_info *mt
write_enable(nor);
nor->program_opcode = SPINOR_OP_BP;
@@ -155,7 +155,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
if (ret < 0)
goto sst_write_err;
WARN(ret != 1, "While writing 1 byte written %i bytes\n",
-@@ -1000,8 +1001,10 @@ static int sst_write(struct mtd_info *mt
+@@ -1001,8 +1002,10 @@ static int sst_write(struct mtd_info *mt
if (ret)
goto sst_write_err;
write_disable(nor);
@@ -166,7 +166,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE);
return ret;
}
-@@ -1030,15 +1033,17 @@ static int spi_nor_write(struct mtd_info
+@@ -1031,15 +1034,17 @@ static int spi_nor_write(struct mtd_info
/* do all the bytes fit onto one page? */
if (page_offset + len <= nor->page_size) {
@@ -186,7 +186,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
/* write everything in nor->page_size chunks */
for (i = ret; i < len; ) {
-@@ -1052,10 +1057,10 @@ static int spi_nor_write(struct mtd_info
+@@ -1053,10 +1058,10 @@ static int spi_nor_write(struct mtd_info
write_enable(nor);
diff --git a/target/linux/layerscape/patches-4.4/1095-mtd-spi-nor-simplify-write-loop.patch b/target/linux/layerscape/patches-4.4/1095-mtd-spi-nor-simplify-write-loop.patch
index f07694e7cf..f3179cd56e 100644
--- a/target/linux/layerscape/patches-4.4/1095-mtd-spi-nor-simplify-write-loop.patch
+++ b/target/linux/layerscape/patches-4.4/1095-mtd-spi-nor-simplify-write-loop.patch
@@ -18,7 +18,7 @@ Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1018,8 +1018,8 @@ static int spi_nor_write(struct mtd_info
+@@ -1019,8 +1019,8 @@ static int spi_nor_write(struct mtd_info
size_t *retlen, const u_char *buf)
{
struct spi_nor *nor = mtd_to_spi_nor(mtd);
@@ -29,7 +29,7 @@ Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
dev_dbg(nor->dev, "to 0x%08x, len %zd\n", (u32)to, len);
-@@ -1027,45 +1027,37 @@ static int spi_nor_write(struct mtd_info
+@@ -1028,45 +1028,37 @@ static int spi_nor_write(struct mtd_info
if (ret)
return ret;
diff --git a/target/linux/layerscape/patches-4.4/1096-mtd-spi-nor-add-read-loop.patch b/target/linux/layerscape/patches-4.4/1096-mtd-spi-nor-add-read-loop.patch
index 604baa3e05..59d9f3e88a 100644
--- a/target/linux/layerscape/patches-4.4/1096-mtd-spi-nor-add-read-loop.patch
+++ b/target/linux/layerscape/patches-4.4/1096-mtd-spi-nor-add-read-loop.patch
@@ -15,7 +15,7 @@ Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -920,14 +920,22 @@ static int spi_nor_read(struct mtd_info
+@@ -921,14 +921,22 @@ static int spi_nor_read(struct mtd_info
if (ret)
return ret;
diff --git a/target/linux/layerscape/patches-4.4/1100-mtd-spi_nor-Disable-Micron-flash-HW-protection.patch b/target/linux/layerscape/patches-4.4/1100-mtd-spi_nor-Disable-Micron-flash-HW-protection.patch
index 5e61b2cdae..a5495616e9 100644
--- a/target/linux/layerscape/patches-4.4/1100-mtd-spi_nor-Disable-Micron-flash-HW-protection.patch
+++ b/target/linux/layerscape/patches-4.4/1100-mtd-spi_nor-Disable-Micron-flash-HW-protection.patch
@@ -24,7 +24,7 @@ Signed-off-by: Yunhui Cui <B56489@freescale.com>
struct flash_info {
char *name;
-@@ -1238,6 +1239,14 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1239,6 +1240,14 @@ int spi_nor_scan(struct spi_nor *nor, co
if (ret)
return ret;
diff --git a/target/linux/layerscape/patches-4.4/1103-mtd-spi-nor-Support-R-W-for-S25FS-S-family-flash.patch b/target/linux/layerscape/patches-4.4/1103-mtd-spi-nor-Support-R-W-for-S25FS-S-family-flash.patch
index 9b3f69d4e1..9cfa2697a8 100644
--- a/target/linux/layerscape/patches-4.4/1103-mtd-spi-nor-Support-R-W-for-S25FS-S-family-flash.patch
+++ b/target/linux/layerscape/patches-4.4/1103-mtd-spi-nor-Support-R-W-for-S25FS-S-family-flash.patch
@@ -24,7 +24,7 @@ Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
struct flash_info {
char *name;
-@@ -73,6 +77,8 @@ struct flash_info {
+@@ -74,6 +78,8 @@ struct flash_info {
};
#define JEDEC_MFR(info) ((info)->id[0])
@@ -33,7 +33,7 @@ Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
static const struct flash_info *spi_nor_match_id(const char *name);
-@@ -785,6 +791,7 @@ static const struct flash_info spi_nor_i
+@@ -786,6 +792,7 @@ static const struct flash_info spi_nor_i
*/
{ "s25sl032p", INFO(0x010215, 0x4d00, 64 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25sl064p", INFO(0x010216, 0x4d00, 64 * 1024, 128, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
@@ -41,7 +41,7 @@ Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
{ "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, 0) },
{ "s25fl256s1", INFO(0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25fl512s", INFO(0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
-@@ -909,6 +916,53 @@ static const struct flash_info *spi_nor_
+@@ -910,6 +917,53 @@ static const struct flash_info *spi_nor_
return ERR_PTR(-ENODEV);
}
@@ -95,7 +95,7 @@ Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf)
{
-@@ -1247,6 +1301,12 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1248,6 +1302,12 @@ int spi_nor_scan(struct spi_nor *nor, co
write_sr(nor, ret);
}
diff --git a/target/linux/layerscape/patches-4.4/1105-mtd-spi-nor-add-DDR-quad-read-support.patch b/target/linux/layerscape/patches-4.4/1105-mtd-spi-nor-add-DDR-quad-read-support.patch
index 1afc405f77..bad120e7be 100644
--- a/target/linux/layerscape/patches-4.4/1105-mtd-spi-nor-add-DDR-quad-read-support.patch
+++ b/target/linux/layerscape/patches-4.4/1105-mtd-spi-nor-add-DDR-quad-read-support.patch
@@ -31,10 +31,10 @@ Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
-#define USE_FSR 0x80 /* use flag status register */
+#define SPI_NOR_DDR_QUAD_READ 0x80 /* Flash supports DDR Quad Read */
+#define USE_FSR 0x100 /* use flag status register */
+ #define SPI_NOR_HAS_LOCK 0x100 /* Flash supports lock/unlock via SR */
};
- #define JEDEC_MFR(info) ((info)->id[0])
-@@ -144,13 +145,17 @@ static int read_cr(struct spi_nor *nor)
+@@ -145,13 +146,17 @@ static int read_cr(struct spi_nor *nor)
* It can be used to support more commands with
* different dummy cycle requirements.
*/
@@ -53,7 +53,7 @@ Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
case SPI_NOR_NORMAL:
return 0;
}
-@@ -798,7 +803,8 @@ static const struct flash_info spi_nor_i
+@@ -799,7 +804,8 @@ static const struct flash_info spi_nor_i
{ "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) },
{ "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) },
{ "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) },
@@ -63,7 +63,7 @@ Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
{ "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25sl004a", INFO(0x010212, 0, 64 * 1024, 8, 0) },
-@@ -1187,6 +1193,23 @@ static int spansion_quad_enable(struct s
+@@ -1188,6 +1194,23 @@ static int spansion_quad_enable(struct s
return 0;
}
@@ -87,7 +87,7 @@ Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info)
{
int status;
-@@ -1376,8 +1399,15 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1378,8 +1401,15 @@ int spi_nor_scan(struct spi_nor *nor, co
if (info->flags & SPI_NOR_NO_FR)
nor->flash_read = SPI_NOR_NORMAL;
@@ -105,7 +105,7 @@ Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
ret = set_quad_mode(nor, info);
if (ret) {
dev_err(dev, "quad mode not supported\n");
-@@ -1390,6 +1420,14 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1392,6 +1422,14 @@ int spi_nor_scan(struct spi_nor *nor, co
/* Default commands */
switch (nor->flash_read) {
@@ -120,7 +120,7 @@ Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
case SPI_NOR_QUAD:
nor->read_opcode = SPINOR_OP_READ_1_1_4;
break;
-@@ -1417,6 +1455,9 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1419,6 +1457,9 @@ int spi_nor_scan(struct spi_nor *nor, co
if (JEDEC_MFR(info) == SNOR_MFR_SPANSION) {
/* Dedicated 4-byte command set */
switch (nor->flash_read) {
@@ -130,7 +130,7 @@ Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
case SPI_NOR_QUAD:
nor->read_opcode = SPINOR_OP_READ4_1_1_4;
break;
-@@ -1446,7 +1487,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1448,7 +1489,7 @@ int spi_nor_scan(struct spi_nor *nor, co
return -EINVAL;
}
diff --git a/target/linux/layerscape/patches-4.4/1109-drivers-mtd-spi-nor-Enable-QSPI-Flash-in-Kernel.patch b/target/linux/layerscape/patches-4.4/1109-drivers-mtd-spi-nor-Enable-QSPI-Flash-in-Kernel.patch
index 64773fd566..95321ebf1b 100644
--- a/target/linux/layerscape/patches-4.4/1109-drivers-mtd-spi-nor-Enable-QSPI-Flash-in-Kernel.patch
+++ b/target/linux/layerscape/patches-4.4/1109-drivers-mtd-spi-nor-Enable-QSPI-Flash-in-Kernel.patch
@@ -14,7 +14,7 @@ Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -797,6 +797,7 @@ static const struct flash_info spi_nor_i
+@@ -798,6 +798,7 @@ static const struct flash_info spi_nor_i
{ "s25sl032p", INFO(0x010215, 0x4d00, 64 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25sl064p", INFO(0x010216, 0x4d00, 64 * 1024, 128, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25fs256s1", INFO6(0x010219, 0x4d0181, 64 * 1024, 512, 0)},
@@ -22,7 +22,7 @@ Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
{ "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, 0) },
{ "s25fl256s1", INFO(0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25fl512s", INFO(0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
-@@ -963,9 +964,11 @@ static int spansion_s25fs_disable_4kb_er
+@@ -964,9 +965,11 @@ static int spansion_s25fs_disable_4kb_er
ret = nor->read_reg(nor, SPINOR_OP_SPANSION_RDAR, &cr3v, 1);
if (ret)
return ret;
diff --git a/target/linux/layerscape/patches-4.4/1110-mtd-spi-nor-fsl-quad-add-flash-S25FS-extra-support.patch b/target/linux/layerscape/patches-4.4/1110-mtd-spi-nor-fsl-quad-add-flash-S25FS-extra-support.patch
index 34ad68736f..8dab548550 100644
--- a/target/linux/layerscape/patches-4.4/1110-mtd-spi-nor-fsl-quad-add-flash-S25FS-extra-support.patch
+++ b/target/linux/layerscape/patches-4.4/1110-mtd-spi-nor-fsl-quad-add-flash-S25FS-extra-support.patch
@@ -116,7 +116,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
* Used for Spansion S25FS-S family flash only.
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -797,7 +797,6 @@ static const struct flash_info spi_nor_i
+@@ -798,7 +798,6 @@ static const struct flash_info spi_nor_i
{ "s25sl032p", INFO(0x010215, 0x4d00, 64 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25sl064p", INFO(0x010216, 0x4d00, 64 * 1024, 128, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25fs256s1", INFO6(0x010219, 0x4d0181, 64 * 1024, 512, 0)},
@@ -124,7 +124,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
{ "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, 0) },
{ "s25fl256s1", INFO(0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25fl512s", INFO(0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
-@@ -964,11 +963,9 @@ static int spansion_s25fs_disable_4kb_er
+@@ -965,11 +964,9 @@ static int spansion_s25fs_disable_4kb_er
ret = nor->read_reg(nor, SPINOR_OP_SPANSION_RDAR, &cr3v, 1);
if (ret)
return ret;
@@ -136,7 +136,7 @@ Integrated-by: Jiang Yutang <yutang.jiang@nxp.com>
return 0;
}
-@@ -1335,6 +1332,8 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1336,6 +1333,8 @@ int spi_nor_scan(struct spi_nor *nor, co
if (!mtd->name)
mtd->name = dev_name(dev);
diff --git a/target/linux/layerscape/patches-4.4/1111-mtd-spi-nor-disable-4kb-sector-erase-for-s25fl128.patch b/target/linux/layerscape/patches-4.4/1111-mtd-spi-nor-disable-4kb-sector-erase-for-s25fl128.patch
index aba6958bd4..f9cdb88f13 100644
--- a/target/linux/layerscape/patches-4.4/1111-mtd-spi-nor-disable-4kb-sector-erase-for-s25fl128.patch
+++ b/target/linux/layerscape/patches-4.4/1111-mtd-spi-nor-disable-4kb-sector-erase-for-s25fl128.patch
@@ -16,7 +16,7 @@ Integrated-by: Yutang Jiang <yutang.jiang@nxp.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -803,7 +803,7 @@ static const struct flash_info spi_nor_i
+@@ -804,7 +804,7 @@ static const struct flash_info spi_nor_i
{ "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) },
{ "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) },
{ "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) },
diff --git a/target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch b/target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
index 2fbbd774c9..b45d3aa579 100644
--- a/target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
+++ b/target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
@@ -3942,7 +3942,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
struct flash_info {
char *name;
-@@ -60,14 +61,20 @@ struct flash_info {
+@@ -60,15 +61,20 @@ struct flash_info {
u16 addr_width;
u16 flags;
@@ -3954,6 +3954,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
-#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 SECT_4K BIT(0) /* SPINOR_OP_BE_4K works uniformly */
+#define SPI_NOR_NO_ERASE BIT(1) /* No erase command needed */
+#define SST_WRITE BIT(2) /* use SST byte programming */
@@ -3971,7 +3972,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
};
#define JEDEC_MFR(info) ((info)->id[0])
-@@ -313,6 +320,29 @@ static void spi_nor_unlock_and_unprep(st
+@@ -314,6 +320,29 @@ static void spi_nor_unlock_and_unprep(st
}
/*
@@ -4001,7 +4002,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
* Erase an address range on the nor chip. The address range may extend
* one or more erase sectors. Return an error is there is a problem erasing.
*/
-@@ -371,10 +401,9 @@ static int spi_nor_erase(struct mtd_info
+@@ -372,10 +401,9 @@ static int spi_nor_erase(struct mtd_info
while (len) {
write_enable(nor);
@@ -4014,7 +4015,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
addr += mtd->erasesize;
len -= mtd->erasesize;
-@@ -387,17 +416,13 @@ static int spi_nor_erase(struct mtd_info
+@@ -388,17 +416,13 @@ static int spi_nor_erase(struct mtd_info
write_disable(nor);
@@ -4034,7 +4035,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
}
static void stm_get_locked_range(struct spi_nor *nor, u8 sr, loff_t *ofs,
-@@ -415,32 +440,58 @@ static void stm_get_locked_range(struct
+@@ -416,32 +440,58 @@ static void stm_get_locked_range(struct
} else {
pow = ((sr & mask) ^ mask) >> shift;
*len = mtd->size >> pow;
@@ -4100,7 +4101,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
* Sample table portion for 8MB flash (Winbond w25q64fw):
*
* SEC | TB | BP2 | BP1 | BP0 | Prot Length | Protected Portion
-@@ -453,26 +504,55 @@ static int stm_is_locked_sr(struct spi_n
+@@ -454,26 +504,55 @@ static int stm_is_locked_sr(struct spi_n
* 0 | 0 | 1 | 0 | 1 | 2 MB | Upper 1/4
* 0 | 0 | 1 | 1 | 0 | 4 MB | Upper 1/2
* X | X | 1 | 1 | 1 | 8 MB | ALL
@@ -4165,7 +4166,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
/*
* Need smallest pow such that:
-@@ -483,7 +563,7 @@ static int stm_lock(struct spi_nor *nor,
+@@ -484,7 +563,7 @@ static int stm_lock(struct spi_nor *nor,
*
* pow = ceil(log2(size / len)) = log2(size) - floor(log2(len))
*/
@@ -4174,7 +4175,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
val = mask - (pow << shift);
if (val & ~mask)
return -EINVAL;
-@@ -491,14 +571,27 @@ static int stm_lock(struct spi_nor *nor,
+@@ -492,14 +571,27 @@ static int stm_lock(struct spi_nor *nor,
if (!(val & mask))
return -EINVAL;
@@ -4205,7 +4206,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
}
/*
-@@ -509,17 +602,43 @@ static int stm_lock(struct spi_nor *nor,
+@@ -510,17 +602,43 @@ static int stm_lock(struct spi_nor *nor,
static int stm_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
{
struct mtd_info *mtd = &nor->mtd;
@@ -4253,7 +4254,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
/*
* Need largest pow such that:
*
-@@ -529,8 +648,8 @@ static int stm_unlock(struct spi_nor *no
+@@ -530,8 +648,8 @@ static int stm_unlock(struct spi_nor *no
*
* pow = floor(log2(size / len)) = log2(size) - ceil(log2(len))
*/
@@ -4264,7 +4265,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
val = 0; /* fully unlocked */
} else {
val = mask - (pow << shift);
-@@ -539,14 +658,28 @@ static int stm_unlock(struct spi_nor *no
+@@ -540,14 +658,28 @@ static int stm_unlock(struct spi_nor *no
return -EINVAL;
}
@@ -4296,7 +4297,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
}
/*
-@@ -736,8 +869,8 @@ static const struct flash_info spi_nor_i
+@@ -737,8 +869,8 @@ static const struct flash_info spi_nor_i
{ "n25q032a", INFO(0x20bb16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) },
{ "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) },
{ "n25q064a", INFO(0x20bb17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) },
@@ -4307,7 +4308,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
{ "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) },
{ "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
{ "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
-@@ -771,6 +904,7 @@ static const struct flash_info spi_nor_i
+@@ -772,6 +904,7 @@ static const struct flash_info spi_nor_i
{ "s25fl008k", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25fl064k", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) },
@@ -4315,7 +4316,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
{ "s25fl132k", INFO(0x014016, 0, 64 * 1024, 64, SECT_4K) },
{ "s25fl164k", INFO(0x014017, 0, 64 * 1024, 128, SECT_4K) },
{ "s25fl204k", INFO(0x014013, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_DUAL_READ) },
-@@ -834,11 +968,23 @@ static const struct flash_info spi_nor_i
+@@ -835,11 +968,23 @@ static const struct flash_info spi_nor_i
{ "w25x16", INFO(0xef3015, 0, 64 * 1024, 32, SECT_4K) },
{ "w25x32", INFO(0xef3016, 0, 64 * 1024, 64, SECT_4K) },
{ "w25q32", INFO(0xef4016, 0, 64 * 1024, 64, SECT_4K) },
@@ -4342,7 +4343,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
{ "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) },
{ "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) },
{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
-@@ -861,7 +1007,7 @@ static const struct flash_info *spi_nor_
+@@ -862,7 +1007,7 @@ static const struct flash_info *spi_nor_
tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN);
if (tmp < 0) {
@@ -4351,7 +4352,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
return ERR_PTR(tmp);
}
-@@ -872,7 +1018,7 @@ static const struct flash_info *spi_nor_
+@@ -873,7 +1018,7 @@ static const struct flash_info *spi_nor_
return &spi_nor_ids[tmp];
}
}
@@ -4360,7 +4361,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
id[0], id[1], id[2]);
return ERR_PTR(-ENODEV);
}
-@@ -1018,6 +1164,8 @@ static int macronix_quad_enable(struct s
+@@ -1019,6 +1164,8 @@ static int macronix_quad_enable(struct s
int ret, val;
val = read_sr(nor);
@@ -4369,7 +4370,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
write_enable(nor);
write_sr(nor, val | SR_QUAD_EN_MX);
-@@ -1099,7 +1247,7 @@ static int set_quad_mode(struct spi_nor
+@@ -1100,7 +1247,7 @@ static int set_quad_mode(struct spi_nor
static int spi_nor_check(struct spi_nor *nor)
{
if (!nor->dev || !nor->read || !nor->write ||
@@ -4378,7 +4379,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
pr_err("spi-nor: please fill all the necessary fields!\n");
return -EINVAL;
}
-@@ -1112,7 +1260,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1113,7 +1260,7 @@ int spi_nor_scan(struct spi_nor *nor, co
const struct flash_info *info = NULL;
struct device *dev = nor->dev;
struct mtd_info *mtd = &nor->mtd;
@@ -4387,30 +4388,15 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
int ret;
int i;
-@@ -1162,9 +1310,11 @@ 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) {
+@@ -1167,6 +1314,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+ info->flags & SPI_NOR_HAS_LOCK) {
write_enable(nor);
write_sr(nor, 0);
+ spi_nor_wait_till_ready(nor);
}
if (!mtd->name)
-@@ -1178,7 +1328,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;
-@@ -1198,6 +1349,8 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1201,6 +1349,8 @@ int spi_nor_scan(struct spi_nor *nor, co
if (info->flags & USE_FSR)
nor->flags |= SNOR_F_USE_FSR;
@@ -4419,7 +4405,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
#ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
/* prefer "small sector" erase if possible */
-@@ -1300,6 +1453,12 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1303,6 +1453,12 @@ int spi_nor_scan(struct spi_nor *nor, co
nor->addr_width = 3;
}
diff --git a/target/linux/oxnas/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch b/target/linux/oxnas/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
index 2fbbd774c9..b45d3aa579 100644
--- a/target/linux/oxnas/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
+++ b/target/linux/oxnas/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
@@ -3942,7 +3942,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
struct flash_info {
char *name;
-@@ -60,14 +61,20 @@ struct flash_info {
+@@ -60,15 +61,20 @@ struct flash_info {
u16 addr_width;
u16 flags;
@@ -3954,6 +3954,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
-#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 SECT_4K BIT(0) /* SPINOR_OP_BE_4K works uniformly */
+#define SPI_NOR_NO_ERASE BIT(1) /* No erase command needed */
+#define SST_WRITE BIT(2) /* use SST byte programming */
@@ -3971,7 +3972,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
};
#define JEDEC_MFR(info) ((info)->id[0])
-@@ -313,6 +320,29 @@ static void spi_nor_unlock_and_unprep(st
+@@ -314,6 +320,29 @@ static void spi_nor_unlock_and_unprep(st
}
/*
@@ -4001,7 +4002,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
* Erase an address range on the nor chip. The address range may extend
* one or more erase sectors. Return an error is there is a problem erasing.
*/
-@@ -371,10 +401,9 @@ static int spi_nor_erase(struct mtd_info
+@@ -372,10 +401,9 @@ static int spi_nor_erase(struct mtd_info
while (len) {
write_enable(nor);
@@ -4014,7 +4015,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
addr += mtd->erasesize;
len -= mtd->erasesize;
-@@ -387,17 +416,13 @@ static int spi_nor_erase(struct mtd_info
+@@ -388,17 +416,13 @@ static int spi_nor_erase(struct mtd_info
write_disable(nor);
@@ -4034,7 +4035,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
}
static void stm_get_locked_range(struct spi_nor *nor, u8 sr, loff_t *ofs,
-@@ -415,32 +440,58 @@ static void stm_get_locked_range(struct
+@@ -416,32 +440,58 @@ static void stm_get_locked_range(struct
} else {
pow = ((sr & mask) ^ mask) >> shift;
*len = mtd->size >> pow;
@@ -4100,7 +4101,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
* Sample table portion for 8MB flash (Winbond w25q64fw):
*
* SEC | TB | BP2 | BP1 | BP0 | Prot Length | Protected Portion
-@@ -453,26 +504,55 @@ static int stm_is_locked_sr(struct spi_n
+@@ -454,26 +504,55 @@ static int stm_is_locked_sr(struct spi_n
* 0 | 0 | 1 | 0 | 1 | 2 MB | Upper 1/4
* 0 | 0 | 1 | 1 | 0 | 4 MB | Upper 1/2
* X | X | 1 | 1 | 1 | 8 MB | ALL
@@ -4165,7 +4166,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
/*
* Need smallest pow such that:
-@@ -483,7 +563,7 @@ static int stm_lock(struct spi_nor *nor,
+@@ -484,7 +563,7 @@ static int stm_lock(struct spi_nor *nor,
*
* pow = ceil(log2(size / len)) = log2(size) - floor(log2(len))
*/
@@ -4174,7 +4175,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
val = mask - (pow << shift);
if (val & ~mask)
return -EINVAL;
-@@ -491,14 +571,27 @@ static int stm_lock(struct spi_nor *nor,
+@@ -492,14 +571,27 @@ static int stm_lock(struct spi_nor *nor,
if (!(val & mask))
return -EINVAL;
@@ -4205,7 +4206,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
}
/*
-@@ -509,17 +602,43 @@ static int stm_lock(struct spi_nor *nor,
+@@ -510,17 +602,43 @@ static int stm_lock(struct spi_nor *nor,
static int stm_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
{
struct mtd_info *mtd = &nor->mtd;
@@ -4253,7 +4254,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
/*
* Need largest pow such that:
*
-@@ -529,8 +648,8 @@ static int stm_unlock(struct spi_nor *no
+@@ -530,8 +648,8 @@ static int stm_unlock(struct spi_nor *no
*
* pow = floor(log2(size / len)) = log2(size) - ceil(log2(len))
*/
@@ -4264,7 +4265,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
val = 0; /* fully unlocked */
} else {
val = mask - (pow << shift);
-@@ -539,14 +658,28 @@ static int stm_unlock(struct spi_nor *no
+@@ -540,14 +658,28 @@ static int stm_unlock(struct spi_nor *no
return -EINVAL;
}
@@ -4296,7 +4297,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
}
/*
-@@ -736,8 +869,8 @@ static const struct flash_info spi_nor_i
+@@ -737,8 +869,8 @@ static const struct flash_info spi_nor_i
{ "n25q032a", INFO(0x20bb16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) },
{ "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) },
{ "n25q064a", INFO(0x20bb17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) },
@@ -4307,7 +4308,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
{ "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) },
{ "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
{ "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
-@@ -771,6 +904,7 @@ static const struct flash_info spi_nor_i
+@@ -772,6 +904,7 @@ static const struct flash_info spi_nor_i
{ "s25fl008k", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
{ "s25fl064k", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) },
@@ -4315,7 +4316,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
{ "s25fl132k", INFO(0x014016, 0, 64 * 1024, 64, SECT_4K) },
{ "s25fl164k", INFO(0x014017, 0, 64 * 1024, 128, SECT_4K) },
{ "s25fl204k", INFO(0x014013, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_DUAL_READ) },
-@@ -834,11 +968,23 @@ static const struct flash_info spi_nor_i
+@@ -835,11 +968,23 @@ static const struct flash_info spi_nor_i
{ "w25x16", INFO(0xef3015, 0, 64 * 1024, 32, SECT_4K) },
{ "w25x32", INFO(0xef3016, 0, 64 * 1024, 64, SECT_4K) },
{ "w25q32", INFO(0xef4016, 0, 64 * 1024, 64, SECT_4K) },
@@ -4342,7 +4343,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
{ "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) },
{ "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) },
{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
-@@ -861,7 +1007,7 @@ static const struct flash_info *spi_nor_
+@@ -862,7 +1007,7 @@ static const struct flash_info *spi_nor_
tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN);
if (tmp < 0) {
@@ -4351,7 +4352,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
return ERR_PTR(tmp);
}
-@@ -872,7 +1018,7 @@ static const struct flash_info *spi_nor_
+@@ -873,7 +1018,7 @@ static const struct flash_info *spi_nor_
return &spi_nor_ids[tmp];
}
}
@@ -4360,7 +4361,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
id[0], id[1], id[2]);
return ERR_PTR(-ENODEV);
}
-@@ -1018,6 +1164,8 @@ static int macronix_quad_enable(struct s
+@@ -1019,6 +1164,8 @@ static int macronix_quad_enable(struct s
int ret, val;
val = read_sr(nor);
@@ -4369,7 +4370,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
write_enable(nor);
write_sr(nor, val | SR_QUAD_EN_MX);
-@@ -1099,7 +1247,7 @@ static int set_quad_mode(struct spi_nor
+@@ -1100,7 +1247,7 @@ static int set_quad_mode(struct spi_nor
static int spi_nor_check(struct spi_nor *nor)
{
if (!nor->dev || !nor->read || !nor->write ||
@@ -4378,7 +4379,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
pr_err("spi-nor: please fill all the necessary fields!\n");
return -EINVAL;
}
-@@ -1112,7 +1260,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1113,7 +1260,7 @@ int spi_nor_scan(struct spi_nor *nor, co
const struct flash_info *info = NULL;
struct device *dev = nor->dev;
struct mtd_info *mtd = &nor->mtd;
@@ -4387,30 +4388,15 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
int ret;
int i;
-@@ -1162,9 +1310,11 @@ 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) {
+@@ -1167,6 +1314,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+ info->flags & SPI_NOR_HAS_LOCK) {
write_enable(nor);
write_sr(nor, 0);
+ spi_nor_wait_till_ready(nor);
}
if (!mtd->name)
-@@ -1178,7 +1328,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;
-@@ -1198,6 +1349,8 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1201,6 +1349,8 @@ int spi_nor_scan(struct spi_nor *nor, co
if (info->flags & USE_FSR)
nor->flags |= SNOR_F_USE_FSR;
@@ -4419,7 +4405,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
#ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
/* prefer "small sector" erase if possible */
-@@ -1300,6 +1453,12 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1303,6 +1453,12 @@ int spi_nor_scan(struct spi_nor *nor, co
nor->addr_width = 3;
}
diff --git a/target/linux/oxnas/patches-4.4/0074-mtd-nand-import-nand_hw_control_init.patch b/target/linux/oxnas/patches-4.4/0074-mtd-nand-import-nand_hw_control_init.patch
index 6f1979b11b..4b3260c41b 100644
--- a/target/linux/oxnas/patches-4.4/0074-mtd-nand-import-nand_hw_control_init.patch
+++ b/target/linux/oxnas/patches-4.4/0074-mtd-nand-import-nand_hw_control_init.patch
@@ -25,11 +25,9 @@ Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
include/linux/mtd/nand.h | 7 +++++++
14 files changed, 20 insertions(+), 26 deletions(-)
-diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
-index 37da423..3962f55 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
-@@ -761,8 +761,7 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
+@@ -748,8 +748,7 @@ static int bf5xx_nand_probe(struct platf
platform_set_drvdata(pdev, info);
@@ -39,11 +37,9 @@ index 37da423..3962f55 100644
info->device = &pdev->dev;
info->platform = plat;
-diff --git a/drivers/mtd/nand/brcmnand/brcmnand.c b/drivers/mtd/nand/brcmnand/brcmnand.c
-index 8eb2c64..82ec36b 100644
--- a/drivers/mtd/nand/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/brcmnand/brcmnand.c
-@@ -2370,8 +2370,7 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc)
+@@ -2156,8 +2156,7 @@ int brcmnand_probe(struct platform_devic
init_completion(&ctrl->done);
init_completion(&ctrl->dma_done);
@@ -53,11 +49,9 @@ index 8eb2c64..82ec36b 100644
INIT_LIST_HEAD(&ctrl->host_list);
/* NAND register range */
-diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c
-index 4731699..7af2a3c 100644
--- a/drivers/mtd/nand/docg4.c
+++ b/drivers/mtd/nand/docg4.c
-@@ -1249,8 +1249,7 @@ static void __init init_mtd_structs(struct mtd_info *mtd)
+@@ -1227,8 +1227,7 @@ static void __init init_mtd_structs(stru
nand->options = NAND_BUSWIDTH_16 | NAND_NO_SUBPAGE_WRITE;
nand->IO_ADDR_R = nand->IO_ADDR_W = doc->virtadr + DOC_IOSPACE_DATA;
nand->controller = &nand->hwcontrol;
@@ -67,11 +61,9 @@ index 4731699..7af2a3c 100644
/* methods */
nand->cmdfunc = docg4_command;
-diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
-index 60a88f2..113f76e 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
-@@ -879,8 +879,7 @@ static int fsl_elbc_nand_probe(struct platform_device *pdev)
+@@ -866,8 +866,7 @@ static int fsl_elbc_nand_probe(struct pl
}
elbc_fcm_ctrl->counter++;
@@ -81,11 +73,9 @@ index 60a88f2..113f76e 100644
fsl_lbc_ctrl_dev->nand = elbc_fcm_ctrl;
} else {
elbc_fcm_ctrl = fsl_lbc_ctrl_dev->nand;
-diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
-index 4e9e5fd..0a177b1 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
-@@ -987,8 +987,7 @@ static int fsl_ifc_nand_probe(struct platform_device *dev)
+@@ -1073,8 +1073,7 @@ static int fsl_ifc_nand_probe(struct pla
ifc_nand_ctrl->addr = NULL;
fsl_ifc_ctrl_dev->nand = ifc_nand_ctrl;
@@ -95,11 +85,9 @@ index 4e9e5fd..0a177b1 100644
} else {
ifc_nand_ctrl = fsl_ifc_ctrl_dev->nand;
}
-diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
-index 77533f7..53ea796 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
-@@ -3191,8 +3191,7 @@ static void nand_set_defaults(struct nand_chip *chip, int busw)
+@@ -3202,8 +3202,7 @@ static void nand_set_defaults(struct nan
if (!chip->controller) {
chip->controller = &chip->hwcontrol;
@@ -109,11 +97,9 @@ index 77533f7..53ea796 100644
}
}
-diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
-index 218c789..28e6118 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
-@@ -218,8 +218,7 @@ static int ndfc_probe(struct platform_device *ofdev)
+@@ -220,8 +220,7 @@ static int ndfc_probe(struct platform_de
ndfc = &ndfc_ctrl[cs];
ndfc->chip_select = cs;
@@ -123,11 +109,9 @@ index 218c789..28e6118 100644
ndfc->ofdev = ofdev;
dev_set_drvdata(&ofdev->dev, ndfc);
-diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
-index 436dd6d..b121bf4 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
-@@ -1810,8 +1810,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
+@@ -1739,8 +1739,7 @@ static int alloc_nand_resource(struct pl
chip->cmdfunc = nand_cmdfunc;
}
@@ -137,11 +121,9 @@ index 436dd6d..b121bf4 100644
info->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(info->clk)) {
dev_err(&pdev->dev, "failed to get nand clock\n");
-diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
-index d9309cf..b1734d7 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
-@@ -977,8 +977,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
+@@ -955,8 +955,7 @@ static int s3c24xx_nand_probe(struct pla
platform_set_drvdata(pdev, info);
@@ -151,11 +133,9 @@ index d9309cf..b1734d7 100644
/* get the clock source and enable it */
-diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
-index e414b31..8b5dadc 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
-@@ -2175,8 +2175,7 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
+@@ -1426,8 +1426,7 @@ static int sunxi_nfc_probe(struct platfo
return -ENOMEM;
nfc->dev = dev;
@@ -165,11 +145,9 @@ index e414b31..8b5dadc 100644
INIT_LIST_HEAD(&nfc->chips);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c
-index 04d63f5..0a14fda 100644
--- a/drivers/mtd/nand/txx9ndfmc.c
+++ b/drivers/mtd/nand/txx9ndfmc.c
-@@ -303,8 +303,7 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
+@@ -304,8 +304,7 @@ static int __init txx9ndfmc_probe(struct
dev_info(&dev->dev, "CLK:%ldMHz HOLD:%d SPW:%d\n",
(gbusclk + 500000) / 1000000, hold, spw);
@@ -179,11 +157,9 @@ index 04d63f5..0a14fda 100644
platform_set_drvdata(dev, drvdata);
txx9ndfmc_initialize(dev);
-diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
-index 8dd6e01..f6a2d5e 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
-@@ -460,6 +460,13 @@ struct nand_hw_control {
+@@ -461,6 +461,13 @@ struct nand_hw_control {
wait_queue_head_t wq;
};
@@ -197,6 +173,3 @@ index 8dd6e01..f6a2d5e 100644
/**
* struct nand_ecc_ctrl - Control structure for ECC
* @mode: ECC mode
---
-2.10.2
-
diff --git a/target/linux/ramips/patches-4.4/0054-mtd-add-chunked-read-io-to-m25p80.patch b/target/linux/ramips/patches-4.4/0054-mtd-add-chunked-read-io-to-m25p80.patch
index a87d5cd25b..8eef3affed 100644
--- a/target/linux/ramips/patches-4.4/0054-mtd-add-chunked-read-io-to-m25p80.patch
+++ b/target/linux/ramips/patches-4.4/0054-mtd-add-chunked-read-io-to-m25p80.patch
@@ -1,6 +1,6 @@
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -1013,6 +1013,66 @@ write_err:
+@@ -1014,6 +1014,66 @@ write_err:
return ret;
}
@@ -67,7 +67,7 @@
static int macronix_quad_enable(struct spi_nor *nor)
{
int ret, val;
-@@ -1191,10 +1251,12 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1194,10 +1254,12 @@ int spi_nor_scan(struct spi_nor *nor, co
}
/* sst nor chips use AAI word program */
@@ -82,7 +82,7 @@
if (info->flags & USE_FSR)
nor->flags |= SNOR_F_USE_FSR;
-@@ -1222,11 +1284,20 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -1225,11 +1287,20 @@ int spi_nor_scan(struct spi_nor *nor, co
mtd->writebufsize = nor->page_size;
if (np) {