All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Enable USB-C port as Host on Ubuntu with DWC3 driver
       [not found] <PR3P191MB12150E0D54799FE616B709E4F8699@PR3P191MB1215.EURP191.PROD.OUTLOOK.COM>
@ 2021-03-19  8:01 ` Heikki Krogerus
  0 siblings, 0 replies; only message in thread
From: Heikki Krogerus @ 2021-03-19  8:01 UTC (permalink / raw)
  To: Phil Rasoa; +Cc: linux-usb

Hi Philippe,

+linux-usb ml

On Thu, Mar 18, 2021 at 02:08:17PM +0000, Phil Rasoa wrote:
> I am currently working on a project that forces me to use a USB-C port on a
> Ubuntu server "computer". Since I have 2 USB controllers (one using xhci_hdc
> kernel dricer and the other dwc3-pci driver), I would like to know how to
> enable this port as a USB host.

If your computer is Intel based, then the DWC3 controller is device
only. Dual-role capability is achieved with a mux. So if you connect
one of the connectors on your computer to another USB host with USB
Type-C cable, that connector on your board is muxed to the DWC3
controller, so it's in device role. If you connect an USB device to
that same connector, the connector will be in host role and it'll be
muxed to the xHCI. The muxing is handled in system firmware, and we
have no direct control over it.

However, you should be able to attempt role swap if you have connected
the connector to another machine that is also USB dual-role capable
with USB Type-C cable. You should have all the connectors on your
board and the partners attached to them listed in sysfs (_should have_):

        ls /sys/class/typec/
        port0 port1 port1-partner ...

So if let say you have connected port1 to another dual-role capable
machine (you can see the port1-partner device appearing), you can
attempt role swapping like this:

        # Check the current role (device)
        cat /sys/class/typec/port1/data_role
        [device] host

        # Swap to host role
        echo host > /sys/class/typec/port1/data_role

        # Check the current role again
        cat /sys/class/typec/port1/data_role
        device [host]

Hope this helps. If you need more help then please share some more
details about your system.

Br,

-- 
heikki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-19  8:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <PR3P191MB12150E0D54799FE616B709E4F8699@PR3P191MB1215.EURP191.PROD.OUTLOOK.COM>
2021-03-19  8:01 ` Enable USB-C port as Host on Ubuntu with DWC3 driver Heikki Krogerus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.