aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/musb/musb_gadget.c57
1 files changed, 53 insertions, 4 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 6f3cf4ce8bd6..0a50a35e1853 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -372,7 +372,7 @@ static void txstate(struct musb *musb, struct musb_request *req)
372 372
373 /* MUSB_TXCSR_P_ISO is still set correctly */ 373 /* MUSB_TXCSR_P_ISO is still set correctly */
374 374
375#ifdef CONFIG_USB_INVENTRA_DMA 375#if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_UX500_DMA)
376 { 376 {
377 if (request_size < musb_ep->packet_sz) 377 if (request_size < musb_ep->packet_sz)
378 musb_ep->dma->desired_mode = 0; 378 musb_ep->dma->desired_mode = 0;
@@ -555,7 +555,7 @@ void musb_g_tx(struct musb *musb, u8 epnum)
555 if ((request->zero && request->length 555 if ((request->zero && request->length
556 && (request->length % musb_ep->packet_sz == 0) 556 && (request->length % musb_ep->packet_sz == 0)
557 && (request->actual == request->length)) 557 && (request->actual == request->length))
558#ifdef CONFIG_USB_INVENTRA_DMA 558#if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_UX500_DMA)
559 || (is_dma && (!dma->desired_mode || 559 || (is_dma && (!dma->desired_mode ||
560 (request->actual & 560 (request->actual &
561 (musb_ep->packet_sz - 1)))) 561 (musb_ep->packet_sz - 1))))
@@ -758,6 +758,53 @@ static void rxstate(struct musb *musb, struct musb_request *req)
758 if (use_dma) 758 if (use_dma)
759 return; 759 return;
760 } 760 }
761#elif defined(CONFIG_USB_UX500_DMA)
762 if ((is_buffer_mapped(req)) &&
763 (request->actual < request->length)) {
764
765 struct dma_controller *c;
766 struct dma_channel *channel;
767 int transfer_size = 0;
768
769 c = musb->dma_controller;
770 channel = musb_ep->dma;
771
772 /* In case first packet is short */
773 if (len < musb_ep->packet_sz)
774 transfer_size = len;
775 else if (request->short_not_ok)
776 transfer_size = min(request->length -
777 request->actual,
778 channel->max_len);
779 else
780 transfer_size = min(request->length -
781 request->actual,
782 (unsigned)len);
783
784 csr &= ~MUSB_RXCSR_DMAMODE;
785 csr |= (MUSB_RXCSR_DMAENAB |
786 MUSB_RXCSR_AUTOCLEAR);
787
788 musb_writew(epio, MUSB_RXCSR, csr);
789
790 if (transfer_size <= musb_ep->packet_sz) {
791 musb_ep->dma->desired_mode = 0;
792 } else {
793 musb_ep->dma->desired_mode = 1;
794 /* Mode must be set after DMAENAB */
795 csr |= MUSB_RXCSR_DMAMODE;
796 musb_writew(epio, MUSB_RXCSR, csr);
797 }
798
799 if (c->channel_program(channel,
800 musb_ep->packet_sz,
801 channel->desired_mode,
802 request->dma
803 + request->actual,
804 transfer_size))
805
806 return;
807 }
761#endif /* Mentor's DMA */ 808#endif /* Mentor's DMA */
762 809
763 fifo_count = request->length - request->actual; 810 fifo_count = request->length - request->actual;
@@ -895,7 +942,8 @@ void musb_g_rx(struct musb *musb, u8 epnum)
895 musb_readw(epio, MUSB_RXCSR), 942 musb_readw(epio, MUSB_RXCSR),
896 musb_ep->dma->actual_len, request); 943 musb_ep->dma->actual_len, request);
897 944
898#if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_TUSB_OMAP_DMA) 945#if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_TUSB_OMAP_DMA) || \
946 defined(CONFIG_USB_UX500_DMA)
899 /* Autoclear doesn't clear RxPktRdy for short packets */ 947 /* Autoclear doesn't clear RxPktRdy for short packets */
900 if ((dma->desired_mode == 0 && !hw_ep->rx_double_buffered) 948 if ((dma->desired_mode == 0 && !hw_ep->rx_double_buffered)
901 || (dma->actual_len 949 || (dma->actual_len
@@ -925,7 +973,8 @@ void musb_g_rx(struct musb *musb, u8 epnum)
925 if (!req) 973 if (!req)
926 return; 974 return;
927 } 975 }
928#if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_TUSB_OMAP_DMA) 976#if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_TUSB_OMAP_DMA) || \
977 defined(CONFIG_USB_UX500_DMA)
929exit: 978exit:
930#endif 979#endif
931 /* Analyze request */ 980 /* Analyze request */