aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/otg
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-03-31 15:26:10 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-16 00:44:40 -0400
commitdef6f8b978618d50daaddb92331d398da9e141f1 (patch)
treeac8de48477184a97fec8cd96fa932b6ca90bb177 /drivers/usb/otg
parentdc2f2b7505c195a6963fc07b549e269eee417261 (diff)
USB: twl4030-usb: fix minor reporting goofage
Fix a reporting glitch in the twl4030 USB transceiver code. It wasn't properly distinguishing the two types of active USB link: ID grounded, vs not. In the current code that distinction doesn't much matter; in the future this bugfix should help support better USB controller communications. Provide a comment sorting out some of the cryptic bits of the manual: different sections use different names for key signals, and the register definitions don't help much without the explanations and diagrams. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/otg')
-rw-r--r--drivers/usb/otg/twl4030-usb.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index c34e63910acb..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",