On 07/11/2013 07:14 PM, Sebastian Andrzej Siewior wrote: Dan, Vinod, do you guys have an idea how the dma driver could inform its user how much of the requested data got really transferred? This requirement seems unique to USB where this happens and is not an error. Below an reply to Greg where I tried to explain the problem. The original thread started at [0]. I've been browsing by some drivers and did not find anything close to this. The UART drivers which use DMA seem to know the exact number of bytes in advance. The dmaengine_tx_status() seems to serve a different purpose. > On 07/11/2013 06:58 PM, Greg KH wrote: >>> Now, the way I understand it is, you tell musb that the complete >>> transfer of 256 bytes has ended instead one byte that really >>> happened. Is my assumption wrong? >> >> What do you mean by "tell musb"? Of course the transfer has completed, >> that's all the device sent to the host controller, so it has to complete >> the transfer and send that on up to the driver that requested the urb. >> >> I don't understand the question/problem you are asking here, care to be >> more descriptive? > > Okay. musb offloads the actual transfer to the DMA engine it is using. > Once it does so, it relies on whatever comes back from dma engine > regarding transfer complete, transferred size etc. > > In case of ux500-dma (as far as I can tell) musb forwards the RX > request to the DMA engine, which will receive one byte instead of the > requested 256bytes. Since the DMA engine did not inform musb about the > correct transfer size, musb will complete that URB with 256 bytes. > > If you take a look on ux500_dma_callback() you will see the line: > ux500_channel->channel.actual_len = ux500_channel->cur_len; > > ->actual_len is what musb thinks got transferred. ->cur_len is what > musb asked to transfer. I don't see where the case of a shorter > transfer is considered. Again I have no HW I was just browsing. > [0] http://www.mail-archive.com/linux-usb@xxxxxxxxxxxxxxx/msg24190.html Sebastian -- 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