From a5a05a241b2ec75a99eeb90a32705cea31106ba9 Mon Sep 17 00:00:00 2001 From: Chen Zhenhua Date: Fri, 14 Jul 2023 08:34:17 +0800 Subject: [PATCH 1/3] xHCI: add XHCI_RESET_ON_RESUME quirk for Phytium xHCI host The resume operation of Phytium Px210 xHCI host would failed to restore state. Use the XHCI_RESET_ON_RESUME quirk to skip it and reset the controller after resume. Signed-off-by: Wang Zhimin Signed-off-by: Chen Zhenhua Reviewed-by: Chen Baozi Signed-off-by: Wang Yinfeng --- drivers/usb/host/xhci-pci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index d6fc08e5db8fb..c910bdd05c457 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -61,6 +61,7 @@ #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI 0x1138 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI 0x51ed #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_PCH_XHCI 0x54ed +#define PCI_DEVICE_ID_PHYTIUM_XHCI 0xdc27 #define PCI_DEVICE_ID_AMD_RENOIR_XHCI 0x1639 #define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9 @@ -474,6 +475,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) if (pdev->vendor == PCI_VENDOR_ID_VIA) xhci->quirks |= XHCI_RESET_ON_RESUME; + if (pdev->vendor == PCI_VENDOR_ID_PHYTIUM || + pdev->device == PCI_DEVICE_ID_PHYTIUM_XHCI) + xhci->quirks |= XHCI_RESET_ON_RESUME; + /* See https://bugzilla.kernel.org/show_bug.cgi?id=79511 */ if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3432) From 3ae09f2e9d28db1d3b0cb1e333cc8cc1fc5b77dd Mon Sep 17 00:00:00 2001 From: Chen Baozi Date: Fri, 14 Jul 2023 08:34:17 +0800 Subject: [PATCH 2/3] dt-bindings: usb-xhci: Add Phytium Pe220x support This patch documents the DT bindings for Phytium Pe220x XHCI controller. Signed-off-by: Wang Zhimin Signed-off-by: Chen Baozi --- Documentation/devicetree/bindings/usb/generic-xhci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/generic-xhci.yaml b/Documentation/devicetree/bindings/usb/generic-xhci.yaml index 594ebb3ee4320..ef24fa3bf977d 100644 --- a/Documentation/devicetree/bindings/usb/generic-xhci.yaml +++ b/Documentation/devicetree/bindings/usb/generic-xhci.yaml @@ -29,6 +29,11 @@ properties: enum: - brcm,xhci-brcm-v2 - brcm,bcm7445-xhci + - description: Phytium Pe220x SoC with xHCI + items: + - enum: + - phytium,pe220x-xhci + - const: generic-xhci - description: Generic xHCI device const: xhci-platform deprecated: true From 44abc8fe10836e11290a5474c07a9d70b042c046 Mon Sep 17 00:00:00 2001 From: Chen Zhenhua Date: Mon, 19 Feb 2024 15:31:10 +0800 Subject: [PATCH 3/3] usb: xhci: xhci-plat: Add XHCI_RESET_ON_RESUME quirk for Phytium Pe220x Phytium Pe220x xHCI host controller does not have suspend/resume support. Therefore, use of the XHCI_RESET_ON_RESUME quirk is mandatory in order to avoid failures after resume. Signed-off-by: Wang Zhimin Signed-off-by: Chen Zhenhua --- drivers/usb/host/xhci-plat.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index d68e9abcdc69a..f0f5d4b9b35b0 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -113,6 +113,10 @@ static const struct xhci_plat_priv xhci_plat_brcm = { .quirks = XHCI_RESET_ON_RESUME | XHCI_SUSPEND_RESUME_CLKS, }; +static const struct xhci_plat_priv xhci_plat_phytium_pe220x = { + .quirks = XHCI_RESET_ON_RESUME, +}; + static const struct of_device_id usb_xhci_of_match[] = { { .compatible = "generic-xhci", @@ -133,6 +137,9 @@ static const struct of_device_id usb_xhci_of_match[] = { }, { .compatible = "brcm,bcm7445-xhci", .data = &xhci_plat_brcm, + }, { + .compatible = "phytium,pe220x-xhci", + .data = &xhci_plat_phytium_pe220x, }, {}, }; @@ -396,6 +403,8 @@ static int xhci_generic_plat_probe(struct platform_device *pdev) if (pdev->dev.of_node) priv_match = of_device_get_match_data(&pdev->dev); + else if (has_acpi_companion(&pdev->dev)) + priv_match = acpi_device_get_match_data(&pdev->dev); else priv_match = dev_get_platdata(&pdev->dev); @@ -554,6 +563,7 @@ EXPORT_SYMBOL_GPL(xhci_plat_pm_ops); static const struct acpi_device_id usb_xhci_acpi_match[] = { /* XHCI-compliant USB Controller */ { "PNP0D10", }, + { "PHYT0039", (kernel_ulong_t)&xhci_plat_phytium_pe220x }, { } }; MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match);