aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3
AgeCommit message (Collapse)AuthorFilesLines
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 Nguyen4-34/+147
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-07-13usb: dwc3: gadget: remove redundant variable maxpacketColin Ian King1-3/+0
Variable maxpacket is being assigned but is never used hence it is redundant and can be removed. Cleans up clang warning: warning: variable 'maxpacket' set but not used [-Wunused-but-set-variable] Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-06-19usb: dwc3: qcom: mark PM functions as __maybe_unusedArnd Bergmann1-8/+4
The #ifdef guards around these are wrong, resulting in warnings in certain configurations: drivers/usb/dwc3/dwc3-qcom.c:244:12: error: 'dwc3_qcom_resume' defined but not used [-Werror=unused-function] static int dwc3_qcom_resume(struct dwc3_qcom *qcom) ^~~~~~~~~~~~~~~~ drivers/usb/dwc3/dwc3-qcom.c:223:12: error: 'dwc3_qcom_suspend' defined but not used [-Werror=unused-function] static int dwc3_qcom_suspend(struct dwc3_qcom *qcom) This replaces the guards with __maybe_unused annotations to shut up the warnings and give better compile time coverage. Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver") Reviewed-by: Douglas Anderson <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-06-19usb: dwc3: Fix error return code in dwc3_qcom_probe()Wei Yongjun1-0/+1
Fix to return error code -ENODEV from the get device failed error handling case instead of 0, as done elsewhere in this function. Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-06-18usb: dwc3: Only call clk_bulk_get() on devicetree instantiated devicesHans de Goede1-10/+13
Commit fe8abf332b8f ("usb: dwc3: support clocks and resets for DWC3 core") adds support for handling clocks and resets in the DWC3 core, so that for platforms following the standard devicetree bindings this does not need to be duplicated in all the different glue layers. These changes intended for devicetree based platforms introduce an uncoditional clk_bulk_get() in the core probe path. This leads to the following error being logged on x86/ACPI systems: [ 26.276783] dwc3 dwc3.3.auto: Failed to get clk 'ref': -2 This commits wraps the clk_bulk_get() in an if (dev->of_node) check so that it only is done on devicetree instantiated devices, fixing this error. Cc: Masahiro Yamada <[email protected]> Reviewed-by: Masahiro Yamada <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-06-18usb: dwc3: of-simple: fix use-after-free on removeJohan Hovold1-1/+2
The clocks have already been explicitly disabled and put as part of remove() so the runtime suspend callback must not be run when balancing the runtime PM usage count before returning. Fixes: 16adc674d0d6 ("usb: dwc3: add generic OF glue layer") Signed-off-by: Johan Hovold <[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-05-31USB: dwc3: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-32/+11
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Felipe Balbi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-05-31usb: dwc3: Remove DEBUG define from Qualcomm DWC3 glue driverDouglas Anderson1-1/+0
It appears that a "#define DEBUG" was left in on the recent patch landed for the Qualcomm DWC3 glue driver. Let's remove it. Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver") Signed-off-by: Douglas Anderson <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-05-21usb: dwc3: gadget: Fix list_del corruption in dwc3_ep_dequeueMayank Rana1-1/+1
dwc3_ep_dequeue() waits for completion of End Transfer command using wait_event_lock_irq(), which will release the dwc3->lock while waiting and reacquire after completion. This allows a potential race condition with ep_disable() which also removes all requests from started_list and pending_list. The check for NULL r->trb should catch this but currently it exits to the wrong 'out1' label which calls dwc3_gadget_giveback(). Since its list entry was already removed, if CONFIG_DEBUG_LIST is enabled a 'list_del corruption' bug is thrown since its next/prev pointers are already LIST_POISON1/2. If r->trb is NULL it should simply exit to 'out0'. Fixes: cf3113d893d4 ("usb: dwc3: gadget: properly increment dequeue pointer on ep_dequeue") Cc: [email protected] # v4.12+ Signed-off-by: Mayank Rana <[email protected]> Signed-off-by: Jack Pham <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: dwc3_gadget_del_and_unmap_request() can be staticWei Yongjun1-1/+1
Fixes the following sparse warning: drivers/usb/dwc3/gadget.c:169:6: warning: symbol 'dwc3_gadget_del_and_unmap_request' was not declared. Should it be static? Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: dwc3_get_extcon() can be statickbuild test robot1-1/+1
Fix sparse warning Fixes: 5f0b74e54890 ("USB: dwc3: get extcon device by OF graph bindings") Reviewed-by: Andrzej Hajda <[email protected]> Signed-off-by: kbuild test robot <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: init req->{direction,epnum} from alloc_request()Felipe Balbi1-2/+1
We dont' need to touch req->direction or req->epnum from ep_queue(). It's enough that we initialize both fields from alloc_request() and just keep them for the entire lifetime of the request. No functional changes. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: initialize transfer index from send_gadget_ep_cmd()Felipe Balbi2-6/+1
Instead of *always* calling dwc3_gadget_ep_get_transfer_index() after sending a Start Transfer command, we can call it once from dwc3_send_gadget_ep_cmd() itself. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: assign resource_index inside get_transfer_index()Felipe Balbi3-10/+6
Instead of returning resource index number just to assign it to a field inside 'dep' which was passed as argument, we can assing dep->resource_index from inside dwc3_gadget_ep_get_transfer_index() itself. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: always start isochronous aligned to dep->intervalFelipe Balbi1-10/+5
We will *always* start transfer to the next uFrame number aligned to dep->interval. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: don't issue End Transfer if we have started reqsFelipe Balbi1-1/+3
In case we have many started requests and one of them in the middle is completed with Missed Isoc, let's not End Transfer as that would result in us loosing (possibly) many more intervals. Instead, let's allow the controller to go through its list of started requests. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: debug: decode uFrame from event tooFelipe Balbi1-3/+7
XferNotReady and XferInProgress give us the uFrame number we're currently in. Printing that out on tracepoints may help us find bugs in transfer scheduling. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: move dwc3_calc_trbs_left() in place of prototypeFelipe Balbi1-49/+47
Avoid a prototype when the function can be defined earlier. No functional changes, cleanup only. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: move set_xfer_resource() in place of prototypeFelipe Balbi1-13/+11
Instead of having a prototype for a function that's defined a few lines down, let's just move definition to the place where prototype was. No functional changes, cleanup only. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: remove a few more dwc argumentsFelipe Balbi1-8/+10
In a few places, the argument is completely unnecessary. On places where it's needed, we can get it from dep->dwc. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: combine modify & restore into single argumentFelipe Balbi1-22/+11
Those two arguments refer to a single bitfield in the register. In order to simplify the code, we can combine them into a single argument and expect caller to pass the correct action argument at all times. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: refactor dwc3_gadget_init_endpoints()Felipe Balbi1-87/+116
This just makes it slightly easier to read. No functional changes. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: split dwc3_gadget_ep_cleanup_completed_requests()Felipe Balbi1-24/+36
No functional changes, it just makes the code slightly easier to read. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: get rid of the length variableFelipe Balbi1-3/+1
Code is just as readable without it. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: reduce scope of ret variableFelipe Balbi1-1/+1
We can declare it inside list_for_each_entry_safe() loop and reduce its scope. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: one declaration per lineFelipe Balbi1-2/+3
Misc cleanup. No functional changes. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: simplify IOC handlingFelipe Balbi1-15/+10
We will only have event status of IOC when IOC bit is set in TRB. There's no need to check both bits. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: simplify short packet eventFelipe Balbi1-7/+1
We know that only OUT endpoints can trigger SHORT. We also know that count MUST be > 0 whenever SHORT triggers. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: trace: print out event status tooFelipe Balbi1-4/+16
This will make it easier to figure out the reason for the event. That information really helps debugging certain problems. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: simplify unaligned and zlp handlingFelipe Balbi1-4/+2
We can just call reclaim_trb_linear instead of reimplementing it. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: remove unnecessary 'chain' variableFelipe Balbi1-3/+1
Minor cleanup, no functional changes. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: remove PENDING handling from cleanup_completedFelipe Balbi1-14/+0
We are trying to kick transfers on Isochronous endpoints in a more controlled manner now. And this ended up rendering this piece of code unnecessary. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: split scatterlist and linear handlersFelipe Balbi1-26/+45
instead of having one big loop, let's split it down into two smaller handlers: one for linear buffers and one for scatterlist. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: simplify isoc case on cleanup_completed_requestsFelipe Balbi1-10/+3
Just a minor simplification, no functional changes. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: simplify queueing of isoc transfersFelipe Balbi1-12/+6
After all the previous changes, it's now a lot clearer how isoc transfers should be managed. We don't need to try to End Transfers from ep_queue since that's already done by cleanup_requests. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: remove duplicated missed isoc handlingFelipe Balbi3-35/+3
Now, this part of the code is duplicated and brings no extra value to the driver. Let's remove it. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: check for Missed Isoc from event statusFelipe Balbi2-5/+14
In case we get an event with status set to Missed Isoc, this means we have missed an isochronous interval and should issue End Transfer command and wait for the following XferNotReady. Let's do that early, rather than late. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: remove unnecessary 'ioc' variableFelipe Balbi1-6/+1
It's only written to, never read. We can remove it now. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: make cleanup_completed_requests() return nothingFelipe Balbi1-9/+4
We don't need to return a value anymore here. Let's remove it. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: remove DWC3_EP_BUSY flagFelipe Balbi4-18/+6
It has no use anymore. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: start removing BUSY flagFelipe Balbi1-2/+2
By now, it has the same semantics as DWC3_EP_TRANSFER_STARTED, but that has a much more descriptive name. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: update dep->frame_number from XferInprogress tooFelipe Balbi1-6/+13
We will need an up-to-date frame_number from XferInProgress too when future patches improve our handling of Isoc endpoints. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: always use frame number from XferNotReadyFelipe Balbi1-7/+5
The core requires the extra two bits of information for properly scheduling Isochronous transfers. This means that we can't rely on __dwc3_gadget_get_frame(). Let's always cache uFrame number from XferNotReady instead. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: remove unnecessary 'dwc' parameterFelipe Balbi1-36/+32
Endpoint handlers need to know about endpoints, not dwc. If they really need access to dwc (e.g. for printing error messages) we have a reference to it tucked inside the endpoint. This patch has no functional changes, it's simply moving things around. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: move handler closer to calling siteFelipe Balbi1-11/+11
Cleanup only, no functional changes. Just making code easier to follow. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: rename dwc3_gadget_start_isoc()Felipe Balbi1-2/+2
Cleanup only, no functional changes. This just matches the event name with its handler. Signed-off-by: Felipe Balbi <[email protected]>
2018-05-21usb: dwc3: gadget: remove some pointless checksFelipe Balbi1-13/+1
We *KNOW* which events we enable for which endpoint types and we *KNOW* when they'll trigger. The endpoint type checks are pointless. Signed-off-by: Felipe Balbi <[email protected]>