Skip to contentSkip to conversation

OMAP3430: MUSB host and hot-plugging

DISCUSSION Felipe Balbi 3 participants 7 messages Mar 20, 2008

lore
Share & tools
lore
#0 lore raw
Quoted 10 lines

Using the default config omap_3430sdp_defconig, I'm doing some basic hot-plug tests of MUSB in host mode.

I noticed that after booting, the first time I connect my USB key, it is detected just fine, the usb/scsi storage modulesare loaded by hotplug and I can access the device just fine.

I then remove the key, and the kernel seems to detect the removal just fine, and does what seems to be a clean shutdown.

Quoted 8 lines

However, if I then plug the key back in, nothing happens.

Forcing a session start via "echo 'F' > /proc/driver/musb_hdrc" causes the device to be (re)detected and things look good again. It is not until I force the session start that I see the interrupt and the CONNECT event.

Any ideas why this isn't detected on insertion?

You're better than me then, I can't get even the first insertion right.

What I'm suspecting is that we do get the insertion but twl4030 do not notify musb about id pin status through ULPI.

You can check that cuz you still in b_idle state even though you have a mini-A connector attached to it. Also, if you put a printk in the irq handler (on twl4030-usb.c) you can see it gets called after attaching the cable.

And there's one other trick, after switching to host role,
you see that you're in a_host from /sys/devices/platform/musb_hdrc.0/mode, if you remove the cable (mini-A) and attach it again right after that, before musb_do_idle put musb in b_idle again,
you get the usb stick recognized and musb_core goes back
to a_host from a_wait_bcon state.

I'm suspecting that twl4030_phy_suspend is somehow messing it up. I'm now digging on it and still I can't say for sure what's happening.

Maybe somebody else has other comments on that.

Signature · 5 lines
Best Regards,

Felipe Balbi
http://felipebalbi.com
[email protected]
#2 lore raw
In reply to Pandita, Vikram
Quoted 17 lines · Vikram

Hi Felipe/Kevin

Quoted 15 lines

To: Kevin Hilman; Linux omap
Subject: RE: OMAP3430: MUSB host and hot-plugging

Quoted 6 lines

Forcing a session start via "echo 'F' > /proc/driver/musb_hdrc" causes the device to be (re)detected and things look good again. It is not until I force the session start that I see the interrupt and the CONNECT event.

Any ideas why this isn't detected on insertion?

You're better than me then, I can't get even the first insertion I'm suspecting that twl4030_phy_suspend is somehow messing it up. I'm now digging on it and still
I can't say for sure what's happening.

Quoted 4 lines
Quoted 1 line

Maybe somebody else has other comments on that.

If you can provide us the procedure to enable hot-plugging for MUSB on OMAP3430, we will look into this issue.

As far as musb driver is concerned it should be just a mater of building it with otg support. But as of now, I cannot get id pin status to musb using twl4030.

Maybe we still have some missing pieces on linux-omap, which I'm researching on that.

Signature · 5 lines
Best Regards,

Felipe Balbi
http://felipebalbi.com
[email protected]
#1 lore raw
In reply to Felipe Balbi

Hi Felipe/Kevin

Quoted 8 lines

To: Kevin Hilman; Linux omap
Subject: RE: OMAP3430: MUSB host and hot-plugging

Quoted 5 lines

Forcing a session start via "echo 'F' > /proc/driver/musb_hdrc" causes the device to be (re)detected and things look good again. It is not until I force the session start that I see the interrupt and the CONNECT event.

Quoted 8 lines
Quoted 1 line

Any ideas why this isn't detected on insertion?

You're better than me then, I can't get even the first insertion I'm suspecting that twl4030_phy_suspend is somehow messing it up. I'm now digging on it and still
I can't say for sure what's happening.

Maybe somebody else has other comments on that.

If you can provide us the procedure to enable hot-plugging for MUSB on OMAP3430, we will look into this issue.

Quoted 12 lines

--
Best Regards,

Felipe Balbi
http://felipebalbi.com
[email protected]

--
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
In reply to Felipe Balbi

Felipe

Quoted 9 lines

Sent: Thursday, March 20, 2008 6:09 PM
To: Pandita, Vikram
Cc: Kevin Hilman; Linux omap
Subject: RE: OMAP3430: MUSB host and hot-plugging

Quoted 2 lines

If you can provide us the procedure to enable hot-plugging for MUSB on OMAP3430, we will look into this issue.

Quoted 6 lines

As far as musb driver is concerned it should be just a mater of building it with otg support. But as of now, I cannot get id pin status to musb using twl4030.

Maybe we still have some missing pieces on linux-omap, which I'm researching on that.

I meant if you could pass on how you have written the hot plugging function/agent for MUSB.
I have not tried hot-plugging on omap.

