value = readl(reg + GP_RWREG1); if (!(value & GP_RWREG1_ULPI_REFCLK_DISABLE)) goto unmap; /* ULPI refclk already enabled */ value &= ~GP_RWREG1_ULPI_REFCLK_DISABLE; writel(value, reg + GP_RWREG1); /* This comes from the Intel Android x86 tree w/o any explanation */ msleep(100); unmap: pcim_iounmap(pci, reg); return 0; } static const struct property_entry dwc3_pci_intel_properties[] = { PROPERTY_ENTRY_STRING("dr_mode", "peripheral"), PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), {} }; static const struct property_entry dwc3_pci_mrfld_properties[] = { PROPERTY_ENTRY_STRING("dr_mode", "otg"), PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), {} }; static const struct property_entry dwc3_pci_amd_properties[] = { PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"), PROPERTY_ENTRY_U8("snps,lpm-nyet-threshold", 0xf), PROPERTY_ENTRY_BOOL("snps,u2exit_lfps_quirk"), PROPERTY_ENTRY_BOOL("snps,u2ss_inp3_quirk"),
static int dwc3_pci_quirks(struct dwc3_pci *dwc) { struct platform_device *dwc3 = dwc->dwc3; struct pci_dev *pdev = dwc->pci; if (pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == PCI_DEVICE_ID_AMD_NL_USB) { struct property_entry properties[] = { PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"), PROPERTY_ENTRY_U8("snps,lpm-nyet-threshold", 0xf), PROPERTY_ENTRY_BOOL("snps,u2exit_lfps_quirk"), PROPERTY_ENTRY_BOOL("snps,u2ss_inp3_quirk"), PROPERTY_ENTRY_BOOL("snps,req_p1p2p3_quirk"), PROPERTY_ENTRY_BOOL("snps,del_p1p2p3_quirk"), PROPERTY_ENTRY_BOOL("snps,del_phy_power_chg_quirk"), PROPERTY_ENTRY_BOOL("snps,lfps_filter_quirk"), PROPERTY_ENTRY_BOOL("snps,rx_detect_poll_quirk"), PROPERTY_ENTRY_BOOL("snps,tx_de_emphasis_quirk"), PROPERTY_ENTRY_U8("snps,tx_de_emphasis", 1), /* * FIXME these quirks should be removed when AMD NL * tapes out */ PROPERTY_ENTRY_BOOL("snps,disable_scramble_quirk"), PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"), PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"), PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), { }, }; return platform_device_add_properties(dwc3, properties); } if (pdev->vendor == PCI_VENDOR_ID_INTEL) { int ret; struct property_entry properties[] = { PROPERTY_ENTRY_STRING("dr_mode", "peripheral"), PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), { } }; ret = platform_device_add_properties(dwc3, properties); if (ret < 0) return ret; if (pdev->device == PCI_DEVICE_ID_INTEL_BXT || pdev->device == PCI_DEVICE_ID_INTEL_BXT_M) { guid_parse(PCI_INTEL_BXT_DSM_GUID, &dwc->guid); dwc->has_dsm_for_pm = true; } if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) { struct gpio_desc *gpio; ret = devm_acpi_dev_add_driver_gpios(&pdev->dev, acpi_dwc3_byt_gpios); if (ret) dev_dbg(&pdev->dev, "failed to add mapping table\n"); /* * These GPIOs will turn on the USB2 PHY. Note that we have to * put the gpio descriptors again here because the phy driver * might want to grab them, too. */ gpio = gpiod_get_optional(&pdev->dev, "cs", GPIOD_OUT_LOW); if (IS_ERR(gpio)) return PTR_ERR(gpio); gpiod_set_value_cansleep(gpio, 1); gpiod_put(gpio); gpio = gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(gpio)) return PTR_ERR(gpio); if (gpio) { gpiod_set_value_cansleep(gpio, 1); gpiod_put(gpio); usleep_range(10000, 11000); } } } if (pdev->vendor == PCI_VENDOR_ID_SYNOPSYS && (pdev->device == PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 || pdev->device == PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI || pdev->device == PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31)) { struct property_entry properties[] = { PROPERTY_ENTRY_BOOL("snps,usb3_lpm_capable"), PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"), PROPERTY_ENTRY_BOOL("snps,dis_enblslpm_quirk"), PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), { }, }; return platform_device_add_properties(dwc3, properties); } return 0; }