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 +#include #include +#include 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;