summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorJun Li <r65092@freescale.com>2009-11-06 18:00:11 +0800
committerAlejandro Gonzalez <alex.gonzalez@digi.com>2010-02-12 17:19:32 +0100
commit03e58d2b2f40f23fb9d729f679812b94e05aa4eb (patch)
treeff2a438adb3b535e7a4086ad1c0de4d71682ee26 /drivers/usb
parentc3eaa781a143fe64a587b80a875856aef687712e (diff)
ENGR00117937 USB pin detct is broken on 2.6.31 branch
When register platform driver in 2.6.31 kernal, suspend and resume are not set for device driver. The patch fix this issue by using platform driver's suspend/resume rountine directly in otg driver. Signed-off-by: Li Jun <r65092@freescale.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/otg/fsl_otg.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/usb/otg/fsl_otg.c b/drivers/usb/otg/fsl_otg.c
index d5c8cf0434e3..c4849f8a581d 100644
--- a/drivers/usb/otg/fsl_otg.c
+++ b/drivers/usb/otg/fsl_otg.c
@@ -410,11 +410,15 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on)
struct otg_transceiver *xceiv = fsm->transceiver;
struct device *dev;
struct fsl_otg *otg_dev = container_of(xceiv, struct fsl_otg, otg);
+ struct platform_driver *host_pdrv;
+ struct platform_device *host_pdev;
u32 retval = 0;
if (!xceiv->host)
return -ENODEV;
dev = xceiv->host->controller;
+ host_pdrv = container_of((dev->driver), struct platform_driver, driver);
+ host_pdev = to_platform_device(dev);
/* Update a_vbus_vld state as a_vbus_vld int is disabled
* in device mode
@@ -428,8 +432,8 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on)
else {
otg_reset_controller();
VDBG("host on......\n");
- if (dev->driver->resume) {
- retval = dev->driver->resume(dev);
+ if (host_pdrv->resume) {
+ retval = host_pdrv->resume(host_pdev);
if (fsm->id) {
/* default-b */
fsl_otg_drv_vbus(1);
@@ -452,8 +456,8 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on)
goto end;
else {
VDBG("host off......\n");
- if (dev && dev->driver) {
- retval = dev->driver->suspend(dev,
+ if (host_pdrv->suspend) {
+ retval = host_pdrv->suspend(host_pdev,
otg_suspend_state);
if (fsm->id)
/* default-b */
@@ -473,6 +477,8 @@ int fsl_otg_start_gadget(struct otg_fsm *fsm, int on)
{
struct otg_transceiver *xceiv = fsm->transceiver;
struct device *dev;
+ struct platform_driver *gadget_pdrv;
+ struct platform_device *gadget_pdev;
if (!xceiv->gadget || !xceiv->gadget->dev.parent)
return -ENODEV;
@@ -480,10 +486,14 @@ int fsl_otg_start_gadget(struct otg_fsm *fsm, int on)
VDBG("gadget %s \n", on ? "on" : "off");
dev = xceiv->gadget->dev.parent;
+ gadget_pdrv = container_of((dev->driver),
+ struct platform_driver, driver);
+ gadget_pdev = to_platform_device(dev);
+
if (on)
- dev->driver->resume(dev);
+ gadget_pdrv->resume(gadget_pdev);
else
- dev->driver->suspend(dev, otg_suspend_state);
+ gadget_pdrv->suspend(gadget_pdev, otg_suspend_state);
return 0;
}