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