Page 1 of 1

OHCI stops generating WritebackDoneHead after some time

Posted: Sat Oct 21, 2023 6:13 am
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

Re: OHCI stops generating WritebackDoneHead after some time

Posted: Wed Oct 25, 2023 10:22 am
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.