@@ -963,16 +963,21 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
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.
+ * If type of platform data match with the name of
+ * spi_nor_ids set,and JEDEC ID also match with
+ * INFO ID of spi_nor_ids set,shouldn't overwrite
+ * spi device info point.Otherwise,will overwrite
+ * it.
*/
- dev_warn(dev, "found %s, expected %s\n",
- jid->name, id->name);
+ struct flash_info *tmpinfo;
+
+ tmpinfo = (void *)jid->driver_data;
+ if (tmpinfo->jedec_id != info->jedec_id) {
+ dev_warn(dev, "found %s, expected %s\n",
+ jid->name, id->name);
id = jid;
info = (void *)jid->driver_data;
+ }
}
}
This patch used to modify the method of spi_nor_scan overwrite platform Id. If type of platform data match with the name of spi_nor_ids set, and JEDEC ID also match with INFO ID of spi_nor_ids set,spi device ID point(this is before probed according to device name) shouldn't be overwrote.Otherwise,this point will be overwrote by new spi_nor_ids set point that probed according to JEDEC ID. Signed-off-by: bean huo <beanhuo@micron.com> --- drivers/mtd/spi-nor/spi-nor.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)