-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
USB for Surface Connect Port #18
Comments
As the Surface Connect USB(s?) is supported in ACPI ( |
Here's what I have so far. I'm struggling to describe the PHYs as I have no idea how they're represented in ACPI. Also, I think the interrupts may not be correct/complete.
|
Currently looking through then Windows driver. A ton of stuff is hard-coded. From what I can tell there are two (single-lane?) QMP-PHYs associated with the MP controller (MP0 and MP1). Those PHYs should be USB-only, i.e. not combo USB/DP PHYs like PRIM and SEC. The Windows driver uses one large MMIO range for all PHY access as base, with individual PHYs being accessed at different register offsets. That space is at PHYs are accessed from that via
|
I've created a separate branch for this issue. See linux-surface/kernel@spx/next-20220616...spx/next-20220616-usbmp. |
I've added the bindings and some code to enable and configure the additional PHYs, but things still don't work properly. If I understand it correctly, it seems that the buses get set up properly but XHCI fails setting up devices with I suspect we may be missing a couple of config bits... there are some additional register writes in the multi-port code paths of the Windows driver that don't seem to be present in the Linux driver. Log attached: dmesg.log |
According to the Windows driver, there should be some control for the MP1 pipe clock. This is similar to https://elixir.bootlin.com/linux/v5.19-rc1/source/drivers/usb/dwc3/dwc3-qcom.c#L420, accessing the same register but values shifted by 16 bit. Pseudo-code from the Windows driver below: #define PIPE0_UTMI_CLK_SEL BIT(0)
#define PIPE0_UTMI_CLK_DIS BIT(8)
#define PIPE1_UTMI_CLK_SEL BIT(16)
#define PIPE1_UTMI_CLK_DIS BIT(25)
// pipe 0
set_bits(ctrl->dwc3_mem_virt, QSCRATCH_GENERAL_CFG, PIPE0_UTMI_CLK_DIS);
delay_ms(1);
set_bits(ctrl->dwc3_mem_virt, QSCRATCH_GENERAL_CFG, PIPE0_UTMI_CLK_SEL);
delay_ms(1);
clear_bits(ctrl->dwc3_mem_virt, QSCRATCH_GENERAL_CFG, PIPE0_UTMI_CLK_DIS);
// pipe 1
set_bits(ctrl->dwc3_mem_virt, QSCRATCH_GENERAL_CFG, PIPE1_UTMI_CLK_DIS);
delay_ms(1);
set_bits(ctrl->dwc3_mem_virt, QSCRATCH_GENERAL_CFG, PIPE1_UTMI_CLK_SEL);
delay_ms(1);
clear_bits(ctrl->dwc3_mem_virt, QSCRATCH_GENERAL_CFG, PIPE1_UTMI_CLK_DIS); Note: This should only be called in case no SSPHY is present... |
USB works! Turns out I either had a missing clock or an invalid IOMMU spec. My bet is on the IOMMU. DT fixes are based on the 8180-based automotive reference found at https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/blob/auto-kernel.lnx.4.14.c31/arch/arm64/boot/dts/qcom/sdmshrike-usb.dtsi. |
Implemented in linux-surface/kernel#129. Some remaining things to maybe look at: Both ACPI and the driver provide some init value tables, similar to what we currently use in Linux based on the sm8150. I've created a new issue for this in #33. |
The Surface Connect port is, for the most part, a USB. Adding support for that apparently requires some driver changes, and we also need to describe it in the DT. More research as to what specifically needs to be done is required.
The text was updated successfully, but these errors were encountered: