Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usb:xHCI: add XHCI_RESET_ON_RESUME quirk for phytium #128

Merged
merged 3 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Documentation/devicetree/bindings/usb/generic-xhci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions drivers/usb/host/xhci-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions drivers/usb/host/xhci-plat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此处代码会导致在没打开CONFIG_OF且打开CONFIG_ACPI时编译不通过。

.quirks = XHCI_RESET_ON_RESUME,
};

static const struct of_device_id usb_xhci_of_match[] = {
{
.compatible = "generic-xhci",
Expand All @@ -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,
},
{},
};
Expand Down Expand Up @@ -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))
opsiff marked this conversation as resolved.
Show resolved Hide resolved
priv_match = acpi_device_get_match_data(&pdev->dev);
else
priv_match = dev_get_platdata(&pdev->dev);

Expand Down Expand Up @@ -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);
Expand Down