aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3/dwc3-pci.c
AgeCommit message (Collapse)AuthorFilesLines
2018-12-07Revert "usb: dwc3: pci: Use devm functions to get the phy GPIOs"Stephan Gerhold1-4/+4
Commit 211f658b7b40 ("usb: dwc3: pci: Use devm functions to get the phy GPIOs") changed the code to claim the PHY GPIOs permanently for Intel Baytrail devices. This causes issues when the actual PHY driver attempts to claim the same GPIO descriptors. For example, tusb1210 now fails to probe with: tusb1210: probe of dwc3.0.auto.ulpi failed with error -16 (EBUSY) dwc3-pci needs to turn on the PHY once before dwc3 is loaded, but usually the PHY driver will then hold the GPIOs to turn off the PHY when requested (e.g. during suspend). To fix the problem, this reverts the commit to restore the old behavior to put the GPIOs immediately after usage. Link: https://www.spinics.net/lists/linux-usb/msg174681.html Cc: [email protected] Signed-off-by: Stephan Gerhold <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-11-14usb: dwc3: Fix NULL pointer exception in dwc3_pci_remove()Kuppuswamy Sathyanarayanan1-1/+3
In dwc3_pci_quirks() function, gpiod lookup table is only registered for baytrail SOC. But in dwc3_pci_remove(), we try to unregistered it without any checks. This leads to NULL pointer de-reference exception in gpiod_remove_lookup_table() when unloading the module for non baytrail SOCs. This patch fixes this issue. Fixes: 5741022cbdf3 ("usb: dwc3: pci: Add GPIO lookup table on platforms without ACPI GPIO resources") Cc: <[email protected]> Signed-off-by: Kuppuswamy Sathyanarayanan <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-08-29usb: dwc3: pci: Fix return value check in dwc3_byt_enable_ulpi_refclock()Wei Yongjun1-2/+2
In case of error, the function pcim_iomap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: 7740d04d901d ("usb: dwc3: pci: Enable ULPI Refclk on platforms where the firmware does not") Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-07-30usb: dwc3: pci: Intel Merrifield can be hostAndy Shevchenko1-1/+7
On Intel Edison board the OTG function is enabled, thus, USB can switch to the host mode. Allow that by changing dr_mode property to "otg" for Intel Merrifield. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-07-30usb: dwc3: pci: Supply device properties via driver dataAndy Shevchenko1-57/+74
For now all PCI enumerated dwc3 devices require some properties to be present. This allows us to unconditionally append them and supply via driver_data. No functional change intended. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-07-30usb: dwc3: Describe 'wakeup_work' field of struct dwc3_pciAndy Shevchenko1-0/+1
Describe 'wakeup_work' field of struct dwc3_pci to avoid a warning: drivers/usb/dwc3/dwc3-pci.c:59: warning: Function parameter or member 'wakeup_work' not described in 'dwc3_pci' Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-07-26usb: dwc3: pci: Use devm functions to get the phy GPIOsHans de Goede1-4/+4
Even though we only use them once, it is better to not put/release the GPIOs immediately after use, so that others cannot claim them. Use devm functions to get the phy GPIOs, so that they will be automatically released when were unbound from the device and remove the gpio_put calls. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-07-26usb: dwc3: pci: Enable ULPI Refclk on platforms where the firmware does notHans de Goede1-0/+31
On some Bay Trail (BYT) systems the firmware does not enable the ULPI Refclk. This commit adds a helper which checks and if necessary enabled the Refclk and calls this helper for BYT machines. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-07-26usb: dwc3: pci: Add GPIO lookup table on platforms without ACPI GPIO resourcesHans de Goede1-0/+18
Bay Trail / BYT SoCs do not have a builtin device-mode phy, instead they require an external ULPI phy for device-mode. Only some BYT devices have an external phy, but even on those devices device-mode is not working because the dwc3 does not see the phy. The problem is that the ACPI fwnode for the dwc3 does not contain the expected GPIO resources for the GPIOs connected to the chip-select and reset pins of the phy. I've found the workaround which some Android x86 kernels use for this: https://github.com/BORETS24/Kernel-for-Asus-Zenfone-2/blob/master/arch/x86/platform/intel-mid/device_libs/pci/platform_usb_otg.c Which boils down to hardcoding the GPIOs for these devices. The good news it that all boards (*) use the same GPIOs. This commit fixes the ULPI phy not woring by adding a gpiod_lookup_table call which adds a hardcoded mapping for BYT devices. Note that the mapping added by gpiod_add_lookup_table is a fallback mapping, so boards which properly provide GPIO resources in the ACPI firmware-node resources will not use this. *) Except for the first revision of the evalulation-kit, which normal users don't have Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-07-26usb: dwc3: Add a glue driver for Synopsys HAPS platformThinh Nguyen1-30/+0
This driver is to be used for Synopsys PCIe-base HAPS platform. Move the the HAPS support from dwc3-pci to this driver. Signed-off-by: Thinh Nguyen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-06-18usb: dwc3: pci: add support for Intel IceLakeHeikki Krogerus1-0/+2
PCI IDs for Intel IceLake. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-03-22usb: dwc3: pci: Properly cleanup resourceThinh Nguyen1-1/+1
Platform device is allocated before adding resources. Make sure to properly cleanup on error case. Cc: <[email protected]> Fixes: f1c7e7108109 ("usb: dwc3: convert to pcim_enable_device()") Signed-off-by: Thinh Nguyen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-11-07USB: dwc3: Remove redundant license textGreg Kroah-Hartman1-9/+0
Now that the SPDX tag is in all USB files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Kukjin Kim <[email protected]> Cc: Krzysztof Kozlowski <[email protected]> Cc: Patrice Chotard <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-11-04USB: add SPDX identifiers to all remaining files in drivers/usb/Greg Kroah-Hartman1-0/+1
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/usb/ and include/linux/usb* files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Thomas Gleixner <[email protected]> Cc: Kate Stewart <[email protected]> Cc: Philippe Ombredanne <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Acked-by: Felipe Balbi <[email protected]> Acked-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-10-24usb: dwc3: pci: Runtime resume child device from wqManu Gautam1-2/+27
Driver currently resumes and increments pm usage_count of its child device (dwc3 main) from its runtime_resume handler. This requires dwc3 runtime_resume to perform pm_runtime_put to decrement the pm usage_count. However runtime_put from dwc3 happens for non pci drivers (e.g. dwc3-if-simple.c) as well which results in dwc3 pm usage_count becoming negative after couple of runtime suspend resume iterations. Fix this by performing runtime_get/put from dwc3-pci driver only using workqueue. Signed-off-by: Manu Gautam <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-08-10usb/dwc3:constify dev_pm_opsDoug Wilson1-1/+1
dev_pm_ops is not supposed to change at runtime. Marking it constant. Signed-off-by: Doug Wilson <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-06-28PM / core: Drop run_wake flag from struct dev_pm_infoRafael J. Wysocki1-2/+1
The run_wake flag in struct dev_pm_info is used to indicate whether or not the device is capable of generating remote wakeup signals at run time (or in the system working state), but the distinction between runtime remote wakeup and system wakeup signaling has always been rather artificial. The only practical reason for it to exist at the core level was that ACPI and PCI treated those two cases differently, but that's not the case any more after recent changes. For this reason, get rid of the run_wake flag and, when applicable, use device_set_wakeup_capable() and device_can_wakeup() instead of device_set_run_wake() and device_run_wake(), respectively. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Acked-by: Bjorn Helgaas <[email protected]>
2017-06-07ACPI: Switch to use generic guid_t in acpi_evaluate_dsm()Andy Shevchenko1-5/+5
acpi_evaluate_dsm() and friends take a pointer to a raw buffer of 16 bytes. Instead we convert them to use guid_t type. At the same time we convert current users. acpi_str_to_uuid() becomes useless after the conversion and it's safe to get rid of it. Acked-by: Rafael J. Wysocki <[email protected]> Cc: Borislav Petkov <[email protected]> Acked-by: Dan Williams <[email protected]> Cc: Amir Goldstein <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Reviewed-by: Jani Nikula <[email protected]> Acked-by: Jani Nikula <[email protected]> Cc: Ben Skeggs <[email protected]> Acked-by: Benjamin Tissoires <[email protected]> Acked-by: Joerg Roedel <[email protected]> Acked-by: Adrian Hunter <[email protected]> Cc: Yisen Zhuang <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Acked-by: Felipe Balbi <[email protected]> Acked-by: Mathias Nyman <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
2017-05-16usb: dwc3: pci: add Intel Cannonlake PCI IDsHeikki Krogerus1-0/+4
Intel Cannonlake PCH has the same DWC3 than Intel Sunrisepoint. Add the new IDs to the supported devices. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-03-23usb: dwc3: pci: Switch to devm_acpi_dev_add_driver_gpios()Andy Shevchenko1-2/+3
Switch to use managed variant of acpi_dev_add_driver_gpios() to simplify error path and fix potentially wrong assignment if ->probe() fails. While here, add a debug message in case assignment fails to allow user see the cause of a potential issue. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2017-01-02usb: dwc3: pci: add Intel Gemini Lake PCI IDHeikki Krogerus1-0/+2
Intel Gemini Lake SoC has the same DWC3 than Broxton. Add the new ID to the supported Devices. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc3: pci: Add "linux,sysdev_is_parent" propertyJohn Youn1-10/+3
Calling platform_device_add_properties() replaces existing properties so the "linux,sysdev_is_parent" property doesn't get set. Add this property to each platform. Fixes: d64ff406e51e ("usb: dwc3: use bus->sysdev for DMA configuration") Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc3: pci: Fix dr_mode misspellingHans de Goede1-1/+1
usb_get_dr_mode() expects the device-property to be spelled "dr_mode" not "dr-mode". Spelling it properly fixes the following warning showing up in dmesg: [ 8704.500545] dwc3 dwc3.2.auto: Configuration mismatch. dr_mode forced to gadget Signed-off-by: Hans de Goede <[email protected] Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: use bus->sysdev for DMA configurationArnd Bergmann1-0/+10
The dma ops for dwc3 devices are not set properly. So, use a physical device sysdev, which will be inherited from parent, to set the hardware / firmware parameters like dma. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Sriram Dash <[email protected]> Tested-by: Baolin Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: pci: avoid build warningFelipe Balbi1-24/+26
dwc3_pci_dsm() is only needed if (PM || PM_SLEEP), we should make sure it's not defined if neither of those is defined. This fixes a randconfig build warning. Acked-by: Arnd Bergmann <[email protected]> Reported-by: Arnd Bergmann <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: pci: call _DSM for suspend/resumeFelipe Balbi1-12/+61
Intel's BXT devices need to execute a _DSM method during {runtime_,}{suspend,resume} in order to get a chunk of dwc3 to power gate and save some extra power. Let's do that now. Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: pci: add a private driver structureFelipe Balbi1-15/+34
We'll be tracking a little more information for PCI drivers, it's about time we add a private structure for that. Signed-off-by: Felipe Balbi <[email protected]>
2016-09-07usb: dwc3: pci: fix build warning on !PM_SLEEPFelipe Balbi1-1/+3
When building a kernel with CONFIG_PM_SLEEP=n, we get the following warning: drivers/usb/dwc3/dwc3-pci.c:253:12: warning: 'dwc3_pci_pm_dummy' defined but not used In order to fix this, we should only define dwc3_pci_pm_dummy() when CONFIG_PM_SLEEP is defined. Fixes: f6c274e11e3b ("usb: dwc3: pci: runtime_resume child device") Reported-by: Arnd Bergmann <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-08-22usb: dwc3: pci: runtime_resume child deviceFelipe Balbi1-1/+8
During runtime_resume of dwc3-pci.c, we need to runtime suspend our child device (which is dwc3 proper) otherwise nothing will happen. Signed-off-by: Felipe Balbi <[email protected]>
2016-08-10usb: dwc3: pci: add Intel Kabylake PCI IDHeikki Krogerus1-0/+2
Intel Kabylake PCH has the same DWC3 than Intel Sunrisepoint. Add the new ID to the supported devices. Cc: <[email protected]> Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-06-21usb: dwc3: pci: add dr-mode for Intel dwc3Felipe Balbi1-25/+37
It's know that Intel's SoCs' dwc3 integration is peripheral-only since Intel implements its own portmux for role-swapping. In order to prevent dwc3 from ever registering and XHCI platform_device, let's just set dr-mode to peripheral-only on Intel SoCs. Signed-off-by: Felipe Balbi <[email protected]>
2016-06-20usb: dwc3: pci: use build-in properties instead of platform dataHeikki Krogerus1-38/+32
This should allow the core driver to drop handling of platform data and expect the platform specific details to always come from properties. Tested-by: John Youn <[email protected]> Signed-off-by: Heikki Krogerus <[email protected]> Cc: Huang Rui <[email protected]> CC: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-06-20usb: dwc3: pci: add Power Management dummy hooksFelipe Balbi1-0/+39
Allow for dwc3-pci to reach D3 and enable pm_runtime by providing dummy PM hooks. Without them, PCI subsystem won't put device to D3. Signed-off-by: Felipe Balbi <[email protected]>
2016-04-28usb: dwc3: pci: pass the platform device as a parameter to dwc3_pci_quirks()Heikki Krogerus1-8/+5
For convenience, passing the dwc3 platform device as a parameter to dwc3_pci_quirks() function. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-04-28usb: dwc3: pci: make build-in device properties availableHeikki Krogerus1-3/+4
Setting the ACPI companion before calling dwc3_pci_quirks. The ACPI companion will be set unconditionally as the primary fwnode, overriding any previously set primary fwnode. This will make sure that any build-in properties added to the platform device will be added as the secondary fwnode in cases where also ACPI companion exists. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-04-06usb: dwc3: pci: add ID for one more Intel Broxton platformHeikki Krogerus1-0/+2
BXT-M is a Intel Broxton SoC based platform with unique PCI ID. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-11-16usb: dwc3: pci: add support for Intel Broxton SOCHeikki Krogerus1-0/+4
PCI IDs for Broxton based platforms. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-10-09usb: dwc3: pci: Set enblslpm quirk for Synopsys platformsJohn Youn1-0/+1
Certain Synopsys prototyping PHY boards are not able to meet timings constraints for LPM. This allows the PHY to meet those timings by leaving the PHY clock running during suspend. Cc: <[email protected]> # v3.18+ Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-10-09usb: dwc3: pci: Add platform data for Synopsys HAPSJohn Youn1-0/+15
Add platform data and set usb3_lpm_capable and has_lpm_erratum. Cc: <[email protected]> # v3.18+ Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-10-09usb: dwc3: pci: trivial: FormattingJohn Youn1-8/+8
Fix the alignment of the PCI device definitions. Also change the hex digit capitalization of one constant to make it consistent with the rest of the file and driver. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-10-09usb: dwc3: pci: Add the PCI Product ID for Synopsys USB 3.1John Youn1-0/+5
This adds the PCI product ID for the Synopsys USB 3.1 IP core (DWC_usb31) on a HAPS-based PCI development platform. Cc: <[email protected]> # v3.18+ Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-10-09usb: dwc3: pci: Add the Synopsys HAPS AXI Product IDJohn Youn1-0/+5
This ID is for the Synopsys DWC_usb3 core with AXI interface on PCIe HAPS platform. This core has the debug registers mapped at a separate BAR in order to support enhanced hibernation. Cc: <[email protected]> # v3.18+ Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-09-27usb: dwc3: pci: passing forward the ACPI companionHeikki Krogerus1-0/+1
Sharing the ACPI companion with dwc3 core so it has access to the properties defined for DWC3 in ACPI tables. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-07-29usb: dwc3: pci: make better use of gpiod APIUwe Kleine-König1-10/+16
Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions) which appeared in v3.17-rc1, the gpiod_get* functions take an additional parameter that allows to specify direction and initial value for output. Use this additional parameter and the _optional variant to simplify the driver and improve error handling. Also expand the comment to explain why it's not sensible to switch to devm_gpiod_get and why the gpiod_put is also necessary. Furthermore this is one caller less that stops us making the flags argument to gpiod_get*() mandatory. Tested-by: Heikki Krogerus <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-05-13usb: dwc3: pci: add quirk for BaytrailsHeikki Krogerus1-0/+36
On some BYT platforms the USB2 PHY needs to be put into operational mode by the controller driver with GPIOs controlling the PHYs reset and cs signals. Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-03-10usb: move definition of PCI_VENDOR_ID_SYNOPSYS to linux/pci_ids.hJoseph Kogut1-2/+0
Removed FIXME from usb/dwc3/dwc3-pci.c by moving definition of PCI_VENDOR_ID_SYNOPSYS shared with usb/dwc2 to linux/pci_ids.h. Signed-off-by: Joseph Kogut <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-01-19Merge tag 'v3.19-rc5' into nextFelipe Balbi1-0/+4
Linux 3.19-rc5 Conflicts: drivers/usb/dwc2/gadget.c drivers/usb/gadget/udc/bdc/bdc_ep.c
2015-01-15usb: dwc3: pci: code cleanupHeikki Krogerus1-54/+42
Removing a few items that are not needed anymore and adding separate function for quirks. Acked-by: Huang Rui <[email protected]> Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-01-15usb: dwc3: pci: rely on default PM callbacks from PCI driver utilityHeikki Krogerus1-34/+0
There is nothing specific being done in the suspend and resume callbacks that is not already taken care of in PCI driver core, so dropping the functions. Acked-by: Huang Rui <[email protected]> Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-01-15usb: dwc3: pci: remove registration of NOP PHYsHeikki Krogerus1-68/+0
None of the PCI platforms need the NOP transceivers, and since we can now live without the PHYs, removing registration of the platform devices for them. Acked-by: Huang Rui <[email protected]> Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>