diff options
authorNoralf Trønnes <>2015-05-15 20:20:09 +0200
committerpopcornmix <>2015-05-18 14:13:31 +0100
commitd54112e7c36831a5c1033135f10b4c228e6165fa (patch)
parent8beaa1d2022374c0ece1195aa155a1af52ca31e6 (diff)
usb: dwc_otg: Don't use dma_to_virt()
Commit 6ce0d20 changes dma_to_virt() which breaks this driver. Open code the old dma_to_virt() implementation to work around this. Limit the use of __bus_to_virt() to cases where transfer_buffer_length is set and transfer_buffer is not set. This is done to increase the chance that this driver will also work on ARCH_BCM2835. transfer_buffer should not be NULL if the length is set, but the comment in the code indicates that there are situations where this might happen. drivers/usb/isp1760/isp1760-hcd.c also has a similar comment pointing to a possible: 'usb storage / SCSI bug'. Signed-off-by: Noralf Trønnes <>
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
index 1d28459d5b0e..6aad9c437998 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
@@ -766,16 +766,17 @@ static int dwc_otg_urb_enqueue(struct usb_hcd *hcd,
buf = urb->transfer_buffer;
- if (hcd->self.uses_dma) {
+ if (hcd->self.uses_dma && !buf && urb->transfer_buffer_length) {
* Calculate virtual address from physical address,
* because some class driver may not fill transfer_buffer.
* In Buffer DMA mode virual address is used,
* when handling non DWORD aligned buffers.
- //buf = phys_to_virt(urb->transfer_dma);
- // DMA addresses are bus addresses not physical addresses!
- buf = dma_to_virt(&urb->dev->dev, urb->transfer_dma);
+ buf = (void *)__bus_to_virt((unsigned long)urb->transfer_dma);
+ dev_warn_once(&urb->dev->dev,
+ "USB transfer_buffer was NULL, will use __bus_to_virt(%pad)=%p\n",
+ &urb->transfer_dma, buf);
if (!(urb->transfer_flags & URB_NO_INTERRUPT))