summaryrefslogtreecommitdiff
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2014-04-18 21:08:55 (GMT)
committerScott Wood <scottwood@freescale.com>2014-04-18 21:08:55 (GMT)
commitfb4408c608480c14dfeae557b7e7e0e75bc0c0f4 (patch)
tree5ed0e003f6b15e1ce13121e06669f458f1df53df /drivers/usb/host
parent10667100a057af290ccfdf9c7178ba81867f80e7 (diff)
parentb35a69559c46e066e6f24bb02d5a6090483786e3 (diff)
downloadlinux-fsl-qoriq-fb4408c608480c14dfeae557b7e7e0e75bc0c0f4.tar.xz
Merge branch 'master-tmp' into sdk-v1.6.x
master-tmp is the master branch as of 8b60f5ea90c49344692a70f62cd4aa349de38b48 with the following commits reverted due to excessive conflicts: commit b35a69559c46e066e6f24bb02d5a6090483786e3 Author: Scott Wood <scottwood@freescale.com> Date: Fri Apr 18 15:27:52 2014 -0500 Revert "net: add sysfs helpers for netdev_adjacent logic" This reverts commit 0be682ca768d671c91cfd1379759efcb3b29102a. commit 1c0dc06e47e11bf758f3e84ea90c2178a31dbf0f Author: Scott Wood <scottwood@freescale.com> Date: Fri Apr 18 15:27:47 2014 -0500 Revert "net: rename sysfs symlinks on device name change" This reverts commit 45ce45c69750b93b8262aa66792185bd49150293. Conflicts: drivers/iommu/fsl_pamu.c drivers/net/bonding/bond_3ad.c drivers/net/bonding/bond_sysfs.c drivers/net/bonding/bonding.h drivers/net/ethernet/freescale/gianfar.c Signed-off-by: Scott Wood <scottwood@freescale.com> Conflicts: drivers/iommu/fsl_pamu.c drivers/net/bonding/bond_3ad.c drivers/net/bonding/bond_sysfs.c drivers/net/bonding/bonding.h drivers/net/ethernet/freescale/gianfar.c
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ehci-fsl.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 3ef6e26..c307ab0 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -38,6 +38,7 @@ struct ehci_fsl {
struct ehci_hcd ehci;
#ifdef CONFIG_PM
+ struct ehci_regs *saved_regs;
/* Saved USB PHY settings, need to restore after deep sleep. */
u32 usb_ctrl;
#endif
@@ -482,7 +483,43 @@ static int ehci_fsl_setup(struct usb_hcd *hcd)
return retval;
}
+
+
+
#ifdef CONFIG_PM
+/* save usb registers */
+static int ehci_fsl_save_context(struct usb_hcd *hcd)
+{
+ 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->saved_regs = kzalloc(sizeof(struct ehci_regs), GFP_KERNEL);
+ if (!ehci_fsl->saved_regs)
+ return -ENOMEM;
+ _memcpy_fromio(ehci_fsl->saved_regs, ehci->regs,
+ sizeof(struct ehci_regs));
+ ehci_fsl->usb_ctrl = in_be32(non_ehci + FSL_SOC_USB_CTRL);
+ return 0;
+
+}
+
+/*Restore usb registers */
+static int ehci_fsl_restore_context(struct usb_hcd *hcd)
+{
+ struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);
+ void __iomem *non_ehci = hcd->regs;
+
+ if (ehci_fsl->saved_regs) {
+ _memcpy_toio(ehci->regs, ehci_fsl->saved_regs,
+ sizeof(struct ehci_regs));
+ out_be32(non_ehci + FSL_SOC_USB_CTRL, ehci_fsl->usb_ctrl);
+ kfree(ehci_fsl->saved_regs);
+ ehci_fsl->saved_regs = NULL;
+ }
+ return 0;
+}
#ifdef CONFIG_PPC_MPC512x
static int ehci_fsl_mpc512x_drv_suspend(struct device *dev)
@@ -658,6 +695,9 @@ static int ehci_fsl_drv_suspend(struct device *dev)
ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd),
device_may_wakeup(dev));
+
+ ehci_fsl_save_context(hcd);
+
if (!fsl_deep_sleep())
return 0;
@@ -671,6 +711,9 @@ 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