summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* usb: ulpi: move setting of ulpi->dev parent up in ulpi_register()Tal Shorer2016-09-061-1/+2
| | | | | | | | | | Once ulpi operations use the parent device directly, this will be needed during the operations used in ulpi_register() itself, so set the parent field before calling any ulpi operations. Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Tal Shorer <tal.shorer@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* Documentation: devicetree: dwc2: Deprecate g-tx-fifo-sizeJohn Youn2016-09-061-1/+4
| | | | | | | | | | This property is not needed because the periodic fifos are not configurable. So it was incorrect to add this property in the first place. Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc2: gadget: free TX FIFO after killing requestsRobert Baldyga2016-08-311-4/+4
| | | | | | | | | As kill_all_requests() potentially flushes TX FIFO, we should should free FIFO after calling it. Otherwise FIFO could stay unflushed properly. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc2: gadget: remove dead code from dwc2_hsotg_ep_enable()Robert Baldyga2016-08-311-12/+1Star
| | | | | | | | | | Since FIFO is always freed in dwc2_hsotg_ep_disable(), ep->fifo_index is always 0 in dwc2_hsotg_ep_enable(), hence code inside if() block is never executed. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc2: gadget: change variable name to more meaningfulRobert Baldyga2016-08-311-4/+4
| | | | | | | | | Since we handle FIFOs and endpoint separately, using variable named 'ep' in context of FIFO is misleading, hence we rename it to 'fifo'. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc2: gadget: fix TX FIFO size and address initializationRobert Baldyga2016-08-312-46/+8Star
| | | | | | | | | | | | | | | | | | | | According to DWC2 documentation, DPTxFSize field of DPTXFSIZn register is read only, which means that software cannot change FIFO size. Register description says: "The value of this register is the Largest Device Mode Periodic Tx Data FIFO Depth (parameter OTG_TX_DPERIO_DFIFO_DEPTH_n), as specified during coreConsultant configuration." That means, that we have to setup only FIFO start addresses (DPTxFStAddr), taking into account reset values of DPTxFSize. Initialize FIFO start addresses properly and remove unneeded core related to incorrect FIFO size initialization. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc2: gadget: use ep->fifo_index in context of FIFO registersRobert Baldyga2016-08-311-2/+3
| | | | | | | | In context of FIFO registers we use ep->fifo_index instead of ep->index. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: configfs: log function unbinding as debugRomain Izard2016-08-311-1/+1
| | | | | | | | | Disabling USB gadget functions configured through configfs is something that can happen in normal use cases. Keep the existing log for this type of event, but only as debug, not as an error. Signed-off-by: Romain Izard <romain.izard.pro@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: uvc: Add missing call for additional setup dataPetr Cvek2016-08-311-0/+7
| | | | | | | | | Some UVC commands require additional data (non zero uvc->event_length). Add usb_ep_queue() call, so uvc_function_ep0_complete() can be called and send received data to the userspace. Signed-off-by: Petr Cvek <petr.cvek@tul.cz> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: renesas_usbhs: set quirk_avoids_skb_reserve if USB-DMAC is usedYoshihiro Shimoda2016-08-311-0/+2
| | | | | | | | | | | | This patch sets the quirk_avoids_skb_reserve flag to improve performance of a network gadget driver (e.g. f_ncm.c) if USB-DMAC is used. For example (on r8a7795 board + f_ncm.c + iperf udp mode / receiving): - without this patch: 90.3 Mbits/sec - with this patch: 273 Mbits/sec Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: f_ncm: add support for no_skb_reserveYoshihiro Shimoda2016-08-311-0/+2
| | | | | | | | | | This patch adds to support no_skb_reserve function to improve performance for some platforms. About the detail, please refer to the commit log of "quirk_avoids_skb_reserve" in include/linux/usb/gadget.h. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: u_ether: add a flag to avoid skb_reserve() callingYoshihiro Shimoda2016-08-312-1/+5
| | | | | | | | | | This patch adds a flag "no_skb_reserve" in struct eth_dev. So, if a peripheral driver sets the quirk_avoids_skb_reserve flag, upper network gadget drivers (e.g. f_ncm.c) can avoid skb_reserve() calling using the flag as well. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: add a new quirk to avoid skb_reserve in u_ether.cYoshihiro Shimoda2016-08-311-0/+13
| | | | | | | | | | | | | | | | | | | Some platforms (e.g. USB-DMAC on R-Car SoCs) has memory alignment restriction. If memory alignment is not match, the usb peripheral driver decides not to use the DMA controller. Then, the performance is not good. In the case of u_ether.c, since it calls skb_reserve() in rx_submit(), it is possible to cause memory alignment mismatch. So, this patch adds a new quirk "quirk_avoids_skb_reserve" to avoid skb_reserve() calling in u_ether.c to improve performance. A peripheral driver will set this flag and network gadget drivers (e.g. f_ncm.c) will reference the flag via gadget_avoids_skb_reserve(). Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: net2280: fix typo: "Inavlid" -> "Invalid"Colin Ian King2016-08-311-1/+1
| | | | | | | trivial typo fix in dev_err message Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: renesas_usbhs: add a compatible string for r8a7796Yoshihiro Shimoda2016-08-312-0/+5
| | | | | | | | | This patch adds support for r8a7796 (R-Car M3-W). Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: goku_udc: fix memory leak in goku_probe()Alexey Khoroshilov2016-08-291-0/+2
| | | | | | | | | | | Memory allocated for goku_udc device is not deallocated at error paths in goku_probe(), because gadget_release() destructor is not registered yet. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: renesas_usbhs: pipe: don't print on ENOMEMWolfram Sang2016-08-291-3/+1Star
| | | | | | | All kmalloc-based functions print enough information on failures. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: renesas_usbhs: mod_host: don't print on ENOMEMWolfram Sang2016-08-291-8/+2Star
| | | | | | | All kmalloc-based functions print enough information on failures. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: renesas_usbhs: mod_gadget: don't print on ENOMEMWolfram Sang2016-08-291-5/+1Star
| | | | | | | All kmalloc-based functions print enough information on failures. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: udc: udc-xilinx: don't print on ENOMEMWolfram Sang2016-08-291-3/+1Star
| | | | | | | All kmalloc-based functions print enough information on failures. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: udc: goku_udc: don't print on ENOMEMWolfram Sang2016-08-291-2/+1Star
| | | | | | | All kmalloc-based functions print enough information on failures. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: udc: fsl_qe_udc: don't print on ENOMEMWolfram Sang2016-08-291-12/+4Star
| | | | | | | All kmalloc-based functions print enough information on failures. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc2: gadget: don't print on ENOMEMWolfram Sang2016-08-291-6/+2Star
| | | | | | | All kmalloc-based functions print enough information on failures. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: phy: ab8500-usb: fix spelling mistake "regester" -> "register"Colin Ian King2016-08-291-4/+4
| | | | | | | Trivial fix to spelling mistakes in dev_err messages. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: don't couple configfs to legacy gadgetsFelipe Balbi2016-08-261-19/+19
| | | | | | | | It's perfectly fine to have all configfs functions built-in while having modular legacy gadgets. Let's allow for that. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc3: gadget: stop kicking if we run out of spaceFelipe Balbi2016-08-251-0/+3
| | | | | | | | In case our TRB ring is full, we can avoid trying to kick transfers which won't start and just add requests to the queue. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc3: gadget: abolish trbs_leftFelipe Balbi2016-08-251-9/+7Star
| | | | | | | Instead, we can always rely on dwc3_calc_trbs_left() directly. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: f_hid: use alloc_ep_req()Felipe F. Tonello2016-08-251-5/+1Star
| | | | | | | | Use gadget's framework allocation function instead of directly calling usb_ep_alloc_request(). Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: f_hid: use free_ep_req()Felipe F. Tonello2016-08-251-7/+3Star
| | | | | | | | We should always use free_ep_req() when allocating requests with alloc_ep_req(). Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: remove useless parameter in alloc_ep_req()Felipe F. Tonello2016-08-256-16/+10Star
| | | | | | | | | | | | The default_length parameter of alloc_ep_req was not really necessary and gadget drivers would almost always create an inline function to pass the same value to len and default_len. This patch removes that parameter and updates all calls to alloc_ep_req() to use the new API. Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc3: Add ENDXFER command pollingJohn Youn2016-08-253-1/+30
| | | | | | | | | | | | ENDXFER polling is available on version 3.10a and later of the DWC_usb3 (USB 3.0) controller. With this feature, the software can poll the CMDACT bit in the DEPCMD register after issuing an ENDXFER command. This feature is enabled by writing GUCTL2[14]. This feature is NOT available on the DWC_usb31 (USB 3.1) IP. Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: phy: mxs: Add DT bindings to configure TX settingsJaret Cantu2016-08-252-0/+71
| | | | | | | | | | | | | | | | | | The TX settings can be calibrated for particular hardware. The phy is reset by Linux, so this cannot be handled by the bootloader. The TRM mentions that the maximum resistance should be used for the DN/DP calibration in order to pass USB certification. The values for the TX registers are poorly described in the TRM. The meanings of the register values were taken from another NXP-provided document: https://community.nxp.com/message/566147#comment-566912 Acked-by: Peter Chen <peter.chen@nxp.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jaret Cantu <jaret.cantu@timesys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* Documentation: dt: dwc3: note the supported phy-namesBrian Norris2016-08-251-1/+2
| | | | | | | | | The dwc3 driver expicitly looks for "usb2-phy" or "usb3-phy", but we never noted these names in the documentation. Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc3: Add revision numbers for the USB 3.0 IPJohn Youn2016-08-251-0/+2
| | | | | | | Add revision number constants for the 3.00a and 3.10a releases. Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: f_fs: handle control requests in config 0Felix Hädicke2016-08-252-2/+4
| | | | | | | | | | | Introduces a new FunctionFS descriptor flag named FUNCTIONFS_CONFIG0_SETUP. When this flag is enabled, FunctionFS userspace drivers can process non-standard control requests in configuration 0. Signed-off-by: Felix Hädicke <felixhaedicke@web.de> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: composite: let USB functions process ctrl reqs in cfg0Felix Hädicke2016-08-254-10/+24
| | | | | | | | | | | | | | | | | | It can sometimes be necessary for gadget drivers to process non-standard control requests, which host devices can send without having sent USB_REQ_SET_CONFIGURATION. Therefore, the req_match() usb_function method is enhanced with the new parameter "config0". When a USB configuration is active, this parameter is false. When a non-core control request is processed in composite_setup(), without an active configuration, req_match() of the USB functions of all available configurations which implement this function, is called with config0=true. Then the control request gets processed by the first usb_function instance whose req_match() returns true. Signed-off-by: Felix Hädicke <felixhaedicke@web.de> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: f_fs: handle control requests not directed to interface or endpointFelix Hädicke2016-08-252-4/+31
| | | | | | | | | | | | | Introduces a new FunctionFS descriptor flag named FUNCTIONFS_ALL_CTRL_RECIP. When this flag is enabled, control requests, which are not explicitly directed to an interface or endpoint, can be handled. This allows FunctionFS userspace drivers to process non-standard control requests. Signed-off-by: Felix Hädicke <felixhaedicke@web.de> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: f_hid: add dev to configfsJohannes Berg2016-08-251-0/+10
| | | | | | | | | | | | | | Even if the /dev/hidg* chardev is automatically created, one has to guess which one belongs to which function. In the case of multiple HID functions, or maybe even multiple peripherals, this becomes difficult. Add the dev (with major and minor number) to configfs to allow looking up (or even creating) the right device node for each function. This file is read-only. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc3: core: Move the mode setting to the right placeBaolin Wang2016-08-251-3/+15
| | | | | | | | | | | | When dwc3 core enters into suspend mode, the system (especially for mobile device) may power off the dwc3 controller for power saving, that will cause dwc3 controller lost the mode operation when resuming dwc3 core. Thus we can move the mode setting into dwc3_core_init() function to avoid this issue. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: f_midi: drop substreams when disabling endpointFelipe F. Tonello2016-08-251-12/+15
| | | | | | | | | | | This change makes sure that the ALSA buffers are cleaned if an endpoint becomes disabled. Before this change, if the internal ALSA buffer did overflow, the MIDI function would stop sending MIDI to the host. Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: f_midi: refactor state machineFelipe F. Tonello2016-08-251-75/+129
| | | | | | | | | | | This refactor results in a cleaner state machine code and promotes consistency, readability, and maintanability of this driver. This refactor state machine was well tested and it is currently running in production code and devices. Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: f_midi: defaults buflen sizes to 512Felipe F. Tonello2016-08-252-2/+2
| | | | | | | | | 512 is the value used by wMaxPacketSize, as specified by the USB Spec. This makes sure this driver uses, by default, the most optimal value for IN and OUT endpoint requests. Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: f_midi: remove alignment code for OUT endpointFelipe F. Tonello2016-08-251-3/+2Star
| | | | | | | | The new version of alloc_ep_req() already aligns the buffer size to wMaxPacketSize on OUT endpoints. Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: align buffer size when allocating for OUT endpointFelipe F. Tonello2016-08-252-1/+18
| | | | | | | | | Using usb_ep_align() makes sure that the buffer size for OUT endpoints is always aligned with wMaxPacketSize (512 usually). This makes sure that no buffer has the wrong size, which can cause nasty bugs. Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: change len to size_t on alloc_ep_req()Felipe F. Tonello2016-08-252-2/+2
| | | | | | | | | Length of buffers should be of type size_t whenever possible. Altough recommended, this change has no real practical change, unless a driver has a uses a huge or negative buffer size - it might help find these bugs. Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_alignFelipe F. Tonello2016-08-251-3/+14
| | | | | | | | | | | | | USB spec specifies wMaxPacketSize to be little endian (as other properties), so when using this variable in the driver we should convert to the current CPU endianness if necessary. This patch also introduces usb_ep_align() which does always returns the aligned buffer size for an endpoint. This is useful to be used by USB requests allocator functions. Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: gadget: Add per-lun inquiry stringPhilipp Gesang2016-08-254-6/+57
| | | | | | | | | | | | | | | | | | Introduce an attribute "inquiry_string" to the lun. In some environments, e. g. BIOS boot menus, the inquiry string is the only information about devices presented to the user. The default string depends on the "cdrom" bit of the first lun as well as the kernel version and allows no further customization. So without access to the client it is not obvious which gadget is active at a given point and what any of the available luns might contain. If "inquiry_string" is ignored or set to the empty string, the old behavior is preserved. Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc3: of-simple: add compatible for rockchip rk3399William Wu2016-08-251-0/+1
| | | | | | | | | Rockchip platform merely enable usb3 clocks and populate its children. So we can use this generic glue layer to support Rockchip dwc3. Signed-off-by: William Wu <william.wu@rock-chips.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc3: rockchip: add devicetree bindings documentationWilliam Wu2016-08-251-0/+59
| | | | | | | | | | | | This patch adds the devicetree documentation required for Rockchip USB3.0 core wrapper consisting of USB3.0 IP from Synopsys. It supports DRD mode, and could operate in device mode (SS, HS, FS) and host mode (SS, HS, FS, LS). Signed-off-by: William Wu <william.wu@rock-chips.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* usb: dwc3: add dis_del_phy_power_chg_quirkWilliam Wu2016-08-253-0/+10
| | | | | | | | | | | Add a quirk to clear the GUSB3PIPECTL.DELAYP1TRANS bit, which specifies whether disable delay PHY power change from P0 to P1/P2/P3 when link state changing from U0 to U1/U2/U3 respectively. Signed-off-by: William Wu <william.wu@rock-chips.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>