aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx/patches-3.14/402-mtd-spi-nor-allow-NULL-as-spi_device_id-in-spi_nor_s.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2014-08-21 21:10:29 +0000
committerHauke Mehrtens <hauke@hauke-m.de>2014-08-21 21:10:29 +0000
commitb118879cc39270c623239a9775ad3acdfdbbcc35 (patch)
treed61f624d9e90e9e44cefbb34ecfa8c47c40ae80b /target/linux/bcm53xx/patches-3.14/402-mtd-spi-nor-allow-NULL-as-spi_device_id-in-spi_nor_s.patch
parenta81f3568737bfbeb8446c34c087fa6a383932fb4 (diff)
downloadupstream-b118879cc39270c623239a9775ad3acdfdbbcc35.tar.gz
upstream-b118879cc39270c623239a9775ad3acdfdbbcc35.tar.bz2
upstream-b118879cc39270c623239a9775ad3acdfdbbcc35.zip
bcm53xx: backport more spi-nor patches
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 42259
Diffstat (limited to 'target/linux/bcm53xx/patches-3.14/402-mtd-spi-nor-allow-NULL-as-spi_device_id-in-spi_nor_s.patch')
-rw-r--r--target/linux/bcm53xx/patches-3.14/402-mtd-spi-nor-allow-NULL-as-spi_device_id-in-spi_nor_s.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/target/linux/bcm53xx/patches-3.14/402-mtd-spi-nor-allow-NULL-as-spi_device_id-in-spi_nor_s.patch b/target/linux/bcm53xx/patches-3.14/402-mtd-spi-nor-allow-NULL-as-spi_device_id-in-spi_nor_s.patch
new file mode 100644
index 0000000000..6cc77528e0
--- /dev/null
+++ b/target/linux/bcm53xx/patches-3.14/402-mtd-spi-nor-allow-NULL-as-spi_device_id-in-spi_nor_s.patch
@@ -0,0 +1,46 @@
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -925,29 +925,23 @@ int spi_nor_scan(struct spi_nor *nor, co
+ if (ret)
+ return ret;
+
+- info = (void *)id->driver_data;
+-
+- if (info->jedec_id) {
+- const struct spi_device_id *jid;
+-
+- jid = nor->read_id(nor);
+- if (IS_ERR(jid)) {
+- return PTR_ERR(jid);
+- } else if (jid != id) {
+- /*
+- * JEDEC knows better, so overwrite platform ID. We
+- * can't trust partitions any longer, but we'll let
+- * mtd apply them anyway, since some partitions may be
+- * marked read-only, and we don't want to lose that
+- * information, even if it's not 100% accurate.
+- */
+- dev_warn(dev, "found %s, expected %s\n",
+- jid->name, id->name);
+- id = jid;
+- info = (void *)jid->driver_data;
++ if (id) {
++ info = (void *)id->driver_data;
++ if (info->jedec_id) {
++ dev_warn(dev,
++ "passed SPI device ID (%s) contains JEDEC, ignoring it, driver should be fixed!\n",
++ id->name);
++ id = NULL;
+ }
+ }
+
++ if (!id) {
++ id = nor->read_id(nor);
++ if (IS_ERR(id))
++ return PTR_ERR(id);
++ }
++ info = (void *)id->driver_data;
++
+ mutex_init(&nor->lock);
+
+ /*