usb: renesas_usbhs: add DMAEngine support on mod_host
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 29 Oct 2012 07:45:24 +0000 (00:45 -0700)
committerFelipe Balbi <balbi@ti.com>
Wed, 31 Oct 2012 12:50:29 +0000 (14:50 +0200)
This patch enabled dma mapping, and used dma transfer handler
on mod_host

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/renesas_usbhs/mod_host.c

index 9b69a132329474052486e0483649b6c64a746a4f..e856b449e28aa71f8349476220089f5368b5cc00 100644 (file)
@@ -681,9 +681,9 @@ static int usbhsh_queue_push(struct usb_hcd *hcd,
        }
 
        if (usb_pipein(urb->pipe))
-               pipe->handler = &usbhs_fifo_pio_pop_handler;
+               pipe->handler = &usbhs_fifo_dma_pop_handler;
        else
-               pipe->handler = &usbhs_fifo_pio_push_handler;
+               pipe->handler = &usbhs_fifo_dma_push_handler;
 
        buf = (void *)(urb->transfer_buffer + urb->actual_length);
        len = urb->transfer_buffer_length - urb->actual_length;
@@ -916,6 +916,19 @@ static int usbhsh_dcp_queue_push(struct usb_hcd *hcd,
  */
 static int usbhsh_dma_map_ctrl(struct usbhs_pkt *pkt, int map)
 {
+       if (map) {
+               struct usbhsh_request *ureq = usbhsh_pkt_to_ureq(pkt);
+               struct urb *urb = ureq->urb;
+
+               /* it can not use scatter/gather */
+               if (urb->num_sgs)
+                       return -EINVAL;
+
+               pkt->dma = urb->transfer_dma;
+               if (!pkt->dma)
+                       return -EINVAL;
+       }
+
        return 0;
 }