summaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx/patches-3.14/002-mtd-spi-nor-from-3.18.patch
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2014-10-22 14:16:18 +0000
committerRafał Miłecki <zajec5@gmail.com>2014-10-22 14:16:18 +0000
commit2466b04a5aba116df977697841d9e6fff27ccd68 (patch)
tree6755ed7f6d1a2f9fe734935d0ba13293b89443f3 /target/linux/bcm53xx/patches-3.14/002-mtd-spi-nor-from-3.18.patch
parent18ae41edf01c56e633703132575b082e8e167eb6 (diff)
downloadmaster-31e0f0ae-2466b04a5aba116df977697841d9e6fff27ccd68.tar.gz
master-31e0f0ae-2466b04a5aba116df977697841d9e6fff27ccd68.tar.bz2
master-31e0f0ae-2466b04a5aba116df977697841d9e6fff27ccd68.zip
bcm53xx: backport spi-nor patches from 3.18-rc1
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 43030
Diffstat (limited to 'target/linux/bcm53xx/patches-3.14/002-mtd-spi-nor-from-3.18.patch')
-rw-r--r--target/linux/bcm53xx/patches-3.14/002-mtd-spi-nor-from-3.18.patch106
1 files changed, 106 insertions, 0 deletions
diff --git a/target/linux/bcm53xx/patches-3.14/002-mtd-spi-nor-from-3.18.patch b/target/linux/bcm53xx/patches-3.14/002-mtd-spi-nor-from-3.18.patch
new file mode 100644
index 0000000000..1d837032d6
--- /dev/null
+++ b/target/linux/bcm53xx/patches-3.14/002-mtd-spi-nor-from-3.18.patch
@@ -0,0 +1,106 @@
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -611,6 +611,7 @@ const struct spi_device_id spi_nor_ids[]
+ { "m25px32-s0", INFO(0x207316, 0, 64 * 1024, 64, SECT_4K) },
+ { "m25px32-s1", INFO(0x206316, 0, 64 * 1024, 64, SECT_4K) },
+ { "m25px64", INFO(0x207117, 0, 64 * 1024, 128, 0) },
++ { "m25px80", INFO(0x207114, 0, 64 * 1024, 16, 0) },
+
+ /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */
+ { "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) },
+@@ -623,7 +624,6 @@ const struct spi_device_id spi_nor_ids[]
+ { "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64, SECT_4K) },
+ { "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) },
+ { "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) },
+- { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },
+ { "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) },
+@@ -671,11 +671,6 @@ static const struct spi_device_id *spi_n
+ return ERR_PTR(-ENODEV);
+ }
+
+-static const struct spi_device_id *jedec_probe(struct spi_nor *nor)
+-{
+- return nor->read_id(nor);
+-}
+-
+ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
+ size_t *retlen, u_char *buf)
+ {
+@@ -920,7 +915,6 @@ int spi_nor_scan(struct spi_nor *nor, co
+ enum read_mode mode)
+ {
+ struct flash_info *info;
+- struct flash_platform_data *data;
+ struct device *dev = nor->dev;
+ struct mtd_info *mtd = nor->mtd;
+ struct device_node *np = dev->of_node;
+@@ -931,34 +925,12 @@ int spi_nor_scan(struct spi_nor *nor, co
+ if (ret)
+ return ret;
+
+- /* Platform data helps sort out which chip type we have, as
+- * well as how this board partitions it. If we don't have
+- * a chip ID, try the JEDEC id commands; they'll work for most
+- * newer chips, even if we don't recognize the particular chip.
+- */
+- data = dev_get_platdata(dev);
+- if (data && data->type) {
+- const struct spi_device_id *plat_id;
+-
+- for (i = 0; i < ARRAY_SIZE(spi_nor_ids) - 1; i++) {
+- plat_id = &spi_nor_ids[i];
+- if (strcmp(data->type, plat_id->name))
+- continue;
+- break;
+- }
+-
+- if (i < ARRAY_SIZE(spi_nor_ids) - 1)
+- id = plat_id;
+- else
+- dev_warn(dev, "unrecognized id %s\n", data->type);
+- }
+-
+ info = (void *)id->driver_data;
+
+ if (info->jedec_id) {
+ const struct spi_device_id *jid;
+
+- jid = jedec_probe(nor);
++ jid = nor->read_id(nor);
+ if (IS_ERR(jid)) {
+ return PTR_ERR(jid);
+ } else if (jid != id) {
+@@ -990,11 +962,8 @@ int spi_nor_scan(struct spi_nor *nor, co
+ write_sr(nor, 0);
+ }
+
+- if (data && data->name)
+- mtd->name = data->name;
+- else
++ if (!mtd->name)
+ mtd->name = dev_name(dev);
+-
+ mtd->type = MTD_NORFLASH;
+ mtd->writesize = 1;
+ mtd->flags = MTD_CAP_NORFLASH;
+@@ -1018,6 +987,7 @@ int spi_nor_scan(struct spi_nor *nor, co
+ nor->wait_till_ready == spi_nor_wait_till_ready)
+ nor->wait_till_ready = spi_nor_wait_till_fsr_ready;
+
++#ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
+ /* prefer "small sector" erase if possible */
+ if (info->flags & SECT_4K) {
+ nor->erase_opcode = SPINOR_OP_BE_4K;
+@@ -1025,7 +995,9 @@ int spi_nor_scan(struct spi_nor *nor, co
+ } else if (info->flags & SECT_4K_PMC) {
+ nor->erase_opcode = SPINOR_OP_BE_4K_PMC;
+ mtd->erasesize = 4096;
+- } else {
++ } else
++#endif
++ {
+ nor->erase_opcode = SPINOR_OP_SE;
+ mtd->erasesize = info->sector_size;
+ }