diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/ehci-fsl.c | 27 |
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); |