From: Mathias Kresin Date: Sat, 3 Sep 2016 07:27:09 +0000 (+0200) Subject: kernel: mtd: backport Macronix sector size fix X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=85fefcdb61e9362abbb16eb2a9d3e6dda19a175b;p=openwrt%2Fstaging%2Fthess.git kernel: mtd: backport Macronix sector size fix Signed-off-by: Mathias Kresin --- 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 abc9b0face..df252b2154 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 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -871,6 +871,18 @@ static const struct flash_info *spi_nor_ +@@ -873,6 +873,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 91fc1ff693..3dce6c0361 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 spifi->nor.write = nxp_spifi_write; --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -1109,7 +1109,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1111,7 +1111,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/043-mtd-spi-nor-mx25l3205d-mx25l6405d-append-SECT_4K.patch b/target/linux/generic/patches-4.4/043-mtd-spi-nor-mx25l3205d-mx25l6405d-append-SECT_4K.patch new file mode 100644 index 0000000000..b7fd046a23 --- /dev/null +++ b/target/linux/generic/patches-4.4/043-mtd-spi-nor-mx25l3205d-mx25l6405d-append-SECT_4K.patch @@ -0,0 +1,27 @@ +From 0501f2e5ff28a02295e42fc9e7164a20ef4c30d5 Mon Sep 17 00:00:00 2001 +From: Andreas Fenkart +Date: Thu, 5 Nov 2015 10:04:23 +0100 +Subject: [PATCH] mtd: spi-nor: mx25l3205d/mx25l6405d: append SECT_4K + +according datasheet both chips can erase 4kByte sectors individually + +Signed-off-by: Andreas Fenkart +Signed-off-by: Brian Norris +--- + drivers/mtd/spi-nor/spi-nor.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -715,9 +715,9 @@ static const struct flash_info spi_nor_i + { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) }, + { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) }, + { "mx25l1606e", INFO(0xc22015, 0, 64 * 1024, 32, SECT_4K) }, +- { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, 0) }, ++ { "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, 0) }, ++ { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) }, + { "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) }, + { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, + { "mx25l12855e", INFO(0xc22618, 0, 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 8ad59dfb33..77cd5904fc 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 @@ -4296,19 +4296,7 @@ Signed-off-by: John Crispin } /* -@@ -716,9 +849,9 @@ static const struct flash_info spi_nor_i - { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) }, - { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) }, - { "mx25l1606e", INFO(0xc22015, 0, 64 * 1024, 32, SECT_4K) }, -- { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, 0) }, -+ { "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, 0) }, -+ { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) }, - { "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) }, - { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) }, - { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) }, -@@ -733,8 +866,8 @@ static const struct flash_info spi_nor_i +@@ -735,8 +868,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) }, @@ -4319,7 +4307,7 @@ Signed-off-by: John Crispin { "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) }, -@@ -768,6 +901,7 @@ static const struct flash_info spi_nor_i +@@ -770,6 +903,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) }, @@ -4327,7 +4315,7 @@ Signed-off-by: John Crispin { "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) }, -@@ -831,11 +965,23 @@ static const struct flash_info spi_nor_i +@@ -833,11 +967,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) }, @@ -4354,7 +4342,7 @@ Signed-off-by: John Crispin { "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) }, -@@ -858,7 +1004,7 @@ static const struct flash_info *spi_nor_ +@@ -860,7 +1006,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) { @@ -4363,7 +4351,7 @@ Signed-off-by: John Crispin return ERR_PTR(tmp); } -@@ -869,7 +1015,7 @@ static const struct flash_info *spi_nor_ +@@ -871,7 +1017,7 @@ static const struct flash_info *spi_nor_ return &spi_nor_ids[tmp]; } } @@ -4372,7 +4360,7 @@ Signed-off-by: John Crispin id[0], id[1], id[2]); return ERR_PTR(-ENODEV); } -@@ -1015,6 +1161,8 @@ static int macronix_quad_enable(struct s +@@ -1017,6 +1163,8 @@ static int macronix_quad_enable(struct s int ret, val; val = read_sr(nor); @@ -4381,7 +4369,7 @@ Signed-off-by: John Crispin write_enable(nor); write_sr(nor, val | SR_QUAD_EN_MX); -@@ -1096,7 +1244,7 @@ static int set_quad_mode(struct spi_nor +@@ -1098,7 +1246,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 || @@ -4390,7 +4378,7 @@ Signed-off-by: John Crispin pr_err("spi-nor: please fill all the necessary fields!\n"); return -EINVAL; } -@@ -1109,7 +1257,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1111,7 +1259,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; @@ -4399,7 +4387,7 @@ Signed-off-by: John Crispin int ret; int i; -@@ -1159,9 +1307,11 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1161,9 +1309,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 || @@ -4412,7 +4400,7 @@ Signed-off-by: John Crispin } if (!mtd->name) -@@ -1175,7 +1325,8 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1177,7 +1327,8 @@ int spi_nor_scan(struct spi_nor *nor, co mtd->_read = spi_nor_read; /* NOR protection support for STmicro/Micron chips and similar */ @@ -4422,7 +4410,7 @@ Signed-off-by: John Crispin nor->flash_lock = stm_lock; nor->flash_unlock = stm_unlock; nor->flash_is_locked = stm_is_locked; -@@ -1195,6 +1346,8 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1197,6 +1348,8 @@ int spi_nor_scan(struct spi_nor *nor, co if (info->flags & USE_FSR) nor->flags |= SNOR_F_USE_FSR; @@ -4431,7 +4419,7 @@ Signed-off-by: John Crispin #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS /* prefer "small sector" erase if possible */ -@@ -1297,6 +1450,12 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1299,6 +1452,12 @@ int spi_nor_scan(struct spi_nor *nor, co nor->addr_width = 3; } 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 f5a4b072cb..825f8fab94 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 -@@ -1010,6 +1010,66 @@ write_err: +@@ -1012,6 +1012,66 @@ write_err: return ret; } @@ -67,7 +67,7 @@ static int macronix_quad_enable(struct spi_nor *nor) { int ret, val; -@@ -1188,10 +1248,12 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1190,10 +1250,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; -@@ -1219,11 +1281,20 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1221,11 +1283,20 @@ int spi_nor_scan(struct spi_nor *nor, co mtd->writebufsize = nor->page_size; if (np) {