Hi Sergei,

I am reading up on the OTG state machine, also on my board I have USB ID wired 
to a GPIO so may be able to hack in an interrupt to help me out if I have to.

Meanwhile though here is what I have found; thanks for any clues:

Sergei Shtylyov wrote:
> Jon Povey wrote:
>> but having some problems with it not finding memory sticks in host
>> mode after connecting as a gadget,
>
>     IIRC, that should be cured by adding musb_platfrom_try_idle() to
> drivers/usb/musb/davinci.c. I'm not sure why it lacks this function,
> while it's been proven that DA830 needs it. You can try copying the
> code from omap2430.c (you'll also have to modify the #ifdef'ery
> around the declaration in musb_core.h). My memory may be wrong
> though...

I had a go at hacking that in, triggering otg_timer() with some extra case 
statements. I can see it printing things during module shutdown at debug level 
4.
It hasn't made any difference to my main issues which are:

After use in host mode (memory stick detected), swapping cables for use in 
gadget (serial) mode, does not react to cable connect/disconnect. Gadget mode 
does work if tried first after module load, and can disconnect/reconnect 
multiple times (until cables are swapped and a memory stick is used)

I have two USB memory sticks here which I will call "good" and "bad". Different 
models, both work fine on PC, I have no reason to think there is anything wrong 
with the "bad" stick, but the "bad" stick will only be detected after the 
"good" stick has successfully been detected, or immediately after driver module 
load iff the correct cable was connected at module load time. Note the stick 
doesn't have to be plugged into the cable at module load time, the cable just 
has to be plugged into the board.

After use in gadget mode and swapping cables, the "bad" stick will not be 
detected until the "good" stick has been.

I will paste a couple of console logs at the end of this email.

>> and a few weird error messages.
>
>     Like?

When I have a memory stick connected and detected, if I remove the cable from 
the board I get dma warnings:

        usb 1-1: USB disconnect, address 11
        drivers/usb/musb/davinci.c musb_platform_enable: dma not reactivated

This doesn't happen if I remove the stick from the cable but leave the cable 
connected to the board, then remove the cable a few seconds later. The cable 
connector has the ID pin grounded.. I assume it's something to do with that.

I looked at the code generating the dma warnings; it seems to be a flag that's 
not actually associated with any DMA (dma_off in davinci.c) - seems to be 
pointless.

Also, a possible red herring:

I have times when I will get a console screen full of messages like

        serial8250: too much work for irq14
        serial8250: too much work for irq14
        ttyS2: 5 input overrun(s)
        serial8250: too much work for irq14

which seems to be associated with loading and doing things with the musb 
driver, but only very loosely and intermittently. May be something else 
entirely. We do have something hooked up to ttyS2 sending lots of data that's 
probably not configured right yet, so ignore this if it doesn't mean anything 
to you.

Log for gadget -> memory stick
------------------------------

r...@h:/# # disconnect gadget
r...@h:/# davinci_interrupt 362: IRQ 00010000
musb_interrupt 1505: ** IRQ peripheral usb0001 tx0000 rx0000
musb_stage0_irq 380: <== Power=f0, DevCtl=99, int_usb=0x1
musb_stage0_irq 564: SUSPEND (b_peripheral) devctl 99 power f0
musb_g_suspend 1921: devctl 99
r...@h:/# # plug in host cable
r...@h:/# # plug in black stick (no reaction)
r...@h:/# # swap for blue stick
r...@h:/# davinci_interrupt 362: IRQ 00200000
musb_interrupt 1505: ** IRQ peripheral usb0020 tx0000 rx0000
musb_stage0_irq 380: <== Power=e0, DevCtl=88, int_usb=0x20
musb_stage0_irq 696: DISCONNECT (b_peripheral) as Peripheral, devctl 88
musb_g_disconnect 1957: devctl 88
nuke 189: ep1out: abort DMA --> 0
musb_gadget_disable 1038: ep1out
nuke 189: ep1in: abort DMA --> 0
musb_gadget_disable 1038: ep1in
nuke 189: ep2in: abort DMA --> 0
musb_gadget_disable 1038: ep2in
otg_timer 216: poll devctl 88 (b_idle)
davinci_interrupt 362: IRQ 01000000
davinci_interrupt 423: VBUS on (a_wait_vrise), devctl 19
davinci_interrupt 362: IRQ 00100000
musb_interrupt 1505: ** IRQ host usb0010 tx0000 rx0000
musb_stage0_irq 380: <== Power=e0, DevCtl=5d, int_usb=0x10
musb_stage0_irq 689: CONNECT (a_host) devctl 5d

Log for stick -> gadget
-----------------------
r...@h:/# # remove memory stick
r...@h:/# davinci_interrupt 362: IRQ 00200000
musb_interrupt 1505: ** IRQ peripheral usb0020 tx0000 rx0000
musb_stage0_irq 380: <== Power=e0, DevCtl=19, int_usb=0x20
musb_stage0_irq 696: DISCONNECT (a_host) as Host, devctl 19
musb_platform_try_idle 328: a_wait_bcon inactive, for idle timer for 1100 ms
musb_hub_control 356: port status 00010100
musb_hub_control 290: clear feature 16
usb 1-1: USB disconnect, address 2
musb_hub_control 356: port status 00000100
musb_hub_control 356: port status 00000100
musb_hub_control 356: port status 00000100
musb_hub_control 356: port status 00000100
musb_hub_control 356: port status 00000100
otg_timer 216: poll devctl 19 (a_wait_bcon)
davinci_interrupt 362: IRQ 01000000
davinci_interrupt 423: VBUS off (b_idle), devctl 98
otg_timer 216: poll devctl 98 (b_idle)
otg_timer 216: poll devctl 99 (b_idle)
otg_timer 216: poll devctl 99 (b_idle)
# remove host cable
otg_timer 216: poll devctl 99 (b_idle)
otg_timer 216: poll devctl 91 (b_idle)
otg_timer 216: poll devctl 91 (b_idle)
otg_timer 216: poll devctl 91 (b_idle)
otg_timer 216: poll devctl 91 (b_idle)
otg_timer 216: poll devctl 91 (b_idle)
# connect gadget cable (to PC)
otg_timer 216: poll devctl 91 (b_idle)
otg_timer 216: poll devctl 99 (b_idle)
otg_timer 216: poll devctl 99 (b_idle)
otg_timer 216: poll devctl 99 (b_idle)

--
Jon Povey
[email protected]

Racelogic is a limited company registered in England. Registered number 2743719 
.
Registered Office Unit 10, Swan Business Centre, Osier Way, Buckingham, Bucks, 
MK18 1TB .

The information contained in this electronic mail transmission is intended by 
Racelogic Ltd for the use of the named individual or entity to which it is 
directed and may contain information that is confidential or privileged. If you 
have received this electronic mail transmission in error, please delete it from 
your system without copying or forwarding it, and notify the sender of the 
error by reply email so that the sender's address records can be corrected. The 
views expressed by the sender of this communication do not necessarily 
represent those of Racelogic Ltd. Please note that Racelogic reserves the right 
to monitor e-mail communications passing through its network


_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to