From 5f736c61d64cd5efb1c9cc4bc4d5f45e73f4f59c Mon Sep 17 00:00:00 2001 From: KangNam Park Date: Wed, 30 Jul 2014 23:38:57 +0900 Subject: [PATCH] arch64: dma: add the dma interface for audio Change-Id: I8037f12b582668ed6c7fb3031dca768685a909db Signed-off-by: KangNam Park Signed-off-by: Seokju Yoon --- arch/arm64/include/asm/dma-mapping.h | 7 +++++++ arch/arm64/mm/dma-mapping.c | 30 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index 0df756b24863..5398d2dad0eb 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h @@ -20,11 +20,18 @@ #include #include +#include #include #include +#define DMA_ERROR_CODE (~(dma_addr_t)0) + extern const struct dma_map_ops dummy_dma_ops; +extern struct dma_map_ops *dma_ops; +extern struct dma_map_ops coherent_swiotlb_dma_ops; +extern struct dma_map_ops noncoherent_swiotlb_dma_ops; +extern struct dma_map_ops arm_exynos_dma_mcode_ops; static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) { diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 115b32639a3c..6d245950491a 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -386,6 +386,36 @@ static const struct dma_map_ops swiotlb_dma_ops = { .mapping_error = __swiotlb_dma_mapping_error, }; +static void *arm_exynos_dma_mcode_alloc(struct device *dev, size_t size, + dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs); +static void arm_exynos_dma_mcode_free(struct device *dev, size_t size, void *cpu_addr, + dma_addr_t handle, struct dma_attrs *attrs); + +struct dma_map_ops arm_exynos_dma_mcode_ops = { + .alloc = arm_exynos_dma_mcode_alloc, + .free = arm_exynos_dma_mcode_free, +}; +EXPORT_SYMBOL(arm_exynos_dma_mcode_ops); + +static void *arm_exynos_dma_mcode_alloc(struct device *dev, size_t size, + dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs) +{ + void *addr; + + if (!*handle) + return NULL; + + addr = ioremap(*handle, size); + + return addr; +} + +static void arm_exynos_dma_mcode_free(struct device *dev, size_t size, void *cpu_addr, + dma_addr_t handle, struct dma_attrs *attrs) +{ + iounmap(cpu_addr); +} + static int __init atomic_pool_init(void) { pgprot_t prot = __pgprot(PROT_NORMAL_NC); -- 2.20.1