diff options
author | Huacai Chen <chenhc@lemote.com> | 2018-08-23 01:33:10 -0400 |
---|---|---|
committer | Paul Burton <paul.burton@mips.com> | 2018-08-28 12:47:14 -0400 |
commit | 33f2ac5451a62f4e441454522b0588790144a717 (patch) | |
tree | 1f04758c19f6909e1031703cbbc88704518eb815 | |
parent | 5b394b2ddf0347bef56e50c69a58773c94343ff3 (diff) |
MIPS: Loongon64: DMA functions cleanup
Split the common dma.c which shared by Loongson-2E and Loongson-2F,
since the code in 'common' directory is assumed be shared by all 64bit
Loongson platforms (but Loongson-3 doesn't use it now). By the way,
Loongson-2E and Loongson-2F have already dropped 32bit kernel support,
so CONFIG_64BIT isn't needed.
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/20302/
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Cc: Huacai Chen <chenhuacai@gmail.com>
-rw-r--r-- | arch/mips/loongson64/common/Makefile | 1 | ||||
-rw-r--r-- | arch/mips/loongson64/fuloong-2e/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/loongson64/fuloong-2e/dma.c | 12 | ||||
-rw-r--r-- | arch/mips/loongson64/lemote-2f/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/loongson64/lemote-2f/dma.c (renamed from arch/mips/loongson64/common/dma.c) | 4 |
5 files changed, 14 insertions, 7 deletions
diff --git a/arch/mips/loongson64/common/Makefile b/arch/mips/loongson64/common/Makefile index 57ee03022941..684624f61f5a 100644 --- a/arch/mips/loongson64/common/Makefile +++ b/arch/mips/loongson64/common/Makefile | |||
@@ -6,7 +6,6 @@ | |||
6 | obj-y += setup.o init.o cmdline.o env.o time.o reset.o irq.o \ | 6 | obj-y += setup.o init.o cmdline.o env.o time.o reset.o irq.o \ |
7 | bonito-irq.o mem.o machtype.o platform.o serial.o | 7 | bonito-irq.o mem.o machtype.o platform.o serial.o |
8 | obj-$(CONFIG_PCI) += pci.o | 8 | obj-$(CONFIG_PCI) += pci.o |
9 | obj-$(CONFIG_CPU_LOONGSON2) += dma.o | ||
10 | 9 | ||
11 | # | 10 | # |
12 | # Serial port support | 11 | # Serial port support |
diff --git a/arch/mips/loongson64/fuloong-2e/Makefile b/arch/mips/loongson64/fuloong-2e/Makefile index b7622720c1ad..0a9a472bec0a 100644 --- a/arch/mips/loongson64/fuloong-2e/Makefile +++ b/arch/mips/loongson64/fuloong-2e/Makefile | |||
@@ -2,4 +2,4 @@ | |||
2 | # Makefile for Lemote Fuloong2e mini-PC board. | 2 | # Makefile for Lemote Fuloong2e mini-PC board. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += irq.o reset.o | 5 | obj-y += irq.o reset.o dma.o |
diff --git a/arch/mips/loongson64/fuloong-2e/dma.c b/arch/mips/loongson64/fuloong-2e/dma.c new file mode 100644 index 000000000000..e122292bf666 --- /dev/null +++ b/arch/mips/loongson64/fuloong-2e/dma.c | |||
@@ -0,0 +1,12 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | #include <linux/dma-direct.h> | ||
3 | |||
4 | dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr) | ||
5 | { | ||
6 | return paddr | 0x80000000; | ||
7 | } | ||
8 | |||
9 | phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr) | ||
10 | { | ||
11 | return dma_addr & 0x7fffffff; | ||
12 | } | ||
diff --git a/arch/mips/loongson64/lemote-2f/Makefile b/arch/mips/loongson64/lemote-2f/Makefile index 08b8abcbfef5..b5792c334cd5 100644 --- a/arch/mips/loongson64/lemote-2f/Makefile +++ b/arch/mips/loongson64/lemote-2f/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for lemote loongson2f family machines | 2 | # Makefile for lemote loongson2f family machines |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += clock.o machtype.o irq.o reset.o ec_kb3310b.o | 5 | obj-y += clock.o machtype.o irq.o reset.o dma.o ec_kb3310b.o |
6 | 6 | ||
7 | # | 7 | # |
8 | # Suspend Support | 8 | # Suspend Support |
diff --git a/arch/mips/loongson64/common/dma.c b/arch/mips/loongson64/lemote-2f/dma.c index 48f04126bde2..abf0e39d7e46 100644 --- a/arch/mips/loongson64/common/dma.c +++ b/arch/mips/loongson64/lemote-2f/dma.c | |||
@@ -8,11 +8,7 @@ dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr) | |||
8 | 8 | ||
9 | phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr) | 9 | phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr) |
10 | { | 10 | { |
11 | #if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT) | ||
12 | if (dma_addr > 0x8fffffff) | 11 | if (dma_addr > 0x8fffffff) |
13 | return dma_addr; | 12 | return dma_addr; |
14 | return dma_addr & 0x0fffffff; | 13 | return dma_addr & 0x0fffffff; |
15 | #else | ||
16 | return dma_addr & 0x7fffffff; | ||
17 | #endif | ||
18 | } | 14 | } |