[Letux-kernel] musb otg/y-cable regressions, OTG support removal

Andreas Kemnade andreas at kemnade.info
Mon Feb 18 23:37:27 CET 2019


On Mon, 18 Feb 2019 13:27:35 +0100
"H. Nikolaus Schaller" <hns at goldelico.com> wrote:

> Hi,
> 
> > Am 18.02.2019 um 12:52 schrieb Andreas Kemnade <andreas at kemnade.info>:
> > 
> > On Mon, 18 Feb 2019 08:53:20 +0100
> > "H. Nikolaus Schaller" <hns at goldelico.com> wrote:
> >   
> >> Hi,
> >>   
> >>> Am 18.02.2019 um 07:58 schrieb Andreas Kemnade <andreas at kemnade.info>:
> >>> 
> >>> Hi,
> >>> 
> >>> after quite some searching why b_host mode only works very randomly, I found
> >>> out that
> >>> - musb: disable b_host wait timeout for y-cable usage
> >>> is missing in >= letux-4.18. Seems to be forgotten in a conflict resolution.    
> >> 
> >> Ok. Do you have a reference to the original patch?
> >>   
> >>> - and them we have this one
> >>> commit 0a9134bd733bbb99bd18f5520a488960170271f2
> >>> Author: Bin Liu <b-liu at ti.com>
> >>> Date:   Mon May 21 08:42:19 2018 -0500
> >>> 
> >>>   usb: musb: disable otg protocol support
> >>> 
> >>>   As decided in the discussion [1] we are deleting the otg protocol
> >>>   support from the musb drivers.
> >>> 
> >>>   First this patch disables the flags for enabling the otg protocols. We
> >>>   will later gradually delete the otg protocol code from the musb drivers.
> >>> 
> >>>   [1] https://www.spinics.net/lists/linux-usb/msg167003.html
> >>> 
> >>>   Signed-off-by: Bin Liu <b-liu at ti.com>
> >>>   Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> >>> 
> >>> that seems also to influence things.    
> >> 
> >> Hm. What are the effects of this? Does it influcence OTG operation on GTA04?
> >>   
> > well, it influences operation if something tries to do hnp.
> > So it about letting the device say:"hey, I would rather be a usb host".
> > So then you might have a_peripherals and b_hosts.  
> 
> Ah, ok that is role switching after initial role defined by the ID pin
> 
> https://en.wikipedia.org/wiki/USB_On-The-Go
> 
> Is this widely used?
> 
> > 
> > Well, there are rare devices which actually use that feature.   
> 
> Well, I can't imagine that I have one that does... Either there are computers
> and chargers which connect to the GTA04 in client mode. And I have an
> OTG cable to connect e.g. an USB memory stick in host mode.
> 
I connect a circuit at my bike which should charge the gta04 and is a usb
peripheral. As that microcontroller does not support real otg, I have to
hack a bit... The clean way there would be as far as I understand that
that microcontroller starts as a_host (and the gta04 as b_peripheral) and
asks the gta04 side to become host (by that hnp).
There are also other use-cases for such things.

> > But my b_host hacks actually depend on that logic in the kernel.  
> 
> Ok, that is understandable. You need to connect something in client
> mode and then somehow tell (in this case by user-space) that you want
> to have host-mode.
> 
What I am actually doing is a bit different. The state machine is in the soc, so afaik you
cannot easily choose between device and host. But maybe I should recheck.
So what I am doing here (see also b_host.sh comments)?

1. I make sure that there is some voltage at vusb
2. I am fooling musb to think it is connected to a host (the fake_host sysfs
node)
3. I am triggering the b_hnp_enable thing by another sysfs node (also not
upstream), that should normally happen by the device.
4. I remove that fake_host connecting
5. I connect the device.


> > 
> >   
> >> Well, we never had a really OTG compatible socket, just the OTG mode.
> >>   
> > Well, the socket on gta04 is a usb-miniab socket, isn't it? So it is
> > a usb-otg socket.    
> 
> Yes, you are right. We even have the grey color code which is required for OTG.
> And the ID pin is connected.
> 
> Hm. So we probably should ask that they either keep it in kernel.org or provide
> an alternative for what we need (user-space triggered role switch).
> 
The interesting question is what we need. Support clean hnp, because the hardware
can do that and it is a phone to tinker around, so is should be prepared for
your wildest ideas (and that includes hnp)? Hacks to charge the gta04
and also having it act as a host? Being able to use b-mini plug to a-receptable
cables without id connected (because you cannot find a real otg one)?

Other use-cases besides of my bike setup:
I also have a modified usb hub (input powered) so I can charge the gta04 and connect
usb devices at the same time.

And another really dirty hack I am doing often in summer: Connecting my camera to
the gta04 and use linear charging to provide a low vbus output (instead of the
charge pump delivering 5v) which has the
nice side effect that the camera does not use the gta04 battery to charge.

I am a bit unsure here what to do. Maybe just raise our hands here and
just say:"Hello there is a device out there with a real usb-mini-ab socket."
Or explain concrete usecases. Somehow this all feels strange: Remove a feature.

That all is the main reason why I am still sticking with 4.17+cherry-picks (besides
developing+testing things). I just did not find the time yet to fully analyze it.

Regards,
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.goldelico.com/pipermail/letux-kernel/attachments/20190218/ade8424b/attachment.asc>


More information about the Letux-kernel mailing list