return mtd_device_unregister(&flash->mtd);
}
+static void m25p_shutdown(struct spi_device *spi)
+{
+ struct m25p *flash = spi_get_drvdata(spi);
+
+ spi_nor_shutdown(&flash->spi_nor);
+}
+
/*
* XXX This needs to be kept in sync with spi_nor_ids. We can't share
* it with spi-nor, because if this is built as a module then modpost
.id_table = m25p_ids,
.probe = m25p_probe,
.remove = m25p_remove,
+ .shutdown = m25p_shutdown,
/* REVISIT: many of these chips have deep power-down modes, which
* should clearly be entered on suspend() to minimize power use.
return NULL;
}
+void spi_nor_shutdown(struct spi_nor *nor)
+{
+ if (nor->addr_width == 3 &&
+ (nor->mtd->size >> nor->shift) > 0x1000000)
+ write_ear(nor, 0);
+}
+EXPORT_SYMBOL_GPL(spi_nor_shutdown);
+
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Huang Shijie <shijie8@gmail.com>");
MODULE_AUTHOR("Mike Lavender");
*/
int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode);
+/**
+ * spi_nor_shutdown() - prepare for reboot
+ * @nor: the spi_nor structure
+ *
+ * The drivers can use this fuction to get the address back to
+ * 0 as will be required for a ROM boot.
+ */
+void spi_nor_shutdown(struct spi_nor *nor);
+
#endif