On Thu, 9 Oct 2014 15:25:46 -0400
"[email protected]" <[email protected]> wrote:

> On Thu, Oct 9, 2014 at 3:21 PM, Siarhei Siamashka
> <[email protected]> wrote:
> > On Thu, 9 Oct 2014 15:07:43 -0400
> > "[email protected]" <[email protected]> wrote:
> >
> >> On Thu, Oct 9, 2014 at 3:00 PM, Benjamin Henrion <[email protected]> wrote:
> >> > On Thu, Oct 9, 2014 at 8:49 PM, [email protected] <[email protected]> 
> >> > wrote:
> >> >> Has anyone tried USB gadget mode on the A20?
> >> >>
> >> >> Any success? Which kernels does it work on?
> >> >>
> >> >> I tried it on mainline and the OTG device is not in the device tree,
> >> >> I'm poking around and trying to figure out how to get it going.
> >> >
> >> > On the Ralink RT5350F, I spent quite some time to find out that you
> >> > had to put a GPIO low in order to get the OTG mode.
> >> >
> >> > Maybe it is the same on A20?
> >>
> >> USB0-VBUSDET goes into GPIO PH22 on the Cubietruck.
> >> I wonder that that does? It is marked as input.
> >>
> >> My understanding was that plugging an OTG device in would trigger that
> >> input and signal the system to go into OTG mode.  So how do I set this
> >> up in a Cubietruck DTS?
> >
> > There is no MUSB support for sunxi in the mainline kernel yet. Check
> >     
> > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/253463.html
> > and the Chen-Yu Tsai's wip branch:
> >     https://github.com/wens/linux/tree/wip/sunxi-musb
> >
> > I've got a couple of Allwiner tablets a week ago, so MUSB has also
> > become my problem since then (because there is not other USB
> > connectivity). Let's see what can be done.
> 
> I don't care about having it toggle between host and device mode. Is
> there a simple way to force it to always go into device mode?

The required code just does not exist in the mainline kernel.

USB host and USB OTG are using different hardware blocks and need
different drivers. The OTG hardware block is Mentor Graphics Inventra
HDRC (High-speed Dual Role Controller), with some documentation for
it available here in the wiki:
    http://linux-sunxi.org/USB_OTG_Controller_Register_Guide

The tricky part is that MUSB requires platform specific glue layer,
which already exists for a number of other platforms:
    
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/musb/Kconfig?id=v3.17#n61
Do you see sunxi there? No luck for us so far.

At least Chen-Yu Tsai and Carlo Caione tried to do some work on this
MUSB glue layer and I mentioned a link to Chen-Yu Tsai's wip branch in
my previous reply. Not sure what is the current status though. The last
mailing list thread about it died off at the "system controller"
support discussion (see the Allwinner user manuals for more details
about this piece of hardware), which is a necessary pre-requisite
for MUSB. I'm a little bit scared, because looks like it may have
some potential for another simplefb-alike bikeshedding comedy.

On the sunxi-3.4 side, there are two alternative drivers for USB OTG.
One is the Allwinner's custom-made driver for this hardware. And another
one is a glue layer for MUSB, contributed by Jussi Kivilinna some time
ago in the following patch (together with some other patches):
    
https://github.com/linux-sunxi/linux-sunxi/commit/d1eb7fe40ec5a61178a2c4b0bf339310aaf9a7f4

I myself have only started to pay attention to the MUSB driver status a
few days ago and just briefly checked the code, but have not tried to do
anything serious yet. There are way too many other things and
distractions.

In any case, the sunxi MUSB glue layer in the sunxi-3.4 kernel works
(even though it is not totally problem free). This code, together with
the https://github.com/wens/linux/tree/wip/sunxi-musb branch, is a good
starting point for developing the mainline MUSB glue layer. I don't see
any obvious show stoppers. But the people, who worked on this stuff in
the past, might probably correct me and also explain why this work had
been abandoned/suspended.

-- 
Best regards,
Siarhei Siamashka

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

Reply via email to