Skip to content

Commit

Permalink
mtd: spi-nor: core: disable Octal DTR mode on suspend.
Browse files Browse the repository at this point in the history
On resume, the init procedure will be run that will re-enable it.

Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/r/20201005153138.6437-14-p.yadav@ti.com
  • Loading branch information
Pratyush Yadav authored and Vignesh Raghavendra committed Nov 9, 2020
1 parent d73ee75 commit 1b65c43
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/mtd/spi-nor/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3216,6 +3216,20 @@ static void spi_nor_soft_reset(struct spi_nor *nor)
usleep_range(SPI_NOR_SRST_SLEEP_MIN, SPI_NOR_SRST_SLEEP_MAX);
}

/* mtd suspend handler */
static int spi_nor_suspend(struct mtd_info *mtd)
{
struct spi_nor *nor = mtd_to_spi_nor(mtd);
int ret;

/* Disable octal DTR mode if we enabled it. */
ret = spi_nor_octal_dtr_enable(nor, false);
if (ret)
dev_err(nor->dev, "suspend() failed\n");

return ret;
}

/* mtd resume handler */
static void spi_nor_resume(struct mtd_info *mtd)
{
Expand Down Expand Up @@ -3421,6 +3435,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name,
mtd->size = nor->params->size;
mtd->_erase = spi_nor_erase;
mtd->_read = spi_nor_read;
mtd->_suspend = spi_nor_suspend;
mtd->_resume = spi_nor_resume;

if (nor->params->locking_ops) {
Expand Down

0 comments on commit 1b65c43

Please sign in to comment.