Skip to content

Commit d3bc81b

Browse files
Christoph Hellwigpaulburton
authored andcommitted
MIPS: loongson: untangle dma implementations
Only loongson-3 is DMA coherent and uses swiotlb. So move the dma address translations stubs directly to the loongson-3 code, and remove a few Kconfig indirections. Signed-off-by: Christoph Hellwig <hch@lst.de> Patchwork: https://patchwork.linux-mips.org/patch/19539/ Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: David Daney <david.daney@cavium.com> Cc: Kevin Cernekee <cernekee@gmail.com> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: Tom Bogendoerfer <tsbogend@alpha.franken.de> Cc: Huacai Chen <chenhc@lemote.com> Cc: iommu@lists.linux-foundation.org Cc: linux-mips@linux-mips.org
1 parent a330a9c commit d3bc81b

File tree

5 files changed

+6
-24
lines changed

5 files changed

+6
-24
lines changed

arch/mips/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,6 @@ config MACH_LOONGSON32
454454

455455
config MACH_LOONGSON64
456456
bool "Loongson-2/3 family of machines"
457-
select ARCH_HAS_PHYS_TO_DMA
458457
select SYS_SUPPORTS_ZBOOT
459458
help
460459
This enables the support of Loongson-2/3 family of machines.
@@ -1389,6 +1388,7 @@ choice
13891388
config CPU_LOONGSON3
13901389
bool "Loongson 3 CPU"
13911390
depends on SYS_HAS_CPU_LOONGSON3
1391+
select ARCH_HAS_PHYS_TO_DMA
13921392
select CPU_SUPPORTS_64BIT_KERNEL
13931393
select CPU_SUPPORTS_HIGHMEM
13941394
select CPU_SUPPORTS_HUGEPAGES

arch/mips/loongson64/Kconfig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ config LOONGSON_MACH3X
9393
select LOONGSON_MC146818
9494
select ZONE_DMA32
9595
select LEFI_FIRMWARE_INTERFACE
96-
select PHYS48_TO_HT40
9796
help
9897
Generic Loongson 3 family machines utilize the 3A/3B revision
9998
of Loongson processor and RS780/SBX00 chipset.
@@ -132,10 +131,6 @@ config LOONGSON_UART_BASE
132131
default y
133132
depends on EARLY_PRINTK || SERIAL_8250
134133

135-
config PHYS48_TO_HT40
136-
bool
137-
default y if CPU_LOONGSON3
138-
139134
config LOONGSON_MC146818
140135
bool
141136
default n

arch/mips/loongson64/common/Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,3 @@ obj-$(CONFIG_CS5536) += cs5536/
2525
#
2626

2727
obj-$(CONFIG_SUSPEND) += pm.o
28-
29-
#
30-
# Big Memory (SWIOTLB) Support
31-
#
32-
obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o

arch/mips/loongson64/loongson-3/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# Makefile for Loongson-3 family machines
33
#
4-
obj-y += irq.o cop2-ex.o platform.o acpi_init.o
4+
obj-y += irq.o cop2-ex.o platform.o acpi_init.o dma.o
55

66
obj-$(CONFIG_SMP) += smp.o
77

arch/mips/loongson64/common/dma-swiotlb.c renamed to arch/mips/loongson64/loongson-3/dma.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,18 @@
55

66
dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr)
77
{
8-
long nid;
9-
#ifdef CONFIG_PHYS48_TO_HT40
108
/* We extract 2bit node id (bit 44~47, only bit 44~45 used now) from
119
* Loongson-3's 48bit address space and embed it into 40bit */
12-
nid = (paddr >> 44) & 0x3;
13-
paddr = ((nid << 44) ^ paddr) | (nid << 37);
14-
#endif
15-
return paddr;
10+
long nid = (paddr >> 44) & 0x3;
11+
return ((nid << 44) ^ paddr) | (nid << 37);
1612
}
1713

1814
phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t daddr)
1915
{
20-
long nid;
21-
#ifdef CONFIG_PHYS48_TO_HT40
2216
/* We extract 2bit node id (bit 44~47, only bit 44~45 used now) from
2317
* Loongson-3's 48bit address space and embed it into 40bit */
24-
nid = (daddr >> 37) & 0x3;
25-
daddr = ((nid << 37) ^ daddr) | (nid << 44);
26-
#endif
27-
return daddr;
18+
long nid = (daddr >> 37) & 0x3;
19+
return ((nid << 37) ^ daddr) | (nid << 44);
2820
}
2921

3022
void __init plat_swiotlb_setup(void)

0 commit comments

Comments
 (0)