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.
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>
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>
28 /*****************************************************************************
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
,
40 void __init
loki_map_io(void)
42 iotable_init(loki_io_desc
, ARRAY_SIZE(loki_io_desc
));
46 /*****************************************************************************
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
,
59 /*****************************************************************************
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
,
72 /*****************************************************************************
74 ****************************************************************************/
75 static struct resource loki_sas_resources
[] = {
78 .start
= SAS0_PHYS_BASE
,
79 .end
= SAS0_PHYS_BASE
+ 0x01ff,
80 .flags
= IORESOURCE_MEM
,
83 .start
= IRQ_LOKI_SAS_A
,
84 .end
= IRQ_LOKI_SAS_A
,
85 .flags
= IORESOURCE_IRQ
,
88 .start
= SAS1_PHYS_BASE
,
89 .end
= SAS1_PHYS_BASE
+ 0x01ff,
90 .flags
= IORESOURCE_MEM
,
93 .start
= IRQ_LOKI_SAS_B
,
94 .end
= IRQ_LOKI_SAS_B
,
95 .flags
= IORESOURCE_IRQ
,
99 static struct platform_device loki_sas
= {
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 /*****************************************************************************
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 /*****************************************************************************
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 /*****************************************************************************
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 /*****************************************************************************
156 ****************************************************************************/
157 void __init
loki_init(void)
159 printk(KERN_INFO
"Loki ID: 88RC8480. TCLK=%d.\n", LOKI_TCLK
);
161 loki_setup_cpu_mbus();