Signed-off-by: Yoichi Yuasa <yoichi_yuasa@xxxxxxxxxxxxxx> diff -pruN -X /home/yuasa/Memo/dontdiff linux-orig/arch/mips/Kconfig linux/arch/mips/Kconfig --- linux-orig/arch/mips/Kconfig 2009-04-21 10:55:44.353177629 +0900 +++ linux/arch/mips/Kconfig 2009-04-21 11:01:02.801170966 +0900 @@ -3,6 +3,7 @@ config MIPS default y select HAVE_IDE select HAVE_OPROFILE + select HAVE_GENERIC_DMA_COHERENT select HAVE_ARCH_KGDB # Horrible source of confusion. Die, die, die ... select EMBEDDED diff -pruN -X /home/yuasa/Memo/dontdiff linux-orig/arch/mips/include/asm/dma-mapping.h linux/arch/mips/include/asm/dma-mapping.h --- linux-orig/arch/mips/include/asm/dma-mapping.h 2009-04-21 10:55:44.549177717 +0900 +++ linux/arch/mips/include/asm/dma-mapping.h 2009-04-21 11:19:40.077177611 +0900 @@ -3,6 +3,7 @@ #include <asm/scatterlist.h> #include <asm/cache.h> +#include <asm-generic/dma-coherent.h> void *dma_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag); @@ -73,7 +74,6 @@ extern int dma_is_consistent(struct devi extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, enum dma_data_direction direction); -#if 0 #define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY extern int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, @@ -81,6 +81,5 @@ extern int dma_declare_coherent_memory(s extern void dma_release_declared_memory(struct device *dev); extern void * dma_mark_declared_memory_occupied(struct device *dev, dma_addr_t device_addr, size_t size); -#endif #endif /* _ASM_DMA_MAPPING_H */ diff -pruN -X /home/yuasa/Memo/dontdiff linux-orig/arch/mips/mm/dma-default.c linux/arch/mips/mm/dma-default.c --- linux-orig/arch/mips/mm/dma-default.c 2009-04-21 10:55:46.409177601 +0900 +++ linux/arch/mips/mm/dma-default.c 2009-04-21 11:21:17.061177557 +0900 @@ -89,6 +89,9 @@ void *dma_alloc_coherent(struct device * { void *ret; + if (dma_alloc_from_coherent(dev, size, dma_handle, &ret)) + return ret; + gfp = massage_gfp_flags(dev, gfp); ret = (void *) __get_free_pages(gfp, get_order(size)); @@ -120,8 +123,12 @@ EXPORT_SYMBOL(dma_free_noncoherent); void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle) { + int order = get_order(size); unsigned long addr = (unsigned long) vaddr; + if (dma_release_from_coherent(dev, order, vaddr)) + return; + plat_unmap_dma_mem(dev, dma_handle); if (!plat_device_is_coherent(dev))