summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorRamneek Mehresh <ramneek.mehresh@freescale.com>2015-03-24 12:23:15 (GMT)
committerHonghua Yin <Hong-Hua.Yin@freescale.com>2015-03-30 08:12:05 (GMT)
commitdb63a7500a9a0e4c38799819592ac594b77e49eb (patch)
tree8e315b924838f94b1e47556ac49a185a5d0a4ccc /drivers/usb
parent9b1fb49a2f1ac00637f73eac0b226e24d42d043e (diff)
downloadlinux-fsl-qoriq-db63a7500a9a0e4c38799819592ac594b77e49eb.tar.xz
drivers:usb:pm: Fix usb pm support for deep-sleep
Make sure that saving and restoration of usb phy registers only happen in case of deep-sleep, and not for any other feature like sleep, etc. Also export pm_suspend_state() and set_pm_suspend_state() Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com> Change-Id: I2e08208c975ec7aee7ed42e7d424aaa8d14899e3 Reviewed-on: http://git.am.freescale.net:8181/33384 Reviewed-by: Nikhil Badola <nikhil.badola@freescale.com> Tested-by: Honghua Yin <Hong-Hua.Yin@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-fsl.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 07bdd3a..c19ddd6 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -31,8 +31,11 @@
#include <linux/platform_device.h>
#include <linux/fsl_devices.h>
#include <linux/of_platform.h>
+
#ifdef CONFIG_PPC
#include <sysdev/fsl_soc.h>
+#include <asm/fsl_pm.h>
+#include <linux/suspend.h>
#endif
#include "ehci-fsl.h"
@@ -534,6 +537,7 @@ static int ehci_fsl_setup(struct usb_hcd *hcd)
#ifdef CONFIG_PM
void __iomem *phy_reg;
+#ifdef CONFIG_PPC
/* save usb registers */
static int ehci_fsl_save_context(struct usb_hcd *hcd)
{
@@ -578,6 +582,7 @@ static int ehci_fsl_restore_context(struct usb_hcd *hcd)
iowrite32be(ehci_fsl->usb_ctrl, non_ehci + FSL_SOC_USB_CTRL);
return 0;
}
+#endif
#ifdef CONFIG_PPC_MPC512x
static int ehci_fsl_mpc512x_drv_suspend(struct device *dev)
@@ -729,13 +734,18 @@ static int ehci_fsl_drv_suspend(struct device *dev)
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
void __iomem *non_ehci = hcd->regs;
-
- ehci_fsl_save_context(hcd);
-
#if defined(CONFIG_FSL_USB2_OTG) || defined(CONFIG_FSL_USB2_OTG_MODULE)
struct usb_bus host = hcd->self;
#endif
+#ifdef CONFIG_PPC
+ suspend_state_t pm_state;
+ pm_state = pm_suspend_state();
+
+ if (pm_state == PM_SUSPEND_MEM)
+ ehci_fsl_save_context(hcd);
+#endif
+
if (of_device_is_compatible(dev->parent->of_node,
"fsl,mpc5121-usb2-dr")) {
return ehci_fsl_mpc512x_drv_suspend(dev);
@@ -772,13 +782,18 @@ static int ehci_fsl_drv_resume(struct device *dev)
struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
void __iomem *non_ehci = hcd->regs;
-
- ehci_fsl_restore_context(hcd);
-
#if defined(CONFIG_FSL_USB2_OTG) || defined(CONFIG_FSL_USB2_OTG_MODULE)
struct usb_bus host = hcd->self;
#endif
+#ifdef CONFIG_PPC
+ suspend_state_t pm_state;
+ pm_state = pm_suspend_state();
+
+ if (pm_state == PM_SUSPEND_MEM)
+ ehci_fsl_restore_context(hcd);
+#endif
+
if (of_device_is_compatible(dev->parent->of_node,
"fsl,mpc5121-usb2-dr")) {
return ehci_fsl_mpc512x_drv_resume(dev);