aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/sunxi/patches-3.13/162-3-ahci-plat-runtime-resume.patch
diff options
context:
space:
mode:
authorZoltan Herpai <wigyori@uid0.hu>2014-03-06 00:09:30 +0000
committerZoltan Herpai <wigyori@uid0.hu>2014-03-06 00:09:30 +0000
commitac4b9dbb3c9b056008e00ee3d02fe3dad65641b7 (patch)
treeef1ef8907c63a75c4ac441f8c95325a6d5abb9ec /target/linux/sunxi/patches-3.13/162-3-ahci-plat-runtime-resume.patch
parent2c771cc71f3b6aceda5fe81f44a79b724e0941d0 (diff)
downloadupstream-ac4b9dbb3c9b056008e00ee3d02fe3dad65641b7.tar.gz
upstream-ac4b9dbb3c9b056008e00ee3d02fe3dad65641b7.tar.bz2
upstream-ac4b9dbb3c9b056008e00ee3d02fe3dad65641b7.zip
sunxi: driver refresh for 3.13 - update gmac / mmc / usb / ahci drivers to follow mainline dev trees - add driver for spi - update clock support - update a31 support - move to new DT compats where appropriate - re-order patchqueue where needed - verified working a20 smp - move most DTSes off files/ - update defconfig
Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu> SVN-Revision: 39782
Diffstat (limited to 'target/linux/sunxi/patches-3.13/162-3-ahci-plat-runtime-resume.patch')
-rw-r--r--target/linux/sunxi/patches-3.13/162-3-ahci-plat-runtime-resume.patch85
1 files changed, 85 insertions, 0 deletions
diff --git a/target/linux/sunxi/patches-3.13/162-3-ahci-plat-runtime-resume.patch b/target/linux/sunxi/patches-3.13/162-3-ahci-plat-runtime-resume.patch
new file mode 100644
index 0000000000..18953d1046
--- /dev/null
+++ b/target/linux/sunxi/patches-3.13/162-3-ahci-plat-runtime-resume.patch
@@ -0,0 +1,85 @@
+From 48379fed3987d587a25a48e155872e9d3125490d Mon Sep 17 00:00:00 2001
+From: Roger Quadros <rogerq@ti.com>
+Date: Wed, 9 Oct 2013 15:08:59 +0300
+Subject: [PATCH] ata: ahci_platform: runtime resume the device before use
+
+On OMAP platforms the device needs to be runtime resumed before
+it can be accessed. The OMAP HWMOD framework takes care of
+enabling the module and its resources based on the
+device's runtime PM state.
+
+In this patch we runtime resume during .probe() and runtime suspend
+after .remove().
+
+We also update the runtime PM state during .resume().
+
+CC: Balaji T K <balajitk@ti.com>
+Signed-off-by: Roger Quadros <rogerq@ti.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+---
+ drivers/ata/ahci.h | 1 +
+ drivers/ata/ahci_platform.c | 15 +++++++++++++++
+ 2 files changed, 16 insertions(+)
+
+diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
+index 3ab7ac9..51af275b 100644
+--- a/drivers/ata/ahci.h
++++ b/drivers/ata/ahci.h
+@@ -324,6 +324,7 @@ struct ahci_host_priv {
+ u32 em_loc; /* enclosure management location */
+ u32 em_buf_sz; /* EM buffer size in byte */
+ u32 em_msg_type; /* EM message type */
++ bool got_runtime_pm; /* Did we do pm_runtime_get? */
+ struct clk *clks[AHCI_MAX_CLKS]; /* Optional */
+ struct regulator *target_pwr; /* Optional */
+ struct phy *phy; /* If platform uses phy */
+diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
+index 99d38c1..75698a4 100644
+--- a/drivers/ata/ahci_platform.c
++++ b/drivers/ata/ahci_platform.c
+@@ -24,6 +24,7 @@
+ #include <linux/libata.h>
+ #include <linux/ahci_platform.h>
+ #include <linux/phy/phy.h>
++#include <linux/pm_runtime.h>
+ #include "ahci.h"
+
+ static void ahci_host_stop(struct ata_host *host);
+@@ -229,6 +230,11 @@ static void ahci_platform_put_resources(struct device *dev, void *res)
+ struct ahci_host_priv *hpriv = res;
+ int c;
+
++ if (hpriv->got_runtime_pm) {
++ pm_runtime_put_sync(dev);
++ pm_runtime_disable(dev);
++ }
++
+ for (c = 0; c < AHCI_MAX_CLKS && hpriv->clks[c]; c++)
+ clk_put(hpriv->clks[c]);
+ }
+@@ -326,6 +332,10 @@ struct ahci_host_priv *ahci_platform_get_resources(
+ }
+ }
+
++ pm_runtime_enable(dev);
++ pm_runtime_get_sync(dev);
++ hpriv->got_runtime_pm = true;
++
+ devres_remove_group(dev, NULL);
+ return hpriv;
+
+@@ -635,6 +645,11 @@ int ahci_platform_resume(struct device *dev)
+ if (rc)
+ goto disable_resources;
+
++ /* We resumed so update PM runtime state */
++ pm_runtime_disable(dev);
++ pm_runtime_set_active(dev);
++ pm_runtime_enable(dev);
++
+ return 0;
+
+ disable_resources:
+--
+1.8.5.5
+