summaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)Author
2014-07-16usb: gadget: Gadget directory cleanup - group UDC driversAndrzej Pietrasiewicz
The drivers/usb/gadget directory contains many files. Files which are related can be distributed into separate directories. This patch moves the UDC drivers into a separate directory. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-16usb: gadget: Gadget directory cleanup - group legacy gadgetsAndrzej Pietrasiewicz
The drivers/usb/gadget directory contains many files. Files which are related can be distributed into separate directories. This patch moves the legacy gadgets (i.e. those not using configfs) into a separate directory. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-16usb: renesas_usbhs: add R-Car Gen. 2 init and power controlUlrich Hecht
In preparation for DT conversion to reduce reliance on platform device callbacks. Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-16usb: gadget: composite: dequeue cdev->req before free it in ↵Li Jun
composite_dev_cleanup This patch try to dequeue the cdev->req to guarantee the request is not queued before free it. Signed-off-by: Li Jun <b47624@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-16usb: musb: dsps: Add the sw_babble_control() and Enable for newer siliconGeorge Cherian
Add sw_babble_control() logic to differentiate between transient babble and real babble condition. Also add the SW babble control register definitions. Babble control register logic is implemented in the latest revision of AM335x. Find whether we are running on newer silicon. The babble control register reads 0x4 by default in newer silicon as opposed to 0 in old versions of AM335x. Based on this enable the sw babble control logic. Signed-off-by: George Cherian <george.cherian@ti.com> Tested-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-16usb: musb: core: Convert the musb_platform_reset to have a return value.George Cherian
Currently musb_platform_reset() is only used by dsps. In case of BABBLE interrupt for other platforms the musb_platform_reset() is a NOP. In such situations no need to re-initialize the endpoints. Also in the latest silicon revision of AM335x, we do have a babble recovery mechanism without resetting the IP block. In preperation to add that support its better to have a rest_done return for musb_platform_reset(). Signed-off-by: George Cherian <george.cherian@ti.com> Tested-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-16usb: musb: core: Convert babble recover work to delayed workGeorge Cherian
During babble condition both first disconnect of devices are initiated. Make sure MUSB controller is reset and re-initialized after all disconnects. To acheive this schedule a delayed work for babble recovery. While at that convert udelay to usleep_range. Refer Documentation/timers/timers-howto.txt Signed-off-by: George Cherian <george.cherian@ti.com> Tested-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-16usb: musb: core: Handle Babble condition only in HOST modeGeorge Cherian
BABBLE and RESET share the same interrupt. The interrupt is considered to be RESET if MUSB is in peripheral mode and as a BABBLE if MUSB is in HOST mode. Handle babble condition iff MUSB is in HOST mode. Signed-off-by: George Cherian <george.cherian@ti.com> Tested-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-16usb: dwc3: omap: add dwc3_omap_extcon_register functionGeorge Cherian
Move the extcon related code to its own function. Improve code readability, decrease the dwc3_probe() size. Signed-off-by: George Cherian <george.cherian@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-16usb: dwc3: omap: add dwc3_omap_set_utmi_mode() functionGeorge Cherian
Move find and set the utmi mode to its own separate function. Improve code readability, decrease the dwc3_probe() size. Signed-off-by: George Cherian <george.cherian@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-16usb: dwc3: omap: add dwc3_omap_map_offset() functionGeorge Cherian
Move map offset to its own separate function. Improve code readability, decrease the dwc3_probe() size. Signed-off-by: George Cherian <george.cherian@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-16usb: dwc3: omap: remove x_major calculation from revision registerGeorge Cherian
Remove the x_major calculation logic from the wrapper revision register to differentiate between OMAP5 and AM437x. This was done to find the register offsets of wrapper register. Now that We do it using dt compatible, remove the whole logic. Signed-off-by: George Cherian <george.cherian@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: gadget: NCM: Stop RX TCP Bursts getting dropped.Jim Baxter
This fixes a problem with dropped packets over 16k CDC-NCM when the connection is being heavily used. The issue was that the extracted frames cloned from the received frame were consuming more memory than necessary resulting in the truesize being ~32KB instead of ~2KB, this meant there was a high chance of reaching the sk_rcvbuf limit. Signed-off-by: Jim Baxter <jim_baxter@mentor.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: gadget: NCM: Add transmit multi-frame.Jim Baxter
This adds multi-frame support to the NCM NTB's for the gadget driver. This allows multiple network packets to be put inside a single USB NTB with a maximum size of 16kB. It has a time out of 300ms to ensure that smaller number of packets still maintain a normal latency. Also the .fp_index and .next_fp_index have been changed to .ndp_index and .next_ndp_index to match the latest CDC-NCM specification and help with maintenance. Results transmitting from gadget to host. Before the change: TCP_STREAM Throughput (10^6bits/sec): 22.72 UDP_STREAM Throughput (10^6bits/sec): 25.94 Latency: netperf -H 192.168.1.101 -v2 -l 50 -t TCP_RR -- -r 16384,16384 Trans. RoundTrip Throughput Rate Latency 10^6bits/s per sec usec/Tran Outbound 100.83 9918.116 13.215 After the change: TCP_STREAM Throughput (10^6bits/sec): 124.26 UDP_STREAM Throughput (10^6bits/sec): 227.48 Latency: netperf -H 192.168.1.101 -v2 -l 50 -t TCP_RR -- -r 16384,16384 Trans. RoundTrip Throughput Rate Latency 10^6bits/s per sec usec/Tran Outbound 156.80 6377.730 20.552 Signed-off-by: Jim Baxter <jim_baxter@mentor.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: gadget: NCM: RX function support multiple NDPsJim Baxter
The NDP was ignoring the wNextNdpIndex in the NDP which means that NTBs containing multiple NDPs would have missed frames. Signed-off-by: Jim Baxter <jim_baxter@mentor.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: gadget: fix eem_wrap cloned skb logicNathan Sullivan
Even if the skb is cloned, we still need a ZLP or USB will stall. Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com> Acked-by: Brad Mouring <brad.mouring@ni.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: dwc3: gadget: remove unnecessary 'start_new' variableJingoo Han
Remove 'start_new' variable from dwc3_endpoint_transfer_complete(), since this variable has not been used. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: phy: am335x: Use SIMPLE_DEV_PM_OPS macroJingoo Han
Use SIMPLE_DEV_PM_OPS macro and remove DEV_PM_OPS macro, in order to make the code simpler. Acked-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: gadget: Convert drivers to use module_usb_composite_driver()Tobias Klauser
Use the module_usb_composite_driver() macro where applicable to eliminate the module_init/module_exit boilerplate in USB gadget composite drivers. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: gadget: f_fs: OS descriptors supportAndrzej Pietrasiewicz
Add support for OS descriptors. The new format of descriptors is used, because the "flags" field is required for extensions. os_count gives the number of OSDesc[] elements. The format of descriptors is given in include/uapi/linux/usb/functionfs.h. For extended properties descriptor the usb_ext_prop_desc structure covers only a part of a descriptor, because the wPropertyNameLength is unknown up front. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: gadget: u_os_desc: helper functions for accessing ext prop bufferAndrzej Pietrasiewicz
Provide helper functions to get pointers to particular locations within a buffer holding an extended properties descriptor. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: gadget: f_fs: rename descriptor parsing functionsAndrzej Pietrasiewicz
ffs_do_desc() handles one descriptor, while ffs_do_descs() handles a number of descriptors. The tho names are so similar that it causes confusion. Rename to reflect their purpose better. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: phy: tegra: Do not include asm/mach-types.hThierry Reding
It is no longer needed and keeping it will break 64-bit ARM builds. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: musb: register nop transceiver driver for jz4740Apelete Seketeli
Following the name change of the NOP transceiver driver in commit 4525bee (usb: phy: rename usb_nop_xceiv to usb_phy_generic), the transceiver driver was no longer operable under its old name. Register the transceiver driver before calling usb_get_phy() to make sure we are noticed by an error message if it is not available. Signed-off-by: Apelete Seketeli <apelete@seketeli.net> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: gadget: net2280: Fix typo on #ifdefRicardo Ribalda Delgado
Commit e56e69cc0ff4 ("usb: gadget: net2280: Use pr_* function") includes a editing mistake on one of the #ifdef. This patch fixes it. Reported-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: gadget: pxa25x_udc: use correct header for gpio devm_ functionsArnd Bergmann
commit c63d2225e7be ("usb: gadget: pxa25x_udc: use devm_ functions") introduced the use of devm_gpio_request in this driver, but did not correctly include the header file declaring this function, which causes a build failure. This changes pxa25x_udc to include linux/gpio.h instead of asm/gpio.h to fix this. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Himangi Saraogi <himangi774@gmail.com> Cc: Julia Lawall <julia.lawall@lip6.fr> Cc: Felipe Balbi <balbi@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: renesas_usbhs: gadget: fix re-enabling pipe without re-connectingYoshihiro Shimoda
This patch fixes an issue that the renesas_usbhs driver in gadget mode cannot work correctly even if I disabled DMAC of the driver when I used the g_zero driver and the testusb tool. When a usb cable is re-connected, the renesas_usbhs driver calls the usbhsp_flags_init() (via usbhs_hotplug() --> usbhs_mod_call(start) --> usbhsg_try_start() --> usbhs_pipe_init()). However, the driver doesn't call the usbhsp_flags_init() when usbhsg_ep_disable() is called. So, if a gadget driver calls usb_ep_enable() and usb_ep_disable() again and again, the renesas_usbhs driver will output the following log: renesas_usbhs renesas_usbhs: can't get pipe (BULK) renesas_usbhs renesas_usbhs: wrong recip request Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-07-10usb: renesas_usbhs: fix usbhs_pipe_malloc() to re-enable a pipe.Yoshihiro Shimoda
This patch fixes an issue that the driver cannot push a new data when a pipe is re-enabled after the pipe is queued. Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: gadget: s3c2410: Move to clk_prepare_enable/clk_disable_unprepareVasily Khoruzhick
Use clk_prepare_enable/clk_disable_unprepare to make the driver work properly with common clock framework. Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: musb: cppi41: fire hrtimer according to programmed channel lengthDaniel Mack
The musb/cppi41 code installs a hrtimer to work around DMA completion interrupts that have fired too early on AM335x hardware. This timer is currently programmed to first fire 140 microseconds after the DMA completion callback. According to the commit which introduced it (a655f481d83, "usb: musb: musb_cppi41: handle pre-mature TX complete interrupt"), that value is is considered a 'rule of thumb' that worked well with the test case described in the commit log. Test show, however, that for USB audio devices and much smaller packet sizes, the timer has to fire earlier in order to correctly handle the audio stream. The original test case had output transfer sizes of 1514 bytes, and a delay of 140 microseconds. For audio devices with 24 bytes channel size, 3 microseconds seem to work well. Hence, let's assume that the time it takes to clear the bit correlates with the number of bytes transferred. The referenced commit log mentions such a suspicion as well. Let the timer fire in cppi41_channel->total_len/10 microseconds to correctly handle both cases. Also, shorten the interval in which the timer fires again in case of a non-empty early_tx list. With these changes in place, both FS and HS audio devices appear to work well on AM335x hardware. Signed-off-by: Daniel Mack <zonque@gmail.com> Reported-by: Sebastian Reimers <sebastian.reimers@googlemail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30Revert "usb: musb: musb_cppi41: Handle ISOCH differently and not use the ↵Daniel Mack
hrtimer." This reverts commit 1af54b7a4. The commit tried to address cases in which isochronous transfers are 'not reliable', most probably in the tests conducted, polling for the MUSB_TXCSR_TXPKTRDY bit in MUSB_TXCSR is done too late. Hence, it installs a work struct which basically busy-polls for the bit in a rather agressive way by rescheduling the work if the FIFO is not empty. With USB audio devices, tests have shown that it takes approximately 100 iterations of the asynchronous worker until the FIFO signals completion, which leads to 100% CPU loads when streaming audio. The issue the patch tried to address can be handled differently, which is what the next patch does. Signed-off-by: Daniel Mack <zonque@gmail.com> Reported-by: Sebastian Reimers <sebastian.reimers@googlemail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: musb: fix wrong indentation in musb_host.cDaniel Mack
Just a cosmetic cleanup with no functional change. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: musb/cppi41: call musb_ep_select() before accessing an endpoint's CSRDaniel Mack
Before accessing any of an endpoint's CSR registers, make sure the correct endpoint is selected. Otherwise, data read from or written to the registers is likely to affect the wrong endpoint as long as the connected device has more than one endpoint. This, of course, leads to all sorts of strange effects such as stream starvation and driver internal state machine confusion due to spurious interrupts. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: musb: introduce dma_channel.rx_packet_doneDaniel Mack
The musb/cppi41 glue layer is capable of handling transactions that span over more than one USB packet by reloading the DMA descriptors partially. An urb is considered completed when either its transfer buffer has been filled entirely (actual_length == transfer_buffer_length) or if a packet in the stream has less bytes than the endpoint's wMaxPacketSize. Once one of the above conditions is met, musb_dma_completion() is called from cppi41_trans_done(). However, the final decision whether or not to return the urb to its owner is made by the core and its determination of the variable 'done' in musb_host_rx(). This code has currently no way of knowing what the size of the last packet was, and whether or not to give back the urb due to a short read. Fix this by introducing a new boolean flag in 'struct dma_channel', and set it from musb_cppi41.c. If set, it will make the core do what the DMA layer decided and complete the urb. Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: George Cherian <george.cherian@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: musb: fix bit mask for CSR in musb_h_tx_flush_fifo()Daniel Mack
The datasheet says that MUSB_TXCSR_FLUSHFIFO is only valid when MUSB_TXCSR_TXPKTRDY is set as well. With this patch applied, the warning in this function does no longer kick in when an USB soundcard is unplugged while the stream is active. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: musb: use is_host_active() to distinguish between host and gadget modeDaniel Mack
On AM33xx platforms, unplugging a device in the middle of an active transfer leads to a drop of MUSB_DEVCTL_HM in MUSB_DEVCTL before the system is informed about a disconnect. This consequently makes the musb core call the gadget code to handle the interrupt request, which then crashes the kernel because the relevant pointers haven't been set up for gadget mode. To fix this, use is_host_active() rather than (devctl & MUSB_DEVCTL_HM) in musb_interrupt() and musb_dma_completion() to detect whether the controller is in host or peripheral mode. This information is provided by the driver logic and does not rely on register contents. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: musb: remove unnecessary (void) prefix at function callsDaniel Mack
Just a little cleanup that removes unnecessary casts. Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: George Cherian <george.cherian@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: gadget: FunctionFS: Return -ENOENT instead of -ENODEV when device not ↵Krzysztof Opasiak
found. Syscall mount returns -ENODEV error if requested FS type has not been found. Returning the same error from FFS mount callback makes value returned to userspace misleading. Other file systems returns -ENOENT if requested device has not been found. Adjust FFS to this convention to make error codes meaningfull. Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: gadget: omap_udc: should not call gadget driver's .unbindPeter Chen
It has already been covered by udc core Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: gadget: net2272: do not need to judge gadget driver's .unbindPeter Chen
It has already been covered by udc core, besides, we do not need unbind at .udc_start Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: gadget: m66592-udc: should not call gadget driver's .unbindPeter Chen
It has already been covered by udc core Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: gadget: fusb300_udc: should not call gadget driver's .unbindPeter Chen
It has already been covered by udc core Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: gadget: fsl_udc_core: should not call gadget driver's .unbindPeter Chen
It has already been covered by udc core Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: phy: msm: Make phy_reset clk and reset line optional.Srinivas Kandagatla
This patch makes the phy reset clk and reset line optional as this clk is not available on boards like IFC6410 with APQ8064. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: gadget: pxa27x_udc: prepare and unprepare the clockRobert Jarzmik
Add clock prepare and unprepare as required by clock framework. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: gadget: net2280: Use quirks instead of pci idRicardo Ribalda Delgado
Use of quirks improve readability and will be easier to add new devices to this driver. Suggested-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: gadget: net2280: Use pr_* functionRicardo Ribalda Delgado
Driver was using custom functions WARNING, ERROR, DEBUG, instead of pr_err, pr_dgb... New ep_* macros have been created that use standard pr_* functions. Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: gadget: net2280: Code CleanupRicardo Ribalda Delgado
- Move logical continuations to end of line - Improve spacing Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: gadget: net2280: Pass checkpacth.pl testRicardo Ribalda Delgado
Fix Code Style using checkpatch.pl criteria Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: gadget: net2280: Refactor queues_showRicardo Ribalda Delgado
Replace a long and ugly expresion with an already available function. Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>