Skip to contentSkip to conversation

musb OTG broken in 2.6.29-rc3?

DISCUSSION Steve Sakoman 5 participants 10 messages Feb 9, 2009 – Feb 10, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I've been running with musb in host mode on Overo.

Now that EHCI is working, I decided to try putting musb in OTG mode.

Last time I tried this was back in 2.6.28 and it seemed to work just fine.

In 2.6.29-rc3 I don't get any joy - the musb port doesn't seem to switch into host mode when I plug in a miniA cable. Booting with the miniA cable in place doesn't seem to help. Compiling the kernel with host mode enabled works as expected.

Before I spend too much time debugging, has anyone else been successful with musb OTG in 2.6.29-rc3? A quick search of this list didn't turn up any discussion of issues.

Steve

#1 lore raw
Quoted 9 lines · On Mon, 9 Feb 2009 09:40:57 -0800 Steve Sakoman <[email protected]> wrote:

In 2.6.29-rc3 I don't get any joy - the musb port doesn't seem to switch into host mode when I plug in a miniA cable. Booting with the miniA cable in place doesn't seem to help. Compiling the kernel with host mode enabled works as expected.

Before I spend too much time debugging, has anyone else been successful with musb OTG in 2.6.29-rc3? A quick search of this list didn't turn up any discussion of issues.

N810 is working fine in both modes. Either as an ethernet gadget for PC or detecting hub connected into it. Both when booting or during runtime.

I don't have Beagle now to verify but probably this helps a little to hunt.

Jarkko

#2 lore raw
In reply to Steve Sakoman
Quoted 15 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Steve Sakoman
Sent: Monday, February 09, 2009 11:11 PM
To: linux-omap
Subject: musb OTG broken in 2.6.29-rc3?

I've been running with musb in host mode on Overo.

Now that EHCI is working, I decided to try putting musb in OTG mode.

Last time I tried this was back in 2.6.28 and it seemed to work just fine.

Quoted 8 lines

In 2.6.29-rc3 I don't get any joy - the musb port doesn't seem to switch into host mode when I plug in a miniA cable. Booting with the miniA cable in place doesn't seem to help. Compiling the kernel with host mode enabled works as expected.

Before I spend too much time debugging, has anyone else been successful with musb OTG in 2.6.29-rc3? A quick search of this list didn't turn up any discussion of issues.

It works fine on OMAP35x EVM too. I had to add a proc entry for session start (Switching on the vBus).

Ajay

Quoted 6 lines

Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 6 lines · Ajay Kumar
Quoted 3 lines

Before I spend too much time debugging, has anyone else been successful with musb OTG in 2.6.29-rc3? A quick search of this list didn't turn up any discussion of issues.

It works fine on OMAP35x EVM too. I had to add a proc entry for session start (Switching on the vBus).

Could you give me a little more detail on what you had to do for session start? Perhaps I have a similar issue on Overo.

Thanks!

Steve

#4 lore raw
Quoted 13 lines

-----Original Message-----
From: Steve Sakoman [mailto:[email protected]]
Sent: Tuesday, February 10, 2009 10:13 AM
To: Gupta, Ajay Kumar
Cc: linux-omap
Subject: Re: musb OTG broken in 2.6.29-rc3?

Quoted 4 lines · Ajay Kumar
Quoted 3 lines

Before I spend too much time debugging, has anyone else been successful with musb OTG in 2.6.29-rc3? A quick search of this list didn't turn up any discussion of issues.

Quoted 5 lines
Quoted 2 lines

It works fine on OMAP35x EVM too. I had to add a proc entry for session start (Switching on the vBus).

Could you give me a little more detail on what you had to do for session start? Perhaps I have a similar issue on Overo.

It is same $ echo "F" >/proc/driver/musb_hdrc, which was earlier In musb_procfs.c and now been removed.

+ case 'F':

