# [SOLVED] Thunderbolt 3 with USB-C drive

## manwe_

Hi *.

My first laptop with TB3 (Toshiba X40-E). Alternate Mode (Display Port) is working fine, but I have a problem with standard USB-C hard drive. When connected to TB3 via USB-C 3.1Gen1 (5Gbps) cable, no block device shows up. Works completly fine when connected to type A port via USB 3.1Gen1 A»C cable. Also works with TB3 on Win10 so it's (probably) not BIOS/UEFI related. 

I've done diff of whole /dev and /sys before and after connecting the drive. Content of /dev folder doesn't change, content of /sys gains this:

```
10918a10919

> /sys/class/typec/port0-partner

11616a11618,11629

> /sys/devices/platform/USBC000:00/typec/port0/port0-partner

> /sys/devices/platform/USBC000:00/typec/port0/port0-partner/uevent

> /sys/devices/platform/USBC000:00/typec/port0/port0-partner/accessory_mode

> /sys/devices/platform/USBC000:00/typec/port0/port0-partner/power

> /sys/devices/platform/USBC000:00/typec/port0/port0-partner/power/runtime_active_time

> /sys/devices/platform/USBC000:00/typec/port0/port0-partner/power/runtime_status

> /sys/devices/platform/USBC000:00/typec/port0/port0-partner/power/autosuspend_delay_ms

> /sys/devices/platform/USBC000:00/typec/port0/port0-partner/power/runtime_suspended_time

> /sys/devices/platform/USBC000:00/typec/port0/port0-partner/power/control

> /sys/devices/platform/USBC000:00/typec/port0/port0-partner/device

> /sys/devices/platform/USBC000:00/typec/port0/port0-partner/subsystem

> /sys/devices/platform/USBC000:00/typec/port0/port0-partner/supports_usb_power_delivery

```

So *something* is detected. 

Any ideas? Kernel config: https://pastebin.com/raw/6gqNTSR4

-- update: 

So far I found that CONFIG_USB_UAS was disabled and is required in this USB over TB3 combination. Unfortunately after enabling, nothing changed. So I'm missing at least one more thing.

-- update 2:

Another attempt, this time with CONFIG_HOTPLUG_PCI_PCIE (because TB3 passes PCIe). Still nothing. Also I've checked Ubuntu Live - works fine. So it's definitely something in my kernel.Last edited by manwe_ on Thu Jan 23, 2020 12:53 pm; edited 2 times in total

----------

## manwe_

Shameless bump   :Rolling Eyes: 

----------

## nvaert1986

I'm using USB Type-C devices just fine on my Thunderbolt ports and it works (have a J-Micron USB-C to NVME Mass Storage Controller, which I can confirm that works):

Make sure the following are set:

CONFIG_TYPEC

CONFIG_TYPEC_TCPM

CONFIG_TYPEC_TCPCI

CONFIG_TYPEC_UCSI

CONFIG_UCSI_ACPI <- Required for Skylake and upwards

CONFIG_TYPEC_DP_ALTMODE -< For DisplayPort

CONFIG_TYPEC_NVIDIA_ALTMODE <- For NVIDIA VirtualLink

CONFIG_USB_ROLE_SWITCH <- USB Role Switch Support

I assume the CONFIG_USB_XHCI_HCD and CONFIG_USB_PCI and CONFIG_USB_STORAGE are already set.

----------

## nvaert1986

I also suggest you set CONFIG_INTEL_WMI_THUNDERBOLT to Y

P.S.: If it's a recent laptop I'd also suggest running kernel-5.4

Update: My own .config file so you can compare: https://pastebin.com/D0BeSaVv

It's for kernel 5.4.12.

----------

## manwe_

