Skip to contentSkip to conversation

usb: musb: OMAP4430: Fix usb device detection if connected during boot

PATCH Superseded Hema HK 2 participants 3 messages Feb 3, 2011 – Feb 15, 2011

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Hema HK

author
#0 lore raw

PATCH 7/7 usb: musb: OMAP4430: Fix usb device detection if connected during boot

OMAP4430 is embedded with UTMI PHY. This PHY does not support the OTG features like ID pin detection and VBUS detection. This function is exported to an external companion chip TWL6030. Software must retrieve the OTG HNP and SRP status from the TWL6030 and configure the bits inside the control module that drive the related USBOTGHS UTMI interface signals. It must also read back the UTMI signals needed to configure the TWL6030 OTG module.

Can find more details in the TRM[1]. [1]:http://focus.ti.com/pdfs/wtbu/OMAP4430_ES2.0_Public_TRM_vJ.pdf

In OMAP4430 musb driver VBUS and ID notifications are received from the transceiver driver. If the cable/device is connected during boot, notifications from transceiver driver will be missed till musb driver is loaded.
Patch to configure the transceiver in the platform_enable/disable functions and enable the vbus in the gadget driver based on the last_event of the otg_transceiver.

Cc Felipe Balbi <[email protected]>
---
 drivers/usb/musb/musb_gadget.c |    4 +++
 drivers/usb/musb/omap2430.c    |   49 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 48 insertions(+), 5 deletions(-)
drivers/usb/musb/musb_gadget.c +4 -0
Index: linux-2.6/drivers/usb/musb/musb_gadget.c
===================================================================
@@ -1855,6 +1855,10 @@ int usb_gadget_probe_driver(struct usb_g
 			} else {
 				hcd->self.uses_pio_for_control = 1;
 			}
+
+			if ((musb->xceiv->last_event == USB_EVENT_ID)
+						&& musb->xceiv->set_vbus)
+				otg_set_vbus(musb->xceiv, 1);
 		}
 	}
 
drivers/usb/musb/omap2430.c +47 -5

69 lines not on this page · raw message

#1 lore raw

Hi,

Quoted 8 lines · Hema HK
drivers/usb/musb/omap2430.c +8 -0
+static void omap2430_musb_enable(struct musb *musb)
+{
+	u8		devctl;
+	unsigned long timeout = jiffies + msecs_to_jiffies(1000);
+	struct device *dev = musb->controller;
+	struct musb_hdrc_platform_data *pdata = dev->platform_data;
+	struct omap_musb_board_data *data = pdata->board_data;
+

drivers/usb/musb/omap2430.c static int omap2430_musb_init(struct mus · line 375

Quoted 10 lines
drivers/usb/musb/omap2430.c +10 -0
+	switch (musb->xceiv->last_event) {
+
+	case USB_EVENT_ID:
+		otg_init(musb->xceiv);
+		if (data->interface_type == MUSB_INTERFACE_UTMI) {
+			devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
+			/* start the session */
+			devctl |= MUSB_DEVCTL_SESSION;
+			musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
+			while (musb_readb(musb->mregs, MUSB_DEVCTL) & 0x80) {

isn't this BDEVICE bit ? We have a define for that, please use it.

Signature · 1 line
balbi
#2 lore raw
Quoted 31 lines

-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Monday, February 14, 2011 3:36 PM
To: Hema HK
Cc: [email protected]; [email protected]; Felipe Balbi
Subject: Re: [PATCH 7/7] usb: musb: OMAP4430: Fix usb device detection if connected during boot

Hi,

Quoted 8 lines · Hema HK
drivers/usb/musb/omap2430.c +8 -0
+static void omap2430_musb_enable(struct musb *musb)
+{
+	u8		devctl;
+	unsigned long timeout = jiffies + msecs_to_jiffies(1000);
+	struct device *dev = musb->controller;
+	struct musb_hdrc_platform_data *pdata = dev->platform_data;
+	struct omap_musb_board_data *data = pdata->board_data;
+

drivers/usb/musb/omap2430.c static int omap2430_musb_init(struct mus

Quoted 10 lines
drivers/usb/musb/omap2430.c +10 -0
+	switch (musb->xceiv->last_event) {
+
+	case USB_EVENT_ID:
+		otg_init(musb->xceiv);
+		if (data->interface_type == MUSB_INTERFACE_UTMI) {
+			devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
+			/* start the session */
+			devctl |= MUSB_DEVCTL_SESSION;
+			musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
+			while (musb_readb(musb->mregs,

MUSB_DEVCTL) & 0x80) {

Quoted 2 lines

isn't this BDEVICE bit ? We have a define for that, please use it.

OK.

Regards,
Hema

Quoted 3 lines

--
balbi