h8300: use dma-direct
authorChristoph Hellwig <hch@lst.de>
Tue, 9 Jan 2018 15:32:29 +0000 (16:32 +0100)
committerChristoph Hellwig <hch@lst.de>
Mon, 15 Jan 2018 08:35:17 +0000 (09:35 +0100)
Replace the bare-bones h8300 direct dma mapping implementation with
the fully featured generic dma-direct one.

Signed-off-by: Christoph Hellwig <hch@lst.de>
arch/h8300/Kconfig
arch/h8300/include/asm/Kbuild
arch/h8300/include/asm/dma-mapping.h [deleted file]
arch/h8300/kernel/Makefile
arch/h8300/kernel/dma.c [deleted file]

index f8d3fde0819092e651969a07791d487317a1f973..091d6d04b5e505f9d46c703cf08f4664b67ad453 100644 (file)
@@ -23,6 +23,7 @@ config H8300
        select HAVE_ARCH_KGDB
        select HAVE_ARCH_HASH
        select CPU_NO_EFFICIENT_FFS
+       select DMA_DIRECT_OPS
 
 config CPU_BIG_ENDIAN
        def_bool y
index bc077491d299c95ad526d154c8d919bdbe5549dc..642752c94306affd679449a27930b139798e3f37 100644 (file)
@@ -9,6 +9,7 @@ generic-y += delay.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/h8300/include/asm/dma-mapping.h b/arch/h8300/include/asm/dma-mapping.h
deleted file mode 100644 (file)
index 21bb1fc..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _H8300_DMA_MAPPING_H
-#define _H8300_DMA_MAPPING_H
-
-extern const struct dma_map_ops h8300_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-       return &h8300_dma_map_ops;
-}
-
-#endif
index b62e830525c67d162ee7b4036f9800308da13267..307aa51576dd00ba44afe09805d0854132112ad7 100644 (file)
@@ -7,7 +7,7 @@ extra-y := vmlinux.lds
 
 obj-y := process.o traps.o ptrace.o \
         signal.o setup.o syscalls.o \
-        irq.o entry.o dma.o
+        irq.o entry.o
 
 obj-$(CONFIG_ROMKERNEL) += head_rom.o
 obj-$(CONFIG_RAMKERNEL) += head_ram.o
diff --git a/arch/h8300/kernel/dma.c b/arch/h8300/kernel/dma.c
deleted file mode 100644 (file)
index d44ba5d..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file COPYING in the main directory of this archive
- * for more details.
- */
-
-#include <linux/dma-mapping.h>
-#include <linux/kernel.h>
-#include <linux/scatterlist.h>
-#include <linux/module.h>
-#include <asm/pgalloc.h>
-
-static void *dma_alloc(struct device *dev, size_t size,
-                      dma_addr_t *dma_handle, gfp_t gfp,
-                      unsigned long attrs)
-{
-       void *ret;
-
-       if (dev == NULL || (*dev->dma_mask < 0xffffffff))
-               gfp |= GFP_DMA;
-       ret = (void *)__get_free_pages(gfp, get_order(size));
-
-       if (ret != NULL) {
-               memset(ret, 0, size);
-               *dma_handle = virt_to_phys(ret);
-       }
-       return ret;
-}
-
-static void dma_free(struct device *dev, size_t size,
-                    void *vaddr, dma_addr_t dma_handle,
-                    unsigned long attrs)
-
-{
-       free_pages((unsigned long)vaddr, get_order(size));
-}
-
-static dma_addr_t map_page(struct device *dev, struct page *page,
-                                 unsigned long offset, size_t size,
-                                 enum dma_data_direction direction,
-                                 unsigned long attrs)
-{
-       return page_to_phys(page) + offset;
-}
-
-static int map_sg(struct device *dev, struct scatterlist *sgl,
-                 int nents, enum dma_data_direction direction,
-                 unsigned long attrs)
-{
-       struct scatterlist *sg;
-       int i;
-
-       for_each_sg(sgl, sg, nents, i) {
-               sg->dma_address = sg_phys(sg);
-       }
-
-       return nents;
-}
-
-const struct dma_map_ops h8300_dma_map_ops = {
-       .alloc = dma_alloc,
-       .free = dma_free,
-       .map_page = map_page,
-       .map_sg = map_sg,
-};
-EXPORT_SYMBOL(h8300_dma_map_ops);