aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-dove/addr-map.c
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2011-12-07 15:48:05 -0500
committerNicolas Pitre <nico@fluxnic.net>2011-12-13 18:46:20 -0500
commitb6d1c33a31deb1784c1d34070db6e84fd6f9d870 (patch)
tree18739a6c79b10f0fe69c01be5571e7a5af4d0e21 /arch/arm/mach-dove/addr-map.c
parent527ef0550d79e3b3a0ef8f5061072075afef6aaf (diff)
ARM: Orion: Consolidate the address map setup
Compile tested on Dove, orion5x, mv78xx0. Boot tested on Kirkwood. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Michael Walle <michael@walle.cc> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'arch/arm/mach-dove/addr-map.c')
-rw-r--r--arch/arm/mach-dove/addr-map.c113
1 files changed, 45 insertions, 68 deletions
diff --git a/arch/arm/mach-dove/addr-map.c b/arch/arm/mach-dove/addr-map.c
index 00be4fc26dd7..1584726088e4 100644
--- a/arch/arm/mach-dove/addr-map.c
+++ b/arch/arm/mach-dove/addr-map.c
@@ -14,6 +14,7 @@
14#include <linux/io.h> 14#include <linux/io.h>
15#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
16#include <asm/setup.h> 16#include <asm/setup.h>
17#include <plat/addr-map.h>
17#include "common.h" 18#include "common.h"
18 19
19/* 20/*
@@ -34,14 +35,6 @@
34#define ATTR_PCIE_MEM 0xe8 35#define ATTR_PCIE_MEM 0xe8
35#define ATTR_SCRATCHPAD 0x0 36#define ATTR_SCRATCHPAD 0x0
36 37
37/*
38 * CPU Address Decode Windows registers
39 */
40#define WIN_CTRL(n) (BRIDGE_VIRT_BASE + ((n) << 4) + 0x0)
41#define WIN_BASE(n) (BRIDGE_VIRT_BASE + ((n) << 4) + 0x4)
42#define WIN_REMAP_LO(n) (BRIDGE_VIRT_BASE + ((n) << 4) + 0x8)
43#define WIN_REMAP_HI(n) (BRIDGE_VIRT_BASE + ((n) << 4) + 0xc)
44
45struct mbus_dram_target_info dove_mbus_dram_info; 38struct mbus_dram_target_info dove_mbus_dram_info;
46 39
47static inline void __iomem *ddr_map_sc(int i) 40static inline void __iomem *ddr_map_sc(int i)
@@ -49,78 +42,62 @@ static inline void __iomem *ddr_map_sc(int i)
49 return (void __iomem *)(DOVE_MC_VIRT_BASE + 0x100 + ((i) << 4)); 42 return (void __iomem *)(DOVE_MC_VIRT_BASE + 0x100 + ((i) << 4));
50} 43}
51 44
52static int cpu_win_can_remap(int win) 45/*
53{ 46 * Description of the windows needed by the platform code
54 if (win < 4) 47 */
55 return 1; 48static struct __initdata orion_addr_map_cfg addr_map_cfg = {
56 49 .num_wins = 8,
57 return 0; 50 .remappable_wins = 4,
58} 51 .bridge_virt_base = BRIDGE_VIRT_BASE,
59 52};
60static void __init setup_cpu_win(int win, u32 base, u32 size,
61 u8 target, u8 attr, int remap)
62{
63 u32 ctrl;
64
65 base &= 0xffff0000;
66 ctrl = ((size - 1) & 0xffff0000) | (attr << 8) | (target << 4) | 1;
67
68 writel(base, WIN_BASE(win));
69 writel(ctrl, WIN_CTRL(win));
70 if (cpu_win_can_remap(win)) {
71 if (remap < 0)
72 remap = base;
73 writel(remap & 0xffff0000, WIN_REMAP_LO(win));
74 writel(0, WIN_REMAP_HI(win));
75 }
76}
77
78void __init dove_setup_cpu_mbus(void)
79{
80 int i;
81 int cs;
82 53
54static const struct __initdata orion_addr_map_info addr_map_info[] = {
83 /* 55 /*
84 * First, disable and clear windows. 56 * Windows for PCIe IO+MEM space.
85 */ 57 */
86 for (i = 0; i < 8; i++) { 58 { 0, DOVE_PCIE0_IO_PHYS_BASE, DOVE_PCIE0_IO_SIZE,
87 writel(0, WIN_BASE(i)); 59 TARGET_PCIE0, ATTR_PCIE_IO, DOVE_PCIE0_IO_BUS_BASE
88 writel(0, WIN_CTRL(i)); 60 },
89 if (cpu_win_can_remap(i)) { 61 { 1, DOVE_PCIE1_IO_PHYS_BASE, DOVE_PCIE1_IO_SIZE,
90 writel(0, WIN_REMAP_LO(i)); 62 TARGET_PCIE1, ATTR_PCIE_IO, DOVE_PCIE1_IO_BUS_BASE
91 writel(0, WIN_REMAP_HI(i)); 63 },
92 } 64 { 2, DOVE_PCIE0_MEM_PHYS_BASE, DOVE_PCIE0_MEM_SIZE,
93 } 65 TARGET_PCIE0, ATTR_PCIE_MEM, -1
94 66 },
67 { 3, DOVE_PCIE1_MEM_PHYS_BASE, DOVE_PCIE1_MEM_SIZE,
68 TARGET_PCIE1, ATTR_PCIE_MEM, -1
69 },
95 /* 70 /*
96 * Setup windows for PCIe IO+MEM space. 71 * Window for CESA engine.
97 */ 72 */
98 setup_cpu_win(0, DOVE_PCIE0_IO_PHYS_BASE, DOVE_PCIE0_IO_SIZE, 73 { 4, DOVE_CESA_PHYS_BASE, DOVE_CESA_SIZE,
99 TARGET_PCIE0, ATTR_PCIE_IO, DOVE_PCIE0_IO_BUS_BASE); 74 TARGET_CESA, ATTR_CESA, -1
100 setup_cpu_win(1, DOVE_PCIE1_IO_PHYS_BASE, DOVE_PCIE1_IO_SIZE, 75 },
101 TARGET_PCIE1, ATTR_PCIE_IO, DOVE_PCIE1_IO_BUS_BASE);
102 setup_cpu_win(2, DOVE_PCIE0_MEM_PHYS_BASE, DOVE_PCIE0_MEM_SIZE,
103 TARGET_PCIE0, ATTR_PCIE_MEM, -1);
104 setup_cpu_win(3, DOVE_PCIE1_MEM_PHYS_BASE, DOVE_PCIE1_MEM_SIZE,
105 TARGET_PCIE1, ATTR_PCIE_MEM, -1);
106
107 /* 76 /*
108 * Setup window for CESA engine. 77 * Window to the BootROM for Standby and Sleep Resume
109 */ 78 */
110 setup_cpu_win(4, DOVE_CESA_PHYS_BASE, DOVE_CESA_SIZE, 79 { 5, DOVE_BOOTROM_PHYS_BASE, DOVE_BOOTROM_SIZE,
111 TARGET_CESA, ATTR_CESA, -1); 80 TARGET_BOOTROM, ATTR_BOOTROM, -1
112 81 },
113 /* 82 /*
114 * Setup the Window to the BootROM for Standby and Sleep Resume 83 * Window to the PMU Scratch Pad space
115 */ 84 */
116 setup_cpu_win(5, DOVE_BOOTROM_PHYS_BASE, DOVE_BOOTROM_SIZE, 85 { 6, DOVE_SCRATCHPAD_PHYS_BASE, DOVE_SCRATCHPAD_SIZE,
117 TARGET_BOOTROM, ATTR_BOOTROM, -1); 86 TARGET_SCRATCHPAD, ATTR_SCRATCHPAD, -1
87 },
88 /* End marker */
89 { -1, 0, 0, 0, 0, 0 }
90};
91
92void __init dove_setup_cpu_mbus(void)
93{
94 int i;
95 int cs;
118 96
119 /* 97 /*
120 * Setup the Window to the PMU Scratch Pad space 98 * Disable, clear and configure windows.
121 */ 99 */
122 setup_cpu_win(6, DOVE_SCRATCHPAD_PHYS_BASE, DOVE_SCRATCHPAD_SIZE, 100 orion_config_wins(&addr_map_cfg, addr_map_info);
123 TARGET_SCRATCHPAD, ATTR_SCRATCHPAD, -1);
124 101
125 /* 102 /*
126 * Setup MBUS dram target info. 103 * Setup MBUS dram target info.