Yes. I have everything you mentioned (except CONFIG_TYPEC_NVIDIA_ALTMODE, but I don't have nVidia GPU). Still doesn't work with newest kernel (5.4.13). Current config: https://pastebin.com/BHamDhSj

When I connect any pendrive to TB3 port in Ubuntu, first thing in dmesg that appears is creating new USB hub/controller, then the device shows up. So, looks like to me, what doesn't work in my kernel is that fallback, from TB3 to USB-C XHCI.

-- update:

I've found another difference between Ubuntu and my kernel. Ubuntu's lspci shows 

```
04:00.0 PCI bridge: Intel Corporation JHL6540 Thunderbolt 3 Bridge (C step) [Alpine Ridge 4C 2016] (rev 02)

   Kernel driver in use: pcieport

05:00.0 PCI bridge: Intel Corporation JHL6540 Thunderbolt 3 Bridge (C step) [Alpine Ridge 4C 2016] (rev 02)

   Kernel driver in use: pcieport

05:01.0 PCI bridge: Intel Corporation JHL6540 Thunderbolt 3 Bridge (C step) [Alpine Ridge 4C 2016] (rev 02)

   Kernel driver in use: pcieport

05:02.0 PCI bridge: Intel Corporation JHL6540 Thunderbolt 3 Bridge (C step) [Alpine Ridge 4C 2016] (rev 02)

   Kernel driver in use: pcieport

05:04.0 PCI bridge: Intel Corporation JHL6540 Thunderbolt 3 Bridge (C step) [Alpine Ridge 4C 2016] (rev 02)

   Kernel driver in use: pcieport

```

My Gentoo doesn't show this. But so far I have no idea why.

----------

## nvaert1986

 *manwe_ wrote:*   

> Yes. I have everything you mentioned (except CONFIG_TYPEC_NVIDIA_ALTMODE, but I don't have nVidia GPU). Still doesn't work with newest kernel (5.4.13). Current config: https://pastebin.com/BHamDhSj
> 
> When I connect any pendrive to TB3 port in Ubuntu, first thing in dmesg that appears is creating new USB hub/controller, then the device shows up. So, looks like to me, what doesn't work in my kernel is that fallback, from TB3 to USB-C XHCI.
> 
> -- update:
> ...

 

Normally thunderbolt should be in use in your configuration too. Same goes for ACPI hotplug and PCI-E hotplug and PCI-E support. Did you actually compile PCI-E support? Did you try a fresh compilation?

----------

## manwe_

I've added CONFIG_HOTPLUG_PCI_ACPI to already enabled CONFIG_HOTPLUG_PCI_PCIE but it didn't help.

> Did you actually compile PCI-E support? 

Everything else works, like NVMe drive.

> Did you try a fresh compilation?

You mean make mrproper? I did.

----------

## manwe_

Finally! CONFIG_HOTPLUG_PCI_SHPC=y and now it works flawlessly. When I plug in USB-C storage, all JHL6540 TB3 Bridge devices show up in lspci.

But to be honest, SHPC description in kernel is shit. It says nothing about TB3, JHL6540 or Alpine Ridge. I found it thanks to this website.  https://www.linux-hardware.org/index.php?id=pci:8086-15d3-2222-1111

----------

## eu47

Configured the kernel as mentioned above.

"tbtadm topology" shows:

Controller 0

    ├─ Details:

    │   ├─ Name: NUC10FNB, Intel Corporation

    │   └─ Security level: SL0 (none)

    │

    └─ Element Hub, CalDigit, Inc.

        ├─ Details:

        │   ├─ Route-string: 0-1

        │   ├─ Authorized: Yes

        │   ├─ In ACL: No

        │   └─ UUID: 00425a40-16b8-8780-ffff-ffffffffffff

        │

        └─ Rugged SSD Pro, LaCie

            └─ Details:

                ├─ Route-string: 0-701

                ├─ Authorized: Yes

                ├─ In ACL: No

                └─ UUID: 0001c1cc-9fdd-0300-ffff-ffffffffffff

boltctl shows:

 * CalDigit, Inc. Element Hub

   |- type:          peripheral

   |- name:          Element Hub

   |- vendor:        CalDigit, Inc.

   |- uuid:          00425a40-16b8-8780-ffff-ffffffffffff

   |- generation:    USB4

   |- status:        authorized

   |  |- domain:     c2010000-0062-641e-8338-163d1261d200

   |  |- rx speed:   40 Gb/s = 2 lanes * 20 Gb/s

   |  |- tx speed:   40 Gb/s = 2 lanes * 20 Gb/s

   |  `- authflags:  none

   |- authorized:    Fri 06 May 2022 04:40:22 AM

   |- connected:     Fri 06 May 2022 04:40:22 AM

   `- stored:        Wed 13 Apr 2022 07:10:36 AM

      |- policy:     iommu

      `- key:        no

 * LaCie Rugged SSD Pro

   |- type:          peripheral

   |- name:          Rugged SSD Pro

   |- vendor:        LaCie

   |- uuid:          0001c1cc-9fdd-0300-ffff-ffffffffffff

   |- generation:    Thunderbolt 3

   |- status:        authorized

   |  |- domain:     c2010000-0062-641e-8338-163d1261d200

   |  |- rx speed:   40 Gb/s = 2 lanes * 20 Gb/s

   |  |- tx speed:   40 Gb/s = 2 lanes * 20 Gb/s

   |  `- authflags:  none

   |- authorized:    Fri 06 May 2022 04:40:57 AM

   |- connected:     Fri 06 May 2022 04:40:57 AM

   `- stored:        Wed 13 Apr 2022 12:12:04 AM

      |- policy:     iommu

      `- key:        no

Although everything seems to be OK, there is no new /dev/nvme device for the SSD.

Same thing happens when the SSD is plugged directly into the Thunderbolt port of the NUC (no TB hub in between).

What's missing in the kernel to make it work?

----------

## davidshen84

 *manwe_ wrote:*   

> Finally! CONFIG_HOTPLUG_PCI_SHPC=y and now it works flawlessly. When I plug in USB-C storage, all JHL6540 TB3 Bridge devices show up in lspci.
> 
> But to be honest, SHPC description in kernel is shit. It says nothing about TB3, JHL6540 or Alpine Ridge. I found it thanks to this website.  https://www.linux-hardware.org/index.php?id=pci:8086-15d3-2222-1111

 

Thanks a lot. I have been battling this issue for more than a year...no clue how to fix it.

----------

## eu47

Adding this to GRUB fixed it for me:

pci=realloc,assign-busses,hpbussize=0x33

----------