Quoted 12 lines

--
Best Regards,

Felipe Balbi
http://felipebalbi.com
[email protected]

--
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

#4 lore raw
Quoted 15 lines · Vikram

Felipe

Quoted 13 lines

Sent: Thursday, March 20, 2008 6:09 PM
To: Pandita, Vikram
Cc: Kevin Hilman; Linux omap
Subject: RE: OMAP3430: MUSB host and hot-plugging

Quoted 2 lines

If you can provide us the procedure to enable hot-plugging for MUSB on OMAP3430, we will look into this issue.

As far as musb driver is concerned it should be just a mater of building it with otg support. But as of now, I cannot get id pin status to musb using twl4030.

Quoted 6 lines
Quoted 2 lines

Maybe we still have some missing pieces on linux-omap, which I'm researching on that.

I meant if you could pass on how you have written the hot plugging
function/agent for MUSB.
I have not tried hot-plugging on omap.

There should be no need for that.
twl4030-usb is using ulpi interface on 3430sdp, which means all interrupts are
directed to musb using that interface, also musb switches between host/peripheral
roles automatically as long as we get an id pin change interrupt.

Somehow this interrupt is not going to musb's driver when we're using ulpi on 3430.

I have some other questions for you but it'll be privatly.

Quoted 14 lines
Quoted 13 lines

--
Best Regards,

Felipe Balbi
http://felipebalbi.com
[email protected]

--
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

Signature · 5 lines
Best Regards,

Felipe Balbi
http://felipebalbi.com
[email protected]
#5 lore raw
In reply to Pandita, Vikram
Quoted 15 lines · Vikram

Felipe

Quoted 13 lines

Sent: Thursday, March 20, 2008 6:09 PM
To: Pandita, Vikram
Cc: Kevin Hilman; Linux omap
Subject: RE: OMAP3430: MUSB host and hot-plugging

Quoted 2 lines

If you can provide us the procedure to enable hot-plugging for MUSB on OMAP3430, we will look into this issue.

As far as musb driver is concerned it should be just a mater of building it with otg support. But as of now, I cannot get id pin status to musb using twl4030.

Quoted 6 lines
Quoted 2 lines

Maybe we still have some missing pieces on linux-omap, which I'm researching on that.

I meant if you could pass on how you have written the hot plugging
function/agent for MUSB. I have not tried hot-plugging on omap.

There's no additional code. You can reproduce this with current OMAP git, and default omap_3430sdp_defconfig, which enables MUSB in OTG mode.

Here's what I do:

- plug in cable (mini-A to A-female)
- boot
- after booting, plug in USB storage device.
on my userland, hotplug does its thing, and the usb/scsi storage modules are loaded, and I can then access /dev/sda*
- unplug USB key.
kernel msgs show the disconnect happens etc.

- replug USB key --- nothing happens

- echo 'F' > /proc/driver/musb_hdrc

USB key is detected and 'CONNECT' event happens, and I can then access /dev/sda* again.

Kevin

#6 lore raw
Quoted 38 lines · Kevin Hilman
Quoted 15 lines · Vikram

Felipe

Quoted 13 lines

Sent: Thursday, March 20, 2008 6:09 PM
To: Pandita, Vikram
Cc: Kevin Hilman; Linux omap
Subject: RE: OMAP3430: MUSB host and hot-plugging

Quoted 2 lines

If you can provide us the procedure to enable hot-plugging for MUSB on OMAP3430, we will look into this issue.

As far as musb driver is concerned it should be just a mater of building it with otg support. But as of now, I cannot get id pin status to musb using twl4030.

Quoted 6 lines
Quoted 2 lines

Maybe we still have some missing pieces on linux-omap, which I'm researching on that.

I meant if you could pass on how you have written the hot plugging
function/agent for MUSB. I have not tried hot-plugging on omap.

There's no additional code. You can reproduce this with current OMAP git, and default omap_3430sdp_defconfig, which enables MUSB in OTG mode.

Here's what I do:

- plug in cable (mini-A to A-female)
- boot
- after booting, plug in USB storage device.
on my userland, hotplug does its thing, and the usb/scsi storage modules are loaded, and I can then access /dev/sda*
- unplug USB key.
kernel msgs show the disconnect happens etc.

Quoted 1 line

- replug USB key --- nothing happens

Same here. Although if you unplug and replug right away, it'll work. That's because musb was still waiting in a_wait_bcon state and I didn't let it fall into b_idle.

That's why I'm suspecting on twl4030_phy_{suspend,resume}() routines. After reading twl4030's docs I couldn't find anything suspicious on the code but I'll dig more tomorrow and after the holidays.

Signature · 5 lines
Best Regards,

Felipe Balbi
[email protected]
http://blog.felipebalbi.com