+               reg = musb_readb(mbase, MUSB_DEVCTL);
+               reg |= MUSB_DEVCTL_SESSION;
+               musb_writeb(mbase, MUSB_DEVCTL, reg);

Ajay

Quoted 4 lines

Thanks!

Steve

#5 lore raw
Quoted 21 lines · Ajay Kumar Gupta
Quoted 13 lines

-----Original Message-----
From: Steve Sakoman [mailto:[email protected]]
Sent: Tuesday, February 10, 2009 10:13 AM
To: Gupta, Ajay Kumar
Cc: linux-omap
Subject: Re: musb OTG broken in 2.6.29-rc3?

Quoted 4 lines · Ajay Kumar
Quoted 3 lines

Before I spend too much time debugging, has anyone else been successful with musb OTG in 2.6.29-rc3? A quick search of this list didn't turn up any discussion of issues.

Quoted 5 lines
Quoted 2 lines

It works fine on OMAP35x EVM too. I had to add a proc entry for session start (Switching on the vBus).

Could you give me a little more detail on what you had to do for session start? Perhaps I have a similar issue on Overo.

It is same $ echo "F" >/proc/driver/musb_hdrc, which was earlier In musb_procfs.c and now been removed.

Review

Quoted 4 lines
(quoted diff) +4 -0
+       case 'F':
+               reg = musb_readb(mbase, MUSB_DEVCTL);
+               reg |= MUSB_DEVCTL_SESSION;
+               musb_writeb(mbase, MUSB_DEVCTL, reg);

a temp sysfs for that will help:

Steve, could you try the following

==== cut here ====

drivers/usb/musb/musb_core.c +29 -0
index 2cc34fa..0ffd611 100644
@@ -1713,6 +1713,32 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf)
 }
 static DEVICE_ATTR(vbus, 0644, musb_vbus_show, musb_vbus_store);
 
+static ssize_t
+musb_session_store(struct device *dev, struct device_attribute *attr,
+               const char *buf, size_t n)
+{
+       struct musb     *musb = dev_to_musb(dev);
+       unsigned short  session;
+       u8              devctl;
+
+       if (sscanf(buf, "%hu", &session) != 1
+                       || (session != 1) || (session != 0)) {
+               dev_err(dev, "value must be 1 on 0\n");
+               return -EINVAL;
+       }
+
+       devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
+       if (session)
+               devctl |= MUSB_DEVCTL_SESSION;
+       else
+               devctl &= ~MUSB_DEVCTL_SESSION;
+
+       musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
+
+       return n;
+}
+static DEVICE_ATTR(session, 0644, NULL, musb_session_store);
+
 #ifdef CONFIG_USB_GADGET_MUSB_HDRC
 
 /* Gadget drivers can't know that a host is connected so they might want
@@ -1813,6 +1839,7 @@ static void musb_free(struct musb *musb)
         */
 
 #ifdef CONFIG_SYSFS
+       device_remove_file(musb->controller, &dev_attr_session);
        device_remove_file(musb->controller, &dev_attr_mode);
        device_remove_file(musb->controller, &dev_attr_vbus);
 #ifdef CONFIG_USB_MUSB_OTG
@@ -2047,6 +2074,7 @@ bad_config:
        }
 
 #ifdef CONFIG_SYSFS
+       status = device_create_file(dev, &dev_attr_session);
        status = device_create_file(dev, &dev_attr_mode);
        status = device_create_file(dev, &dev_attr_vbus);
 #ifdef CONFIG_USB_GADGET_MUSB_HDRC
@@ -2061,6 +2089,7 @@ bad_config:
 
 fail2:
 #ifdef CONFIG_SYSFS
+       device_remove_file(musb->controller, &dev_attr_session);
        device_remove_file(musb->controller, &dev_attr_mode);
        device_remove_file(musb->controller, &dev_attr_vbus);
 #ifdef CONFIG_USB_MUSB_OTG
Signature · 1 line
balbi
#6 lore raw
Quoted 41 lines · Balbi Felipe (Nokia-D/Helsinki)
Quoted 21 lines · Ajay Kumar Gupta
Quoted 13 lines

-----Original Message-----
From: Steve Sakoman [mailto:[email protected]]
Sent: Tuesday, February 10, 2009 10:13 AM
To: Gupta, Ajay Kumar
Cc: linux-omap
Subject: Re: musb OTG broken in 2.6.29-rc3?

Quoted 4 lines · Ajay Kumar
Quoted 3 lines

Before I spend too much time debugging, has anyone else been successful with musb OTG in 2.6.29-rc3? A quick search of this list didn't turn up any discussion of issues.

Quoted 5 lines
Quoted 2 lines

It works fine on OMAP35x EVM too. I had to add a proc entry for session start (Switching on the vBus).

Could you give me a little more detail on what you had to do for session start? Perhaps I have a similar issue on Overo.

It is same $ echo "F" >/proc/driver/musb_hdrc, which was earlier In musb_procfs.c and now been removed.

Review

Quoted 4 lines
(quoted diff) +4 -0
+       case 'F':
+               reg = musb_readb(mbase, MUSB_DEVCTL);
+               reg |= MUSB_DEVCTL_SESSION;
+               musb_writeb(mbase, MUSB_DEVCTL, reg);

a temp sysfs for that will help:

Steve, could you try the following

==== cut here ====

drivers/usb/musb/musb_core.c +0 -0
index 2cc34fa..0ffd611 100644
@@ -1713,6 +1713,32 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf)
 }
 static DEVICE_ATTR(vbus, 0644, musb_vbus_show, musb_vbus_store);
 

drivers/usb/musb/musb_core.c musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf) · line 1725

Quoted 10 lines
drivers/usb/musb/musb_core.c +10 -0
+static ssize_t
+musb_session_store(struct device *dev, struct device_attribute *attr,
+               const char *buf, size_t n)
+{
+       struct musb     *musb = dev_to_musb(dev);
+       unsigned short  session;
+       u8              devctl;
+
+       if (sscanf(buf, "%hu", &session) != 1
+                       || (session != 1) || (session != 0)) {
			ugg, this should be &&

here's the updated:

drivers/usb/musb/musb_core.c +29 -0
index 2cc34fa..1ea7cfa 100644
@@ -1713,6 +1713,32 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf)
 }
 static DEVICE_ATTR(vbus, 0644, musb_vbus_show, musb_vbus_store);
 
+static ssize_t
+musb_session_store(struct device *dev, struct device_attribute *attr,
+               const char *buf, size_t n)
+{
+       struct musb     *musb = dev_to_musb(dev);
+       unsigned short  session;
+       u8              devctl;
+
+       if (sscanf(buf, "%hu", &session) != 1
+                       || ((session != 1) && (session != 0))) {
+               dev_err(dev, "value must be 1 on 0\n");
+               return -EINVAL;
+       }
+
+       devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
+       if (session)
+               devctl |= MUSB_DEVCTL_SESSION;
+       else
+               devctl &= ~MUSB_DEVCTL_SESSION;
+
+       musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
+
+       return n;
+}
+static DEVICE_ATTR(session, 0644, NULL, musb_session_store);
+
 #ifdef CONFIG_USB_GADGET_MUSB_HDRC
 
 /* Gadget drivers can't know that a host is connected so they might want
@@ -1813,6 +1839,7 @@ static void musb_free(struct musb *musb)
         */
 
 #ifdef CONFIG_SYSFS
+       device_remove_file(musb->controller, &dev_attr_session);
        device_remove_file(musb->controller, &dev_attr_mode);
        device_remove_file(musb->controller, &dev_attr_vbus);
 #ifdef CONFIG_USB_MUSB_OTG
@@ -2047,6 +2074,7 @@ bad_config:
        }
 
 #ifdef CONFIG_SYSFS
+       status = device_create_file(dev, &dev_attr_session);
        status = device_create_file(dev, &dev_attr_mode);
        status = device_create_file(dev, &dev_attr_vbus);
 #ifdef CONFIG_USB_GADGET_MUSB_HDRC
@@ -2061,6 +2089,7 @@ bad_config:
 
 fail2:
 #ifdef CONFIG_SYSFS
+       device_remove_file(musb->controller, &dev_attr_session);
        device_remove_file(musb->controller, &dev_attr_mode);
        device_remove_file(musb->controller, &dev_attr_vbus);
 #ifdef CONFIG_USB_MUSB_OTG
Signature · 1 line
balbi
#7 lore raw
In reply to Felipe Balbi
Quoted 5 lines · On Tue, 10 Feb 2009 08:35:31 +0100 "Balbi Felipe (Nokia-D/Helsinki)"…
Quoted 5 lines
Quoted 2 lines

Could you give me a little more detail on what you had to do for session start? Perhaps I have a similar issue on Overo.

It is same $ echo "F" >/proc/driver/musb_hdrc, which was earlier In musb_procfs.c and now been removed.

Quoted 9 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+       case 'F':
+               reg = musb_readb(mbase, MUSB_DEVCTL);
+               reg |= MUSB_DEVCTL_SESSION;
+               musb_writeb(mbase, MUSB_DEVCTL, reg);

a temp sysfs for that will help:

Steve, could you try the following

I let Felipe to send new version of the patch where it applies (I had there spaces instead of tabs?) and condition for session value is not true for all values ;-)

But for me Beagle work. Ethernet gadget just fine and HS HUB by kicking the session on.

Jarkko

#8 lore raw
Quoted 13 lines · Jarkko Nikula
Quoted 10 lines · On Tue, 10 Feb 2009 08:35:31 +0100 "Balbi Felipe (Nokia-D/Helsinki)"…
Quoted 9 lines
Quoted 2 lines

Could you give me a little more detail on what you had to do for session start? Perhaps I have a similar issue on Overo.

It is same $ echo "F" >/proc/driver/musb_hdrc, which was earlier In musb_procfs.c and now been removed.

(quoted diff) +4 -0
+       case 'F':
+               reg = musb_readb(mbase, MUSB_DEVCTL);
+               reg |= MUSB_DEVCTL_SESSION;
+               musb_writeb(mbase, MUSB_DEVCTL, reg);
Quoted 7 lines
Quoted 4 lines

a temp sysfs for that will help:

Steve, could you try the following

I let Felipe to send new version of the patch where it applies (I had there spaces instead of tabs?) and condition for session value is not true for all values ;-)

I had the same issue with spaces/tabs.

Heading to the airport now, so won't be able to do further testing (beyond compile testing) till Friday.

Quoted 2 lines

But for me Beagle work. Ethernet gadget just fine and HS HUB by kicking the session on.

What method did you use to kick the session on? Was this always required? I might be misremembering, but I seem to recall that plugging in a miniA cable resulted in musb automatically switching modes to host.

Sorry for the perhaps stupid questions, I am *far* from being a USB expert :-)

Regards,

Steve

#9 lore raw
Quoted 8 lines · On Tue, 10 Feb 2009 15:27:18 +0100 ext Steve Sakoman <[email protected]> wrote:
Quoted 2 lines

But for me Beagle work. Ethernet gadget just fine and HS HUB by kicking the session on.

What method did you use to kick the session on? Was this always required? I might be misremembering, but I seem to recall that plugging in a miniA cable resulted in musb automatically switching modes to host.

I used Felipe's patch and "echo 1 >/sys/...musb_something/session". That was required each time I reconnected the cable.

Quoted 3 lines

Sorry for the perhaps stupid questions, I am *far* from being a USB expert :-)

Me too :-)

Jarkko