Hi, On Mon, Feb 16, 2015 at 5:46 PM, Chen-Yu Tsai <[email protected]> wrote: > Hi, > > On Sat, Feb 14, 2015 at 3:25 AM, Hans de Goede <[email protected]> wrote: >> Hi All, >> >> I'm happy to report that after a lot of poking at the Allwinner >> musb code I've it working reliable in both host and peripheral mode, >> as well as automatically switching between the 2 depending on which >> cable gets plugged. > > Many thanks for finishing this. > >> My wip code is available here: >> >> https://github.com/jwrdegoede/linux-sunxi/commits/sunxi-wip >> >> Functionality wise this is complete and I expect / hope there will be >> no functional changes before it goes upstream. >> >> There are 2 things which need to be done before it can be submitted >> upstream though: >> >> 1) All the ForceVbus / ForceID stuff needs to be cleaned up >> 2) Currently this is not suitable for multiplatform kernels as it >> puts a #ifdef MACH_SUNXI in musb_regs.h, this needs to be fixed. >> >> 1) is just a matter of removing a whole lot of unnecessary indirection >> in the code, and giving the relevant defines better names > > There's the issue of the glue registers being in the address space > of the usb phy driver. That part could be part of a usb-phy device, > but would require some notifier between the usb-phy and musb. I got > stuck trying to figure out that bit. But I think it's doable. > >> 2) I've a plan for, I just need some time for this. >> >> I've so far only tested this on a cubietruck, I started development on >> a cubieboard, but the cubieboard has the Vusb hardwired to the 5V of the >> board (or at least mine does) meaning that the Vusb enable gpio does not >> do anything, and Vusb-detect always reads as 1, I think my current code >> may work despite this, but I need to test. >> >> Note that the dts modifications for the cubietruck / cubieboard enable >> the musb controller in otg mode, which means that it will not "start" >> until a gadget driver is loaded. For testing I use: >> >> insmod libcomposite.ko >> insmod u_serial.ko >> insmod usb_f_acm.ko >> insmod g_serial.ko > > I don't suppose there is a way to get it working with the gadget > driver builtin? > > Anyway, I cherry-picked your patches onto sunxi-next and have it > working on my A13 tablet if built as modules. See > > https://github.com/wens/linux/commits/hans-sunxi-otg
So for ease of use I am actually using builtin driver with host mode only. Setting Kconfig to host mode only, while having the DT say "otg" triggers some sort of oops (likely a NULL pointer reference). This was on my tablet, and I haven't looked into it. But I think it should be easy for anyone to reproduce. ChenYu >> After this you should see 2 messages like this: >> >> [ 3528.872816] g_serial gadget: Gadget Serial v2.4 >> [ 3528.877377] g_serial gadget: g_serial ready >> >> And then the controller should work either as a usb serial >> port (ttyGS0 on cubietruck side, ttyACM0 on pc version) >> or as a usb host, depending on what you plug in, and you should >> be able to switch on the fly. >> >> I use the following on the cubietruck side to start a getty >> on the usb serial, this assumes you use systemd :) >> >> systemctl start [email protected] >> >> If you put this in say rc.local, then you can use it to >> get a console on a tablet over the otg connector, which is >> very useful for debugging stuff. >> >> Regards, >> >> Hans -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
