aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-11-18usb: dwc3: gadget: Remove descriptor arguments to ep_enableJohn Youn2-20/+25
The __dwc3_gadget_endpoint_enable() function has access to the endpoint descriptors via the usb_ep. So we don't need to pass them in as arguments. The descriptors should be set by the caller prior to calling usb_ep_enable(). Signed-off-by: John Youn <[email protected]> [[email protected] : minor improvements] Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: gadget: Update for new usb_endpoint_maxp()Vardan Mikayelyan1-19/+23
Update the dwc2 driver for the new behavior of the usb_endpoint_maxp() and also use the new usb_endpoint_maxp_mult() helper function. This commit fixes failures in high-badwith ISOC transfer tests. Signed-off-by: Vardan Mikayelyan <[email protected]> Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: warn on once when no trbsJanusz Dziedzic1-1/+3
Seems last time we hit few issues where we get trb_left = 0, mainly because of HWO bit still set in previous TRB. Add warn on once to catch/fix such problems much faster. Signed-off-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: isoc clean DWC3_EP_PENDING_REQUEST flagJanusz Dziedzic1-0/+1
After we kick_transfer we should clean DWC3_EP_PENDING_REQUEST endpoint flag. Signed-off-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: fix post-incrementJanusz Dziedzic1-1/+1
Use pre-increment and set -ETIMEDOUT correctly. Signed-off-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: clean TRB if STARTTRANSFER failJanusz Dziedzic1-0/+2
In case STARTTRANSFER will fail, clean TRB. Seems HW in such case don't clean HWO bit. So, without this cleanup prev_trb still have HWO bit set. In my case (without patch), after first START failed: - dep->enqueue == 1 - dep->dequeue == 1 - prev_trb still have HWO set - left_trb() == 0 No way to send more data. Signed-off-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc3: decrement queued_requestsJanusz Dziedzic1-0/+1
In case we will fail to STARTTRANSFER we should also decrement queued_requests. Signed-off-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Add PCI propertiesVahram Aharonyan1-0/+19
Add device parameters handling in dwc2-pci similar what is done in dwc3. Signed-off-by: Vahram Aharonyan <[email protected]> Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Get host DMA device propertiesJohn Youn2-31/+23
The driver will automatically enable host DMA and use it if available. This is consistent with the behavior of all existing platforms. Read in the "snps,host-dma-disable" device property to disable it. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Rename the dma_enable parameter to host_dmaJohn Youn4-51/+51
Rename it so that it is more consistent with the gadget dma parameter. It only affects host-mode operation so prefix it with "host". Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Move gadget settings into core_paramsJohn Youn3-91/+296
Move the gadget devicetree settings into the core_params structure and document them. Then set and check them in params.c, with the addition of some helper functions, and remove the equivalent code in gadget.c. Because these parameters came from the standalone s3c driver, they have a fixed default value rather than an autodetected one. Preserve and document this behavior to avoid any compatibility issues. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Rename host_rx_fifo_size hardware parameterJohn Youn2-6/+6
This hardware parameter is not host specific. It also applies to device mode. Drop the "host" from the name to make that clear. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Remove unnecessary prototypesJohn Youn2-235/+54
Remove the unnecessary prototypes for all the parameter setting functions and declare those functions 'static' in the params.c file. Also remove the duplicate documentation that went along with them. They are already documented as part of the params structure definition. Then move the constants that went along with the prototype into the structure. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Remove dwc2_set_all_params functionJohn Youn3-38/+44
Replace this by statically defining a function with defaults, and just assigning it. This will allow us to use parameters of any type and any default value. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Move parameter initialization into params.cJohn Youn3-23/+36
Consolidate and move all the parameter initialization code from the probe function to params.c. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Declare the core params struct staticallyJohn Youn10-181/+176
This makes it consistent with the hw_params struct and simplifies the memory management for future refactoring. Fix up usage in all files. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Add params.c fileJohn Youn5-1089/+1133
Add a params.c file and move all driver parameter code there, including all the static parameter definitions. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Remove unused hardware parameterJohn Youn1-1/+0
The dma_desc_fs_enable does not correspond to any hardware parameter and is unused. Remove it. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Remove unnecessary kfreeJohn Youn1-1/+0
This shouldn't be freed by the HCD as it is owned by the core and allocated with devm_kzalloc. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18USB: phy: am335x-control: fix device and of_node leaksJohan Hovold1-0/+2
Make sure to drop the references taken by of_parse_phandle() and bus_find_device() before returning from am335x_get_phy_control(). Note that there is no guarantee that the devres-managed struct phy_control will be valid for the lifetime of the sibling phy device regardless of this change. Fixes: 3bb869c8b3f1 ("usb: phy: Add AM335x PHY driver") Acked-by: Bin Liu <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: gadget: f_uac2: fix error handling at afunc_bindPeter Chen1-7/+7
The current error handling flow uses incorrect goto label, fix it Cc: <[email protected]> Fixes: d12a8727171c ("usb: gadget: function: Remove redundant usb_free_all_descriptors") Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: gadget: fix request length error for isoc transferPeter Chen1-1/+3
For isoc endpoint descriptor, the wMaxPacketSize is not real max packet size (see Table 9-13. Standard Endpoint Descriptor, USB 2.0 specifcation), it may contain the number of packet, so the real max packet should be ep->desc->wMaxPacketSize && 0x7ff. Cc: Felipe F. Tonello <[email protected]> Cc: Felipe Balbi <[email protected]> Fixes: 16b114a6d797 ("usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_aligna") Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-08usb: gadget: f_hid add super speed supportJanusz Dziedzic1-1/+66
Add super speed descriptors to f_hid. Signed-off-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-08usb: gadget: mv_u3d: mv_u3d_start_queue() refactoringAlexey Khoroshilov1-13/+15
The patch improves readability of mv_u3d_start_queue() by rearranging its code with two semantic modifications: - assignment zero to ep->processing if usb_gadget_map_request() fails; - propagation of error code from mv_u3d_req_to_trb() instead of hardcoded -ENOMEM. Signed-off-by: Alexey Khoroshilov <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-08usb: gadget: mv_u3d: add check for dma mapping errorAlexey Khoroshilov1-0/+6
mv_u3d_req_to_trb() does not check for dma mapping errors. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-08usb: dwc3: trace: purge dwc3_trace()Felipe Balbi6-135/+24
Finally get rid of dwc3_trace() hack. If any other message is truly needed, we should add proper tracepoints for them instead of hacking around with dwc3_trace() or similar. Signed-off-by: Felipe Balbi <[email protected]>
2016-11-08usb: dwc3: trace: add a tracepoint for ep enable/disableFelipe Balbi2-4/+57
instead of using a simple trace_printk() wrapper, let's add an actual tracepoint and print further details about the endpoint being operated upon. Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: pci: call _DSM for suspend/resumeFelipe Balbi2-13/+62
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-11-03usb: dwc3: gadget: always kick if num_pending_sgs > 0Felipe Balbi1-2/+1
When we get a half-way processed request, we should make sure to try to prepare further TRBs for it or for any possibly queued up request held in our pending_list. This will make sure our controller is kept busy for as long as possible. Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: gadget: stop touching HWO TRBsFelipe Balbi1-0/+3
Say we have three requests prepared to the HW (reqA, reqB, and reqC). All of them are composed of SG-lists with several entries and they all requests interrupt only on last TRBs of the SG-list. When we get interrupt for reqA, it could be that reqB is already half-way transferred and some of its TRBs will have HWO already cleared. It's okay to free up TRBs without HWO bit set, but we need to guarantee we don't giveback a request that's half-way transferred as that will confuse gadget drivers. Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: gadget: always try to prepare on started_list firstFelipe Balbi1-0/+18
In cases where we're given an SG-list which is longer than the amount of currently available TRBs, we will be left with the same request on started_list and we should prioritize that request over possible new requests on pending_list. That's a way to guarantee requests complete in order. Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: gadget: tracking per-TRB remaining bytesFelipe Balbi2-13/+8
This will give us a simpler way of figuring out how many bytes were left in each TRB. It's useful for cases where we queue only part of an SG-list due to amount of available TRBs at the time of kicking the transfer. Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: gadget: cope with XferNotReady before usb_ep_queue()Felipe Balbi2-7/+34
If XferNotReady comes before usb_ep_queue() we will set our PENDING request flag and wait for a request. However, originally, we were assuming usb_ep_queue() would always happen before our first XferNotReady and that causes a corner case where we could try to issue ENDTRANSFER command before STARTTRANSFER. Let's fix that by tracking endpoints which have been started. Reported-by: Janusz Dziedzic <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: gadget: wait for End Transfer to completeBaolin Wang2-8/+49
Instead of just delaying for 100us, we should actually wait for End Transfer Command Complete interrupt before moving on. Note that this should only be done if we're dealing with one of the core revisions that actually require the interrupt before moving on. [ [email protected]: minor improvements ] Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: gadget: NCM: differentiate consumed packets from dropped packetsTorsten Polle2-5/+6
dev_kfree_skb_any() is used to free packets that are dropped by the network stack. Therefore the function should not be used for packets that have been successfully processed by the network stack. Instead dev_consume_skb_any() has to be used for such consumed packets. This separation helps to identify dropped packets. Signed-off-by: Torsten Polle <[email protected]> Signed-off-by: Harish Jenny K N <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: gadget: u_ether: link socket buffers to the device for received packetsTorsten Polle1-1/+1
Socket buffers should be linked to the (network) device that allocated the buffers. __netdev_alloc_skb performs this task. Signed-off-by: Torsten Polle <[email protected]> Signed-off-by: Jim Baxter <[email protected]> Signed-off-by: Harish Jenny K N <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: gadget: NCM: link socket buffers to the device for tx packetsTorsten Polle1-0/+3
Socket buffers should be linked to the (network) device that allocated the buffers. Signed-off-by: Torsten Polle <[email protected]> Signed-off-by: Harish Jenny K N <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: gadget: f_fs: use complete() instead complete_all()Daniel Wagner1-1/+1
There is only one waiter for the completion, therefore there is no need to use complete_all(). Let's make that clear by using complete() instead of complete_all(). The usage pattern of the completion is: waiter context waker context reinit_completion() usb_esp_queue() wait_for_completion_interruptible() ffs_ep0_complete() complete() Acked-by: Michal Nazarewicz <[email protected]> Signed-off-by: Daniel Wagner <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Michal Nazarewicz <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: [email protected] Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: renesas_usbhs: cleanup with list_first_entry_or_null()Masahiro Yamada1-4/+1
The combo of list_empty() check and return list_first_entry() can be replaced with list_first_entry_or_null(). Acked-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: cleanup with list_first_entry_or_null()Masahiro Yamada1-4/+1
The combo of list_empty() check and return list_first_entry() can be replaced with list_first_entry_or_null(). Signed-off-by: Masahiro Yamada <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc2: cleanup with list_first_entry_or_null()Masahiro Yamada1-4/+2
The combo of list_empty() check and return list_first_entry() can be replaced with list_first_entry_or_null(). Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: Convert pr_warning to pr_warnJoe Perches10-29/+29
Use the more common logging mechanism. Miscellanea: o Realign multiline statements o Coalesce format Acked-by: Robert Jarzmik <[email protected]> Acked-by: Nicolas Ferre <[email protected]> Signed-off-by: Joe Perches <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: gadget: composite: use kasprintf() instead of open coding itJuergen Gross1-12/+2
Let's not reimplement generic kernel helpers, instead call kasprintf(). [ [email protected]: better commit log ] Signed-off-by: Juergen Gross <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: gadget: don't clear RUN/STOP when it's invalid to do soBaolin Wang3-0/+22
When we change the USB function with configfs dynamically, we possibly met this situation: one core is doing the control transfer, another core is trying to unregister the USB gadget from userspace, we must wait for completing this control tranfer, or it will hang the controller to set the DEVCTRLHLT flag. [ [email protected]: several fixes to the patch - call complete() before starting following SETUP transfer - add a macro for ep0_in_setup's timeout - change commit subject slightly - break lines at 72 characters (git adds an 8-character tab) - avoid changes to dwc3_gadget_run_stop() ] Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: gadget: purge dwc3_stop_active_transfers()Felipe Balbi1-20/+0
That function is unnecessarily called from dwc3_gadget_reset_interrupt(). Gadget drivers (and thus, functions) are required to dequeue all pending requests when they get notified about a USB Bus Reset. Trying to make sure there are no pending requests only serves the purpose of working around possibly bad gadgets. Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: core: add dwc3_get_properties()Felipe Balbi1-41/+49
This helper will be responsible for reading and parsing our properties. No functional changes in this patch, cleanup only. Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: core: remove unnecessary alignmentFelipe Balbi1-6/+2
Kernel will give us page aligned memory anyway. Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: core: introduce dwc3_core_setup_global_control()Felipe Balbi1-42/+48
This little helper will be used to setup anything related to GCTL register. There are no functional changes, this is a cleanup only patch. Signed-off-by: Felipe Balbi <[email protected]>
2016-11-03usb: dwc3: core: introduce dwc3_core_is_valid()Felipe Balbi1-10/+22
This little helper will be used to make sure we're dealing with a valid Synopsys DWC3 or DWC3.1 core. Signed-off-by: Felipe Balbi <[email protected]>