diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/usb-designware.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/firmware/drivers/usb-designware.c b/firmware/drivers/usb-designware.c index 24c6055434..375fd8be74 100644 --- a/firmware/drivers/usb-designware.c +++ b/firmware/drivers/usb-designware.c | |||
@@ -53,6 +53,15 @@ | |||
53 | #define COMMIT_DCACHE_RANGE(b,s) commit_dcache_range(b,s) | 53 | #define COMMIT_DCACHE_RANGE(b,s) commit_dcache_range(b,s) |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | /* On some platforms, virtual addresses must be mangled to | ||
57 | * get a physical address for DMA | ||
58 | */ | ||
59 | #if CONFIG_CPU == X1000 | ||
60 | # define DMA_ADDR2PHYS(x) PHYSADDR(x) | ||
61 | #else | ||
62 | # define DMA_ADDR2PHYS(x) x | ||
63 | #endif | ||
64 | |||
56 | #ifndef USB_DW_TOUTCAL | 65 | #ifndef USB_DW_TOUTCAL |
57 | #define USB_DW_TOUTCAL 0 | 66 | #define USB_DW_TOUTCAL 0 |
58 | #endif | 67 | #endif |
@@ -449,7 +458,7 @@ static void usb_dw_nptx_unqueue(int epnum) | |||
449 | dw_ep->addr -= (bytesinfifo + 3) >> 2; | 458 | dw_ep->addr -= (bytesinfifo + 3) >> 2; |
450 | #else | 459 | #else |
451 | (void) bytesinfifo; | 460 | (void) bytesinfifo; |
452 | DWC_DIEPDMA(ep) = (uint32_t)(dw_ep->addr) + sentbytes; | 461 | DWC_DIEPDMA(ep) = DMA_ADDR2PHYS((uint32_t)(dw_ep->addr) + sentbytes); |
453 | #endif | 462 | #endif |
454 | DWC_DIEPTSIZ(ep) = PKTCNT(packetsleft) | (dw_ep->size - sentbytes); | 463 | DWC_DIEPTSIZ(ep) = PKTCNT(packetsleft) | (dw_ep->size - sentbytes); |
455 | 464 | ||
@@ -676,7 +685,7 @@ static void usb_dw_start_xfer(int epnum, | |||
676 | /* Set up data source */ | 685 | /* Set up data source */ |
677 | dw_ep->addr = (uint32_t*)buf; | 686 | dw_ep->addr = (uint32_t*)buf; |
678 | #ifndef USB_DW_ARCH_SLAVE | 687 | #ifndef USB_DW_ARCH_SLAVE |
679 | DWC_EPDMA(epnum, epdir) = (uint32_t)buf; | 688 | DWC_EPDMA(epnum, epdir) = DMA_ADDR2PHYS((uint32_t)buf); |
680 | #endif | 689 | #endif |
681 | 690 | ||
682 | if (epdir == USB_DW_EPDIR_IN) | 691 | if (epdir == USB_DW_EPDIR_IN) |