blob: 5f02664db81245244a1d1939836968a6ead0b47b [file] [log] [blame]
Lennert Buytenhek777f9be2008-06-22 22:45:02 +02001/*
2 * arch/arm/mach-loki/common.c
3 *
4 * Core functions for Marvell Loki (88RC8480) SoCs
5 *
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 */
10
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>
Andrew Lunn5c602552011-05-15 13:32:40 +020016#include <linux/dma-mapping.h>
Lennert Buytenhek777f9be2008-06-22 22:45:02 +020017#include <asm/page.h>
18#include <asm/timex.h>
19#include <asm/mach/map.h>
20#include <asm/mach/time.h>
Lennert Buytenhek4ee1f6b2010-10-15 16:50:26 +020021#include <mach/bridge-regs.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010022#include <mach/loki.h>
Lennert Buytenhek6f088f12008-08-09 13:44:58 +020023#include <plat/orion_nand.h>
24#include <plat/time.h>
Andrew Lunn28a2b452011-05-15 13:32:41 +020025#include <plat/common.h>
Lennert Buytenhek777f9be2008-06-22 22:45:02 +020026#include "common.h"
27
28/*****************************************************************************
29 * I/O Address Mapping
30 ****************************************************************************/
31static struct map_desc loki_io_desc[] __initdata = {
32 {
33 .virtual = LOKI_REGS_VIRT_BASE,
34 .pfn = __phys_to_pfn(LOKI_REGS_PHYS_BASE),
35 .length = LOKI_REGS_SIZE,
36 .type = MT_DEVICE,
37 },
38};
39
40void __init loki_map_io(void)
41{
42 iotable_init(loki_io_desc, ARRAY_SIZE(loki_io_desc));
43}
44
45
46/*****************************************************************************
Andrew Lunn7e3819d2011-05-15 13:32:44 +020047 * GE00
Lennert Buytenhek777f9be2008-06-22 22:45:02 +020048 ****************************************************************************/
Lennert Buytenhek777f9be2008-06-22 22:45:02 +020049void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data)
50{
Lennert Buytenhek777f9be2008-06-22 22:45:02 +020051 writel(0x00079220, GE0_VIRT_BASE + 0x20b0);
Andrew Lunn7e3819d2011-05-15 13:32:44 +020052
53 orion_ge00_init(eth_data, &loki_mbus_dram_info,
54 GE0_PHYS_BASE, IRQ_LOKI_GBE_A_INT,
55 0, LOKI_TCLK);
Lennert Buytenhek777f9be2008-06-22 22:45:02 +020056}
57
58
59/*****************************************************************************
Andrew Lunn7e3819d2011-05-15 13:32:44 +020060 * GE01
Lennert Buytenhek777f9be2008-06-22 22:45:02 +020061 ****************************************************************************/
Lennert Buytenhek777f9be2008-06-22 22:45:02 +020062void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data)
63{
Lennert Buytenhek777f9be2008-06-22 22:45:02 +020064 writel(0x00079220, GE1_VIRT_BASE + 0x20b0);
Andrew Lunn7e3819d2011-05-15 13:32:44 +020065
66 orion_ge01_init(eth_data, &loki_mbus_dram_info,
67 GE1_PHYS_BASE, IRQ_LOKI_GBE_B_INT,
68 0, LOKI_TCLK);
Lennert Buytenhek777f9be2008-06-22 22:45:02 +020069}
70
71
72/*****************************************************************************
73 * SAS/SATA
74 ****************************************************************************/
75static struct resource loki_sas_resources[] = {
76 {
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,
96 },
97};
98
99static struct platform_device loki_sas = {
100 .name = "mvsas",
101 .id = 0,
102 .dev = {
Andrew Lunn5c602552011-05-15 13:32:40 +0200103 .coherent_dma_mask = DMA_BIT_MASK(32),
Lennert Buytenhek777f9be2008-06-22 22:45:02 +0200104 },
105 .num_resources = ARRAY_SIZE(loki_sas_resources),
106 .resource = loki_sas_resources,
107};
108
109void __init loki_sas_init(void)
110{
111 writel(0x8300f707, DDR_REG(0x1424));
112 platform_device_register(&loki_sas);
113}
114
115
116/*****************************************************************************
117 * UART0
118 ****************************************************************************/
Lennert Buytenhek777f9be2008-06-22 22:45:02 +0200119void __init loki_uart0_init(void)
120{
Andrew Lunn28a2b452011-05-15 13:32:41 +0200121 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
122 IRQ_LOKI_UART0, LOKI_TCLK);
Lennert Buytenhek777f9be2008-06-22 22:45:02 +0200123}
124
Lennert Buytenhek777f9be2008-06-22 22:45:02 +0200125/*****************************************************************************
126 * UART1
127 ****************************************************************************/
Lennert Buytenhek777f9be2008-06-22 22:45:02 +0200128void __init loki_uart1_init(void)
129{
Andrew Lunn28a2b452011-05-15 13:32:41 +0200130 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
131 IRQ_LOKI_UART1, LOKI_TCLK);
Lennert Buytenhek777f9be2008-06-22 22:45:02 +0200132}
133
134
135/*****************************************************************************
136 * Time handling
137 ****************************************************************************/
Lennert Buytenhek4ee1f6b2010-10-15 16:50:26 +0200138void __init loki_init_early(void)
139{
140 orion_time_set_base(TIMER_VIRT_BASE);
141}
142
Lennert Buytenhek777f9be2008-06-22 22:45:02 +0200143static void loki_timer_init(void)
144{
Lennert Buytenhek4ee1f6b2010-10-15 16:50:26 +0200145 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
146 IRQ_LOKI_BRIDGE, LOKI_TCLK);
Lennert Buytenhek777f9be2008-06-22 22:45:02 +0200147}
148
149struct sys_timer loki_timer = {
150 .init = loki_timer_init,
151};
152
153
154/*****************************************************************************
155 * General
156 ****************************************************************************/
157void __init loki_init(void)
158{
159 printk(KERN_INFO "Loki ID: 88RC8480. TCLK=%d.\n", LOKI_TCLK);
160
161 loki_setup_cpu_mbus();
162}