x86: Set cpu_llc_id on AMD CPUs
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-loki / common.c
blob818f19d7ab1f6af7ef050d5a167e14b85b3df921
1 /*
2 * arch/arm/mach-loki/common.c
4 * Core functions for Marvell Loki (88RC8480) SoCs
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/serial_8250.h>
15 #include <linux/mbus.h>
16 #include <linux/mv643xx_eth.h>
17 #include <asm/page.h>
18 #include <asm/timex.h>
19 #include <asm/mach/map.h>
20 #include <asm/mach/time.h>
21 #include <mach/loki.h>
22 #include <plat/orion_nand.h>
23 #include <plat/time.h>
24 #include "common.h"
26 /*****************************************************************************
27 * I/O Address Mapping
28 ****************************************************************************/
29 static struct map_desc loki_io_desc[] __initdata = {
31 .virtual = LOKI_REGS_VIRT_BASE,
32 .pfn = __phys_to_pfn(LOKI_REGS_PHYS_BASE),
33 .length = LOKI_REGS_SIZE,
34 .type = MT_DEVICE,
38 void __init loki_map_io(void)
40 iotable_init(loki_io_desc, ARRAY_SIZE(loki_io_desc));
44 /*****************************************************************************
45 * GE0
46 ****************************************************************************/
47 struct mv643xx_eth_shared_platform_data loki_ge0_shared_data = {
48 .t_clk = LOKI_TCLK,
49 .dram = &loki_mbus_dram_info,
52 static struct resource loki_ge0_shared_resources[] = {
54 .name = "ge0 base",
55 .start = GE0_PHYS_BASE + 0x2000,
56 .end = GE0_PHYS_BASE + 0x3fff,
57 .flags = IORESOURCE_MEM,
61 static struct platform_device loki_ge0_shared = {
62 .name = MV643XX_ETH_SHARED_NAME,
63 .id = 0,
64 .dev = {
65 .platform_data = &loki_ge0_shared_data,
67 .num_resources = 1,
68 .resource = loki_ge0_shared_resources,
71 static struct resource loki_ge0_resources[] = {
73 .name = "ge0 irq",
74 .start = IRQ_LOKI_GBE_A_INT,
75 .end = IRQ_LOKI_GBE_A_INT,
76 .flags = IORESOURCE_IRQ,
80 static struct platform_device loki_ge0 = {
81 .name = MV643XX_ETH_NAME,
82 .id = 0,
83 .num_resources = 1,
84 .resource = loki_ge0_resources,
85 .dev = {
86 .coherent_dma_mask = 0xffffffff,
90 void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data)
92 eth_data->shared = &loki_ge0_shared;
93 loki_ge0.dev.platform_data = eth_data;
95 writel(0x00079220, GE0_VIRT_BASE + 0x20b0);
96 platform_device_register(&loki_ge0_shared);
97 platform_device_register(&loki_ge0);
101 /*****************************************************************************
102 * GE1
103 ****************************************************************************/
104 struct mv643xx_eth_shared_platform_data loki_ge1_shared_data = {
105 .t_clk = LOKI_TCLK,
106 .dram = &loki_mbus_dram_info,
109 static struct resource loki_ge1_shared_resources[] = {
111 .name = "ge1 base",
112 .start = GE1_PHYS_BASE + 0x2000,
113 .end = GE1_PHYS_BASE + 0x3fff,
114 .flags = IORESOURCE_MEM,
118 static struct platform_device loki_ge1_shared = {
119 .name = MV643XX_ETH_SHARED_NAME,
120 .id = 1,
121 .dev = {
122 .platform_data = &loki_ge1_shared_data,
124 .num_resources = 1,
125 .resource = loki_ge1_shared_resources,
128 static struct resource loki_ge1_resources[] = {
130 .name = "ge1 irq",
131 .start = IRQ_LOKI_GBE_B_INT,
132 .end = IRQ_LOKI_GBE_B_INT,
133 .flags = IORESOURCE_IRQ,
137 static struct platform_device loki_ge1 = {
138 .name = MV643XX_ETH_NAME,
139 .id = 1,
140 .num_resources = 1,
141 .resource = loki_ge1_resources,
142 .dev = {
143 .coherent_dma_mask = 0xffffffff,
147 void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data)
149 eth_data->shared = &loki_ge1_shared;
150 loki_ge1.dev.platform_data = eth_data;
152 writel(0x00079220, GE1_VIRT_BASE + 0x20b0);
153 platform_device_register(&loki_ge1_shared);
154 platform_device_register(&loki_ge1);
158 /*****************************************************************************
159 * SAS/SATA
160 ****************************************************************************/
161 static struct resource loki_sas_resources[] = {
163 .name = "mvsas0 mem",
164 .start = SAS0_PHYS_BASE,
165 .end = SAS0_PHYS_BASE + 0x01ff,
166 .flags = IORESOURCE_MEM,
167 }, {
168 .name = "mvsas0 irq",
169 .start = IRQ_LOKI_SAS_A,
170 .end = IRQ_LOKI_SAS_A,
171 .flags = IORESOURCE_IRQ,
172 }, {
173 .name = "mvsas1 mem",
174 .start = SAS1_PHYS_BASE,
175 .end = SAS1_PHYS_BASE + 0x01ff,
176 .flags = IORESOURCE_MEM,
177 }, {
178 .name = "mvsas1 irq",
179 .start = IRQ_LOKI_SAS_B,
180 .end = IRQ_LOKI_SAS_B,
181 .flags = IORESOURCE_IRQ,
185 static struct platform_device loki_sas = {
186 .name = "mvsas",
187 .id = 0,
188 .dev = {
189 .coherent_dma_mask = 0xffffffff,
191 .num_resources = ARRAY_SIZE(loki_sas_resources),
192 .resource = loki_sas_resources,
195 void __init loki_sas_init(void)
197 writel(0x8300f707, DDR_REG(0x1424));
198 platform_device_register(&loki_sas);
202 /*****************************************************************************
203 * UART0
204 ****************************************************************************/
205 static struct plat_serial8250_port loki_uart0_data[] = {
207 .mapbase = UART0_PHYS_BASE,
208 .membase = (char *)UART0_VIRT_BASE,
209 .irq = IRQ_LOKI_UART0,
210 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
211 .iotype = UPIO_MEM,
212 .regshift = 2,
213 .uartclk = LOKI_TCLK,
214 }, {
218 static struct resource loki_uart0_resources[] = {
220 .start = UART0_PHYS_BASE,
221 .end = UART0_PHYS_BASE + 0xff,
222 .flags = IORESOURCE_MEM,
223 }, {
224 .start = IRQ_LOKI_UART0,
225 .end = IRQ_LOKI_UART0,
226 .flags = IORESOURCE_IRQ,
230 static struct platform_device loki_uart0 = {
231 .name = "serial8250",
232 .id = 0,
233 .dev = {
234 .platform_data = loki_uart0_data,
236 .resource = loki_uart0_resources,
237 .num_resources = ARRAY_SIZE(loki_uart0_resources),
240 void __init loki_uart0_init(void)
242 platform_device_register(&loki_uart0);
246 /*****************************************************************************
247 * UART1
248 ****************************************************************************/
249 static struct plat_serial8250_port loki_uart1_data[] = {
251 .mapbase = UART1_PHYS_BASE,
252 .membase = (char *)UART1_VIRT_BASE,
253 .irq = IRQ_LOKI_UART1,
254 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
255 .iotype = UPIO_MEM,
256 .regshift = 2,
257 .uartclk = LOKI_TCLK,
258 }, {
262 static struct resource loki_uart1_resources[] = {
264 .start = UART1_PHYS_BASE,
265 .end = UART1_PHYS_BASE + 0xff,
266 .flags = IORESOURCE_MEM,
267 }, {
268 .start = IRQ_LOKI_UART1,
269 .end = IRQ_LOKI_UART1,
270 .flags = IORESOURCE_IRQ,
274 static struct platform_device loki_uart1 = {
275 .name = "serial8250",
276 .id = 1,
277 .dev = {
278 .platform_data = loki_uart1_data,
280 .resource = loki_uart1_resources,
281 .num_resources = ARRAY_SIZE(loki_uart1_resources),
284 void __init loki_uart1_init(void)
286 platform_device_register(&loki_uart1);
290 /*****************************************************************************
291 * Time handling
292 ****************************************************************************/
293 static void loki_timer_init(void)
295 orion_time_init(IRQ_LOKI_BRIDGE, LOKI_TCLK);
298 struct sys_timer loki_timer = {
299 .init = loki_timer_init,
303 /*****************************************************************************
304 * General
305 ****************************************************************************/
306 void __init loki_init(void)
308 printk(KERN_INFO "Loki ID: 88RC8480. TCLK=%d.\n", LOKI_TCLK);
310 loki_setup_cpu_mbus();