hardkernel / linux

Linux kernel source tree
Other
427 stars 408 forks source link

c1 odroidc-3.10.y: no scheduling of reused QH structs in amlogic dwc_otg driver #320

Open ardje opened 6 years ago

ardje commented 6 years ago

We have 2 bugs with the c1 usb driver. The first bug is partially explained in: https://forum.odroid.com/viewtopic.php?f=117&t=28787 :: The erratic send times on fullspeed devices: usb urbs seemed to be completed 1.02s after the correct time. @S4mw1se found that the exar driver was only scheduling the microframe once upon allocation, and then put in a pool of unused QH's. Upon reuse of that QH struct, the sched_frame was never set again.

The patch: https://github.com/ardje/linux/commit/44602439217d765a6b3b179f8b7e54ed7772b698 makes sure it is set, but it delays setting the sched_frame to frame_counter into the actual scheduling code.

On a side note: another fix: https://github.com/ardje/linux/commit/1722a51581449a7fccdf63e60b3b64754924db3d was attempted which seemed to mimick the behaviour of newer code drops, and it worked if it wasn't for the major memory leak it caused. This however would have been a cleaner fix, as the sched_frame would have been calculated upon each qh allocation.

For now I go with the first one as that was the intention of the original code. So this is a heads up for a pull request. It works for me (tm), I have yet to try more devices than just a pl2303, and I have to ask S4mw1se if he can see if there are weird things to see on the usb analyser (sorry, max 2.0 a 3.0 analyser was too expensive ;-) ).

So tested so far:

Note that after reading into it, I consider the dwc2 driver of the amlogic code drops not that good, it seem to even refer to even older samsung dwc2 driver code drops, specifically the s3c2410x :-) . So all I suggest to do with it is bandaid it until we can switch to 4.X which does have a generic dwc2 driver which seems pretty well designed. And http://linux-meson.com/doku.php#supported_wip_soc_families seems to look prommissing for now.