aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/core/hcd.c3
-rw-r--r--drivers/usb/musb/musb_host.c5
-rw-r--r--include/linux/usb/hcd.h1
3 files changed, 8 insertions, 1 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 5cca00a6d09d..cb2d894321da 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1263,7 +1263,7 @@ static void hcd_free_coherent(struct usb_bus *bus, dma_addr_t *dma_handle,
1263 *dma_handle = 0; 1263 *dma_handle = 0;
1264} 1264}
1265 1265
1266static void unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) 1266void unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb)
1267{ 1267{
1268 enum dma_data_direction dir; 1268 enum dma_data_direction dir;
1269 1269
@@ -1307,6 +1307,7 @@ static void unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb)
1307 URB_DMA_MAP_SG | URB_DMA_MAP_PAGE | 1307 URB_DMA_MAP_SG | URB_DMA_MAP_PAGE |
1308 URB_DMA_MAP_SINGLE | URB_MAP_LOCAL); 1308 URB_DMA_MAP_SINGLE | URB_MAP_LOCAL);
1309} 1309}
1310EXPORT_SYMBOL_GPL(unmap_urb_for_dma);
1310 1311
1311static int map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, 1312static int map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
1312 gfp_t mem_flags) 1313 gfp_t mem_flags)
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 " : "");
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 3b571f1ffbb3..fe89f7c298aa 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -329,6 +329,7 @@ extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags);
329extern int usb_hcd_unlink_urb(struct urb *urb, int status); 329extern int usb_hcd_unlink_urb(struct urb *urb, int status);
330extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, 330extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb,
331 int status); 331 int status);
332extern void unmap_urb_for_dma(struct usb_hcd *, struct urb *);
332extern void usb_hcd_flush_endpoint(struct usb_device *udev, 333extern void usb_hcd_flush_endpoint(struct usb_device *udev,
333 struct usb_host_endpoint *ep); 334 struct usb_host_endpoint *ep);
334extern void usb_hcd_disable_endpoint(struct usb_device *udev, 335extern void usb_hcd_disable_endpoint(struct usb_device *udev,