diff options
author | Ramneek Mehresh <ramneek.mehresh@freescale.com> | 2015-03-24 12:23:15 (GMT) |
---|---|---|
committer | Xie Xiaobo <xiaobo.xie@nxp.com> | 2017-09-25 07:25:29 (GMT) |
commit | d0d31442e3937d873fd7b9568ba65ac27e05937c (patch) | |
tree | 98a434179d065d23077294ee2150db2976ea7049 | |
parent | 438f0176bb247385c1fa41df49e89232695999ce (diff) | |
download | linux-d0d31442e3937d873fd7b9568ba65ac27e05937c.tar.xz |
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>
-rw-r--r-- | drivers/usb/host/ehci-fsl.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 4f93e0a..cd16860 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -37,6 +37,11 @@ #include <linux/fsl_devices.h> #include <linux/of_platform.h> +#ifdef CONFIG_PPC +#include <asm/fsl_pm.h> +#include <linux/suspend.h> +#endif + #include "ehci.h" #include "ehci-fsl.h" @@ -543,6 +548,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) { @@ -588,6 +594,7 @@ static int ehci_fsl_restore_context(struct usb_hcd *hcd) return 0; } +#endif #ifdef CONFIG_PPC_MPC512x static int ehci_fsl_mpc512x_drv_suspend(struct device *dev) @@ -739,13 +746,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); @@ -779,13 +791,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); |