summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0021-twl4030-usb-fix-minor-reporting-goofage.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0021-twl4030-usb-fix-minor-reporting-goofage.patch')
-rw-r--r--meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0021-twl4030-usb-fix-minor-reporting-goofage.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0021-twl4030-usb-fix-minor-reporting-goofage.patch b/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0021-twl4030-usb-fix-minor-reporting-goofage.patch
new file mode 100644
index 0000000000..d9733f92b0
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0021-twl4030-usb-fix-minor-reporting-goofage.patch
@@ -0,0 +1,70 @@
1From c4804e5a447275553c55bbb0ab1748954cb8fbfc Mon Sep 17 00:00:00 2001
2From: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
3Date: Tue, 31 Mar 2009 12:26:10 -0700
4Subject: [PATCH] twl4030-usb: fix minor reporting goofage
5
6Fix a reporting glitch in the twl4030 USB transceiver code.
7It wasn't properly distinguishing the two types of active
8USB link: ID grounded, vs not. In the current code that
9distinction doesn't much matter; in the future this bugfix
10should help support better USB controller communications.
11
12Provide a comment sorting out some of the cryptic bits of
13the manual: different sections use different names for
14key signals, and the register definitions don't help much
15without the explanations and diagrams.
16
17Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
18---
19 drivers/usb/otg/twl4030-usb.c | 26 +++++++++++++++++++-------
20 1 files changed, 19 insertions(+), 7 deletions(-)
21
22diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
23index d9478d0..f740390 100644
24--- a/drivers/usb/otg/twl4030-usb.c
25+++ b/drivers/usb/otg/twl4030-usb.c
26@@ -217,6 +217,7 @@
27
28 /* In module TWL4030_MODULE_PM_MASTER */
29 #define PROTECT_KEY 0x0E
30+#define STS_HW_CONDITIONS 0x0F
31
32 /* In module TWL4030_MODULE_PM_RECEIVER */
33 #define VUSB_DEDICATED1 0x7D
34@@ -351,15 +352,26 @@ static enum linkstat twl4030_usb_linkstat(struct twl4030_usb *twl)
35 int status;
36 int linkstat = USB_LINK_UNKNOWN;
37
38- /* STS_HW_CONDITIONS */
39- status = twl4030_readb(twl, TWL4030_MODULE_PM_MASTER, 0x0f);
40+ /*
41+ * For ID/VBUS sensing, see manual section 15.4.8 ...
42+ * except when using only battery backup power, two
43+ * comparators produce VBUS_PRES and ID_PRES signals,
44+ * which don't match docs elsewhere. But ... BIT(7)
45+ * and BIT(2) of STS_HW_CONDITIONS, respectively, do
46+ * seem to match up. If either is true the USB_PRES
47+ * signal is active, the OTG module is activated, and
48+ * its interrupt may be raised (may wake the system).
49+ */
50+ status = twl4030_readb(twl, TWL4030_MODULE_PM_MASTER,
51+ STS_HW_CONDITIONS);
52 if (status < 0)
53 dev_err(twl->dev, "USB link status err %d\n", status);
54- else if (status & BIT(7))
55- linkstat = USB_LINK_VBUS;
56- else if (status & BIT(2))
57- linkstat = USB_LINK_ID;
58- else
59+ else if (status & (BIT(7) | BIT(2))) {
60+ if (status & BIT(2))
61+ linkstat = USB_LINK_ID;
62+ else
63+ linkstat = USB_LINK_VBUS;
64+ } else
65 linkstat = USB_LINK_NONE;
66
67 dev_dbg(twl->dev, "HW_CONDITIONS 0x%02x/%d; link %d\n",
68--
691.6.0.4
70