Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185243
b: refs/heads/master
c: 1af1077
h: refs/heads/master
i:
  185241: f92382f
  185239: f34f382
v: v3
  • Loading branch information
Anton Vorontsov authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent 6c709b3 commit 243d51d
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dad3843f035a273f9b64e133467e8dcbfaf0ce60
refs/heads/master: 1af107744253b01b4cf119a9bb3369376b01658b
90 changes: 83 additions & 7 deletions trunk/drivers/usb/host/ehci-fsl.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2005 MontaVista Software
* Copyright 2005-2009 MontaVista Software, Inc.
* Copyright 2008 Freescale Semiconductor, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
Expand All @@ -17,17 +18,20 @@
*
* Ported to 834x by Randy Vinson <rvinson@mvista.com> using code provided
* by Hunter Wu.
* Power Management support by Dave Liu <daveliu@freescale.com>,
* Jerry Huang <Chang-Ming.Huang@freescale.com> and
* Anton Vorontsov <avorontsov@ru.mvista.com>.
*/

#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/platform_device.h>
#include <linux/fsl_devices.h>

#include "ehci-fsl.h"

/* FIXME: Power Management is un-ported so temporarily disable it */
#undef CONFIG_PM


/* configure so an HC device and id are always provided */
/* always called with process context; sleeping is OK */

Expand Down Expand Up @@ -285,10 +289,81 @@ static int ehci_fsl_setup(struct usb_hcd *hcd)
return retval;
}

struct ehci_fsl {
struct ehci_hcd ehci;

#ifdef CONFIG_PM
/* Saved USB PHY settings, need to restore after deep sleep. */
u32 usb_ctrl;
#endif
};

#ifdef CONFIG_PM

static struct ehci_fsl *hcd_to_ehci_fsl(struct usb_hcd *hcd)
{
struct ehci_hcd *ehci = hcd_to_ehci(hcd);

return container_of(ehci, struct ehci_fsl, ehci);
}

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;

if (!fsl_deep_sleep())
return 0;

ehci_fsl->usb_ctrl = in_be32(non_ehci + FSL_SOC_USB_CTRL);
return 0;
}

static int ehci_fsl_drv_resume(struct device *dev)
{
struct usb_hcd *hcd = dev_get_drvdata(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;

if (!fsl_deep_sleep())
return 0;

usb_root_hub_lost_power(hcd->self.root_hub);

/* Restore USB PHY settings and enable the controller. */
out_be32(non_ehci + FSL_SOC_USB_CTRL, ehci_fsl->usb_ctrl);

ehci_reset(ehci);
ehci_fsl_reinit(ehci);

return 0;
}

static int ehci_fsl_drv_restore(struct device *dev)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);

usb_root_hub_lost_power(hcd->self.root_hub);
return 0;
}

static struct dev_pm_ops ehci_fsl_pm_ops = {
.suspend = ehci_fsl_drv_suspend,
.resume = ehci_fsl_drv_resume,
.restore = ehci_fsl_drv_restore,
};

#define EHCI_FSL_PM_OPS (&ehci_fsl_pm_ops)
#else
#define EHCI_FSL_PM_OPS NULL
#endif /* CONFIG_PM */

static const struct hc_driver ehci_fsl_hc_driver = {
.description = hcd_name,
.product_desc = "Freescale On-Chip EHCI Host Controller",
.hcd_priv_size = sizeof(struct ehci_hcd),
.hcd_priv_size = sizeof(struct ehci_fsl),

/*
* generic hardware linkage
Expand Down Expand Up @@ -355,6 +430,7 @@ static struct platform_driver ehci_fsl_driver = {
.remove = ehci_fsl_drv_remove,
.shutdown = usb_hcd_platform_shutdown,
.driver = {
.name = "fsl-ehci",
.name = "fsl-ehci",
.pm = EHCI_FSL_PM_OPS,
},
};

0 comments on commit 243d51d

Please sign in to comment.