Email or username:

Password:

Forgot your password?
Top-level
knuxify

@marcan reminds me of a fun case that I still haven't 100% figured out on the exynos 4 - how to get USB OTG working reliably.

the microUSB controller is a mostly-standard DWC2 controller... except the host mode bits have been forcibly ripped out. instead, USB host mode is handled by a separate block on the SoC (hsic). in order to switch between the two, a bit needs to be flipped in a system control register (0 means host mode, 1 means device mode, or something like that - would have to check the code). *both controllers cannot be at the same time*; if dwc2 tries to do *anything* while the host mode is enabled, the driver freezes; the hsic driver is a bit nicer about this though.

the current implementation in the kernel does the necessary bit switch on the USB PHY driver; if the host mode PHY is enabled, it switches to host mode, if the device mode PHY is enabled it switches to device mode. this works fine if you only need one of the two, but if you need both, you get this fun interaction:

- USB device mode gets initialized first, PHY and dwc2
- USB host mode gets initialized second, flips the switch to host mode, inits PHY and hsic
- DWC2 attempts wake-up and fails, causing peripheral mode to not work; so only host mode works.

i ended up hacking around this by making the mode switch happen based on the state of an extcon connector (that is a whole mess in and of itself - there's at least 2 or 3 ways to declare such a dependency in DTS...), and it mostly works but still has the caveat that dwc2 is still technically running so if that driver tries to do any funny reset/resume/etc business and we're in host mode, it fill freeze up and break device mode until reboot

1 comment
knuxify

@marcan (if any smart kernel dev reads this genuinely do give advice lol, i wrote down the details in gitlab.com/exynos4-mainline/li)

Go Up