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> |
f7b861b7 | 13 | #include <linux/cpu.h> |
1da177e4 LT |
14 | |
15 | #include <asm/setup.h> | |
16 | #include <asm/mach-types.h> | |
1da177e4 | 17 | #include <asm/param.h> |
86dfe446 | 18 | #include <asm/system_misc.h> |
1da177e4 LT |
19 | |
20 | #include <asm/mach/map.h> | |
21 | #include <asm/mach/arch.h> | |
22 | #include <asm/mach/time.h> | |
23 | ||
eab184c2 AS |
24 | #define ROMCARD_SIZE 0x08000000 |
25 | #define ROMCARD_START 0x10000000 | |
26 | ||
b95ff9fe | 27 | static void shark_restart(char mode, const char *cmd) |
eab184c2 AS |
28 | { |
29 | short temp; | |
eab184c2 AS |
30 | /* Reset the Machine via pc[3] of the sequoia chipset */ |
31 | outw(0x09,0x24); | |
32 | temp=inw(0x26); | |
33 | temp = temp | (1<<3) | (1<<10); | |
34 | outw(0x09,0x24); | |
35 | outw(temp,0x26); | |
36 | } | |
37 | ||
1da177e4 LT |
38 | static struct plat_serial8250_port serial_platform_data[] = { |
39 | { | |
40 | .iobase = 0x3f8, | |
41 | .irq = 4, | |
42 | .uartclk = 1843200, | |
b7523418 | 43 | .regshift = 0, |
1da177e4 LT |
44 | .iotype = UPIO_PORT, |
45 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, | |
46 | }, | |
47 | { | |
48 | .iobase = 0x2f8, | |
49 | .irq = 3, | |
50 | .uartclk = 1843200, | |
b7523418 | 51 | .regshift = 0, |
1da177e4 LT |
52 | .iotype = UPIO_PORT, |
53 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, | |
54 | }, | |
55 | { }, | |
56 | }; | |
57 | ||
58 | static struct platform_device serial_device = { | |
59 | .name = "serial8250", | |
6df29deb | 60 | .id = PLAT8250_DEV_PLATFORM, |
1da177e4 LT |
61 | .dev = { |
62 | .platform_data = serial_platform_data, | |
63 | }, | |
64 | }; | |
65 | ||
eab184c2 AS |
66 | static struct resource rtc_resources[] = { |
67 | [0] = { | |
68 | .start = 0x70, | |
69 | .end = 0x73, | |
70 | .flags = IORESOURCE_IO, | |
71 | }, | |
72 | [1] = { | |
73 | .start = IRQ_ISA_RTC_ALARM, | |
74 | .end = IRQ_ISA_RTC_ALARM, | |
75 | .flags = IORESOURCE_IRQ, | |
76 | } | |
77 | }; | |
78 | ||
79 | static struct platform_device rtc_device = { | |
80 | .name = "rtc_cmos", | |
81 | .id = -1, | |
82 | .resource = rtc_resources, | |
83 | .num_resources = ARRAY_SIZE(rtc_resources), | |
84 | }; | |
85 | ||
1da177e4 LT |
86 | static int __init shark_init(void) |
87 | { | |
88 | int ret; | |
89 | ||
90 | if (machine_is_shark()) | |
eab184c2 AS |
91 | { |
92 | ret = platform_device_register(&rtc_device); | |
93 | if (ret) printk(KERN_ERR "Unable to register RTC device: %d\n", ret); | |
1da177e4 | 94 | ret = platform_device_register(&serial_device); |
eab184c2 AS |
95 | if (ret) printk(KERN_ERR "Unable to register Serial device: %d\n", ret); |
96 | } | |
97 | return 0; | |
1da177e4 LT |
98 | } |
99 | ||
100 | arch_initcall(shark_init); | |
101 | ||
102 | extern void shark_init_irq(void); | |
103 | ||
1da177e4 LT |
104 | #define IRQ_TIMER 0 |
105 | #define HZ_TIME ((1193180 + HZ/2) / HZ) | |
106 | ||
107 | static irqreturn_t | |
0cd61b68 | 108 | shark_timer_interrupt(int irq, void *dev_id) |
1da177e4 | 109 | { |
0cd61b68 | 110 | timer_tick(); |
1da177e4 LT |
111 | return IRQ_HANDLED; |
112 | } | |
113 | ||
114 | static struct irqaction shark_timer_irq = { | |
115 | .name = "Shark Timer Tick", | |
b30fabad | 116 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, |
09b8b5f8 | 117 | .handler = shark_timer_interrupt, |
1da177e4 LT |
118 | }; |
119 | ||
120 | /* | |
121 | * Set up timer interrupt, and return the current time in seconds. | |
122 | */ | |
123 | static void __init shark_timer_init(void) | |
124 | { | |
125 | outb(0x34, 0x43); /* binary, mode 0, LSB/MSB, Ch 0 */ | |
126 | outb(HZ_TIME & 0xff, 0x40); /* LSB of count */ | |
127 | outb(HZ_TIME >> 8, 0x40); | |
128 | ||
129 | setup_irq(IRQ_TIMER, &shark_timer_irq); | |
130 | } | |
131 | ||
e5ddf4e3 NP |
132 | static void shark_init_early(void) |
133 | { | |
f7b861b7 | 134 | cpu_idle_poll_ctrl(true); |
e5ddf4e3 NP |
135 | } |
136 | ||
1da177e4 | 137 | MACHINE_START(SHARK, "Shark") |
e9dea0c6 | 138 | /* Maintainer: Alexander Schulz */ |
8322cd4b | 139 | .atag_offset = 0x3000, |
e5ddf4e3 | 140 | .init_early = shark_init_early, |
e9dea0c6 | 141 | .init_irq = shark_init_irq, |
6bb27d73 | 142 | .init_time = shark_timer_init, |
fded1ef9 | 143 | .dma_zone_size = SZ_4M, |
b95ff9fe | 144 | .restart = shark_restart, |
1da177e4 | 145 | MACHINE_END |