]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mtd: nand: atmel: Add PM ops
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Thu, 16 Mar 2017 08:36:00 +0000 (09:36 +0100)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Thu, 1 Jun 2017 08:09:29 +0000 (10:09 +0200)
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>
drivers/mtd/nand/atmel/nand-controller.c

index ee32909f7943d2fb442ccf24f131f15f01091a85..846c555e470b42171767f5ec16286d0982e4fba1 100644 (file)
@@ -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",