You are not logged in.

#1 2020-04-25 21:03:25

gen2arch
Member
Registered: 2013-05-16
Posts: 182

An almost perfectly working thunderbolt dock with linux

Hi,

I'm using arch linux with a custom compiled kernel (5.6.7-arch1-1) on a Yoga S940-14IWL quad core i7 4k 16GB ultrabook. I was looking for a thunderbolt dock to use on this machine and bought this one: ThinkPad Thunderbolt 3 Dock Gen 2 (40AN0135EU-FL), that's the Louboutin sort of dock from Lenovo with the red sole, the smaller one with the 135W power supply. As far as I have tested now, everything works: USB-A and USB-C, Gb Ethernet, HDMI and DP, both 4k@60Hz and charging the notebook.

Just a quick note on how I got it working:

  • What I struggled the most with was this: thunderbolt, in the kernel, is not called "thunderbolt", but USB4!! See the according Kconfig: "USB4 and Thunderbolt driver. USB4 is the public speficiation based on Thunderbolt 3 protocol. This driver is required if you want to hotplug Thunderbolt and USB4 compliant devices on Apple hardware or on PCs with Intel Falcon Ridge or newer. To compile this driver a module, choose M here. The module will be called thunderbolt." It seemed that this was the most important config setting; I put in "CONFIG_USB4=y".

  • lspci shows the device as based on the Alpine Ridge chip

  • Enable realtek ethernet of the dock by configuring in the kernel: CONFIG_USB_RTL8152=y

  • In order to get persistent device names with the ethernet port of the dock, I had to write a simple udev rule: "SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="1c:e2:f1:a4:2d:bb", NAME="tbt0" (MAC address as reported by ifconfig).

  • I use systemd-networkd and wrote an equally simple file /etc/systemd/network/20-wired.network with the newly renamed tbt0 device name

  • it is very strange that localmodconfig/modprobdb doesn't work with the "thunderbolt" kernel module: if you do a "modprobed-db store " when booted into the arch kernel it adds the "thunderbolt" module to your database of modules; but then, after a "makepkg -s" in order to compile your custom kernel, it complains "thunderbolt config not found" (@graysky: why might that be?)! so it would seem that you cannot activate thunderbolt with localmodconfig; I changed the PKGBUILD and put a "make menuconfig" between "make LSMOD=$HOME/.config/modprobed.db localmodconfig" and "make olddefconfig" in order to get a chance to activate it manually! That worked.

  • I found that my custom kernel worked better than the arch generic kernel, although I didn't change a lot in  "make menuconfig"

  • You have to authorize and enroll the dock as a thunderbolt device as described in the Arch thunderbolt wiki

  • I use the mode "user"

  • Strangely: there is not a single mention of thunderbolt in the utterly crippled bios of this otherwise very nice machine: so nothing to change there

  • Name change from "thunderbolt" to "usb4" in the kernel see here (thanks @loqs!).

Two things that do not work: after having opened the thunderbolt entry in kde settings (systemsettings5), the settings app crashes absolutely every time as soon as you try to leave the thunderbolt part of Settings.
And secondly: if I boot with the dock connected, it ends up not working, namley as trusted but "disconnected" on the desktop (as shown by boltctl). Plug it out and back in and everything is fine again. Already mentioned here a long time ago!

This is great: The dock is really hot-pluggable, plug it out and back in and everything works as before. This comes in handy also in order to test udev rules by simply reconnecting the device. The ultrabook is charged via the dock, that also works flawlessly. After a supend (during which the LED of the dock power button pulsates slowly), the dock, and attached devices like monitors, also come back as expected, with everything working just fine. And finally: you can switch on the machine via the power button of the dock; if you press it when booted, the normal KDA/plasma overlay appears offering to shut down or log out.
I'll report back if anything changes.

Update: the ethernet chip in the dock seems to be a realtek device, the driver module being r8152, as shown by dmesg:

[  246.934210] usb 6-2.1.2: reset SuperSpeed Gen 1 USB device number 9 using xhci_hcd
[  246.978052] r8152 6-2.1.2:1.0: load rtl8153b-2 v1 10/23/19 successfully
[  247.007965] r8152 6-2.1.2:1.0 eth0: v1.11.11
[  247.040920] usbcore: registered new interface driver cdc_ether
[  247.068786] r8152 6-2.1.2:1.0 tbt0: renamed from eth0

Update: This docks works also well with a Lenovo Thinkpad P50 mobile workstation, with these exceptions: no switching on/off of the notebook via the dock, no charging (power supply of the dock to weak for the P50); everything else, USB, ethernet, DP and HDMI 4k@60Hz works just fine.

Last edited by gen2arch (2020-04-29 18:52:14)

Offline

#2 2020-05-21 11:17:13

gen2arch
Member
Registered: 2013-05-16
Posts: 182

Re: An almost perfectly working thunderbolt dock with linux

No problem now to boot also with the dock connected, everythings works as expected.

Last edited by gen2arch (2020-05-21 11:17:23)

Offline

Board footer

Powered by FluxBB