[PATCH v4 0/2] ARM: sun8i-r40: Enable usb otg support
Evgeny Boger
boger at wirenboard.com
Thu May 19 13:54:57 PDT 2022
Hi qianfan,
As Allwinner A40i user, let me first thank you for your effort for
making better upstream support for R40!
However, I would strongly suggest *not* to add USB support to one more
Allwinner SoC in this particular way.
The problem is, this approach consists of a number of carefully crafted
hacks in device tree to make current drivers work on Allwinner hardware
without modification to the drivers.
a few examples:
1) please notice how ohci0 and ehci0 nodes do not contain reference to
usb phy. It is done intentionally, otherwise EHCI will reset musb mode.
Of course omitting phy reference here is also completely breaking power
cycling in case of usb error and otherwise messes with a power management.
2) one must always enable ohci, ehci and usb_otg nodes at the same time.
If one forgets to enable ohci/ehci nodes while enabling usb_otg node,
the system will silently fail to work as USB host.
3) For host-only mode we still have to enable usb_otg node despite no
role switching is needed. That's because phy reference is missing in
ehci/ohci, so the ehci/ohci driver won't enable the PHY.
Also I might be wrong, but I think phy won't be routed to ehci/ohci
controllers is this case.
4) musb host controller is initialized and present to hardware though
never actually used
To summarize, not only the resulting device tree is not describing the
hardware properly, it is creating device tree configuration which will
be very hard to support in future, once proper driver support is in place.
At Wiren Board kernel tree we tried to untangle this issue [1-6].
Unfortunately I didn't have time to prepare it for kernel submission
yet, but I think I better submit it as RFC to get a feedback from you
and others.
[1]
https://github.com/wirenboard/linux/commit/359abbbd86ddff4d3c61179c882c286de32bb089
[2]
https://github.com/wirenboard/linux/commit/6327f9d7972c21b229fb83457fdde643b31553f9
[3]
https://github.com/wirenboard/linux/commit/f01f4c66758bde460a4d8c5b54ecee3b585c0232
[4]
https://github.com/wirenboard/linux/commit/c27598ad601e5a46f624b73412a531d6f1f63d37
[5]
https://github.com/wirenboard/linux/commit/5796d6eebb86b32a3751b2038b63af46f94954b3
[6]
https://github.com/wirenboard/linux/commit/0928a675d875f9c2849fd3a9888f718bbb673bda
--
Kind regards,
Evgeny Boger
CTO @ Wiren Board
+49 3046690053
https://wirenboard.com/
More information about the linux-arm-kernel
mailing list