Commit 461c3177 authored by Felipe Balbi's avatar Felipe Balbi Committed by Greg Kroah-Hartman

USB: otg: twl4030: fix wrong assumption of starting state

The reset state of twl4030-usb is not sleeping, it starts
up awaken and we need to disable it if we have booted
with a disconnected cable to avoid over consumption on
the default state.

To avoid problems later, we read the current state of the
transceiver from the PHY_PWR_CTRL register. The bootloader
can, anyways, put the device to sleep before us.

Tested on a custom OMAP board.
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7c81aafa
...@@ -550,6 +550,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev) ...@@ -550,6 +550,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
struct twl4030_usb_data *pdata = pdev->dev.platform_data; struct twl4030_usb_data *pdata = pdev->dev.platform_data;
struct twl4030_usb *twl; struct twl4030_usb *twl;
int status, err; int status, err;
u8 pwr;
if (!pdata) { if (!pdata) {
dev_dbg(&pdev->dev, "platform_data not available\n"); dev_dbg(&pdev->dev, "platform_data not available\n");
...@@ -568,7 +569,10 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev) ...@@ -568,7 +569,10 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
twl->otg.set_peripheral = twl4030_set_peripheral; twl->otg.set_peripheral = twl4030_set_peripheral;
twl->otg.set_suspend = twl4030_set_suspend; twl->otg.set_suspend = twl4030_set_suspend;
twl->usb_mode = pdata->usb_mode; twl->usb_mode = pdata->usb_mode;
twl->asleep = 1;
pwr = twl4030_usb_read(twl, PHY_PWR_CTRL);
twl->asleep = (pwr & PHY_PWR_PHYPWD);
/* init spinlock for workqueue */ /* init spinlock for workqueue */
spin_lock_init(&twl->lock); spin_lock_init(&twl->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment