[PATCH] USB: Always map transfer_buffer (Fixes some musb_hdrc issues)

Tony Lindgren <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Hi,

Here's a little patch to make sure tranfer_buffer is always if DMA
is temporarily unavailable. I ran into this with tusb6010 that
currently can only do limited DMA. This fixes a problem of connecting
storage devices and doing mixed DMA/PIO access.

Regards,

Tony

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
usb-core-always-map-transfer-buffer.patch (text/x-diff, 1.2 KB)
From: Tony Lindgren <[email protected]>
Subject: USB: Always map transfer_buffer

In case a DMA channel for an endpoint is temporarily
unavailable, the host controller driver may still be
able to transfer the data using PIO. Without this patch
the transfer_buffer is not mapped, and host controller
does not know what to use for PIO.

Signed-off-by: Tony Lindgren <[email protected]>

--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -412,16 +412,18 @@ int usb_sg_init (
 		io->urbs [i]->status = -EINPROGRESS;
 		io->urbs [i]->actual_length = 0;
 
+		/*
+		 * Always have PIO buffer available in case a DMA channel
+		 * is temporarily unavailable for the given EP in the host
+		 * controller.
+		 */
+		io->urbs [i]->transfer_buffer =
+			page_address (sg [i].page) + sg [i].offset;
 		if (dma) {
-			/* hc may use _only_ transfer_dma */
 			io->urbs [i]->transfer_dma = sg_dma_address (sg + i);
 			len = sg_dma_len (sg + i);
-		} else {
-			/* hc may use _only_ transfer_buffer */
-			io->urbs [i]->transfer_buffer =
-				page_address (sg [i].page) + sg [i].offset;
+		} else
 			len = sg [i].length;
-		}
 
 		if (length) {
 			len = min_t (unsigned, len, length);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.