diff options
author | Nicolas Pitre <nicolas.pitre@linaro.org> | 2011-07-05 22:52:52 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2011-09-26 10:12:02 -0400 |
commit | ee581ae83f6e7878ff937bc0a5724173f1960130 (patch) | |
tree | 01276ca3b8a986268c6c3220b166b2a23d6966b0 /arch/arm | |
parent | 8fce8b2080bf49de9e5d96161932edcbffad11cf (diff) |
ARM: OMAP: move OMAP1 memory config from plat/memory.h to its mach/memory.h
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap1/include/mach/memory.h | 53 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/memory.h | 45 |
2 files changed, 53 insertions, 45 deletions
diff --git a/arch/arm/mach-omap1/include/mach/memory.h b/arch/arm/mach-omap1/include/mach/memory.h index e9b600c113ef..c6337645ba8a 100644 --- a/arch/arm/mach-omap1/include/mach/memory.h +++ b/arch/arm/mach-omap1/include/mach/memory.h | |||
@@ -2,4 +2,55 @@ | |||
2 | * arch/arm/mach-omap1/include/mach/memory.h | 2 | * arch/arm/mach-omap1/include/mach/memory.h |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <plat/memory.h> | 5 | #ifndef __ASM_ARCH_MEMORY_H |
6 | #define __ASM_ARCH_MEMORY_H | ||
7 | |||
8 | /* | ||
9 | * Physical DRAM offset. | ||
10 | */ | ||
11 | #define PLAT_PHYS_OFFSET UL(0x10000000) | ||
12 | |||
13 | /* | ||
14 | * Bus address is physical address, except for OMAP-1510 Local Bus. | ||
15 | * OMAP-1510 bus address is translated into a Local Bus address if the | ||
16 | * OMAP bus type is lbus. We do the address translation based on the | ||
17 | * device overriding the defaults used in the dma-mapping API. | ||
18 | * Note that the is_lbus_device() test is not very efficient on 1510 | ||
19 | * because of the strncmp(). | ||
20 | */ | ||
21 | #ifdef CONFIG_ARCH_OMAP15XX | ||
22 | |||
23 | /* | ||
24 | * OMAP-1510 Local Bus address offset | ||
25 | */ | ||
26 | #define OMAP1510_LB_OFFSET UL(0x30000000) | ||
27 | |||
28 | #define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) | ||
29 | #define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET) | ||
30 | #define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev_name(dev), "ohci", 4) == 0)) | ||
31 | |||
32 | #define __arch_pfn_to_dma(dev, pfn) \ | ||
33 | ({ dma_addr_t __dma = __pfn_to_phys(pfn); \ | ||
34 | if (is_lbus_device(dev)) \ | ||
35 | __dma = __dma - PHYS_OFFSET + OMAP1510_LB_OFFSET; \ | ||
36 | __dma; }) | ||
37 | |||
38 | #define __arch_dma_to_pfn(dev, addr) \ | ||
39 | ({ dma_addr_t __dma = addr; \ | ||
40 | if (is_lbus_device(dev)) \ | ||
41 | __dma += PHYS_OFFSET - OMAP1510_LB_OFFSET; \ | ||
42 | __phys_to_pfn(__dma); \ | ||
43 | }) | ||
44 | |||
45 | #define __arch_dma_to_virt(dev, addr) ({ (void *) (is_lbus_device(dev) ? \ | ||
46 | lbus_to_virt(addr) : \ | ||
47 | __phys_to_virt(addr)); }) | ||
48 | |||
49 | #define __arch_virt_to_dma(dev, addr) ({ unsigned long __addr = (unsigned long)(addr); \ | ||
50 | (dma_addr_t) (is_lbus_device(dev) ? \ | ||
51 | virt_to_lbus(__addr) : \ | ||
52 | __virt_to_phys(__addr)); }) | ||
53 | |||
54 | #endif /* CONFIG_ARCH_OMAP15XX */ | ||
55 | |||
56 | #endif | ||
diff --git a/arch/arm/plat-omap/include/plat/memory.h b/arch/arm/plat-omap/include/plat/memory.h index 7f9df6f1e113..5b1a86d0a4d0 100644 --- a/arch/arm/plat-omap/include/plat/memory.h +++ b/arch/arm/plat-omap/include/plat/memory.h | |||
@@ -37,53 +37,10 @@ | |||
37 | * Physical DRAM offset. | 37 | * Physical DRAM offset. |
38 | */ | 38 | */ |
39 | #if defined(CONFIG_ARCH_OMAP1) | 39 | #if defined(CONFIG_ARCH_OMAP1) |
40 | #define PLAT_PHYS_OFFSET UL(0x10000000) | 40 | #error "OMAP1 should not be including this" |
41 | #else | 41 | #else |
42 | #define PLAT_PHYS_OFFSET UL(0x80000000) | 42 | #define PLAT_PHYS_OFFSET UL(0x80000000) |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | /* | ||
46 | * Bus address is physical address, except for OMAP-1510 Local Bus. | ||
47 | * OMAP-1510 bus address is translated into a Local Bus address if the | ||
48 | * OMAP bus type is lbus. We do the address translation based on the | ||
49 | * device overriding the defaults used in the dma-mapping API. | ||
50 | * Note that the is_lbus_device() test is not very efficient on 1510 | ||
51 | * because of the strncmp(). | ||
52 | */ | ||
53 | #ifdef CONFIG_ARCH_OMAP15XX | ||
54 | |||
55 | /* | ||
56 | * OMAP-1510 Local Bus address offset | ||
57 | */ | ||
58 | #define OMAP1510_LB_OFFSET UL(0x30000000) | ||
59 | |||
60 | #define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) | ||
61 | #define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET) | ||
62 | #define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev_name(dev), "ohci", 4) == 0)) | ||
63 | |||
64 | #define __arch_pfn_to_dma(dev, pfn) \ | ||
65 | ({ dma_addr_t __dma = __pfn_to_phys(pfn); \ | ||
66 | if (is_lbus_device(dev)) \ | ||
67 | __dma = __dma - PHYS_OFFSET + OMAP1510_LB_OFFSET; \ | ||
68 | __dma; }) | ||
69 | |||
70 | #define __arch_dma_to_pfn(dev, addr) \ | ||
71 | ({ dma_addr_t __dma = addr; \ | ||
72 | if (is_lbus_device(dev)) \ | ||
73 | __dma += PHYS_OFFSET - OMAP1510_LB_OFFSET; \ | ||
74 | __phys_to_pfn(__dma); \ | ||
75 | }) | ||
76 | |||
77 | #define __arch_dma_to_virt(dev, addr) ({ (void *) (is_lbus_device(dev) ? \ | ||
78 | lbus_to_virt(addr) : \ | ||
79 | __phys_to_virt(addr)); }) | ||
80 | |||
81 | #define __arch_virt_to_dma(dev, addr) ({ unsigned long __addr = (unsigned long)(addr); \ | ||
82 | (dma_addr_t) (is_lbus_device(dev) ? \ | ||
83 | virt_to_lbus(__addr) : \ | ||
84 | __virt_to_phys(__addr)); }) | ||
85 | |||
86 | #endif /* CONFIG_ARCH_OMAP15XX */ | ||
87 | |||
88 | #endif | 45 | #endif |
89 | 46 | ||