All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: Loongon64: DMA functions cleanup
@ 2018-08-23  5:33 Huacai Chen
  2018-08-28 16:50 ` Paul Burton
  0 siblings, 1 reply; 2+ messages in thread
From: Huacai Chen @ 2018-08-23  5:33 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Paul Burton, James Hogan, linux-mips, Fuxin Zhang, Zhangjin Wu,
	Huacai Chen, Huacai Chen

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>
---
 arch/mips/loongson64/common/Makefile     |  1 -
 arch/mips/loongson64/common/dma.c        | 18 ------------------
 arch/mips/loongson64/fuloong-2e/Makefile |  2 +-
 arch/mips/loongson64/fuloong-2e/dma.c    | 12 ++++++++++++
 arch/mips/loongson64/lemote-2f/Makefile  |  2 +-
 arch/mips/loongson64/lemote-2f/dma.c     | 14 ++++++++++++++
 6 files changed, 28 insertions(+), 21 deletions(-)
 delete mode 100644 arch/mips/loongson64/common/dma.c
 create mode 100644 arch/mips/loongson64/fuloong-2e/dma.c
 create mode 100644 arch/mips/loongson64/lemote-2f/dma.c

diff --git a/arch/mips/loongson64/common/Makefile b/arch/mips/loongson64/common/Makefile
index 57ee030..684624f 100644
--- a/arch/mips/loongson64/common/Makefile
+++ b/arch/mips/loongson64/common/Makefile
@@ -6,7 +6,6 @@
 obj-y += setup.o init.o cmdline.o env.o time.o reset.o irq.o \
     bonito-irq.o mem.o machtype.o platform.o serial.o
 obj-$(CONFIG_PCI) += pci.o
-obj-$(CONFIG_CPU_LOONGSON2) += dma.o
 
 #
 # Serial port support
diff --git a/arch/mips/loongson64/common/dma.c b/arch/mips/loongson64/common/dma.c
deleted file mode 100644
index 48f0412..0000000
--- a/arch/mips/loongson64/common/dma.c
+++ /dev/null
@@ -1,18 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/dma-direct.h>
-
-dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr)
-{
-	return paddr | 0x80000000;
-}
-
-phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr)
-{
-#if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT)
-	if (dma_addr > 0x8fffffff)
-		return dma_addr;
-	return dma_addr & 0x0fffffff;
-#else
-	return dma_addr & 0x7fffffff;
-#endif
-}
diff --git a/arch/mips/loongson64/fuloong-2e/Makefile b/arch/mips/loongson64/fuloong-2e/Makefile
index b762272..0a9a472 100644
--- a/arch/mips/loongson64/fuloong-2e/Makefile
+++ b/arch/mips/loongson64/fuloong-2e/Makefile
@@ -2,4 +2,4 @@
 # Makefile for Lemote Fuloong2e mini-PC board.
 #
 
-obj-y += irq.o reset.o
+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 0000000..e122292
--- /dev/null
+++ b/arch/mips/loongson64/fuloong-2e/dma.c
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/dma-direct.h>
+
+dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr)
+{
+	return paddr | 0x80000000;
+}
+
+phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr)
+{
+	return dma_addr & 0x7fffffff;
+}
diff --git a/arch/mips/loongson64/lemote-2f/Makefile b/arch/mips/loongson64/lemote-2f/Makefile
index 08b8abc..b5792c3 100644
--- a/arch/mips/loongson64/lemote-2f/Makefile
+++ b/arch/mips/loongson64/lemote-2f/Makefile
@@ -2,7 +2,7 @@
 # Makefile for lemote loongson2f family machines
 #
 
-obj-y += clock.o machtype.o irq.o reset.o ec_kb3310b.o
+obj-y += clock.o machtype.o irq.o reset.o dma.o ec_kb3310b.o
 
 #
 # Suspend Support
diff --git a/arch/mips/loongson64/lemote-2f/dma.c b/arch/mips/loongson64/lemote-2f/dma.c
new file mode 100644
index 0000000..abf0e39
--- /dev/null
+++ b/arch/mips/loongson64/lemote-2f/dma.c
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/dma-direct.h>
+
+dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr)
+{
+	return paddr | 0x80000000;
+}
+
+phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr)
+{
+	if (dma_addr > 0x8fffffff)
+		return dma_addr;
+	return dma_addr & 0x0fffffff;
+}
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MIPS: Loongon64: DMA functions cleanup
  2018-08-23  5:33 [PATCH] MIPS: Loongon64: DMA functions cleanup Huacai Chen
@ 2018-08-28 16:50 ` Paul Burton
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Burton @ 2018-08-28 16:50 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Ralf Baechle, James Hogan, linux-mips, Fuxin Zhang, Zhangjin Wu,
	Huacai Chen

Hi Huacai,

On Thu, Aug 23, 2018 at 01:33:10PM +0800, Huacai Chen wrote:
> 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>
> ---
>  arch/mips/loongson64/common/Makefile     |  1 -
>  arch/mips/loongson64/common/dma.c        | 18 ------------------
>  arch/mips/loongson64/fuloong-2e/Makefile |  2 +-
>  arch/mips/loongson64/fuloong-2e/dma.c    | 12 ++++++++++++
>  arch/mips/loongson64/lemote-2f/Makefile  |  2 +-
>  arch/mips/loongson64/lemote-2f/dma.c     | 14 ++++++++++++++
>  6 files changed, 28 insertions(+), 21 deletions(-)
>  delete mode 100644 arch/mips/loongson64/common/dma.c
>  create mode 100644 arch/mips/loongson64/fuloong-2e/dma.c
>  create mode 100644 arch/mips/loongson64/lemote-2f/dma.c

Thanks - applied to mips-next for 4.20.

Paul

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-28 16:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-23  5:33 [PATCH] MIPS: Loongon64: DMA functions cleanup Huacai Chen
2018-08-28 16:50 ` Paul Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.