summaryrefslogtreecommitdiff
path: root/drivers/usb/musb
AgeCommit message (Collapse)Author
2015-11-17usb: musb: enable usb_dma parameterBin Liu
Change the permission of usb_dma parameter so it can be used for runtime debug without reboot. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-11-17usb: musb: fix tx fifo flush handlingBin Liu
Here are a few changes in musb_h_tx_flush_fifo(). - It has been observed that sometimes (if not always) musb is unable to flush tx fifo during urb dequeue when disconnect a device. But it seems to be harmless, since the tx fifo flush is done again in musb_ep_program() when re-use the hw_ep. But the WARN() floods the console in the case when multiple tx urbs are queued, so change it to dev_WARN_ONCE(). - applications could queue up many tx urbs, then the 1ms delay could causes minutes of delay in device disconnect. So remove it to get better user experience. The 1ms delay does not help the flushing anyway. - cleanup the debug code - related to lastcsr. ---- Note: The tx fifo flush issue has been observed during device disconnect on AM335x. To reproduce the issue, ensure tx urb(s) are queued when unplug the usb device which is connected to AM335x usb host port. I found using a usb-ethernet device and running iperf (client on AM335x) has very high chance to trigger the problem. Better to turn on dev_dbg() in musb_cleanup_urb() with CPPI enabled to see the issue when aborting the tx channel. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-11-16usb: musb: core: fix order of arguments to ulpi write callbackUwe Kleine-König
There is a bit of a mess in the order of arguments to the ulpi write callback. There is int ulpi_write(struct ulpi *ulpi, u8 addr, u8 val) in drivers/usb/common/ulpi.c; struct usb_phy_io_ops { ... int (*write)(struct usb_phy *x, u32 val, u32 reg); } in include/linux/usb/phy.h. The callback registered by the musb driver has to comply to the latter, but up to now had "offset" first which effectively made the function broken for correct users. So flip the order and while at it also switch to the parameter names of struct usb_phy_io_ops's write. Fixes: ffb865b1e460 ("usb: musb: add ulpi access operations") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-11-05Merge tag 'usb-4.4-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb Pull USB updates from Greg KH: "Here is the big USB patchset for 4.4-rc1. As usual, most of the changes are in the gadget subsystem, and we removed a host controller for a device that is no longer in existance, and probably never was even made public. There is also other minor driver updates and new device ids, full details in the changelog. All of these have been in linux-next for a while" * tag 'usb-4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (233 commits) USB: core: Codestyle fix in urb.c usb: misc: usb3503: Use i2c_add_driver helper macro usb: host: lpc32xx: don't unregister phy device usb: host: lpc32xx: balance clk enable/disable on removal usb: host: lpc32xx: fix warnings caused by enabling unprepared clock uwb: drp: Use setup_timer uwb: neh: Use setup_timer uwb: rsv: Use setup_timer USB: qcserial: add Sierra Wireless MC74xx/EM74xx usb: chipidea: otg: don't wait vbus drops below BSV when starts host chipidea: ci_hdrc_pci: use PCI_VDEVICE() instead of PCI_DEVICE() doc: dt-binding: ci-hdrc-usb2: split vendor specific properties usb: chipidea: imx: add imx6ul usb support doc: dt-binding: ci-hdrc-usb2: improve property description usb: chipidea: imx: add usb support for imx7d Doc: usb: ci-hdrc-usb2: Add phy-clkgate-delay-us entry usb: chipidea: Add support for 'phy-clkgate-delay-us' property usb: chipidea: Use extcon framework for VBUS and ID detect usb: gadget: net2280: restore ep_cfg after defect7374 workaround usb: dwc2: host: Fix use after free w/ simultaneous irqs ...
2015-10-28usb: musb: omap2430: Fix regression caused by driver core changeTony Lindgren
Commit ddef08dd00f5 ("Driver core: wakeup the parent device before trying probe") started automatically ensuring the parent device is enabled when the child gets probed. This however caused a regression for MUSB omap2430 interface as the runtime PM for the parent device needs the child initialized to access the MUSB hardware registers. Let's delay the enabling of PM runtime for the parent until the child has been properly initialized as suggested in an earlier patch by Grygorii Strashko <grygorii.strashko@ti.com>. In addition to delaying pm_runtime_enable, we now also need to make sure the parent is enabled during omap2430_musb_init. We also want to propagate an error from omap2430_runtime_resume if struct musb is not initialized. Note that we use pm_runtime_put_noidle here for both the child and parent to prevent an extra runtime_suspend/resume cycle. Let's also add some comments to avoid confusion between the two different devices. Fixes: ddef08dd00f5 ("Driver core: wakeup the parent device before trying probe") Suggested-by: Grygorii Strashko <grygorii.strashko@ti.com> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
2015-10-16usb: musb: core: add common method of getting vbus statusRoman Alyautdin
Fix musb_platform_get_vbus_status return value in case of platform implementation is not defined, bringing expected behaviour of musb_platform_get wrapper. Add musb_vbus_show default method to determine VBUS status in case platform method is not defined. Signed-off-by: Roman Alyautdin <ralyautdin@dev.rtsoft.ru> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-10-09musb: sunxi: Make sunxi musb glue work without MUSB_PIO_ONLYHans de Goede
Now that it is possible to build in multiple dma engines, we can no longer require MUSB_PIO_ONLY to be set when using the sunxi musb glue. This patch adds dummy dma hooks to make the musb glue work without MUSB_PIO_ONLY. This hooks are fake because we do not support dma with musb on sunxi. The Allwinnner Android kernels have some dma code, but it is disabled as Allwinner never managed to get it to work. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27usb: common: of_usb_get_dr_mode to usb_get_dr_modeHeikki Krogerus
By using the unified device property interface, the function can be made available for all platforms and not just the ones using DT. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27usb: common: of_usb_get_maximum_speed to usb_get_maximum_speedHeikki Krogerus
By using the unified device property interface, the function can be made available for all platforms and not just the ones using DT. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27usb: musb: dsps: control musb speed based on dts settingBin Liu
Set musb config->maximum_speed based on the dts setting to control musb speed. By default musb works in high-speed mode. Adding maximum-speed = "full-speed"; to dts usb node will force musb to full-speed mode. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27usb: musb: set the controller speed based on the config settingBin Liu
Set the Power register HSENAB bit based on musb->config->maximum_speed, so that the glue layer can control MUSB to work in high- or full-speed. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21usb: musb: fix cppi channel teardown for isoch transferBin Liu
After a few iterations of start/stop UVC camera streaming, the streaming stops. This patch adds 250us delay in the cppi channel abort path to let cppi drain properly. Using 50us delay seems to be too aggressive, some webcams are still broken. 250us is the original value used in TI 3.2 kernel. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21usb: musb: dsps: fix polling in device-only modeBin Liu
Fix the regression caused by commit ad78c918602 ("usb: musb: dsps: just start polling already") which causes polling the ID pin status even in device-only mode. Fixes: ad78c918602c ("usb: musb: dsps: just start polling already") Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-14usb: musb: ux500: Fix module autoload for OF platform driverLuis de Bethencourt
This platform driver has a OF device ID table but the OF module alias information is not created so module autoloading won't work. Signed-off-by: Luis de Bethencourt <luis@debethencourt.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-14usb: musb: Disable interrupts on suspend, enable them on resumePascal Huerst
In certain situations, an interrupt triggers on resume, before musb_start() has been called. This has been observed to cause enumeration issues after suspend/resume cycles with AM335x. Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-14usb: musb: ensure in peripheral mode when checking sessionBin Liu
The change ensures otg is not in a A- state when checking for VBUS in peripheral mode. musb_start() where VBUS checking is in can be called in many situations. One example is in babble recovery routine, in which otg is transitioning from A-HOST to A-WAIT-BCON, but VBUS discharge takes time, so musb->is_active could be set to 1 due to this improper checking, then it causes musb_bus_suspend() failed which leads to warning log message flooding. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-07usb: musb: gadget: fix build break by adding missing 'break'Robert Baldyga
Add missing break after 'default' label to fix compilation error. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-06usb: musb: cppi41: allow it to work againFelipe Balbi
since commit 33c300cb90a6 ("usb: musb: dsps: don't fake of_node to musb core") we have been preventing CPPI 4.1 from probing due to NULL of_node. We can't revert said commit otherwise a different regression would show up, so the fix is to look for the parent device's (glue layer's) of_node instead, since that's the thing which is actually described in DTS. Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-06usb: musb: gadget: remove remaining DMA ifdeferryFelipe Balbi
Commit fb91cddc54e7 ("usb: musb: Remove DMA ifdef for musb_gadget.c short_packet") tried to remove DMA ifdeferry from musb_gadget.c but ended up leaving some around. Remove them so that when building kernels with all DMA engines enabled, we don't end up trying to allocte channels twice. Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-06usb: musb: gadget: add musb_match_ep() functionRobert Baldyga
Add 'match_ep' callback to utilize chip-specific knowledge in endpoint matching process. Function does the same that was done by chip-specific code inside of epautoconf. Now this code can be removed from there to separate generic code from platform specific logic. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04usb: musb: gadget: add ep capabilities supportRobert Baldyga
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04usb: musb: musb_dsps: Simplify return statementSaurabh Karajgaonkar
Replace redundant variable use in return statement. Signed-off-by: Saurabh Karajgaonkar <skarajga@visteon.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-03usb: musb: Allow building in all the DMA codeTony Lindgren
With recent changes to MUSB code, we can now now get rid of the Kconfig choise for the DMA code and allow building in any of the desired DMA code. This makes life easier for distros. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-07-30usb: gadget: add 'quirk_zlp_not_supp' to usb_gadgetRobert Baldyga
Due to some UDC controllers may not support zlp, usb gadget layer needs to provide a generic way to inform gadget functions about non-standard hardware limitations. This patch adds 'quirk_zlp_not_supp' field to struct usb_gadget and helper function gadget_is_zlp_supported(). It also sets 'quirk_zlp_not_supp' to 1 in musb UDC driver, which has such limitation. [ balbi@ti.com : make it build ] Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-07-29usb: musb: sunxi: Add support for musb controller in A33 SoCHans de Goede
The A33 SoC uses the same musb controller as found on the A31 and later, but allwinner has removed the configdata register, this commit adds special handling for this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-07-29usb: musb: sunxi: Add support for musb controller in A31 SoCHans de Goede
The A31 SoC uses the same musb controller as found in earlier SoCs, but it is hooked up slightly different. Its SRAM is private and no longer controlled through the SRAM controller, and its reset is controlled via a separate reset controller. This commit adds support for this setup. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-07-29usb: musb: sunxi: Add support for the Allwinner sunxi musb controllerHans de Goede
This is based on initial code to get the Allwinner sunxi musb controller supported by Chen-Yu Tsai and Roman Byshko. This adds support for the Allwinner sunxi musb controller in both host only and otg mode. Peripheral only mode is not supported, as no boards use that. This has been tested on a cubietruck (A20 SoC) and an UTOO P66 tablet (A13 SoC) with a variety of devices in host mode and with the g_serial gadget driver in peripheral mode, plugging otg / host cables in/out a lot of times in all possible imaginable plug orders. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-07-06usb: musb: host: rely on port_mode to call musb_start()Felipe Balbi
Currently, we're calling musb_start() twice for DRD ports in some situations. This has been observed to cause enumeration issues after suspend/resume cycles with AM335x. In order to fix the problem, we just have to fix the check on musb_has_gadget() so that it only returns true if current mode is Host and ignore the fact that we have or not a gadget driver loaded. Fixes: ae44df2e21b5 (usb: musb: call musb_start() only once in OTG mode) Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: <stable@vger.kernel.org> # v3.11+ Tested-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-06-08Merge 4.1-rc7 into usb-nextGreg Kroah-Hartman
This resolves a merge issue in musb_core.c and we want the fixes that were in Linus's tree in this branch as well for testing. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-27usb: musb: ux500: fix build warningsFelipe Balbi
This patch fixes the following build warnings: drivers/usb/musb/ux500.c:346:12: warning: ‘ux500_suspend’ defined but not used [-Wunused-function] drivers/usb/musb/ux500.c:357:12: warning: ‘ux500_resume’ defined but not used [-Wunused-function] Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-27usb: musb: am35x: fix build warningsFelipe Balbi
This patch fixes the following build warnings: drivers/usb/musb/am35x.c:573:12: warning: ‘am35x_suspend’ defined but not used [-Wunused-function] drivers/usb/musb/am35x.c:589:12: warning: ‘am35x_resume’ defined but not used [-Wunused-function] drivers/usb/musb/am35x.c:573:12: warning: ‘am35x_suspend’ defined but not used [-Wunused-function] drivers/usb/musb/am35x.c:589:12: warning: ‘am35x_resume’ defined but not used [-Wunused-function] Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-26usb: musb: Fix platform code being unable to override ep access opsHans de Goede
musb-core was setting the ops to the default indexed or flat handlers after checking for platform overrides. Reverse the order of this so that platform overrides actually work. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-26usb: musb: Do not use musb_read[b|w] / _write[b|w] wrappers in generic fifo ↵Hans de Goede
functions The generic fifo functions already use non wrapped accesses in various cases through the iowrite#_rep functions, and all platforms which override the default musb_read[b|w] / _write[b|w] functions also provide their own fifo access functions, so we can safely drop the unnecessary indirection from the fifo access functions. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-26usb: musb: Make busctl_offset an io-op rather then a defineHans de Goede
The Allwinner (sunxi) implementation of the musb has its busctl registers indexed by the MUSB_INDEX register rather then in a flat address space. This commit turns MUSB_BUSCTL_OFFSET from a macro into an io-op which can be overridden from the platform ops. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-26usb: musb: Make musb_write_rxfun* and musb_write_rxhub* work like their tx ↵Hans de Goede
versions For some reason the musb_write_rxfun* and musb_write_rxhub* functions had a different function prototype and some extra magic needed on the caller side compared to their tx counterparts, this commit makes them work the same as their tx counterparts. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-26usb: musb: Add pre and post root port reset end callbacksHans de Goede
The sunxi otg phy has a bug where it wrongly detects a high speed squelch when reset on the root port gets de-asserted with a lo-speed device. The workaround for this is to disable squelch detect before de-asserting reset, and re-enabling it after the reset de-assert is done. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-26usb: musb: fix order of conditions for assigning end point operationsBen Hutchings
Currently we always assign one of the two common implementations of ep_offset and ep_select operations, overwriting any platform-specific implementations. Fixes: d026e9c76aac ("usb: musb: Change end point selection to use ...") Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07usb: musb: add softconnect for host modeBin Liu
Add a debugfs interface - softconnect - for host mode to connect/disconnect the devices without physically remove the them. This adds the capability to re-enumerate the devices which are permanently mounted on the board with the MUSB controller together. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07usb: musb: Remove ifdefs for musb_host_rx in musb_host.c part5Tony Lindgren
Remove ifdefs for musb_host_rx to get closer to building in all the DMA drivers. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07usb: musb: Remove ifdefs for musb_host_rx in musb_host.c part4Tony Lindgren
Remove ifdefs for musb_host_rx to get closer to building in all the DMA drivers. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07usb: musb: Remove ifdefs for musb_host_rx in musb_host.c part3Tony Lindgren
Remove ifdefs for musb_host_rx to get closer to building in all the DMA drivers. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07usb: musb: Remove ifdefs for musb_host_rx in musb_host.c part2Tony Lindgren
Remove ifdefs for musb_host_rx to get closer to building in all the DMA drivers. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07usb: musb: Remove ifdefs for musb_host_rx in musb_host.c part1Tony Lindgren
Remove ifdefs for musb_host_rx to get closer to building in all the DMA drivers. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07usb: musb: Remove ifdefs for TX DMA for musb_host.cTony Lindgren
We can remove the ifdefs by setting up helper functions for mentor DMA and cppi/tusb DMA. Note that I've kept the existing formatting as otherwise this patch becomes pretty much unreadable. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07usb: musb: Remove DMA ifdef for musb_gadget.c short_packetTony Lindgren
Let's get rid of the horrible ifdef in middle of the expression. We can do it by adding a variable for short_packet and testing it separately for DMA related code. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07usb: musb: Get rid of the DMA ifdefs for musb_core.cTony Lindgren
For musb_core.c we can now just drop the DMA related ifdef and use the already existing runtime test for !is_cppi_enabled(musb) instead. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07usb: musb: Set up function pointers for DMATony Lindgren
Set up function pointers for DMA so get closer to being able to build in all the DMA engines. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-07usb: musb: Fix up DMA related macrosTony Lindgren
Pass struct musb to tusb_dma_omap() and is_cppi_enabled(), and add macros for the other DMA controllers. Populate the platform specific quirks with the DMA type and use it during runtime. Note that platform glue layers with no custom DMA code are tagged with MUSB_DMA_INVENTRA which may have a chance of working. Looks like the defconfigs for these use PIO_ONLY, so this should not break existing configs. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-04-27usb: musb: only set test mode onceBin Liu
The MUSB test mode register can only be set once, otherwise the result is undefined. This prevents the debugfs testmode entry to set the register more than once which causes test failure. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-04-27usb: musb: fix inefficient copy of unaligned buffersJohan Hovold
Make sure only to copy any actual data rather than the whole buffer, when releasing the temporary buffer used for unaligned non-isochronous transfers. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Felipe Balbi <balbi@ti.com>