Michael Buesch wrote:
On Friday 26 September 2008 23:09:26 Aurelien Jarno wrote:
On Fri, Sep 26, 2008 at 10:49:25PM +0200, Michael Buesch wrote:
On Friday 26 September 2008 22:27:11 Aurelien Jarno wrote:
For SSB_BUSTYPE_SSB type devices, we need to initialize dma_mask using
coherent_dma_mask so that calls to dma_set_mask() succeed.
This is a hack IMO and the mips DMA API should be fixed.
However, I can live with it and you can add my ACK.
Why do you think it is a hack? The isa bus is doing the same.

If dma_set_mask doesn't work without it, why not do it inside of
dma_set_mask?

Anyway, as I said I'm fine with this.

FWIW: Last July, I posted this patch for dma_set_mask to the linux-mips list. It never went anywhere.

Steve


Add support for non-coherent dma to dma_set_mask for mips processors.

Signed-off-by: Steve Brown <[EMAIL PROTECTED]>

---

This is required to support the recent ssb dma api rewrite patch.

diff --git a/include/asm-mips/dma-mapping.h b/include/asm-mips/dma-mapping.h
index 230b3f1..8da4107 100644
--- a/include/asm-mips/dma-mapping.h
+++ b/include/asm-mips/dma-mapping.h
@@ -1,8 +1,9 @@
 #ifndef _ASM_DMA_MAPPING_H
 #define _ASM_DMA_MAPPING_H
 
-#include <asm/scatterlist.h>
+#include <linux/scatterlist.h>
 #include <asm/cache.h>
+#include <dma-coherence.h>
 
 void *dma_alloc_noncoherent(struct device *dev, size_t size,
                           dma_addr_t *dma_handle, gfp_t flag);
@@ -48,7 +49,11 @@ extern int dma_supported(struct device *dev, u64 mask);
 static inline int
 dma_set_mask(struct device *dev, u64 mask)
 {
-       if(!dev->dma_mask || !dma_supported(dev, mask))
+       if(!dma_supported(dev, mask))
+               return -EIO;
+       if(!plat_device_is_coherent(dev))
+               dev->dma_mask = &dev->coherent_dma_mask;
+       if(!dev->dma_mask)
                return -EIO;
 
        *dev->dma_mask = mask;
_______________________________________________
Bcm43xx-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev

Reply via email to