Merge remote-tracking branch 's5p/for-next'
[linux-2.6/next.git] / arch / arm / mach-shark / core.c
blobac2873c8014b35aa75b428b6c599159cc2131b52
1 /*
2 * linux/arch/arm/mach-shark/arch.c
4 * Architecture specific stuff.
5 */
6 #include <linux/kernel.h>
7 #include <linux/init.h>
8 #include <linux/interrupt.h>
9 #include <linux/irq.h>
10 #include <linux/sched.h>
11 #include <linux/serial_8250.h>
12 #include <linux/io.h>
14 #include <asm/setup.h>
15 #include <asm/mach-types.h>
16 #include <asm/leds.h>
17 #include <asm/param.h>
19 #include <asm/mach/map.h>
20 #include <asm/mach/arch.h>
21 #include <asm/mach/time.h>
23 #define IO_BASE 0xe0000000
24 #define IO_SIZE 0x08000000
25 #define IO_START 0x40000000
26 #define ROMCARD_SIZE 0x08000000
27 #define ROMCARD_START 0x10000000
29 void arch_reset(char mode, const char *cmd)
31 short temp;
32 local_irq_disable();
33 /* Reset the Machine via pc[3] of the sequoia chipset */
34 outw(0x09,0x24);
35 temp=inw(0x26);
36 temp = temp | (1<<3) | (1<<10);
37 outw(0x09,0x24);
38 outw(temp,0x26);
41 static struct plat_serial8250_port serial_platform_data[] = {
43 .iobase = 0x3f8,
44 .irq = 4,
45 .uartclk = 1843200,
46 .regshift = 0,
47 .iotype = UPIO_PORT,
48 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
51 .iobase = 0x2f8,
52 .irq = 3,
53 .uartclk = 1843200,
54 .regshift = 0,
55 .iotype = UPIO_PORT,
56 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
58 { },
61 static struct platform_device serial_device = {
62 .name = "serial8250",
63 .id = PLAT8250_DEV_PLATFORM,
64 .dev = {
65 .platform_data = serial_platform_data,
69 static struct resource rtc_resources[] = {
70 [0] = {
71 .start = 0x70,
72 .end = 0x73,
73 .flags = IORESOURCE_IO,
75 [1] = {
76 .start = IRQ_ISA_RTC_ALARM,
77 .end = IRQ_ISA_RTC_ALARM,
78 .flags = IORESOURCE_IRQ,
82 static struct platform_device rtc_device = {
83 .name = "rtc_cmos",
84 .id = -1,
85 .resource = rtc_resources,
86 .num_resources = ARRAY_SIZE(rtc_resources),
89 static int __init shark_init(void)
91 int ret;
93 if (machine_is_shark())
95 ret = platform_device_register(&rtc_device);
96 if (ret) printk(KERN_ERR "Unable to register RTC device: %d\n", ret);
97 ret = platform_device_register(&serial_device);
98 if (ret) printk(KERN_ERR "Unable to register Serial device: %d\n", ret);
100 return 0;
103 arch_initcall(shark_init);
105 extern void shark_init_irq(void);
107 static struct map_desc shark_io_desc[] __initdata = {
109 .virtual = IO_BASE,
110 .pfn = __phys_to_pfn(IO_START),
111 .length = IO_SIZE,
112 .type = MT_DEVICE
116 static void __init shark_map_io(void)
118 iotable_init(shark_io_desc, ARRAY_SIZE(shark_io_desc));
121 #define IRQ_TIMER 0
122 #define HZ_TIME ((1193180 + HZ/2) / HZ)
124 static irqreturn_t
125 shark_timer_interrupt(int irq, void *dev_id)
127 timer_tick();
128 return IRQ_HANDLED;
131 static struct irqaction shark_timer_irq = {
132 .name = "Shark Timer Tick",
133 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
134 .handler = shark_timer_interrupt,
138 * Set up timer interrupt, and return the current time in seconds.
140 static void __init shark_timer_init(void)
142 outb(0x34, 0x43); /* binary, mode 0, LSB/MSB, Ch 0 */
143 outb(HZ_TIME & 0xff, 0x40); /* LSB of count */
144 outb(HZ_TIME >> 8, 0x40);
146 setup_irq(IRQ_TIMER, &shark_timer_irq);
149 static struct sys_timer shark_timer = {
150 .init = shark_timer_init,
153 MACHINE_START(SHARK, "Shark")
154 /* Maintainer: Alexander Schulz */
155 .boot_params = 0x08003000,
156 .map_io = shark_map_io,
157 .init_irq = shark_init_irq,
158 .timer = &shark_timer,
159 .dma_zone_size = SZ_4M,
160 MACHINE_END