OHCI stops generating WritebackDoneHead after some time

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
alex1237424
Posts: 2
Joined: Wed Oct 18, 2023 3:28 pm

OHCI stops generating WritebackDoneHead after some time

Post by alex1237424 »

I started to write ohci driver, and after some time playing with it I got to the point where I can’t identify the issue.
after I do basic ohci configuration, I setup interrupts and do next reads when HccaDoneHead flag is triggered. The problem is that after a few successful request-responses it stops it does not receive next interrupt.
For simplicity I made it now to send same package every time and I can reproduce the issue every time after 3 successful control requests. The log shows 2 last interrupt routings that sends same package, but last never generated interrupt.

(it is running in qemu, simulating allwinner h3)

Code: Select all

---[USB] Interrupt 00000006
StartOfFrame
WritebackDoneHead
after TD[0](4003bf10), 3e00000, 0, 0, 4003bf57
after TD[1](4003bf20), 2f00000, 0, 4003bf10, 4003bf61
after TD[2](4003bf30), 2080000, 0, 4003bf20, 0
Response: 0a 03 
HccaFrameNumber: 3
HccaDoneHead: 4003bf30
—get_descriptor_string 00000001 2								<— here it start a new request, attempt 3
Control ED: 00082000, 4003bf10, 4003bf40, 00000000
Setup TD[0](4003bf10), e2e00000, 4003bf50, 4003bf20, 4003bf57
Setup TD[1](4003bf20), e3f00000, 4003bf60, 4003bf30, 4003bf61
Setup TD[2](4003bf30), e3080000, 0, 4003bf40, 0
Setup Request: 80 06 01 03 09 04 02 00 
HcControl: 00000090											<— printing regs at the end of ira routing
HcControlHeadED: 4003bf00
HcControlCurrentED: 00000000
HcInterruptEnable: 8000007b
HcInterruptStatus: 00000000


---[USB] Interrupt 00000006
StartOfFrame
WritebackDoneHead
after TD[0](4003bf10), 3e00000, 0, 0, 4003bf57
after TD[1](4003bf20), 2f00000, 0, 4003bf10, 4003bf61
after TD[2](4003bf30), 2080000, 0, 4003bf20, 0
Response: 0a 03 
HccaFrameNumber: 5
HccaDoneHead: 4003bf30
—get_descriptor_string 00000001 2								<— here it start a new request, attempt 4
Control ED: 00082000, 4003bf10, 4003bf40, 00000000
Setup TD[0](4003bf10), e2e00000, 4003bf50, 4003bf20, 4003bf57
Setup TD[1](4003bf20), e3f00000, 4003bf60, 4003bf30, 4003bf61
Setup TD[2](4003bf30), e3080000, 0, 4003bf40, 0
Setup Request: 80 06 01 03 09 04 02 00 
HcControl: 00000090											<— printing regs at the end of ira routing
HcControlHeadED: 4003bf00
HcControlCurrentED: 00000000
HcInterruptEnable: 8000007b
HcInterruptStatus: 00000000
alex1237424
Posts: 2
Joined: Wed Oct 18, 2023 3:28 pm

Re: OHCI stops generating WritebackDoneHead after some time

Post by alex1237424 »

Moderating my post took so much time that I found the problem few days before post was published here. So I am answering to my question:

The problem was that I simply was not settings HcCommandStatus |= 2 to tell controller that Control List Filled since first package. I am not sure why it actually worked until 5 packages received, whether it is a qemu bug or confusing explanation of this bit in datasheet plays its role, where it says that controller switches it off but at the same time can turn it on back if finds something.
Post Reply