aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb
diff options
context:
space:
mode:
authorMaulik Mankad <x0082077@ti.com>2010-09-24 06:44:06 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 13:21:53 -0400
commit496dda704bca1208e08773ba39b29a69536f5381 (patch)
tree9b6e445625b8c40b526bef271e29df77b1cd8761 /drivers/usb/musb
parent6587cc0f30cd2f27cf0677e470f18792925a23a4 (diff)
usb: musb: host: unmap the buffer for PIO data transfers
The USB stack maps the buffer for DMA if the controller supports DMA. MUSB controller can perform DMA as well as PIO transfers. The buffer needs to be unmapped before CPU can perform PIO data transfers. Export unmap_urb_for_dma() so that drivers can perform the DMA unmapping in a sane way. Signed-off-by: Maulik Mankad <x0082077@ti.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r--drivers/usb/musb/musb_host.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 9e65c47cc98b..62e39fc57211 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -41,6 +41,7 @@
41#include <linux/errno.h> 41#include <linux/errno.h>
42#include <linux/init.h> 42#include <linux/init.h>
43#include <linux/list.h> 43#include <linux/list.h>
44#include <linux/dma-mapping.h>
44 45
45#include "musb_core.h" 46#include "musb_core.h"
46#include "musb_host.h" 47#include "musb_host.h"
@@ -1332,6 +1333,8 @@ void musb_host_tx(struct musb *musb, u8 epnum)
1332 */ 1333 */
1333 if (length > qh->maxpacket) 1334 if (length > qh->maxpacket)
1334 length = qh->maxpacket; 1335 length = qh->maxpacket;
1336 /* Unmap the buffer so that CPU can use it */
1337 unmap_urb_for_dma(musb_to_hcd(musb), urb);
1335 musb_write_fifo(hw_ep, length, urb->transfer_buffer + offset); 1338 musb_write_fifo(hw_ep, length, urb->transfer_buffer + offset);
1336 qh->segsize = length; 1339 qh->segsize = length;
1337 1340
@@ -1752,6 +1755,8 @@ void musb_host_rx(struct musb *musb, u8 epnum)
1752#endif /* Mentor DMA */ 1755#endif /* Mentor DMA */
1753 1756
1754 if (!dma) { 1757 if (!dma) {
1758 /* Unmap the buffer so that CPU can use it */
1759 unmap_urb_for_dma(musb_to_hcd(musb), urb);
1755 done = musb_host_packet_rx(musb, urb, 1760 done = musb_host_packet_rx(musb, urb,
1756 epnum, iso_err); 1761 epnum, iso_err);
1757 DBG(6, "read %spacket\n", done ? "last " : ""); 1762 DBG(6, "read %spacket\n", done ? "last " : "");