blob: 946c0d11c73b6d80c0dd8e60c8725ba478dd270b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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>
9#include <linux/sched.h>
10#include <linux/serial_8250.h>
11
12#include <asm/setup.h>
13#include <asm/mach-types.h>
14#include <asm/io.h>
15#include <asm/leds.h>
16#include <asm/param.h>
17
18#include <asm/mach/map.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/time.h>
21
22static struct plat_serial8250_port serial_platform_data[] = {
23 {
24 .iobase = 0x3f8,
25 .irq = 4,
26 .uartclk = 1843200,
Alexander Schulzb7523412005-07-16 17:17:18 +010027 .regshift = 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 .iotype = UPIO_PORT,
29 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
30 },
31 {
32 .iobase = 0x2f8,
33 .irq = 3,
34 .uartclk = 1843200,
Alexander Schulzb7523412005-07-16 17:17:18 +010035 .regshift = 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 .iotype = UPIO_PORT,
37 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
38 },
39 { },
40};
41
42static struct platform_device serial_device = {
43 .name = "serial8250",
Russell King6df29de2005-09-08 16:04:41 +010044 .id = PLAT8250_DEV_PLATFORM,
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 .dev = {
46 .platform_data = serial_platform_data,
47 },
48};
49
50static int __init shark_init(void)
51{
52 int ret;
53
54 if (machine_is_shark())
55 ret = platform_device_register(&serial_device);
56
57 return ret;
58}
59
60arch_initcall(shark_init);
61
62extern void shark_init_irq(void);
63
64static struct map_desc shark_io_desc[] __initdata = {
65 { IO_BASE , IO_START , IO_SIZE , MT_DEVICE }
66};
67
68static void __init shark_map_io(void)
69{
70 iotable_init(shark_io_desc, ARRAY_SIZE(shark_io_desc));
71}
72
73#define IRQ_TIMER 0
74#define HZ_TIME ((1193180 + HZ/2) / HZ)
75
76static irqreturn_t
77shark_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
78{
79 write_seqlock(&xtime_lock);
80 timer_tick(regs);
81 write_sequnlock(&xtime_lock);
82 return IRQ_HANDLED;
83}
84
85static struct irqaction shark_timer_irq = {
86 .name = "Shark Timer Tick",
Russell King09b8b5f2005-06-26 17:06:36 +010087 .flags = SA_INTERRUPT | SA_TIMER,
88 .handler = shark_timer_interrupt,
Linus Torvalds1da177e2005-04-16 15:20:36 -070089};
90
91/*
92 * Set up timer interrupt, and return the current time in seconds.
93 */
94static void __init shark_timer_init(void)
95{
96 outb(0x34, 0x43); /* binary, mode 0, LSB/MSB, Ch 0 */
97 outb(HZ_TIME & 0xff, 0x40); /* LSB of count */
98 outb(HZ_TIME >> 8, 0x40);
99
100 setup_irq(IRQ_TIMER, &shark_timer_irq);
101}
102
103static struct sys_timer shark_timer = {
104 .init = shark_timer_init,
105};
106
107MACHINE_START(SHARK, "Shark")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100108 /* Maintainer: Alexander Schulz */
109 .phys_ram = 0x08000000,
110 .phys_io = 0x40000000,
111 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
112 .boot_params = 0x08003000,
113 .map_io = shark_map_io,
114 .init_irq = shark_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 .timer = &shark_timer,
116MACHINE_END