30 Jul 22:24 2012
About dma_sync_single_for_{cpu,device}
Hi, On our board we've got an MV78200 and a network device between which we xfer memory chunks via the ddram with an external dma controller. To handle these xfers we're using the dma API. To tx a chunk of data from the SoC => network device, we : - prepare a buffer with a leading header embedding a pattern, - trigger the xfer and wait for an irq // The device updates the pattern and then triggers an irq - upon irq we check the pattern for the xfer completion I was expecting the following to work: addr = dma_map_single(dev, buffer, size, DMA_TO_DEVICE); dev_send(buffer); // wait for irq (don't peek in the buffer) ... got irq dma_sync_single_single_for_cpu(dev, buffer, pattern_size, DMA_FROM_DEVICE); if (!xfer_done(buffer)) // not RAM value dma_sync_single_for_device(dev, buffer, pattern_size, DMA_FROM_DEVICE); [...] But this does not work (the buffer pattern does not reflect the ddram value). On the other hand, the following works: [...] // wait for irq (don't peek in the buffer) ... got irq dma_sync_single_for_device(dev, buffer, pattern_size, DMA_FROM_DEVICE); if (!xfer_done(buffer)) // RAM value [...](Continue reading)