diff options
Diffstat (limited to 'drivers/usb/otg/twl4030-usb.c')
-rw-r--r-- | drivers/usb/otg/twl4030-usb.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c index d9478d0e1c8b..9e3e7a5c258b 100644 --- a/drivers/usb/otg/twl4030-usb.c +++ b/drivers/usb/otg/twl4030-usb.c | |||
@@ -217,6 +217,7 @@ | |||
217 | 217 | ||
218 | /* In module TWL4030_MODULE_PM_MASTER */ | 218 | /* In module TWL4030_MODULE_PM_MASTER */ |
219 | #define PROTECT_KEY 0x0E | 219 | #define PROTECT_KEY 0x0E |
220 | #define STS_HW_CONDITIONS 0x0F | ||
220 | 221 | ||
221 | /* In module TWL4030_MODULE_PM_RECEIVER */ | 222 | /* In module TWL4030_MODULE_PM_RECEIVER */ |
222 | #define VUSB_DEDICATED1 0x7D | 223 | #define VUSB_DEDICATED1 0x7D |
@@ -351,15 +352,26 @@ static enum linkstat twl4030_usb_linkstat(struct twl4030_usb *twl) | |||
351 | int status; | 352 | int status; |
352 | int linkstat = USB_LINK_UNKNOWN; | 353 | int linkstat = USB_LINK_UNKNOWN; |
353 | 354 | ||
354 | /* STS_HW_CONDITIONS */ | 355 | /* |
355 | status = twl4030_readb(twl, TWL4030_MODULE_PM_MASTER, 0x0f); | 356 | * For ID/VBUS sensing, see manual section 15.4.8 ... |
357 | * except when using only battery backup power, two | ||
358 | * comparators produce VBUS_PRES and ID_PRES signals, | ||
359 | * which don't match docs elsewhere. But ... BIT(7) | ||
360 | * and BIT(2) of STS_HW_CONDITIONS, respectively, do | ||
361 | * seem to match up. If either is true the USB_PRES | ||
362 | * signal is active, the OTG module is activated, and | ||
363 | * its interrupt may be raised (may wake the system). | ||
364 | */ | ||
365 | status = twl4030_readb(twl, TWL4030_MODULE_PM_MASTER, | ||
366 | STS_HW_CONDITIONS); | ||
356 | if (status < 0) | 367 | if (status < 0) |
357 | dev_err(twl->dev, "USB link status err %d\n", status); | 368 | dev_err(twl->dev, "USB link status err %d\n", status); |
358 | else if (status & BIT(7)) | 369 | else if (status & (BIT(7) | BIT(2))) { |
359 | linkstat = USB_LINK_VBUS; | 370 | if (status & BIT(2)) |
360 | else if (status & BIT(2)) | 371 | linkstat = USB_LINK_ID; |
361 | linkstat = USB_LINK_ID; | 372 | else |
362 | else | 373 | linkstat = USB_LINK_VBUS; |
374 | } else | ||
363 | linkstat = USB_LINK_NONE; | 375 | linkstat = USB_LINK_NONE; |
364 | 376 | ||
365 | dev_dbg(twl->dev, "HW_CONDITIONS 0x%02x/%d; link %d\n", | 377 | dev_dbg(twl->dev, "HW_CONDITIONS 0x%02x/%d; link %d\n", |
@@ -641,7 +653,7 @@ static int twl4030_set_host(struct otg_transceiver *x, struct usb_bus *host) | |||
641 | return 0; | 653 | return 0; |
642 | } | 654 | } |
643 | 655 | ||
644 | static int __init twl4030_usb_probe(struct platform_device *pdev) | 656 | static int __devinit twl4030_usb_probe(struct platform_device *pdev) |
645 | { | 657 | { |
646 | struct twl4030_usb_data *pdata = pdev->dev.platform_data; | 658 | struct twl4030_usb_data *pdata = pdev->dev.platform_data; |
647 | struct twl4030_usb *twl; | 659 | struct twl4030_usb *twl; |