Page MenuHomeFreeBSD

Add support for USB 3.0 XHCI via ACPI
ClosedPublic

Authored by greg_unrelenting.technology on Apr 20 2019, 2:05 PM.

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

Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 24039
Build 22924: arc lint + arc unit

Event Timeline

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

manu added a comment.Apr 23 2019, 5:11 PM

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 :)

greg_unrelenting.technology edited the test plan for this revision. (Show Details)

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

andrew added inline comments.Apr 25 2019, 9:55 PM
sys/dev/usb/controller/generic_xhci_fdt.c
34–51

Do we need all these headers in the attachment code?

98

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
manu added a comment.Apr 27 2019, 3:57 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 :)

greg_unrelenting.technology marked 2 inline comments as done.May 1 2019, 4:56 PM
greg_unrelenting.technology added inline comments.
sys/dev/usb/controller/generic_xhci_fdt.c
34–51

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

greg_unrelenting.technology marked an inline comment as done.

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

manu accepted this revision.May 7 2019, 7:40 AM
This revision is now accepted and ready to land.May 7 2019, 7:40 AM
andrew accepted this revision.May 7 2019, 8:23 AM
andrew added inline comments.
sys/dev/usb/controller/generic_xhci_acpi.c
2–4

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

This revision now requires review to proceed.May 8 2019, 11:47 AM
greg_unrelenting.technology marked an inline comment as done.May 8 2019, 11:48 AM
greg_unrelenting.technology added inline comments.
sys/dev/usb/controller/generic_xhci_acpi.c
2–4

okay, I can put myself here I guess

(also added SPDX)

andrew accepted this revision.May 8 2019, 1:59 PM
This revision is now accepted and ready to land.May 8 2019, 1:59 PM
manu accepted this revision.May 8 2019, 2:05 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.