From ecba8723122fc38cf9fbce820f469a6508fd6b55 Mon Sep 17 00:00:00 2001 From: David Brown Date: Mon, 9 Feb 2015 10:09:21 +0000 Subject: juno: ion: Hack around bogus physical addresses Temporary workaround to avoid the issue that sg_phys is returning bogus addresses from the DMA heap in Juno's ION implementation. Signed-off-by: David Brown --- drivers/staging/android/ion/ion.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 62cb8017c18..4e34f6541a7 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -252,8 +252,25 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap, memory comming from the heaps is ready for dma, ie if it has a cached mapping that mapping has been invalidated */ for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->nents, i) { + + +if(buffer && buffer->heap && buffer->heap->ops && buffer->heap->ops->phys) +{ + ion_phys_addr_t addr; + size_t len; +// sg_dma_address(sg) = sg_phys(sg); + buffer->heap->ops->phys(buffer->heap, buffer, &addr, &len); + sg_dma_address(sg) = addr; +// sg_dma_len(sg) = sg->length; + sg_dma_len(sg) = len; +} +else +{ + sg_dma_address(sg) = sg_phys(sg); sg_dma_len(sg) = sg->length; +} + } mutex_lock(&dev->buffer_lock); ion_buffer_add(dev, buffer); -- cgit v1.2.3