diff mbox

[v3,18/19] PCI: Add quirk to prevent AMD NL USB3 DRD to bind with xHCI driver

Message ID 1414497280-3126-19-git-send-email-ray.huang@amd.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Huang Rui Oct. 28, 2014, 11:54 a.m. UTC
The AMD Nolan (NL) SoC contains a DesignWare USB3 Dual-Role Device that can
be operated either as a USB Host or a USB Device.  In the AMD NL platform,
this device ([1022:7912]) has a class code of PCI_CLASS_SERIAL_USB_XHCI
(0x0c0330), which means the xhci driver will claim it.

But the dwc3 driver is a more specific driver for this device, and we'd
prefer to use it instead of xhci.  To prevent xhci from claiming the
device, change the class code to 0x0c03fe, which the PCI r3.0 spec defines
as "USB device (not host controller)".  The dwc3 driver can then claim it
based on its Vendor and Device ID.

Suggested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Jason Chang <jason.chang@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
---
 drivers/pci/quirks.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Sergei Shtylyov Oct. 28, 2014, 12:06 p.m. UTC | #1
Hello.

On 10/28/2014 2:54 PM, Huang Rui wrote:

> The AMD Nolan (NL) SoC contains a DesignWare USB3 Dual-Role Device that can
> be operated either as a USB Host or a USB Device.  In the AMD NL platform,
> this device ([1022:7912]) has a class code of PCI_CLASS_SERIAL_USB_XHCI
> (0x0c0330), which means the xhci driver will claim it.

> But the dwc3 driver is a more specific driver for this device, and we'd
> prefer to use it instead of xhci.  To prevent xhci from claiming the
> device, change the class code to 0x0c03fe, which the PCI r3.0 spec defines
> as "USB device (not host controller)".  The dwc3 driver can then claim it
> based on its Vendor and Device ID.

> Suggested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Jason Chang <jason.chang@amd.com>
> Signed-off-by: Huang Rui <ray.huang@amd.com>
> ---
>   drivers/pci/quirks.c | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)

> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 90acb32..1152bef 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -379,6 +379,26 @@ static void quirk_ati_exploding_mce(struct pci_dev *dev)
>   DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI,	PCI_DEVICE_ID_ATI_RS100,   quirk_ati_exploding_mce);
>
>   /*
> + * In the AMD NL platform, this device ([1022:7912]) has a class code of
> + * PCI_CLASS_SERIAL_USB_XHCI (0x0c0330), which means the xhci driver will
> + * claim it.
> + * But the dwc3 driver is a more specific driver for this device, and we'd
> + * prefer to use it instead of xhci. To prevent xhci from claiming the
> + * device, change the class code to 0x0c03fe, which the PCI r3.0 spec
> + * defines as "USB device (not host controller)". The dwc3 driver can then
> + * claim it based on its Vendor and Device ID.
> + */
> +static void quirk_amd_nl_class(struct pci_dev *pdev)
> +{
> +	/*
> +	 * Use 'USB Device' (0x0x03fe) instead of PCI header provided

     0x0c03fe, you mean?

> +	 */
> +	pdev->class = 0x0c03fe;
> +}
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB,

    I'm not sure it was a good idea to declare the ID in pci_ids.h -- it's 
been long discouraged.

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Huang Rui Oct. 28, 2014, 12:15 p.m. UTC | #2
On Tue, Oct 28, 2014 at 03:06:31PM +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 10/28/2014 2:54 PM, Huang Rui wrote:
> 
> >The AMD Nolan (NL) SoC contains a DesignWare USB3 Dual-Role Device that can
> >be operated either as a USB Host or a USB Device.  In the AMD NL platform,
> >this device ([1022:7912]) has a class code of PCI_CLASS_SERIAL_USB_XHCI
> >(0x0c0330), which means the xhci driver will claim it.
> 
> >But the dwc3 driver is a more specific driver for this device, and we'd
> >prefer to use it instead of xhci.  To prevent xhci from claiming the
> >device, change the class code to 0x0c03fe, which the PCI r3.0 spec defines
> >as "USB device (not host controller)".  The dwc3 driver can then claim it
> >based on its Vendor and Device ID.
> 
> >Suggested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> >Cc: Bjorn Helgaas <bhelgaas@google.com>
> >Cc: Jason Chang <jason.chang@amd.com>
> >Signed-off-by: Huang Rui <ray.huang@amd.com>
> >---
> >  drivers/pci/quirks.c | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> 
> >diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> >index 90acb32..1152bef 100644
> >--- a/drivers/pci/quirks.c
> >+++ b/drivers/pci/quirks.c
> >@@ -379,6 +379,26 @@ static void quirk_ati_exploding_mce(struct pci_dev *dev)
> >  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI,	PCI_DEVICE_ID_ATI_RS100,   quirk_ati_exploding_mce);
> >
> >  /*
> >+ * In the AMD NL platform, this device ([1022:7912]) has a class code of
> >+ * PCI_CLASS_SERIAL_USB_XHCI (0x0c0330), which means the xhci driver will
> >+ * claim it.
> >+ * But the dwc3 driver is a more specific driver for this device, and we'd
> >+ * prefer to use it instead of xhci. To prevent xhci from claiming the
> >+ * device, change the class code to 0x0c03fe, which the PCI r3.0 spec
> >+ * defines as "USB device (not host controller)". The dwc3 driver can then
> >+ * claim it based on its Vendor and Device ID.
> >+ */
> >+static void quirk_amd_nl_class(struct pci_dev *pdev)
> >+{
> >+	/*
> >+	 * Use 'USB Device' (0x0x03fe) instead of PCI header provided
> 
>     0x0c03fe, you mean?

Yes. That's a typo, 'USB Device' class code should be 0x0c03fe, will
update.

> 
> >+	 */
> >+	pdev->class = 0x0c03fe;
> >+}
> >+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB,
> 
>    I'm not sure it was a good idea to declare the ID in pci_ids.h --
> it's been long discouraged.
> 

