]>
Commit | Line | Data |
---|---|---|
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 | 16 | #include <asm/param.h> |
86dfe446 | 17 | #include <asm/system_misc.h> |
1da177e4 LT |
18 | |
19 | #include <asm/mach/map.h> | |
20 | #include <asm/mach/arch.h> | |
21 | #include <asm/mach/time.h> | |
22 | ||
eab184c2 AS |
23 | #define ROMCARD_SIZE 0x08000000 |
24 | #define ROMCARD_START 0x10000000 | |
25 | ||
b95ff9fe | 26 | static void shark_restart(char mode, const char *cmd) |
eab184c2 AS |
27 | { |
28 | short temp; | |
eab184c2 AS |
29 | /* 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 | ||
1da177e4 LT |
37 | static struct plat_serial8250_port serial_platform_data[] = { |
38 | { | |
39 | .iobase = 0x3f8, | |
40 | .irq = 4, | |
41 | .uartclk = 1843200, | |
b7523418 | 42 | .regshift = 0, |
1da177e4 LT |
43 | .iotype = UPIO_PORT, |
44 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, | |
45 | }, | |
46 | { | |
47 | .iobase = 0x2f8, | |
48 | .irq = 3, | |
49 | .uartclk = 1843200, | |
b7523418 | 50 | .regshift = 0, |
1da177e4 LT |
51 | .iotype = UPIO_PORT, |
52 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, | |
53 | }, | |
54 | { }, | |
55 | }; | |
56 | ||
57 | static struct platform_device serial_device = { | |
58 | .name = "serial8250", | |
6df29deb | 59 | .id = PLAT8250_DEV_PLATFORM, |
1da177e4 LT |
60 | .dev = { |
61 | .platform_data = serial_platform_data, | |
62 | }, | |
63 | }; | |
64 | ||
eab184c2 AS |
65 | static 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 | ||
78 | static 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 | ||
1da177e4 LT |
85 | static int __init shark_init(void) |
86 | { | |
87 | int ret; | |
88 | ||
89 | if (machine_is_shark()) | |
eab184c2 AS |
90 | { |
91 | ret = platform_device_register(&rtc_device); | |
92 | if (ret) printk(KERN_ERR "Unable to register RTC device: %d\n", ret); | |
1da177e4 | 93 | ret = platform_device_register(&serial_device); |
eab184c2 AS |
94 | if (ret) printk(KERN_ERR "Unable to register Serial device: %d\n", ret); |
95 | } | |
96 | return 0; | |
1da177e4 LT |
97 | } |
98 | ||
99 | arch_initcall(shark_init); | |
100 | ||
101 | extern void shark_init_irq(void); | |
102 | ||
1da177e4 LT |
103 | #define IRQ_TIMER 0 |
104 | #define HZ_TIME ((1193180 + HZ/2) / HZ) | |
105 | ||
106 | static irqreturn_t | |
0cd61b68 | 107 | shark_timer_interrupt(int irq, void *dev_id) |
1da177e4 | 108 | { |
0cd61b68 | 109 | timer_tick(); |
1da177e4 LT |
110 | return IRQ_HANDLED; |
111 | } | |
112 | ||
113 | static struct irqaction shark_timer_irq = { | |
114 | .name = "Shark Timer Tick", | |
b30fabad | 115 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, |
09b8b5f8 | 116 | .handler = shark_timer_interrupt, |
1da177e4 LT |
117 | }; |
118 | ||
119 | /* | |
120 | * Set up timer interrupt, and return the current time in seconds. | |
121 | */ | |
122 | static 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 | ||
e5ddf4e3 NP |
131 | static void shark_init_early(void) |
132 | { | |
133 | disable_hlt(); | |
134 | } | |
135 | ||
1da177e4 | 136 | MACHINE_START(SHARK, "Shark") |
e9dea0c6 | 137 | /* Maintainer: Alexander Schulz */ |
8322cd4b | 138 | .atag_offset = 0x3000, |
e5ddf4e3 | 139 | .init_early = shark_init_early, |
e9dea0c6 | 140 | .init_irq = shark_init_irq, |
6bb27d73 | 141 | .init_time = shark_timer_init, |
fded1ef9 | 142 | .dma_zone_size = SZ_4M, |
b95ff9fe | 143 | .restart = shark_restart, |
1da177e4 | 144 | MACHINE_END |