Skip to content

Commit

Permalink
mtd: nand: atmel: Add PM ops
Browse files Browse the repository at this point in the history
Provide a ->resume() hook to make sure the NAND timings are correctly
restored by resetting all chips connected to the controller.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
  • Loading branch information
Boris Brezillon committed Jun 1, 2017
1 parent f9ce2ed commit 6e532af
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions drivers/mtd/nand/atmel/nand-controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -2506,6 +2506,24 @@ static int atmel_nand_controller_remove(struct platform_device *pdev)
return nc->caps->ops->remove(nc);
}

static int atmel_nand_controller_resume(struct device *dev)
{
struct atmel_nand_controller *nc = dev_get_drvdata(dev);
struct atmel_nand *nand;

list_for_each_entry(nand, &nc->chips, node) {
int i;

for (i = 0; i < nand->numcs; i++)
nand_reset(&nand->base, i);
}

return 0;
}

static SIMPLE_DEV_PM_OPS(atmel_nand_controller_pm_ops, NULL,
atmel_nand_controller_resume);

static struct platform_driver atmel_nand_controller_driver = {
.driver = {
.name = "atmel-nand-controller",
Expand Down

0 comments on commit 6e532af

Please sign in to comment.