ARM: 7409/1: Do not call flush_cache_user_range with mmap_sem held
[linux/fpc-iii.git] / arch / arm / mach-loki / common.c
blob5f02664db81245244a1d1939836968a6ead0b47b
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/dma-mapping.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/bridge-regs.h>
22 #include <mach/loki.h>
23 #include <plat/orion_nand.h>
24 #include <plat/time.h>
25 #include <plat/common.h>
26 #include "common.h"
28 /*****************************************************************************
29 * I/O Address Mapping
30 ****************************************************************************/
31 static struct map_desc loki_io_desc[] __initdata = {
33 .virtual = LOKI_REGS_VIRT_BASE,
34 .pfn = __phys_to_pfn(LOKI_REGS_PHYS_BASE),
35 .length = LOKI_REGS_SIZE,
36 .type = MT_DEVICE,
40 void __init loki_map_io(void)
42 iotable_init(loki_io_desc, ARRAY_SIZE(loki_io_desc));
46 /*****************************************************************************
47 * GE00
48 ****************************************************************************/
49 void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data)
51 writel(0x00079220, GE0_VIRT_BASE + 0x20b0);
53 orion_ge00_init(eth_data, &loki_mbus_dram_info,
54 GE0_PHYS_BASE, IRQ_LOKI_GBE_A_INT,
55 0, LOKI_TCLK);
59 /*****************************************************************************
60 * GE01
61 ****************************************************************************/
62 void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data)
64 writel(0x00079220, GE1_VIRT_BASE + 0x20b0);
66 orion_ge01_init(eth_data, &loki_mbus_dram_info,
67 GE1_PHYS_BASE, IRQ_LOKI_GBE_B_INT,
68 0, LOKI_TCLK);
72 /*****************************************************************************
73 * SAS/SATA
74 ****************************************************************************/
75 static struct resource loki_sas_resources[] = {
77 .name = "mvsas0 mem",
78 .start = SAS0_PHYS_BASE,
79 .end = SAS0_PHYS_BASE + 0x01ff,
80 .flags = IORESOURCE_MEM,
81 }, {
82 .name = "mvsas0 irq",
83 .start = IRQ_LOKI_SAS_A,
84 .end = IRQ_LOKI_SAS_A,
85 .flags = IORESOURCE_IRQ,
86 }, {
87 .name = "mvsas1 mem",
88 .start = SAS1_PHYS_BASE,
89 .end = SAS1_PHYS_BASE + 0x01ff,
90 .flags = IORESOURCE_MEM,
91 }, {
92 .name = "mvsas1 irq",
93 .start = IRQ_LOKI_SAS_B,
94 .end = IRQ_LOKI_SAS_B,
95 .flags = IORESOURCE_IRQ,
99 static struct platform_device loki_sas = {
100 .name = "mvsas",
101 .id = 0,
102 .dev = {
103 .coherent_dma_mask = DMA_BIT_MASK(32),
105 .num_resources = ARRAY_SIZE(loki_sas_resources),
106 .resource = loki_sas_resources,
109 void __init loki_sas_init(void)
111 writel(0x8300f707, DDR_REG(0x1424));
112 platform_device_register(&loki_sas);
116 /*****************************************************************************
117 * UART0
118 ****************************************************************************/
119 void __init loki_uart0_init(void)
121 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
122 IRQ_LOKI_UART0, LOKI_TCLK);
125 /*****************************************************************************
126 * UART1
127 ****************************************************************************/
128 void __init loki_uart1_init(void)
130 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
131 IRQ_LOKI_UART1, LOKI_TCLK);
135 /*****************************************************************************
136 * Time handling
137 ****************************************************************************/
138 void __init loki_init_early(void)
140 orion_time_set_base(TIMER_VIRT_BASE);
143 static void loki_timer_init(void)
145 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
146 IRQ_LOKI_BRIDGE, LOKI_TCLK);
149 struct sys_timer loki_timer = {
150 .init = loki_timer_init,
154 /*****************************************************************************
155 * General
156 ****************************************************************************/
157 void __init loki_init(void)
159 printk(KERN_INFO "Loki ID: 88RC8480. TCLK=%d.\n", LOKI_TCLK);
161 loki_setup_cpu_mbus();