The HCD_NO_COHERENT_MEM USB host controller driver flag can be enabled to instruct the USB stack to avoid allocating coherent memory for USB buffers. This can be enabled on USB host controller drivers for platforms which have restrictions accessing coherent memory. See patch 2/2 "USB: add HCD_NO_COHERENT_MEM host controller driver flag." for additional information. This flag will be used later to implement support for USB on the Nintendo Wii video game console. ChangeLog: v1 -> v2 - bounce at the platform DMA layer, not at the USB layer - bounce only when strictly needed v2 -> v3 - separate platform DMA code changes from this patchset - expand urb_needs_*_dma_map() into multiple test and return statements - record in the URB flags the mapping types performed and use that info to do the corresponding unmappings - use urb->num_sgs > 0 to check for s-g requests - don't check for s-g requests on control requests - use the following revised logic for mapping transfer buffer (similar for setup_packet): If transfer_buffer_length is 0 then do nothing. Otherwise if num_sgs > 0 then do nothing. Otherwise if URB_NO_TRANSFER_DMA_MAP and transfer_dma != ~0 then do nothing. Otherwise if hcd->self.uses_dma is set then call dma_map_single Otherwise if HCD_LOCAL_MEM is set then call hcd_alloc_coherent Otherwise do nothing (PIO case). - reset transfer_dma and setup_dma on unmap if needed v3 -> v4 - encapsulate multiple duplicated open coded tests into a single function - use the following revised logic for mapping transfer buffer (similar for setup_packet): If transfer_buffer_length is 0 then do nothing. Otherwise if num_sgs > 0 then do nothing. Otherwise if URB_NO_TRANSFER_DMA_MAP and transfer_dma != ~0 and HCD_NO_COHERENT_MEM is not set then do nothing. Otherwise if hcd->self.uses_dma is set then call dma_map_single Otherwise if HCD_LOCAL_MEM is set then call hcd_alloc_coherent Otherwise do nothing (PIO case). - do not reset transfer_dma and setup_dma on unmap Thanks to Alan Stern for his reviews and guidance. Albert Herranz (2): USB: refactor unmap_urb_for_dma/map_urb_for_dma USB: add HCD_NO_COHERENT_MEM host controller driver flag drivers/usb/core/buffer.c | 29 +++++- drivers/usb/core/hcd.c | 233 +++++++++++++++++++++++++++++++-------------- drivers/usb/core/hcd.h | 13 ++- include/linux/usb.h | 5 + 4 files changed, 195 insertions(+), 85 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html