Hi Hans,

On Fri, Feb 13, 2015 at 08:25:46PM +0100, Hans de Goede wrote:
> 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.
> 
> 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
> 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
> 
> 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.

Very nice, thanks!

Last time I tried musb, there was some issue with the switch from host
to peripheral after a random number of switches. Did you encounter
such a thing during your tests?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
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.

Attachment: signature.asc
Description: Digital signature

Reply via email to