blob: 9ad2e9737fb5cabd3a1afc2785d31e8dc61dcfdf [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>
Thomas Gleixner5a67b772006-07-01 22:32:37 +01009#include <linux/irq.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/sched.h>
11#include <linux/serial_8250.h>
Russell Kingfced80c2008-09-06 12:10:45 +010012#include <linux/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
14#include <asm/setup.h>
15#include <asm/mach-types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <asm/param.h>
Olof Johansson86dfe442012-03-29 23:22:44 -070017#include <asm/system_misc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
19#include <asm/mach/map.h>
20#include <asm/mach/arch.h>
21#include <asm/mach/time.h>
22
Alexander Schulzeab184c2009-01-08 18:05:58 +010023#define ROMCARD_SIZE 0x08000000
24#define ROMCARD_START 0x10000000
25
Russell Kingb95ff9f2011-11-05 14:41:14 +000026static void shark_restart(char mode, const char *cmd)
Alexander Schulzeab184c2009-01-08 18:05:58 +010027{
28 short temp;
Alexander Schulzeab184c2009-01-08 18:05:58 +010029 /* Reset the Machine via pc[3] of the sequoia chipset */
30 outw(0x09,0x24);
31 temp=inw(0x26);
32 temp = temp | (1<<3) | (1<<10);
33 outw(0x09,0x24);
34 outw(temp,0x26);
35}
36
Linus Torvalds1da177e2005-04-16 15:20:36 -070037static struct plat_serial8250_port serial_platform_data[] = {
38 {
39 .iobase = 0x3f8,
40 .irq = 4,
41 .uartclk = 1843200,
Alexander Schulzb7523412005-07-16 17:17:18 +010042 .regshift = 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 .iotype = UPIO_PORT,
44 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
45 },
46 {
47 .iobase = 0x2f8,
48 .irq = 3,
49 .uartclk = 1843200,
Alexander Schulzb7523412005-07-16 17:17:18 +010050 .regshift = 0,
Linus Torvalds1da177e2005-04-16 15:20:36 -070051 .iotype = UPIO_PORT,
52 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
53 },
54 { },
55};
56
57static struct platform_device serial_device = {
58 .name = "serial8250",
Russell King6df29de2005-09-08 16:04:41 +010059 .id = PLAT8250_DEV_PLATFORM,
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 .dev = {
61 .platform_data = serial_platform_data,
62 },
63};
64
Alexander Schulzeab184c2009-01-08 18:05:58 +010065static struct resource rtc_resources[] = {
66 [0] = {
67 .start = 0x70,
68 .end = 0x73,
69 .flags = IORESOURCE_IO,
70 },
71 [1] = {
72 .start = IRQ_ISA_RTC_ALARM,
73 .end = IRQ_ISA_RTC_ALARM,
74 .flags = IORESOURCE_IRQ,
75 }
76};
77
78static struct platform_device rtc_device = {
79 .name = "rtc_cmos",
80 .id = -1,
81 .resource = rtc_resources,
82 .num_resources = ARRAY_SIZE(rtc_resources),
83};
84
Linus Torvalds1da177e2005-04-16 15:20:36 -070085static int __init shark_init(void)
86{
87 int ret;
88
89 if (machine_is_shark())
Alexander Schulzeab184c2009-01-08 18:05:58 +010090 {
91 ret = platform_device_register(&rtc_device);
92 if (ret) printk(KERN_ERR "Unable to register RTC device: %d\n", ret);
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 ret = platform_device_register(&serial_device);
Alexander Schulzeab184c2009-01-08 18:05:58 +010094 if (ret) printk(KERN_ERR "Unable to register Serial device: %d\n", ret);
95 }
96 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070097}
98
99arch_initcall(shark_init);
100
101extern void shark_init_irq(void);
102
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103#define IRQ_TIMER 0
104#define HZ_TIME ((1193180 + HZ/2) / HZ)
105
106static irqreturn_t
Linus Torvalds0cd61b62006-10-06 10:53:39 -0700107shark_timer_interrupt(int irq, void *dev_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108{
Linus Torvalds0cd61b62006-10-06 10:53:39 -0700109 timer_tick();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110 return IRQ_HANDLED;
111}
112
113static struct irqaction shark_timer_irq = {
114 .name = "Shark Timer Tick",
Bernhard Walleb30faba2007-05-08 00:35:39 -0700115 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
Russell King09b8b5f2005-06-26 17:06:36 +0100116 .handler = shark_timer_interrupt,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117};
118
119/*
120 * Set up timer interrupt, and return the current time in seconds.
121 */
122static void __init shark_timer_init(void)
123{
124 outb(0x34, 0x43); /* binary, mode 0, LSB/MSB, Ch 0 */
125 outb(HZ_TIME & 0xff, 0x40); /* LSB of count */
126 outb(HZ_TIME >> 8, 0x40);
127
128 setup_irq(IRQ_TIMER, &shark_timer_irq);
129}
130
131static struct sys_timer shark_timer = {
132 .init = shark_timer_init,
133};
134
Nicolas Pitree5ddf4e2011-08-03 12:00:02 -0400135static void shark_init_early(void)
136{
137 disable_hlt();
138}
139
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140MACHINE_START(SHARK, "Shark")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100141 /* Maintainer: Alexander Schulz */
Nicolas Pitre8322cd4b2011-07-05 22:38:17 -0400142 .atag_offset = 0x3000,
Nicolas Pitree5ddf4e2011-08-03 12:00:02 -0400143 .init_early = shark_init_early,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100144 .init_irq = shark_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 .timer = &shark_timer,
Nicolas Pitrefded1ef2011-07-05 22:28:09 -0400146 .dma_zone_size = SZ_4M,
Russell Kingb95ff9f2011-11-05 14:41:14 +0000147 .restart = shark_restart,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148MACHINE_END