Merge git://git.marvell.com/orion into devel
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / mach-shark / core.c
CommitLineData
1da177e4
LT
1/*
2 * linux/arch/arm/mach-shark/arch.c
3 *
4 * Architecture specific stuff.
5 */
6#include <linux/kernel.h>
7#include <linux/init.h>
8#include <linux/interrupt.h>
5a67b777 9#include <linux/irq.h>
1da177e4
LT
10#include <linux/sched.h>
11#include <linux/serial_8250.h>
fced80c7 12#include <linux/io.h>
1da177e4
LT
13
14#include <asm/setup.h>
15#include <asm/mach-types.h>
1da177e4
LT
16#include <asm/leds.h>
17#include <asm/param.h>
18
47190a33
RK
19#include <mach/hardware.h>
20
1da177e4
LT
21#include <asm/mach/map.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/time.h>
24
25static struct plat_serial8250_port serial_platform_data[] = {
26 {
27 .iobase = 0x3f8,
28 .irq = 4,
29 .uartclk = 1843200,
b7523418 30 .regshift = 0,
1da177e4
LT
31 .iotype = UPIO_PORT,
32 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
33 },
34 {
35 .iobase = 0x2f8,
36 .irq = 3,
37 .uartclk = 1843200,
b7523418 38 .regshift = 0,
1da177e4
LT
39 .iotype = UPIO_PORT,
40 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
41 },
42 { },
43};
44
45static struct platform_device serial_device = {
46 .name = "serial8250",
6df29deb 47 .id = PLAT8250_DEV_PLATFORM,
1da177e4
LT
48 .dev = {
49 .platform_data = serial_platform_data,
50 },
51};
52
53static int __init shark_init(void)
54{
55 int ret;
56
57 if (machine_is_shark())
58 ret = platform_device_register(&serial_device);
59
60 return ret;
61}
62
63arch_initcall(shark_init);
64
65extern void shark_init_irq(void);
66
67static struct map_desc shark_io_desc[] __initdata = {
cd5fc8bf
DS
68 {
69 .virtual = IO_BASE,
70 .pfn = __phys_to_pfn(IO_START),
71 .length = IO_SIZE,
72 .type = MT_DEVICE
73 }
1da177e4
LT
74};
75
76static void __init shark_map_io(void)
77{
78 iotable_init(shark_io_desc, ARRAY_SIZE(shark_io_desc));
79}
80
81#define IRQ_TIMER 0
82#define HZ_TIME ((1193180 + HZ/2) / HZ)
83
84static irqreturn_t
0cd61b68 85shark_timer_interrupt(int irq, void *dev_id)
1da177e4 86{
0cd61b68 87 timer_tick();
1da177e4
LT
88 return IRQ_HANDLED;
89}
90
91static struct irqaction shark_timer_irq = {
92 .name = "Shark Timer Tick",
b30fabad 93 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
09b8b5f8 94 .handler = shark_timer_interrupt,
1da177e4
LT
95};
96
97/*
98 * Set up timer interrupt, and return the current time in seconds.
99 */
100static void __init shark_timer_init(void)
101{
102 outb(0x34, 0x43); /* binary, mode 0, LSB/MSB, Ch 0 */
103 outb(HZ_TIME & 0xff, 0x40); /* LSB of count */
104 outb(HZ_TIME >> 8, 0x40);
105
106 setup_irq(IRQ_TIMER, &shark_timer_irq);
107}
108
109static struct sys_timer shark_timer = {
110 .init = shark_timer_init,
111};
112
113MACHINE_START(SHARK, "Shark")
e9dea0c6 114 /* Maintainer: Alexander Schulz */
e9dea0c6
RK
115 .phys_io = 0x40000000,
116 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
117 .boot_params = 0x08003000,
118 .map_io = shark_map_io,
119 .init_irq = shark_init_irq,
1da177e4
LT
120 .timer = &shark_timer,
121MACHINE_END