Page MenuHomeFreeBSD

Add support for USB 3.0 XHCI via ACPI
ClosedPublic

Authored by val_packett.cool on Apr 20 2019, 2:05 PM.
Referenced Files
Unknown Object (File)
Sat, Nov 23, 10:58 PM
Unknown Object (File)
Sat, Nov 23, 1:01 AM
Unknown Object (File)
Fri, Nov 22, 10:10 AM
Unknown Object (File)
Fri, Nov 22, 4:48 AM
Unknown Object (File)
Thu, Nov 21, 6:57 AM
Unknown Object (File)
Wed, Nov 20, 4:00 AM
Unknown Object (File)
Sat, Nov 16, 2:35 PM
Unknown Object (File)
Sat, Nov 16, 2:02 PM
Subscribers

Details

Summary

Ampere eMAG systems have XHCI just descibed in ACPI, not on PCI.

Test Plan

Original version tested on Ampere eMAG by Tuan Phan <tphan@amperecomputing.com>

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Patch looks plausible to me, @manu or @andrew can you review and commit?
PR 237055

Something like D19389 would be better.

In D19986#430466, @manu wrote:

Something like D19389 would be better.

Ah, yes. GregV would you rework it using that approach?

In D19986#430466, @manu wrote:

Something like D19389 would be better.

Ah, yes. GregV would you rework it using that approach?

yeah, sure. I forgot about that one (even though I wrote a comment there) and I was looking at sys/dev/ahci/ahci_generic.c instead :)

val_packett.cool edited the test plan for this revision. (Show Details)

Done. btw, the original version was confirmed working on the Ampere system.

sys/dev/usb/controller/generic_xhci_fdt.c
33–50 ↗(On Diff #56658)

Do we need all these headers in the attachment code?

97 ↗(On Diff #56658)

This should be
return (generic_xhci_attach(dev));

As with GregV's report in PR237055 dsdt has for USB:

Method (_STA, 0, NotSerialized)  // _STA: Status
{
    Return (0x00)
}

regardless of BIOS settings; I wasn't able to test this here.

manu requested changes to this revision.Apr 27 2019, 3:43 PM

The fdt needs it's own detach function where we disable the phy (like it's done in D19389 for ehci).

This revision now requires changes to proceed.Apr 27 2019, 3:43 PM
In D19986#431905, @manu wrote:

The fdt needs it's own detach function where we disable the phy (like it's done in D19389 for ehci).

I know that it wasn't done before (my bad ...) but since we are changing since might as well do it correctly :)

val_packett.cool added inline comments.
sys/dev/usb/controller/generic_xhci_fdt.c
33–50 ↗(On Diff #56658)

We don't actually need xhcireg (I think I've seen an error related to that earlier, but removing it is fine now). We need xhci for the softc and all other USB stuff for xhci

val_packett.cool marked an inline comment as done.

Added fdt detach corresponding to the current attach code (usb-phy)

This revision is now accepted and ready to land.May 7 2019, 7:40 AM
andrew added inline comments.
sys/dev/usb/controller/generic_xhci_acpi.c
2–4 ↗(On Diff #56915)

I doubt Semihalf and Stormshield own the copyright on this file.

This revision now requires review to proceed.May 8 2019, 11:47 AM
val_packett.cool added inline comments.
sys/dev/usb/controller/generic_xhci_acpi.c
2–4 ↗(On Diff #56915)

okay, I can put myself here I guess

(also added SPDX)

This revision is now accepted and ready to land.May 8 2019, 1:59 PM

Tinh Nguyen from Ampere tested and it doesn't seems to make usb working (xhci controller is discovered but nothing more), I've tried on my overdrive in FDT mode and it works.
In acpi mode this doesn't but it doesn't without this patch too, looks like the acpi table is missing info about interrupts, I'll do one more test on the macchiatobin and then commit this.

This revision was automatically updated to reflect the committed changes.