You're right. But PCI_DEVICE_ID_AMD_NL_USB will be used on two
drivers(pci and dwc3). It also might be used for identifying AMD NL
chip for another drivers in future.

Thanks,
Rui
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bjorn Helgaas Oct. 28, 2014, 1:29 p.m. UTC | #3
I suggest a subject like this:

PCI: Prevent xHCI driver from claiming AMD Nolan USB3 DRD device

On Tue, Oct 28, 2014 at 5:54 AM, Huang Rui <ray.huang@amd.com> wrote:
> The AMD Nolan (NL) SoC contains a DesignWare USB3 Dual-Role Device that can
> be operated either as a USB Host or a USB Device.  In the AMD NL platform,
> this device ([1022:7912]) has a class code of PCI_CLASS_SERIAL_USB_XHCI
> (0x0c0330), which means the xhci driver will claim it.
>
> But the dwc3 driver is a more specific driver for this device, and we'd
> prefer to use it instead of xhci.  To prevent xhci from claiming the
> device, change the class code to 0x0c03fe, which the PCI r3.0 spec defines
> as "USB device (not host controller)".  The dwc3 driver can then claim it
> based on its Vendor and Device ID.
>
> Suggested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

Please merge along with the rest of your series.

> Cc: Jason Chang <jason.chang@amd.com>
> Signed-off-by: Huang Rui <ray.huang@amd.com>
> ---
>  drivers/pci/quirks.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 90acb32..1152bef 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -379,6 +379,26 @@ static void quirk_ati_exploding_mce(struct pci_dev *dev)
>  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI,     PCI_DEVICE_ID_ATI_RS100,   quirk_ati_exploding_mce);
>
>  /*
> + * In the AMD NL platform, this device ([1022:7912]) has a class code of
> + * PCI_CLASS_SERIAL_USB_XHCI (0x0c0330), which means the xhci driver will
> + * claim it.
> + * But the dwc3 driver is a more specific driver for this device, and we'd
> + * prefer to use it instead of xhci. To prevent xhci from claiming the
> + * device, change the class code to 0x0c03fe, which the PCI r3.0 spec
> + * defines as "USB device (not host controller)". The dwc3 driver can then
> + * claim it based on its Vendor and Device ID.
> + */
> +static void quirk_amd_nl_class(struct pci_dev *pdev)
> +{
> +       /*
> +        * Use 'USB Device' (0x0x03fe) instead of PCI header provided
> +        */
> +       pdev->class = 0x0c03fe;
> +}
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB,
> +               quirk_amd_nl_class);
> +
> +/*
>   * Let's make the southbridge information explicit instead
>   * of having to worry about people probing the ACPI areas,
>   * for example.. (Yes, it happens, and if you read the wrong
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 90acb32..1152bef 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -379,6 +379,26 @@  static void quirk_ati_exploding_mce(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI,	PCI_DEVICE_ID_ATI_RS100,   quirk_ati_exploding_mce);
 
 /*
+ * In the AMD NL platform, this device ([1022:7912]) has a class code of
+ * PCI_CLASS_SERIAL_USB_XHCI (0x0c0330), which means the xhci driver will
+ * claim it.
+ * But the dwc3 driver is a more specific driver for this device, and we'd
+ * prefer to use it instead of xhci. To prevent xhci from claiming the
+ * device, change the class code to 0x0c03fe, which the PCI r3.0 spec
+ * defines as "USB device (not host controller)". The dwc3 driver can then
+ * claim it based on its Vendor and Device ID.
+ */
+static void quirk_amd_nl_class(struct pci_dev *pdev)
+{
+	/*
+	 * Use 'USB Device' (0x0x03fe) instead of PCI header provided
+	 */
+	pdev->class = 0x0c03fe;
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB,
+		quirk_amd_nl_class);
+
+/*
  * Let's make the southbridge information explicit instead
  * of having to worry about people probing the ACPI areas,
  * for example.. (Yes, it happens, and if you read the wrong