Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Thunderbolt 3 with USB-C drive
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
manwe_
l33t
l33t


Joined: 01 Feb 2006
Posts: 650
Location: Universe

PostPosted: Wed Jan 08, 2020 5:28 pm    Post subject: [SOLVED] Thunderbolt 3 with USB-C drive Reply with quote

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:
Code:
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
Back to top
View user's profile Send private message
manwe_
l33t
l33t


Joined: 01 Feb 2006
Posts: 650
Location: Universe

PostPosted: Tue Jan 14, 2020 9:41 am    Post subject: Reply with quote

Shameless bump :roll:
Back to top
View user's profile Send private message
nvaert1986
Tux's lil' helper
Tux's lil' helper


Joined: 05 May 2019
Posts: 124

PostPosted: Thu Jan 16, 2020 3:23 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
nvaert1986
Tux's lil' helper
Tux's lil' helper


Joined: 05 May 2019
Posts: 124

PostPosted: Thu Jan 16, 2020 3:26 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
manwe_
l33t
l33t


Joined: 01 Feb 2006
Posts: 650
Location: Universe

PostPosted: Wed Jan 22, 2020 6:08 pm    Post subject: Reply with quote

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
Code:
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.
Back to top
View user's profile Send private message
nvaert1986
Tux's lil' helper
Tux's lil' helper


Joined: 05 May 2019
Posts: 124

PostPosted: Wed Jan 22, 2020 8:09 pm    Post subject: Reply with quote

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:

I've found another difference between Ubuntu and my kernel. Ubuntu's lspci shows
Code:
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.


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?
Back to top
View user's profile Send private message
manwe_
l33t
l33t


Joined: 01 Feb 2006
Posts: 650
Location: Universe

PostPosted: Wed Jan 22, 2020 8:36 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
manwe_
l33t
l33t


Joined: 01 Feb 2006
Posts: 650
Location: Universe

PostPosted: Thu Jan 23, 2020 12:48 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
eu47
n00b
n00b


Joined: 06 May 2022
Posts: 25
Location: Edmonton, Canada

PostPosted: Fri May 06, 2022 5:14 am    Post subject: Thunderbolt storage Reply with quote

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?
Back to top
View user's profile Send private message
davidshen84
Guru
Guru


Joined: 09 Aug 2008
Posts: 319

PostPosted: Mon Jul 25, 2022 7:56 am    Post subject: Reply with quote

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.
_________________
David Shen
Back to top
View user's profile Send private message
eu47
n00b
n00b


Joined: 06 May 2022
Posts: 25
Location: Edmonton, Canada

PostPosted: Mon Jul 25, 2022 2:20 pm    Post subject: Reply with quote

Adding this to GRUB fixed it for me:

pci=realloc,assign-busses,hpbussize=0x33
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum