Re: [PATCH RESEND] PCI: Check for USB xHCI class for HAPS platform

From: Lucas Stach
Date: Wed Feb 06 2019 - 04:28:07 EST


Hi Bjorn,

Am Dienstag, den 05.02.2019, 17:31 -0600 schrieb Bjorn Helgaas:
> [+cc Richard, Lucas]
>
> On Tue, Feb 05, 2019 at 01:04:28PM -0800, Thinh Nguyen wrote:
> > The Synopsys HAPS USB controller has a VID PID (16c3,abcd) that
> > matches
> > to an existing PCIe controller. This quirk is intended for USB HAPS
> > devices only. To fix this, check for the PCI class USB xHCI to
> > prevent
> > matching the PCIe controllers.
>
> So there are at least three different parts with the same Vendor &
> Device ID ([16c3:abcd]):
>
> Â 1) Synopsys HAPS USB3 controller
> Â 2) Synopsys PCIe IP in the NXP i.MX6QP (reported by Lukas)

The first incorporation of this IP in a Freescale SoC (i.MX6Q) also
uses the device ID 0xabcd.

So this seems to be a major miscommunication between NXP/Freescale and
Synopsys.

Regards,
Lucas

> Â 3) Synopsys PCIe IP in the NXP i.MX7D (reported by Trent)
>
> I don't know if Synopsys is to blame for 2 & 3, or if NXP was
> expected
> to change the Vendor ID when incorporating the Synopsys IP into the
> i.MX designs.ÂÂBut even leaving the default Device ID of the PCIe IP
> the same as another Synopsys device was probably a bad idea.
>
> dwc3-haps claims by Vendor & Device ID; it doesn't look at the Class
> Code.ÂÂWhat happens when it tries to claim the PCIe IP in i.MX?
>
> lspci also doesn't look at the Class Code when it looks up the text
> name of devices, so it will print the same name for both.ÂÂOf course,
> the Linux PCI ID database at https://pci-ids.ucw.cz/read/PC/16c3
> shows
> basically no information for the 0x16c3 Vendor ID, so it won't print
> anything useful no matter what.ÂÂYou could add some things there :)
>
> > Fixes: 03e6742584af ("PCI: Override Synopsys USB 3.x HAPS device
> > class")
> > Signed-off-by: Thinh Nguyen <thinhn@xxxxxxxxxxxx>
> > ---
> > Âdrivers/pci/quirks.c | 5 +++--
> > Â1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> > index b0a413f3f7ca..e2a879e93d86 100644
> > --- a/drivers/pci/quirks.c
> > +++ b/drivers/pci/quirks.c
> > @@ -639,8 +639,9 @@ static void quirk_synopsys_haps(struct pci_dev
> > *pdev)
> > Â break;
> > Â }
> > Â}
> > -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SYNOPSYS, PCI_ANY_ID,
> > - Âquirk_synopsys_haps);
> > +DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_SYNOPSYS, PCI_ANY_ID,
> > + ÂÂÂÂÂÂÂPCI_CLASS_SERIAL_USB_XHCI, 0,
> > + ÂÂÂÂÂÂÂquirk_synopsys_haps);
> > Â
> > Â/*
> > Â * Let's make the southbridge information explicit instead of
> > having to
> > --Â
> > 2.11.0
> >