dma: cppi41: start tear down only if channel is busy

Start the channel tear down only if the channel is busy, else just
bail out. In some cases its seen that by the time the tear down is
initiated the cppi completes the DMA, especially in ISOCH transfers.

Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
(cherry picked from commit 975faaeb9985af9774007277fdb36b3dc897f4c3)
dma: cppi41: Switch to using managed resource in probe

This change uses managed resource APIs to allocate resources such as,
mem, irq in order to simplify the driver unload or failure cases

Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
(cherry picked from commit f0f3b5fa7537e13dfd20b4cd399f00545f9fc0e7)
usb: musb: cppi41: fix not transmitting zero length packet issue

CPPI TX does not transmit ZLP for TX transfers which
- transfer size is multiple of EP packet size,
- and URB_ZERO_PACKET is set in urb->transfer_flags.

The fix is transmitting the ZLP using PIO mode after the CPPI TX is
done.

Validated using the following usbtest write case in MUSB host mode.

  # testusb -t1 -c1

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 9267edaf8cd7b0ef2cd7785c677fe792c077b6ab)
usb: musb: musb_cppi41: Dont reprogram DMA if tear down is initiated

Reprogramming the DMA after tear down is initiated leads to warning.
This is mainly seen with ISOCH since we do a delayed completion for
ISOCH transfers. In ISOCH transfers dma_completion should not reprogram
if the channel tear down is initiated.

Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit aecbc31d767cb549e93a44e50218e20d1bc66b59)
Merge branch 'test/fix-musb-cppi-3.14.y' into MA-E3xx/linux-3.14.y