Skip to contentSkip to conversation

MUSB: unreliable OTG detection in host mode

DISCUSSION Kevin Hilman 2 participants 5 messages Sep 1, 2007

lore
Share & tools
lore
#0 lore raw

Is anyone else using the MUSB driver in OTG mode?

On 2430, I've noticed that using the driver built in OTG mode, the detection of devices in host-mode is unreliable. Building the driver in only host mode doesn't have any problems with the same devices connected.

I load the musb_hdrc module, then the g_zero module to initiate OTG detection.

If my board is connected as a gadget, this works just fine, but if my board is the host and I have devices connected, the detection doesn't work reliably. In the past it seemed it would work most of the time, but with the latest kernel, it doesn't seem to work at all.

Any ideas?

Kevin

#1 lore raw
Quoted 2 lines

On 2430, I've noticed that using the driver built in OTG mode, the detection of devices in host-mode is unreliable.

Unreliable in what way(s)?

Quoted 10 lines

Building the driver in
only host mode doesn't have any problems with the same devices connected.

I load the musb_hdrc module, then the g_zero module to initiate OTG detection.

If my board is connected as a gadget, this works just fine, but if my board is the host and I have devices connected, the detection doesn't work reliably. In the past it seemed it would work most of the time, but with the latest kernel, it doesn't seem to work at all.

This somewhat resembles a problem I've not tracked down, whereby the 2420 + TUSB6010-EVM, in OTG mode, seems to recieve garbage when reading descriptors from the high speed hub I usually like to connect as a root device.

DaVinci didn't seem to have any such issues...

- Dave

#2 lore raw
Quoted 4 lines · David Brownell
Quoted 2 lines

On 2430, I've noticed that using the driver built in OTG mode, the detection of devices in host-mode is unreliable.

Unreliable in what way(s)?

Meaning it sometimes detects connected devices and sometimes not. Sometimes a reboot and another try helps. But with recent git it seems to never detect devices.

Quoted 12 lines
Quoted 11 lines

Building the driver in
only host mode doesn't have any problems with the same devices connected.

I load the musb_hdrc module, then the g_zero module to initiate OTG detection.

If my board is connected as a gadget, this works just fine, but if my board is the host and I have devices connected, the detection doesn't work reliably. In the past it seemed it would work most of the time, but with the latest kernel, it doesn't seem to work at all.

Quoted 7 lines

This somewhat resembles a problem I've not tracked down, whereby the 2420 + TUSB6010-EVM, in OTG mode, seems to recieve garbage when reading descriptors from the high speed hub I usually like to connect as a root device.

DaVinci didn't seem to have any such issues...

I haven't tested DaVinci in OTG mode since on the EVM board I have, you have to move a jumper to switch between the two.

Kevin

#3 lore raw
Quoted 5 lines
Quoted 1 line

Unreliable in what way(s)?

Meaning it sometimes detects connected devices and sometimes not. Sometimes a reboot and another try helps. But with recent git it seems to never detect devices.

What do you mean "detect" though? Does it not see anything hooked up to the root hub? Or once it sees something, is there some difficulty talking to it? The specifics will say just where the problem lies...

Quoted 4 lines
Quoted 1 line

DaVinci didn't seem to have any such issues...

I haven't tested DaVinci in OTG mode since on the EVM board I have, you have to move a jumper to switch between the two.

And when taking the jumper out, you need to wait 30+ seconds for that capacitor to discharge.

Right, the jumper is just doing what the (missing) ID pin detect IRQ should have been able to do. Hook up the jumper, it assumes host role just as if the A end of a cable was attached and ID grounded. Remove it, it assumes peripheral role just as if the B end of the cable were attached with ID floating.

That's exactly what OTG does ... but it's ultra-slow since you'e got to fake the connector signaling. I haven't tried doing the HNP stuff with DaVinci, but that's not the part of OTG that matters except when you do conformance testing.

- Dave

#4 lore raw
Quoted 9 lines · David Brownell
Quoted 4 lines
Quoted 1 line

Unreliable in what way(s)?

Meaning it sometimes detects connected devices and sometimes not. Sometimes a reboot and another try helps. But with recent git it seems to never detect devices.

What do you mean "detect" though? Does it not see anything hooked up to the root hub? Or once it sees something, is there some difficulty talking to it? The specifics will say just where the problem lies...

Well it depends...

First, for comparison sake, attached is the output from when the driver is built in host-mode (host.txt) The rest of the test are done with no changes in cables. devices connected etc...

When I switch to building the driver in OTG mode, either the devices are detected the same as in host.txt (after the additional 'modprobe g_zero'), or not even the root hub is detected (see otg1.txt). And sometimes only the root hub is detected (otg2.txt)

The working OTG case is much more rare than the non-working ones, but I haven't done enough tests to have a good feel for how often etc.

Kevin

