浏览代码

mtd: nand: atmel: Add PM ops

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>
Boris Brezillon 8 年之前
父节点
当前提交
6e532afaca
共有 1 个文件被更改,包括 18 次插入0 次删除
  1. 18 0
      drivers/mtd/nand/atmel/nand-controller.c

+ 18 - 0
drivers/mtd/nand/atmel/nand-controller.c

@@ -2506,6 +2506,24 @@ static int atmel_nand_controller_remove(struct platform_device *pdev)
 	return nc->caps->ops->remove(nc);
 	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 = {
 static struct platform_driver atmel_nand_controller_driver = {
 	.driver = {
 	.driver = {
 		.name = "atmel-nand-controller",
 		.name = "atmel-nand-controller",