[Letux-kernel] Minor annoyances with USB(3) port on Pyra

Roger Quadros rogerq at ti.com
Mon Sep 17 10:01:17 CEST 2018

Hi Nikolaus,

On 17/09/18 10:25, H. Nikolaus Schaller wrote:
> Hi Roger,
>> Am 10.09.2018 um 09:39 schrieb Roger Quadros <rogerq at ti.com>:
>>> BTW: is there a /sys node to read the OTG state?
>> The sys node should be something like
>> /sys/kernel/debug/<addr>.usb
>> However it doesn't have anything to show the current role.
>> It has a "mode" file which shows the otg mode and allows you to force "host" or "device" modes
>> if initial mode was "otg".
> I have played a little around but configuring and mounting debugfs just to provide
> some information to the GUI seems to be the wrong way to me...

I too agree that it is wrong. debugfs is only meant for debugging.

> root at letux:~# cat /sys/kernel/debug/4a030000.dwc3/link_state /sys/kernel/debug/4a030000.dwc3/mode 
> SS.Disabled
> otg
> root at letux:~# 
>> If you need something to show the current role, it needs to be added to debugfs.c
>> by exporting dwc->current_otg_role if (dwc->dr_mode == USB_DR_MODE_OTG)
> On OMAP3 systems with twl4030 I can simply read
> /sys/bus/platform/devices/musb-hdrc.0.auto/mode
> and it tells all about the interface state: if it is in a or b mode, peripheral, host or idle.
> and I can translate that into different GUI icons.
> root at letux:~# cat /sys/bus/platform/devices/musb-hdrc.0.auto/mode
> b_peripheral
> root at letux:~# 
> So maybe the debugfs mode should be moved to non-debugfs and report the
> same as musb-hdrc.0.auto/mode? Or a new sysattr should be added to
> /sys/class/udc/4a030000.dwc3/
> But strangely, this symlink and /sys/devices/platform/44000000.ocp/4a020000.omap_dwc3/4a030000.dwc3/udc/4a030000.dwc3 disappear when I plug in the OTG cable. They come back on unplugging.

This is because UDC device goes away when we're in host mode.
We need to have something in the controller device i.e. /sys/devices/platform/44000000.ocp/4a020000.omap_dwc3/4a030000.dwc3

Can you please start a discussion about this in lkml with the DWC3 maintainer Felipe? Thanks.

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

More information about the Letux-kernel mailing list