# uname -a
Linux omap2430sdp-v4 2.6.23-rc4-omap1-arm-omap2430-default-g8a52303e-dirty #13 PREEMPT Fri Aug 31 21:33:42 PDT 2007 armv6l GNU/Linux
# modprobe musb_hdrc
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
musb_hdrc: version 6.0, musb-dma, host, debug=0
musb_hdrc: ConfigData=0x55 (UTMI-16, dyn FIFOs, bulk split (X), HB-ISO Rx (X))
musb_hdrc: MHDRC RTL version 1.400 
musb_hdrc: setup fifo_mode 2
musb_hdrc: 7/15 max ep, 2624/16384 memory
musb_hdrc: hw_ep 0shared, max 64
musb_hdrc: hw_ep 1tx, max 512
musb_hdrc: hw_ep 1rx, max 512
musb_hdrc: hw_ep 2tx, max 512
musb_hdrc: hw_ep 2rx, max 512
musb_hdrc: hw_ep 3shared, max 256
musb_hdrc: hw_ep 4shared, max 256
musb_hdrc: USB Host mode controller at c8854000 using DMA, IRQ 92
musb_hdrc musb_hdrc.0: MUSB HDRC host driver
musb_hdrc musb_hdrc.0: new USB bus registered, assigned bus number 1
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
usb 1-1: new high speed USB device using musb_hdrc and address 2
usb 1-1: configuration #1 chosen from 1 choice
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 7 ports detected
usb 1-1.7: new high speed USB device using musb_hdrc and address 3
usb 1-1.7: configuration #1 chosen from 1 choice
SCSI subsystem initialized
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 3
usb-storage: waiting for device to settle before scanning
scsi 0:0:0:0: Direct-Access     Flash    Drive AL_USB20   1.00 PQ: 0 ANSI: 2
usb-storage: device scan complete
sd 0:0:0:0: [sda] 1018624 512-byte hardware sectors (522 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] 1018624 512-byte hardware sectors (522 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk
# uname -a
Linux omap2430sdp-v4 2.6.23-rc4-omap1-arm-omap2430-default-g8a52303e-dirty #12 PREEMPT Fri Aug 31 17:11:46 PDT 2007 armv6l GNU/Linux
# modprobe musb_hdrc
musb_hdrc: version 6.0, musb-dma, peripheral, debug=0
musb_hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine (X), bulk split (X), HB-ISO Rx (X), HB-ISO Tx (X), SoftConn)
musb_hdrc: MHDRC RTL version 1.400 
musb_hdrc: setup fifo_mode 2
musb_hdrc: 7/15 max ep, 2624/16384 memory
musb_hdrc: hw_ep 0shared, max 64
musb_hdrc: hw_ep 1tx, max 512
musb_hdrc: hw_ep 1rx, max 512
musb_hdrc: hw_ep 2tx, max 512
musb_hdrc: hw_ep 2rx, max 512
musb_hdrc: hw_ep 3shared, max 256
musb_hdrc: hw_ep 4shared, max 256
musb_hdrc: USB Peripheral mode controller at c8854000 using DMA, IRQ 92
# modprobe g_zero
zero gadget: Gadget Zero, version: St Patrick's Day 2004
zero gadget: using musb_hdrc, OUT ep1out IN ep1in

#

# modprobe musb_hdrc                                       
usbcore: registered new interface driver usbfs                                  
usbcore: registered new interface driver hub                                    
usbcore: registered new device driver usb                                       
musb_hdrc: version 6.0, musb-dma, otg (peripheral+host), debug=0                
musb_hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine (X), bulk split (X))
musb_hdrc: MHDRC RTL version 1.400                                              
musb_hdrc: setup fifo_mode 2                                                    
musb_hdrc: 7/15 max ep, 2624/16384 memory                                       
musb_hdrc: hw_ep 0shared, max 64                                                
musb_hdrc: hw_ep 1tx, max 512                                                   
musb_hdrc: hw_ep 1rx, max 512                                                   
musb_hdrc: hw_ep 2tx, max 512                                                   
musb_hdrc: hw_ep 2rx, max 512                                                   
musb_hdrc: hw_ep 3shared, max 256                                               
musb_hdrc: hw_ep 4shared, max 256                                               
musb_hdrc: USB OTG mode controller at c8854000 using DMA, IRQ 92                
# modprobe g_zero                                          
zero gadget: Gadget Zero, version: St Patrick's Day 2004                        
zero gadget: using musb_hdrc, OUT ep1out IN ep1in                               
musb_hdrc musb_hdrc.0: MUSB HDRC host driver                                    
musb_hdrc musb_hdrc.0: new USB bus registered, assigned bus number 1            
usb usb1: configuration #1 chosen from 1 choice                                 
hub 1-0:1.0: USB hub found                                                      
hub 1-0:1.0: 1 port detected                                                    
#