sata_rcar: extend PM methods
authorMikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
Fri, 16 Jan 2015 23:00:36 +0000 (02:00 +0300)
committerTejun Heo <tj@kernel.org>
Mon, 19 Jan 2015 14:04:37 +0000 (09:04 -0500)
In order to make it possible to restore from hibernation not only in Linux but
also in e.g. U-Boot, we have to extend  sata_rcar_{suspend|resume}() to {freeze|
thaw}() PM  methods and implement  the  restore() PM method.

Signed-off-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
[Sergei: killed unused variable, changed the order of initializers, modified
copyrights, renamed, modified changelog.]
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/sata_rcar.c

index cb0d2e644af51dc187332f8a2b7ed8a98781351f..d49a5193b7de9e9438ef0f6693ca53db757e5027 100644 (file)
@@ -2,8 +2,8 @@
  * Renesas R-Car SATA driver
  *
  * Author: Vladimir Barinov <source@cogentembedded.com>
- * Copyright (C) 2013 Cogent Embedded, Inc.
- * Copyright (C) 2013 Renesas Solutions Corp.
+ * Copyright (C) 2013-2015 Cogent Embedded, Inc.
+ * Copyright (C) 2013-2015 Renesas Solutions Corp.
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
@@ -992,9 +992,30 @@ static int sata_rcar_resume(struct device *dev)
        return 0;
 }
 
+static int sata_rcar_restore(struct device *dev)
+{
+       struct ata_host *host = dev_get_drvdata(dev);
+       struct sata_rcar_priv *priv = host->private_data;
+
+       clk_prepare_enable(priv->clk);
+
+       sata_rcar_setup_port(host);
+
+       /* initialize host controller */
+       sata_rcar_init_controller(host);
+
+       ata_host_resume(host);
+
+       return 0;
+}
+
 static const struct dev_pm_ops sata_rcar_pm_ops = {
        .suspend        = sata_rcar_suspend,
        .resume         = sata_rcar_resume,
+       .freeze         = sata_rcar_suspend,
+       .thaw           = sata_rcar_resume,
+       .poweroff       = sata_rcar_suspend,
+       .restore        = sata_rcar_restore,
 };
 #endif