diff options
author | Kamal Dasu <kdasu.kdev@gmail.com> | 2017-08-22 22:45:22 +0200 |
---|---|---|
committer | Cyrille Pitchen <cyrille.pitchen@wedev4u.fr> | 2017-10-10 18:20:22 +0200 |
commit | d6084fc83c8249779a6b7a1d48830f1f3fc120fe (patch) | |
tree | 95fb3f0aa26055a40fc983551fce269c76016523 /drivers/mtd/spi-nor | |
parent | mtd: spi-nor: add spi_nor_init() function (diff) | |
download | linux-d6084fc83c8249779a6b7a1d48830f1f3fc120fe.tar.xz linux-d6084fc83c8249779a6b7a1d48830f1f3fc120fe.zip |
mtd: spi-nor: Add spi-nor mtd resume handler
Implemented and populated spi-nor mtd PM handlers for resume ops.
spi-nor resume op re-initializes spi-nor flash to its probed
state by calling the newly implemented spi_nor_init() function.
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
Diffstat (limited to 'drivers/mtd/spi-nor')
-rw-r--r-- | drivers/mtd/spi-nor/spi-nor.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 04751a73c3fe..61fdd3c1a2bc 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -2670,6 +2670,19 @@ static int spi_nor_init(struct spi_nor *nor) return 0; } +/* mtd resume handler */ +static void spi_nor_resume(struct mtd_info *mtd) +{ + struct spi_nor *nor = mtd_to_spi_nor(mtd); + struct device *dev = nor->dev; + int ret; + + /* re-initialize the nor chip */ + ret = spi_nor_init(nor); + if (ret) + dev_err(dev, "resume() failed\n"); +} + int spi_nor_scan(struct spi_nor *nor, const char *name, const struct spi_nor_hwcaps *hwcaps) { @@ -2746,6 +2759,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, mtd->size = params.size; mtd->_erase = spi_nor_erase; mtd->_read = spi_nor_read; + mtd->_resume = spi_nor_resume; /* NOR protection support for STmicro/Micron chips and similar */ if (JEDEC_MFR(info) == SNOR_MFR_MICRON || |