kernel: update 3.14 to 3.14.18
[openwrt/openwrt.git] / target / linux / sunxi / patches-3.14 / 192-ahci-platform-changes.patch
index 3c567f82a4b7ac02cfa3413630742a54b9d77c7b..a5f4fc50a081eccac7514cd2000eeca0541e4ee0 100644 (file)
@@ -14,72 +14,18 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  drivers/ata/ahci_platform.c | 1 +
  1 file changed, 1 insertion(+)
 
-diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
-index bdadec1..d7e55ba 100644
 --- a/drivers/ata/ahci_platform.c
 +++ b/drivers/ata/ahci_platform.c
-@@ -609,6 +609,7 @@ static const struct of_device_id ahci_of_match[] = {
-       { .compatible = "snps,spear-ahci", },
-       { .compatible = "snps,exynos5440-ahci", },
-       { .compatible = "ibm,476gtr-ahci", },
-+      { .compatible = "snps,dwc-ahci", },
-       {},
- };
- MODULE_DEVICE_TABLE(of, ahci_of_match);
--- 
-2.0.3
-
-From 2be39fa6b6531bd083c766999345adc348b14c77 Mon Sep 17 00:00:00 2001
-From: Roger Quadros <rogerq@ti.com>
-Date: Mon, 27 Jan 2014 16:41:18 +0200
-Subject: [PATCH] ata: ahci_platform: Manage SATA PHY
-
-Some platforms have a PHY hooked up to the
-SATA controller. The PHY needs to be initialized
-and powered up for SATA to work. We do that
-using the PHY framework.
-
-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          |  2 ++
- drivers/ata/ahci_platform.c | 47 +++++++++++++++++++++++++++++++++++++++++++--
- 2 files changed, 47 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
-index bf8100c..3ab7ac9 100644
---- a/drivers/ata/ahci.h
-+++ b/drivers/ata/ahci.h
-@@ -37,6 +37,7 @@
- #include <linux/clk.h>
- #include <linux/libata.h>
-+#include <linux/phy/phy.h>
- #include <linux/regulator/consumer.h>
- /* Enclosure Management Control */
-@@ -325,6 +326,7 @@ struct ahci_host_priv {
-       u32                     em_msg_type;    /* EM message type */
-       struct clk              *clks[AHCI_MAX_CLKS]; /* Optional */
-       struct regulator        *target_pwr;    /* Optional */
-+      struct phy              *phy;           /* If platform uses phy */
-       void                    *plat_data;     /* Other platform data */
-       /*
-        * Optional ahci_start_engine override, if not set this gets set to the
-diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
-index d7e55ba..99d38c1 100644
---- a/drivers/ata/ahci_platform.c
-+++ b/drivers/ata/ahci_platform.c
-@@ -23,6 +23,7 @@
+@@ -23,6 +23,8 @@
  #include <linux/platform_device.h>
  #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);
-@@ -147,6 +148,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_disable_clks);
+@@ -147,6 +149,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_disable_
   *    the following order:
   *    1) Regulator
   *    2) Clocks (through ahci_platform_enable_clks)
@@ -87,7 +33,7 @@ index d7e55ba..99d38c1 100644
   *
   *    If resource enabling fails at any point the previous enabled
   *    resources are disabled in reverse order.
-@@ -171,8 +173,23 @@ int ahci_platform_enable_resources(struct ahci_host_priv *hpriv)
+@@ -171,8 +174,23 @@ int ahci_platform_enable_resources(struc
        if (rc)
                goto disable_regulator;
  
@@ -111,7 +57,7 @@ index d7e55ba..99d38c1 100644
  disable_regulator:
        if (hpriv->target_pwr)
                regulator_disable(hpriv->target_pwr);
-@@ -186,14 +203,20 @@ EXPORT_SYMBOL_GPL(ahci_platform_enable_resources);
+@@ -186,14 +204,20 @@ EXPORT_SYMBOL_GPL(ahci_platform_enable_r
   *
   *    This function disables all ahci_platform managed resources in
   *    the following order:
@@ -134,7 +80,19 @@ index d7e55ba..99d38c1 100644
        ahci_platform_disable_clks(hpriv);
  
        if (hpriv->target_pwr)
-@@ -222,6 +245,7 @@ static void ahci_platform_put_resources(struct device *dev, void *res)
+@@ -206,6 +230,11 @@ static void ahci_platform_put_resources(
+       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]);
+ }
+@@ -222,6 +251,7 @@ static void ahci_platform_put_resources(
   *    2) regulator for controlling the targets power (optional)
   *    3) 0 - AHCI_MAX_CLKS clocks, as specified in the devs devicetree node,
   *       or for non devicetree enabled platforms a single clock
@@ -142,7 +100,7 @@ index d7e55ba..99d38c1 100644
   *
   *    LOCKING:
   *    None.
-@@ -283,6 +307,25 @@ struct ahci_host_priv *ahci_platform_get_resources(
+@@ -283,6 +313,29 @@ struct ahci_host_priv *ahci_platform_get
                hpriv->clks[i] = clk;
        }
  
@@ -165,75 +123,6 @@ index d7e55ba..99d38c1 100644
 +              }
 +      }
 +
-       devres_remove_group(dev, NULL);
-       return hpriv;
--- 
-2.0.3
-
-From 22d93de35a39507bcdf0c62c5e1fab0625f7c6f6 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;
@@ -241,7 +130,7 @@ index 99d38c1..75698a4 100644
        devres_remove_group(dev, NULL);
        return hpriv;
  
-@@ -635,6 +645,11 @@ int ahci_platform_resume(struct device *dev)
+@@ -592,6 +645,11 @@ int ahci_platform_resume(struct device *
        if (rc)
                goto disable_resources;
  
@@ -253,27 +142,38 @@ index 99d38c1..75698a4 100644
        return 0;
  
  disable_resources:
--- 
-2.0.3
-
-From 22cccaf7a29b2a9d8a1440d089f399a6d2432b81 Mon Sep 17 00:00:00 2001
-From: Hans de Goede <hdegoede@redhat.com>
-Date: Sun, 23 Feb 2014 11:37:17 +0100
-Subject: [PATCH] ahci_sunxi: Use msleep instead of mdelay
-
-ahci_sunxi_phy_init is called from the probe and resume code paths, and
-sleeping is safe in both, so use msleep instead of mdelay.
-
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
----
- drivers/ata/ahci_sunxi.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/ata/ahci_sunxi.c b/drivers/ata/ahci_sunxi.c
-index 001f7dfc..d1bf3f7 100644
+@@ -609,6 +667,7 @@ static const struct of_device_id ahci_of
+       { .compatible = "snps,spear-ahci", },
+       { .compatible = "snps,exynos5440-ahci", },
+       { .compatible = "ibm,476gtr-ahci", },
++      { .compatible = "snps,dwc-ahci", },
+       {},
+ };
+ MODULE_DEVICE_TABLE(of, ahci_of_match);
+--- a/drivers/ata/ahci.h
++++ b/drivers/ata/ahci.h
+@@ -37,6 +37,7 @@
+ #include <linux/clk.h>
+ #include <linux/libata.h>
++#include <linux/phy/phy.h>
+ #include <linux/regulator/consumer.h>
+ /* Enclosure Management Control */
+@@ -324,8 +325,10 @@ 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 */
+       void                    *plat_data;     /* Other platform data */
+       /*
+        * Optional ahci_start_engine override, if not set this gets set to the
 --- a/drivers/ata/ahci_sunxi.c
 +++ b/drivers/ata/ahci_sunxi.c
-@@ -90,7 +90,7 @@ static int ahci_sunxi_phy_init(struct device *dev, void __iomem *reg_base)
+@@ -90,7 +90,7 @@ static int ahci_sunxi_phy_init(struct de
  
        /* This magic is from the original code */
        writel(0, reg_base + AHCI_RWCR);
@@ -282,7 +182,7 @@ index 001f7dfc..d1bf3f7 100644
  
        sunxi_setbits(reg_base + AHCI_PHYCS1R, BIT(19));
        sunxi_clrsetbits(reg_base + AHCI_PHYCS0R,
-@@ -105,7 +105,7 @@ static int ahci_sunxi_phy_init(struct device *dev, void __iomem *reg_base)
+@@ -105,7 +105,7 @@ static int ahci_sunxi_phy_init(struct de
                         (0x7 << 20), (0x3 << 20));
        sunxi_clrsetbits(reg_base + AHCI_PHYCS2R,
                         (0x1f << 5), (0x19 << 5));
@@ -291,7 +191,7 @@ index 001f7dfc..d1bf3f7 100644
  
        sunxi_setbits(reg_base + AHCI_PHYCS0R, (0x1 << 19));
  
-@@ -137,7 +137,7 @@ static int ahci_sunxi_phy_init(struct device *dev, void __iomem *reg_base)
+@@ -137,7 +137,7 @@ static int ahci_sunxi_phy_init(struct de
                udelay(1);
        } while (1);
  
@@ -300,6 +200,3 @@ index 001f7dfc..d1bf3f7 100644
  
        writel(0x7, reg_base + AHCI_RWCR);
  
--- 
-2.0.3
-