Re: Enable USB-C port as Host on Ubuntu with DWC3 driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux