linux-surface / kernel

Linux kernel with modifications for Microsoft Surface devices.
Other
118 stars 33 forks source link

USB host controller not probed with v5.12-spx-dt and v5.13-spx-dt #121

Closed jhaxhiaj closed 2 years ago

jhaxhiaj commented 2 years ago

I'm trying to run Linux on Surface Pro X SQ2.

With ACPI, the kernel probes correctly the USB Host Controller dwc3-qcom and I can connect a USB keyboard and and USB Network dongle.

While booting with v5.12-spx-dt the device tree , the kernel doesn't probe usb host controllers but manages to mount the roofs from initrd. v5.13-spx-dt with the dt doesn't boot for some reasons, the console starts printing then the screen gets black.

qzed commented 2 years ago

Yeah, the -dt branches have some issues... IIRC USB on the USB-C ports should work? USB for the dock definitely doesn't work. Not sure anymore though. Still very much a work in progress to which I hope to come back to in a month or so.

jhaxhiaj commented 2 years ago

IIRC USB on the USB-C ports should work

This was my understanding from the discussions there https://github.com/Sonicadvance1/linux/issues/27 . For some reason, the USB host controllers aren't even probed. I'm starting to suspect the device tree.

I ran the following commands from grub:

devicetree /root/sc8180x-surface-pro-x.dtb
linux /root/Image.gz efi=novamap
initrd /root/rootfs.cpio.gz 
boot 
qzed commented 2 years ago

Hmm, that does look correct.

jhaxhiaj commented 2 years ago

8A115934-D2F7-4FAE-A9AA-9A19C94AFEDF

I added the capture of boot logs

qzed commented 2 years ago

Thanks! I'll try to have a look at that when I have a bit more time.

qzed commented 2 years ago

Okay, so I still haven't gotten around to recompile a new kernel for the SPX but here's a config from a working v5.13-spx-dt one (not sure if it's the exact same state of the branch though, it's been laying around a while): config.txt. USB devices at least show up in lsusb and as far as I can tell everything seems to be functional.

Before I do all that, I want to figure out what makes that one Grub version work... I don't really like relaying on that one built executable without having the means to reproduce it somehow. So if you have any hints (pointers to source/patches) that would be very helpful.

jhaxhiaj commented 2 years ago

I managed to make it boot by setting CONFIG_SC_GCC_8180X=Y and adding clk_ignore_unused to cmdline. Without clk_ignore_unused, Linux don't finish the boot process. I'm not sure whether it's a bug on the clock controller or on clock is not correctly described in the device tree and get disabled.

Regarding Grub, it worked out of the box. I used the release 2.06 from OpenSUSE

qzed commented 2 years ago

Hmm, I didn't have to set that option. Regarding GRUB, I've written down some stuff here.

qzed commented 2 years ago

To come back to this: I've noticed that I did include gcc-sc8180x in the initram... which explains why that worked as module for me, also makes sense as that's pretty essential. I built that as module because as you've said there's some issue during boot that locks up the device.

As it does work built-in and with the clk_ignore_unused option, it looks like something is trying to access an unclocked register. Specifically at some time during boot. I suspect that when the driver is build as module, it loads later, at which point the clock may be requested by something else and thus everything works. I'm not sure yet how to debug this but it's definitely something that should be fixed in the DT or kernel.

qzed commented 2 years ago

I've added https://github.com/linux-surface/surface-pro-x/issues/8 for the clock issue. Let's track this there.

jhaxhiaj commented 2 years ago

Thank you for your support. I will try to figure out what clock it causing the issue.