blob: 30baaa8b8a2f2e3294c3244713a1b278924af46a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/mach-rpc/riscpc.c
3 *
4 * Copyright (C) 1998-2001 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Architecture specific fixups.
11 */
12#include <linux/kernel.h>
13#include <linux/tty.h>
14#include <linux/delay.h>
15#include <linux/pm.h>
16#include <linux/init.h>
17#include <linux/sched.h>
18#include <linux/device.h>
19#include <linux/serial_8250.h>
Jeff Garzik0a87e3e2008-02-01 18:02:30 -050020#include <linux/ata_platform.h>
Russell Kingfced80c2008-09-06 12:10:45 +010021#include <linux/io.h>
Russell King531660e2009-02-24 19:19:50 +010022#include <linux/i2c.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
24#include <asm/elf.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <asm/mach-types.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010026#include <mach/hardware.h>
Russell Kinge11e9092011-11-04 16:42:37 +000027#include <asm/hardware/iomd.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include <asm/page.h>
29#include <asm/domain.h>
30#include <asm/setup.h>
31
32#include <asm/mach/map.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/time.h>
35
36extern void rpc_init_irq(void);
37
Russell Kingebe2a9f2005-06-22 09:55:04 +010038unsigned int vram_size;
Linus Torvalds1da177e2005-04-16 15:20:36 -070039unsigned int memc_ctrl_reg;
40unsigned int number_mfm_drives;
41
42static int __init parse_tag_acorn(const struct tag *tag)
43{
44 memc_ctrl_reg = tag->u.acorn.memc_control_reg;
45 number_mfm_drives = tag->u.acorn.adfsdrives;
46
47 switch (tag->u.acorn.vram_pages) {
48 case 512:
49 vram_size += PAGE_SIZE * 256;
50 case 256:
51 vram_size += PAGE_SIZE * 256;
52 default:
53 break;
54 }
55#if 0
56 if (vram_size) {
57 desc->video_start = 0x02000000;
58 desc->video_end = 0x02000000 + vram_size;
59 }
60#endif
61 return 0;
62}
63
64__tagtable(ATAG_ACORN, parse_tag_acorn);
65
Linus Torvalds1da177e2005-04-16 15:20:36 -070066static struct map_desc rpc_io_desc[] __initdata = {
Deepak Saxenaf9258f22005-10-28 15:19:02 +010067 { /* VRAM */
68 .virtual = SCREEN_BASE,
69 .pfn = __phys_to_pfn(SCREEN_START),
70 .length = 2*1048576,
71 .type = MT_DEVICE
72 }, { /* IO space */
73 .virtual = (u32)IO_BASE,
74 .pfn = __phys_to_pfn(IO_START),
75 .length = IO_SIZE ,
76 .type = MT_DEVICE
77 }, { /* EASI space */
Russell King5e4cdb82011-07-07 11:40:52 +010078 .virtual = (unsigned long)EASI_BASE,
Deepak Saxenaf9258f22005-10-28 15:19:02 +010079 .pfn = __phys_to_pfn(EASI_START),
80 .length = EASI_SIZE,
81 .type = MT_DEVICE
82 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070083};
84
85static void __init rpc_map_io(void)
86{
87 iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc));
88
89 /*
90 * Turn off floppy.
91 */
Russell King13a63ab2007-07-20 10:44:02 +010092 writeb(0xc, PCIO_BASE + (0x3f2 << 2));
Linus Torvalds1da177e2005-04-16 15:20:36 -070093
94 /*
95 * RiscPC can't handle half-word loads and stores
96 */
97 elf_hwcap &= ~HWCAP_HALF;
98}
99
100static struct resource acornfb_resources[] = {
101 { /* VIDC */
102 .start = 0x03400000,
103 .end = 0x035fffff,
104 .flags = IORESOURCE_MEM,
105 }, {
106 .start = IRQ_VSYNCPULSE,
107 .end = IRQ_VSYNCPULSE,
108 .flags = IORESOURCE_IRQ,
109 },
110};
111
112static struct platform_device acornfb_device = {
113 .name = "acornfb",
114 .id = -1,
115 .dev = {
116 .coherent_dma_mask = 0xffffffff,
117 },
118 .num_resources = ARRAY_SIZE(acornfb_resources),
119 .resource = acornfb_resources,
120};
121
122static struct resource iomd_resources[] = {
123 {
124 .start = 0x03200000,
125 .end = 0x0320ffff,
126 .flags = IORESOURCE_MEM,
127 },
128};
129
130static struct platform_device iomd_device = {
131 .name = "iomd",
132 .id = -1,
133 .num_resources = ARRAY_SIZE(iomd_resources),
134 .resource = iomd_resources,
135};
136
Russell King8c6d9d02012-03-01 15:47:10 +0000137static struct resource iomd_kart_resources[] = {
138 DEFINE_RES_IRQ(IRQ_KEYBOARDRX),
139 DEFINE_RES_IRQ(IRQ_KEYBOARDTX),
140};
141
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142static struct platform_device kbd_device = {
143 .name = "kart",
144 .id = -1,
145 .dev = {
146 .parent = &iomd_device.dev,
147 },
Russell King8c6d9d02012-03-01 15:47:10 +0000148 .num_resources = ARRAY_SIZE(iomd_kart_resources),
149 .resource = iomd_kart_resources,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150};
151
152static struct plat_serial8250_port serial_platform_data[] = {
153 {
154 .mapbase = 0x03010fe0,
155 .irq = 10,
156 .uartclk = 1843200,
157 .regshift = 2,
158 .iotype = UPIO_MEM,
159 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST,
160 },
161 { },
162};
163
164static struct platform_device serial_device = {
165 .name = "serial8250",
Russell King6df29de2005-09-08 16:04:41 +0100166 .id = PLAT8250_DEV_PLATFORM,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 .dev = {
168 .platform_data = serial_platform_data,
169 },
170};
171
Russell Kinga17dba82007-04-21 15:55:06 +0100172static struct pata_platform_info pata_platform_data = {
173 .ioport_shift = 2,
174};
175
176static struct resource pata_resources[] = {
177 [0] = {
178 .start = 0x030107c0,
179 .end = 0x030107df,
180 .flags = IORESOURCE_MEM,
181 },
182 [1] = {
183 .start = 0x03010fd8,
184 .end = 0x03010fdb,
185 .flags = IORESOURCE_MEM,
186 },
187 [2] = {
188 .start = IRQ_HARDDISK,
189 .end = IRQ_HARDDISK,
190 .flags = IORESOURCE_IRQ,
191 },
192};
193
194static struct platform_device pata_device = {
195 .name = "pata_platform",
196 .id = -1,
197 .num_resources = ARRAY_SIZE(pata_resources),
198 .resource = pata_resources,
199 .dev = {
200 .platform_data = &pata_platform_data,
201 .coherent_dma_mask = ~0, /* grumble */
202 },
203};
204
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205static struct platform_device *devs[] __initdata = {
206 &iomd_device,
207 &kbd_device,
208 &serial_device,
209 &acornfb_device,
Russell Kinga17dba82007-04-21 15:55:06 +0100210 &pata_device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211};
212
Russell King531660e2009-02-24 19:19:50 +0100213static struct i2c_board_info i2c_rtc = {
214 I2C_BOARD_INFO("pcf8583", 0x50)
215};
216
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217static int __init rpc_init(void)
218{
Russell King531660e2009-02-24 19:19:50 +0100219 i2c_register_board_info(0, &i2c_rtc, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220 return platform_add_devices(devs, ARRAY_SIZE(devs));
221}
222
223arch_initcall(rpc_init);
224
Russell Kinge11e9092011-11-04 16:42:37 +0000225static void rpc_restart(char mode, const char *cmd)
226{
227 iomd_writeb(0, IOMD_ROMCR0);
228
229 /*
230 * Jump into the ROM
231 */
232 soft_restart(0);
233}
234
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235extern struct sys_timer ioc_timer;
236
237MACHINE_START(RISCPC, "Acorn-RiscPC")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100238 /* Maintainer: Russell King */
Nicolas Pitre237e8872011-07-05 22:38:16 -0400239 .atag_offset = 0x100,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100240 .reserve_lp0 = 1,
241 .reserve_lp1 = 1,
242 .map_io = rpc_map_io,
243 .init_irq = rpc_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244 .timer = &ioc_timer,
Russell Kinge11e9092011-11-04 16:42:37 +0000245 .restart = rpc_restart,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246MACHINE_END