arch64: dma: add the dma interface for audio
authorKangNam Park <kn0710.park@samsung.com>
Wed, 30 Jul 2014 14:38:57 +0000 (23:38 +0900)
committerTaekki Kim <taekki.kim@samsung.com>
Mon, 14 May 2018 05:42:48 +0000 (14:42 +0900)
Change-Id: I8037f12b582668ed6c7fb3031dca768685a909db
Signed-off-by: KangNam Park <kn0710.park@samsung.com>
Signed-off-by: Seokju Yoon <sukju.yoon@samsung.com>
arch/arm64/include/asm/dma-mapping.h
arch/arm64/mm/dma-mapping.c

index 0df756b248633fa76b564ef37540b21d1b59bc63..5398d2dad0ebd54c40c297c0b40bb98627f311d0 100644 (file)
 
 #include <linux/types.h>
 #include <linux/vmalloc.h>
+#include <linux/dma-debug.h>
 
 #include <xen/xen.h>
 #include <asm/xen/hypervisor.h>
 
+#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)
 {
index 115b32639a3cbfcb4a76fd777717ee55edaf2bf5..6d245950491abf8fff885fd25598a4d7acc983b6 100644 (file)
@@ -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);