aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-08-28USB: musb: dsps: add explicit runtime resume at suspendJohan Hovold1-2/+11
The musb_dsps driver is special in that the parent (glue) device's driver is accessing registers mapped by the child. The clock is however shared and is managed by the grandparent device. Since commit 869c59782981 ("usb: musb: dsps: add support for suspend and resume") the dsps driver has been accessing these registers as part of suspend and resume. The parent driver obviously cannot runtime resume the child during system suspend and is currently relying on the fact that the child will be RPM_ACTIVE throughout suspend. The suspend implementation also makes sure to check that the child is indeed present (and hence the clock enabled) before accessing the registers. Let's add an explicit runtime resume of the glue device itself to enable the clock before doing the register accesses in case these assumptions ever change (i.e. if the child is left runtime suspended). Note that the glue-timer cancellation is moved after the child-presence check to keep error handling simple. This should be fine as the timer is not setup until the controller is being registered and at that time glue->musb and its driver data have already been initialised. Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Daniel Mack <zonque@gmail.com> Cc: Tony Lindgren <tony@atomide.com> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28USB: musb: fix external abort on suspendJohan Hovold1-8/+10
Make sure that the controller is runtime resumed when system suspending to avoid an external abort when accessing the interrupt registers: Unhandled fault: external abort on non-linefetch (0x1008) at 0xd025840a ... [<c05481a4>] (musb_default_readb) from [<c0545abc>] (musb_disable_interrupts+0x84/0xa8) [<c0545abc>] (musb_disable_interrupts) from [<c0546b08>] (musb_suspend+0x38/0xb8) [<c0546b08>] (musb_suspend) from [<c04a57f8>] (platform_pm_suspend+0x3c/0x64) This is easily reproduced on a BBB by enabling the peripheral port only (as the host port may enable the shared clock) and keeping it disconnected so that the controller is runtime suspended. (Well, you would also need to the not-yet-merged am33xx-suspend patches by Dave Gerlach to be able to suspend the BBB.) This is a regression that was introduced by commit 1c4d0b4e1806 ("usb: musb: Remove pm_runtime_set_irq_safe") which allowed the parent glue device to runtime suspend and thereby exposed a couple of older issues: Register accesses without explicitly making sure the controller is runtime resumed during suspend was first introduced by commit c338412b5ded ("usb: musb: unconditionally save and restore the context on suspend") in 3.14. Commit a1fc1920aaaa ("usb: musb: core: make sure musb is in RPM_ACTIVE on resume") later started setting the RPM status to active during resume, and this was also implicitly relying on the parent always being active. Since commit 71723f95463d ("PM / runtime: print error when activating a child to unactive parent") this now also results in the following warning: musb-hdrc musb-hdrc.0: runtime PM trying to activate child device musb-hdrc.0 but parent (47401400.usb) is not active This patch has been verified on 4.13-rc2, 4.12 and 4.9 using a BBB (the dsps glue would always be active also in 4.8). Fixes: c338412b5ded ("usb: musb: unconditionally save and restore the context on suspend") Fixes: a1fc1920aaaa ("usb: musb: core: make sure musb is in RPM_ACTIVE on resume") Fixes: 1c4d0b4e1806 ("usb: musb: Remove pm_runtime_set_irq_safe") Cc: stable <stable@vger.kernel.org> # 4.8+ Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Daniel Mack <zonque@gmail.com> Cc: Dave Gerlach <d-gerlach@ti.com> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Tony Lindgren <tony@atomide.com> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28usb: musb: fix endpoint fifo allocation for 4KB fifo memoryBin Liu1-2/+2
The fifo memory allocation in mode_2_cfg[] doesn't utilize all the 4KB memory. Increse some endpoint fifo buffers to fully use all the 4KB memory. Now we can support more webcam usecases on DA8xx. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28usb: musb: print an error message when high bandwidth is unsupportedBin Liu1-0/+4
There are multiple places in usb core or controller driver which returns -EMSGSIZE when a class driver queueing urb failed, so the "Message too long" log doesn't help much for understanding the error. Let the musb driver to specifically print a error message when musb_urb_enqueue() returns -EMSGSIZE. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28usb: musb: print an error message when hwep alloc failedBin Liu1-0/+4
Print an error message with qh maxpacket size and hb_mult when hwep allocation failed, so we have a better idea why it is failed. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28usb: musb: add helper function musb_ep_xfertype_stringBin Liu2-5/+25
Add helper function musb_ep_xfertype_string() to return the ep transfer type string. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-30usb: musb: fix tx fifo flush handling againBin Liu1-0/+1
commit 68fe05e2a451 ("usb: musb: fix tx fifo flush handling") drops the 1ms delay trying to solve the long disconnect time issue when application queued many tx urbs. However, the 1ms delay is needed for some use cases, for example, without the delay, reconnecting AR9271 WIFI dongle no longer works if the connection is dropped from the AP. So let's add back the 1ms delay in musb_h_tx_flush_fifo(), and solve the long disconnect time problem with a separate patch for usb_hcd_flush_endpoint(). Cc: stable@vger.kernel.org # v4.4+ Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-27usb: musb: compress return logic into one lineGustavo A. R. Silva1-4/+2
Simplify return logic to avoid unnecessary variable assignment. Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Acked-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20usb: musb: tusb6010_omap: Convert to DMAengine APIPeter Ujfalusi1-121/+80
With the port_window support in DMAengine and the sDMA driver we can convert the driver to DMAengine. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20usb: musb: tusb6010: Handle DMA TX completion in DMA callback as wellPeter Ujfalusi2-48/+4
Handle the DMA TX in a similar way as we do for the RX: in the DMA completion callback. Since we are no longer using DMA completion interrupt for the TX we can as wall keep these interrupts disabled, but keep the handler for debug purposes. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20usb: musb: tusb6010_omap: Allocate DMA channels upfrontPeter Ujfalusi1-93/+92
Instead of requesting the DMA channel in tusb_omap_dma_allocate() do it when the controller is created and in runtime work from the DMA channel pool. This change is needed for the DMAengine conversion of the driver since the tusb_omap_dma_allocate() is called in interrupt context which might lead to lock within the DMAengine API when requesting channel. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20usb: musb: tusb6010_omap: Create new struct for DMA data/parametersPeter Ujfalusi1-79/+85
For the DMA we have ch (channel), dmareq and sync_dev parameters both within the tusb_omap_dma_ch and tusb_omap_dma struct. By creating a common struct the code can be simplified when selecting between the shared or multichannel DMA parameters. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20usb: musb: tusb6010_omap: Use one musb_ep_select call in tusb_omap_dma_programPeter Ujfalusi1-2/+1
Having one musb_ep_select() instead the two calls in if/else is the same thing, but makes the code a bit simpler to follow. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20usb: musb: tusb6010: Add MUSB_G_NO_SKB_RESERVE to quirksPeter Ujfalusi1-1/+2
When using the g_ncm for networking this flag will make sure that the buffer is aligned to 32bit so the DMA can be used to offload the data movement. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20usb: musb: Add quirk to avoid skb reserve in gadget modePeter Ujfalusi2-0/+4
For tusb6010 the DMA functionality only possible if the buffer is 32bit aligned (SYNC access to FIFO) since with ASYNC access the TX/RX offset registers will corrupt eventually. The MUSB_G_NO_SKB_RESERVE will set the quirk_avoids_skb_reserve flag in usb_gadget struct to provide correctly aligned buffer. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20usb: musb: musb_cppi41: Defer probe only if DMA is not readyAlexandre Bailon1-4/+7
If dma_request_slave_channel() failed to return a channel, then the driver will print an error and request to defer probe, regardless of the cause of the failure. Defer if the DMA is not ready yet otherwise print an error. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Reviewed-by: Johan Hovold <johan@kernel.org> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-27usb: musb: dsps: keep VBUS on for host-only modeBin Liu1-0/+5
Currently VBUS is turned off while a usb device is detached, and turned on again by the polling routine. This short period VBUS loss prevents usb modem to switch mode. VBUS should be constantly on for host-only mode, so this changes the driver to not turn off VBUS for host-only mode. Fixes: 2f3fd2c5bde1 ("usb: musb: Prepare dsps glue layer for PM runtime support") Cc: stable@vger.kernel.org #v4.11 Reported-by: Moreno Bartalucci <moreno.bartalucci@tecnorama.it> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18usb: musb: tusb6010_omap: Do not reset the other direction's packet sizePeter Ujfalusi1-4/+9
We have one register for each EP to set the maximum packet size for both TX and RX. If for example an RX programming would happen before the previous TX transfer finishes we would reset the TX packet side. To fix this issue, only modify the TX or RX part of the register. Fixes: 550a7375fe72 ("USB: Add MUSB and TUSB support") Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18usb: musb: Fix trying to suspend while active for OTG configurationsTony Lindgren1-4/+5
Commit d8e5f0eca1e8 ("usb: musb: Fix hardirq-safe hardirq-unsafe lock order error") caused a regression where musb keeps trying to enable host mode with no cable connected. This seems to be caused by the fact that now phy is enabled earlier, and we are wrongly trying to force USB host mode on an OTG port. The errors we are getting are "trying to suspend as a_idle while active". For ports configured as OTG, we should not need to do anything to try to force USB host mode on it's OTG port. Trying to force host mode in this case just seems to completely confuse the musb state machine. Let's fix the issue by making musb_host_setup() attempt to force the mode only if port_mode is configured for host mode. Fixes: d8e5f0eca1e8 ("usb: musb: Fix hardirq-safe hardirq-unsafe lock order error") Cc: Johan Hovold <johan@kernel.org> Cc: stable <stable@vger.kernel.org> Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-26usb: musb: don't mark of_dev_auxdata as initdataArnd Bergmann1-1/+1
The probe function is not __init since it can be called for deferred probing or when unbinding/rebinding the device, and therefore it must not reference objects in __initdata, as pointed out by this link time warning: WARNING: drivers/usb/musb/da8xx.o(.text+0x9d4): Section mismatch in reference from the function da8xx_probe() to the (unknown reference) .init.data:(unknown) This removes the annotation. Reported-by: Olof's autobuilder <olof@lixom.net> Fixes: d6299b6efbf6 ("usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18usb: musb: musb_cppi41: Workaround DMA stall issue during teardownAlexandre Bailon3-1/+6
The DMA may hang up if a teardown is initiated while an endpoint is still active (Advisory 2.3.27 of DA8xx errata). To workaround this issue, add a delay before to initiate the teardown. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18usb: musb: Add support of CPPI 4.1 DMA controller to DA8xxAlexandre Bailon2-3/+44
Currently, only the PIO mode is supported. This add support of CPPI 4.1 to DA8xx. As in DA8xx the CPPI 4.1 DMA is a part of the USBSS, create the CPPI 4.1 device as a child of USB. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> [b-liu@ti.com: minor tweak in the commit log] Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18usb: musb: Use shared irqAlexandre Bailon1-1/+1
In the DA8xx, USB and CPPI 4.1 are sharing the same interrupt line. Update the driver to request a shared irq. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-18usb: musb: cppi_dma.c: use DIV_ROUND_UP macro in cppi_next_(r|t)x_segment()Ivan Safonov1-6/+5
DIV_ROUND_UP is bit useful than series of "/" and "%" operations. Replace "/%" sequence with DIV_ROUND_UP macro. Signed-off-by: Ivan Safonov <insafonov@gmail.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14usb: musb: fix possible spinlock deadlockBin Liu1-1/+1
The DSPS glue calls del_timer_sync() in its musb_platform_disable() implementation, which requires the caller to not hold a lock. But musb_remove() calls musb_platform_disable() will musb->lock held. This could causes spinlock deadlock. So change musb_remove() to call musb_platform_disable() without holds musb->lock. This doesn't impact the musb_platform_disable implementation in other glue drivers. root@am335x-evm:~# modprobe -r musb-dsps [ 126.134879] musb-hdrc musb-hdrc.1: remove, state 1 [ 126.140465] usb usb2: USB disconnect, device number 1 [ 126.146178] usb 2-1: USB disconnect, device number 2 [ 126.416985] musb-hdrc musb-hdrc.1: USB bus 2 deregistered [ 126.423943] [ 126.425525] ====================================================== [ 126.431997] [ INFO: possible circular locking dependency detected ] [ 126.438564] 4.11.0-rc1-00003-g1557f13bca04-dirty #77 Not tainted [ 126.444852] ------------------------------------------------------- [ 126.451414] modprobe/778 is trying to acquire lock: [ 126.456523] (((&glue->timer))){+.-...}, at: [<c01b8788>] del_timer_sync+0x0/0xd0 [ 126.464403] [ 126.464403] but task is already holding lock: [ 126.470511] (&(&musb->lock)->rlock){-.-...}, at: [<bf30b7f8>] musb_remove+0x50/0x1 30 [musb_hdrc] [ 126.479965] [ 126.479965] which lock already depends on the new lock. [ 126.479965] [ 126.488531] [ 126.488531] the existing dependency chain (in reverse order) is: [ 126.496368] [ 126.496368] -> #1 (&(&musb->lock)->rlock){-.-...}: [ 126.502968] otg_timer+0x80/0xec [musb_dsps] [ 126.507990] call_timer_fn+0xb4/0x390 [ 126.512372] expire_timers+0xf0/0x1fc [ 126.516754] run_timer_softirq+0x80/0x178 [ 126.521511] __do_softirq+0xc4/0x554 [ 126.525802] irq_exit+0xe8/0x158 [ 126.529735] __handle_domain_irq+0x58/0xb8 [ 126.534583] __irq_usr+0x54/0x80 [ 126.538507] [ 126.538507] -> #0 (((&glue->timer))){+.-...}: [ 126.544636] del_timer_sync+0x40/0xd0 [ 126.549066] musb_remove+0x6c/0x130 [musb_hdrc] [ 126.554370] platform_drv_remove+0x24/0x3c [ 126.559206] device_release_driver_internal+0x14c/0x1e0 [ 126.565225] bus_remove_device+0xd8/0x108 [ 126.569970] device_del+0x1e4/0x308 [ 126.574170] platform_device_del+0x24/0x8c [ 126.579006] platform_device_unregister+0xc/0x20 [ 126.584394] dsps_remove+0x14/0x30 [musb_dsps] [ 126.589595] platform_drv_remove+0x24/0x3c [ 126.594432] device_release_driver_internal+0x14c/0x1e0 [ 126.600450] driver_detach+0x38/0x6c [ 126.604740] bus_remove_driver+0x4c/0xa0 [ 126.609407] SyS_delete_module+0x11c/0x1e4 [ 126.614252] __sys_trace_return+0x0/0x10 Fixes: ea2f35c01d5ea ("usb: musb: Fix sleeping function called from invalid context for hdrc glue") Cc: <stable@vger.kernel.org> #4.9+ Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14usb: musb: dsps: fix iounmap in error and exit pathsBin Liu1-1/+4
Cleanly iounmap the pointer in error and exit paths. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14usb: musb: cppi41: don't check early-TX-interrupt for Isoch transferBin Liu1-2/+21
The CPPI 4.1 driver polls register to workaround the premature TX interrupt issue, but it causes audio playback underrun when triggered in Isoch transfers. Isoch doesn't do back-to-back transfers, the TX should be done by the time the next transfer is scheduled. So skip this polling workaround for Isoch transfer. Fixes: a655f481d83d6 ("usb: musb: musb_cppi41: handle pre-mature TX complete interrupt") Cc: <stable@vger.kernel.org> #4.1+ Reported-by: Alexandre Bailon <abailon@baylibre.com> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Tested-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-14usb: musb: add code comment for clarificationGustavo A. R. Silva1-0/+1
Add code comment to make it clear that the fall-through is intentional. Read the link for more details: https://lkml.org/lkml/2017/2/9/292 Addresses-Coverity-ID: 1397608 Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-09usb: musb: dsps: Manage CPPI 4.1 DMA interrupt in DSPSAlexandre Bailon1-2/+79
Despite the CPPI 4.1 is a generic DMA, it is tied to USB. On the DSPS, CPPI 4.1 interrupt's registers are in USBSS (the MUSB glue). Currently, to enable / disable and clear interrupts, the CPPI 4.1 driver maps and accesses to USBSS's register, which making CPPI 4.1 driver not really generic. Move the interrupt management to DSPS driver. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-09usb: musb: tusb6010: Clean up tusb_omap_dma structureAlexandre Bailon1-4/+3
A pointer to musb is now present in the dma_controller structure. Remove the one present in tusb_omap_dma structure. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-09usb: musb: cppi_dma: Clean up cppi41_dma_controller structureAlexandre Bailon1-16/+13
A pointer to musb is now present in the dma_controller structure. Remove the one present in cppi41_dma_controller structure. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-09usb: musb: cppi_dma: Clean up cppi structureAlexandre Bailon2-14/+13
A pointer to musb is now present in the dma_controller structure. Remove the one present in cppi structure. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-09usb: musb: cppi41: Detect aborted transfers in cppi41_dma_callback()Alexandre Bailon1-4/+9
Update cppi41_dma_callback() to detect an aborted transfer. This was not required before because cppi41_dma_callback() was only invoked on transfer completion. In order to make CPPI 4.1 driver more generic, cppi41_dma_callback() will be invoked after a transfer abort in order to let the MUSB driver perform some action such as acknowledge the interrupt that may be fired during a teardown. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-09usb: musb: dma: Add a DMA completion platform callbackAlexandre Bailon2-2/+10
Currently, the CPPI 4.1 driver is not completely generic and only works on DSPS. This is because of IRQ management. Add a callback to dma_controller that could be invoked on DMA completion to acknowledge the IRQ. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-06Merge 4.10-rc7 into usb-nextGreg Kroah-Hartman2-14/+13
We want the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: dsps: make dsps_musb_clear_ep_rxintr() staticWei Yongjun1-1/+1
Fixes the following sparse warning: drivers/usb/musb/musb_dsps.c:270:6: warning: symbol 'dsps_musb_clear_ep_rxintr' was not declared. Should it be static? Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: sunxi: add support for the variant in H3/V3s SoCIcenowy Zheng1-2/+33
Allwinner H3/V3s features a variant of MUSB controller, which lacks one endpoint. Add support for it. Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> [b-liu@ti.com: added usb: to commit subject prefix] Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: omap2430: constify dev_pm_ops structuresBhumika Goyal1-1/+1
Declare dev_pm_ops structures as const as they are only stored in the pm field of a device_driver structure. This field is of type const, so dev_pm_ops structures having similar properties can be declared const too. Size details after cross compiling the .o file for arm architecture. File size before: drivers/usb/musb/omap2430.o text data bss dec hex filename 4141 400 8 4549 11c5 usb/musb/omap2430.o File size after: drivers/usb/musb/omap2430.o text data bss dec hex filename 4333 200 8 4541 11bd usb/musb/omap2430.o Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> [b-liu@ti.com: added omap2430 in commit subject prefix] Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: Add support for optional VBUS irq to dsps glue layerTony Lindgren1-24/+93
We can now configure the PMIC interrupt to provide us VBUS events. In that case we don't need to constantly poll the status and can make it optional. This is only wired up for the mini-B interface on beaglebone. Note that eventually we should get also the connect status for the host interface when the am335x internal PM coprocessor provides us with an IRQ chip. For now, we still need to poll for the host mode status. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: blackfin: fix unused warnings on suspend/resumeJérémy Lefaure1-4/+2
When CONFIG_PM_SLEEP is disabled, SIMPLE_DEV_PM_OPS does not use bfin_resume and bfin_suspend even if CONFIG_PM is enabled: drivers/usb/musb/blackfin.c:602:12: warning: ‘bfin_resume’ defined but not used [-Wunused-function] static int bfin_resume(struct device *dev) ^~~~~~~~~~~ drivers/usb/musb/blackfin.c:585:12: warning: ‘bfin_suspend’ defined but not used [-Wunused-function] static int bfin_suspend(struct device *dev) ^~~~~~~~~~~~ The preprocessor condition should be on CONFIG_PM_SLEEP, not on CONFIG_PM. However it is better to mark these functions as __maybe_unused. Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: dsps: switch to static id for musb-hdrc platform devicesBin Liu1-1/+2
The dsps glue uses PLATFORM_DEVID_AUTO when creating the musb-hdrc platform devices, this causes that the id will change in each system depending on the order of driver probe, the order of the usb instances defined in device-tree, or the list of enabled devices which use also PLATFORM_DEVID_AUTO in kernel config. This id inconsistency causes trouble in shell scripting or user guide documentation. So switch it to static id, starting from 0 to the musb instance with lower MMR offset. This scheme is also aligned to the naming in the SoC. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: debugfs: allow forcing host mode together with speed in testmodePali Rohár1-17/+29
Based on the musb ug, force_host bit is allowed to be set along with force_hs or force_fs bit. It could help to implement forced host mode via testmode on Nokia N900. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: sunxi: Uses the resource-managed extcon API when registering extcon notifierChanwoo Choi1-9/+3
This patch just uses the resource-managed extcon API when registering the extcon notifier. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: da8xx: Fix host mode suspendAlexandre Bailon1-1/+1
On da8xx, VBUS is not maintained during suspend when musb is in host mode. On resume, all the connected devices will be disconnected and then will be enumerated again. This happens because MUSB_DEVCTL is cleared during suspend. Use the quirk MUSB_PRESERVE_SESSION to preseve MUSB_DEVCTL during suspend. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: Add a quirk to preserve the session during suspendAlexandre Bailon2-1/+3
On da8xx, VBUS is not maintained during suspend when musb is in host mode. On resume, all the connected devices will be disconnected and then will be enumerated again. This happens because MUSB_DEVCTL is cleared during suspend. Add a quirk to not clear MUSB_DEVCTL and then preserve the session during a suspend. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: da8xx: Add support of suspend / resumeAlexandre Bailon1-0/+29
Implement PM methods specifics for da8xx glue. The only thing to do is to power off the phy. As the registers are in retention during suspend, there is no need to save them. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: davinci: remove redundant codeBin Liu1-1/+0
The session is cleared in the core whenever musb_platform_disable() is called, so clearing it in the glue driver *_musb_disable() is redundant. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: am35x: remove redundant codeBin Liu1-1/+0
The session is cleared in the core whenever musb_platform_disable() is called, so clearing it in the glue driver *_musb_disable() is redundant. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: da8xx: remove redundant codeBin Liu1-1/+0
The session is cleared in the core whenever musb_platform_disable() is called, so clearing it in the glue driver *_musb_disable() is redundant. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-03usb: musb: dsps: remove redundant codeBin Liu1-1/+0
The session is cleared in the core whenever musb_platform_disable() is called, so clearing it in the glue driver *_musb_disable() is redundant. Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>