diff options
Diffstat (limited to 'arch/arm/mach-dove/addr-map.c')
-rw-r--r-- | arch/arm/mach-dove/addr-map.c | 121 |
1 files changed, 48 insertions, 73 deletions
diff --git a/arch/arm/mach-dove/addr-map.c b/arch/arm/mach-dove/addr-map.c index 00be4fc26dd7..98b8c83b09ab 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,98 +35,72 @@ | |||
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 | |||
45 | struct mbus_dram_target_info dove_mbus_dram_info; | ||
46 | |||
47 | static inline void __iomem *ddr_map_sc(int i) | 38 | static inline void __iomem *ddr_map_sc(int i) |
48 | { | 39 | { |
49 | return (void __iomem *)(DOVE_MC_VIRT_BASE + 0x100 + ((i) << 4)); | 40 | return (void __iomem *)(DOVE_MC_VIRT_BASE + 0x100 + ((i) << 4)); |
50 | } | 41 | } |
51 | 42 | ||
52 | static int cpu_win_can_remap(int win) | 43 | /* |
53 | { | 44 | * Description of the windows needed by the platform code |
54 | if (win < 4) | 45 | */ |
55 | return 1; | 46 | static struct __initdata orion_addr_map_cfg addr_map_cfg = { |
56 | 47 | .num_wins = 8, | |
57 | return 0; | 48 | .remappable_wins = 4, |
58 | } | 49 | .bridge_virt_base = BRIDGE_VIRT_BASE, |
59 | 50 | }; | |
60 | static 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 | |||
78 | void __init dove_setup_cpu_mbus(void) | ||
79 | { | ||
80 | int i; | ||
81 | int cs; | ||
82 | 51 | ||
52 | static const struct __initdata orion_addr_map_info addr_map_info[] = { | ||
83 | /* | 53 | /* |
84 | * First, disable and clear windows. | 54 | * Windows for PCIe IO+MEM space. |
85 | */ | 55 | */ |
86 | for (i = 0; i < 8; i++) { | 56 | { 0, DOVE_PCIE0_IO_PHYS_BASE, DOVE_PCIE0_IO_SIZE, |
87 | writel(0, WIN_BASE(i)); | 57 | TARGET_PCIE0, ATTR_PCIE_IO, DOVE_PCIE0_IO_BUS_BASE |
88 | writel(0, WIN_CTRL(i)); | 58 | }, |
89 | if (cpu_win_can_remap(i)) { | 59 | { 1, DOVE_PCIE1_IO_PHYS_BASE, DOVE_PCIE1_IO_SIZE, |
90 | writel(0, WIN_REMAP_LO(i)); | 60 | TARGET_PCIE1, ATTR_PCIE_IO, DOVE_PCIE1_IO_BUS_BASE |
91 | writel(0, WIN_REMAP_HI(i)); | 61 | }, |
92 | } | 62 | { 2, DOVE_PCIE0_MEM_PHYS_BASE, DOVE_PCIE0_MEM_SIZE, |
93 | } | 63 | TARGET_PCIE0, ATTR_PCIE_MEM, -1 |
94 | 64 | }, | |
65 | { 3, DOVE_PCIE1_MEM_PHYS_BASE, DOVE_PCIE1_MEM_SIZE, | ||
66 | TARGET_PCIE1, ATTR_PCIE_MEM, -1 | ||
67 | }, | ||
95 | /* | 68 | /* |
96 | * Setup windows for PCIe IO+MEM space. | 69 | * Window for CESA engine. |
97 | */ | 70 | */ |
98 | setup_cpu_win(0, DOVE_PCIE0_IO_PHYS_BASE, DOVE_PCIE0_IO_SIZE, | 71 | { 4, DOVE_CESA_PHYS_BASE, DOVE_CESA_SIZE, |
99 | TARGET_PCIE0, ATTR_PCIE_IO, DOVE_PCIE0_IO_BUS_BASE); | 72 | TARGET_CESA, ATTR_CESA, -1 |
100 | setup_cpu_win(1, DOVE_PCIE1_IO_PHYS_BASE, DOVE_PCIE1_IO_SIZE, | 73 | }, |
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 | /* | 74 | /* |
108 | * Setup window for CESA engine. | 75 | * Window to the BootROM for Standby and Sleep Resume |
109 | */ | 76 | */ |
110 | setup_cpu_win(4, DOVE_CESA_PHYS_BASE, DOVE_CESA_SIZE, | 77 | { 5, DOVE_BOOTROM_PHYS_BASE, DOVE_BOOTROM_SIZE, |
111 | TARGET_CESA, ATTR_CESA, -1); | 78 | TARGET_BOOTROM, ATTR_BOOTROM, -1 |
112 | 79 | }, | |
113 | /* | 80 | /* |
114 | * Setup the Window to the BootROM for Standby and Sleep Resume | 81 | * Window to the PMU Scratch Pad space |
115 | */ | 82 | */ |
116 | setup_cpu_win(5, DOVE_BOOTROM_PHYS_BASE, DOVE_BOOTROM_SIZE, | 83 | { 6, DOVE_SCRATCHPAD_PHYS_BASE, DOVE_SCRATCHPAD_SIZE, |
117 | TARGET_BOOTROM, ATTR_BOOTROM, -1); | 84 | TARGET_SCRATCHPAD, ATTR_SCRATCHPAD, -1 |
85 | }, | ||
86 | /* End marker */ | ||
87 | { -1, 0, 0, 0, 0, 0 } | ||
88 | }; | ||
89 | |||
90 | void __init dove_setup_cpu_mbus(void) | ||
91 | { | ||
92 | int i; | ||
93 | int cs; | ||
118 | 94 | ||
119 | /* | 95 | /* |
120 | * Setup the Window to the PMU Scratch Pad space | 96 | * Disable, clear and configure windows. |
121 | */ | 97 | */ |
122 | setup_cpu_win(6, DOVE_SCRATCHPAD_PHYS_BASE, DOVE_SCRATCHPAD_SIZE, | 98 | orion_config_wins(&addr_map_cfg, addr_map_info); |
123 | TARGET_SCRATCHPAD, ATTR_SCRATCHPAD, -1); | ||
124 | 99 | ||
125 | /* | 100 | /* |
126 | * Setup MBUS dram target info. | 101 | * Setup MBUS dram target info. |
127 | */ | 102 | */ |
128 | dove_mbus_dram_info.mbus_dram_target_id = TARGET_DDR; | 103 | orion_mbus_dram_info.mbus_dram_target_id = TARGET_DDR; |
129 | 104 | ||
130 | for (i = 0, cs = 0; i < 2; i++) { | 105 | for (i = 0, cs = 0; i < 2; i++) { |
131 | u32 map = readl(ddr_map_sc(i)); | 106 | u32 map = readl(ddr_map_sc(i)); |
@@ -136,7 +111,7 @@ void __init dove_setup_cpu_mbus(void) | |||
136 | if (map & 1) { | 111 | if (map & 1) { |
137 | struct mbus_dram_window *w; | 112 | struct mbus_dram_window *w; |
138 | 113 | ||
139 | w = &dove_mbus_dram_info.cs[cs++]; | 114 | w = &orion_mbus_dram_info.cs[cs++]; |
140 | w->cs_index = i; | 115 | w->cs_index = i; |
141 | w->mbus_attr = 0; /* CS address decoding done inside */ | 116 | w->mbus_attr = 0; /* CS address decoding done inside */ |
142 | /* the DDR controller, no need to */ | 117 | /* the DDR controller, no need to */ |
@@ -145,5 +120,5 @@ void __init dove_setup_cpu_mbus(void) | |||
145 | w->size = 0x100000 << (((map & 0x000f0000) >> 16) - 4); | 120 | w->size = 0x100000 << (((map & 0x000f0000) >> 16) - 4); |
146 | } | 121 | } |
147 | } | 122 | } |
148 | dove_mbus_dram_info.num_cs = cs; | 123 | orion_mbus_dram_info.num_cs = cs; |
149 | } | 124 | } |