blob: e95859748fa6ba2e90c394eef93d9143beec059a [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>
David Howells9f97da72012-03-28 18:30:01 +010031#include <asm/system_misc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
33#include <asm/mach/map.h>
34#include <asm/mach/arch.h>
35#include <asm/mach/time.h>
36
37extern void rpc_init_irq(void);
38
Russell Kingebe2a9f2005-06-22 09:55:04 +010039unsigned int vram_size;
Linus Torvalds1da177e2005-04-16 15:20:36 -070040unsigned int memc_ctrl_reg;
41unsigned int number_mfm_drives;
42
43static int __init parse_tag_acorn(const struct tag *tag)
44{
45 memc_ctrl_reg = tag->u.acorn.memc_control_reg;
46 number_mfm_drives = tag->u.acorn.adfsdrives;
47
48 switch (tag->u.acorn.vram_pages) {
49 case 512:
50 vram_size += PAGE_SIZE * 256;
51 case 256:
52 vram_size += PAGE_SIZE * 256;
53 default:
54 break;
55 }
56#if 0
57 if (vram_size) {
58 desc->video_start = 0x02000000;
59 desc->video_end = 0x02000000 + vram_size;
60 }
61#endif
62 return 0;
63}
64
65__tagtable(ATAG_ACORN, parse_tag_acorn);
66
Linus Torvalds1da177e2005-04-16 15:20:36 -070067static struct map_desc rpc_io_desc[] __initdata = {
Deepak Saxenaf9258f22005-10-28 15:19:02 +010068 { /* VRAM */
69 .virtual = SCREEN_BASE,
70 .pfn = __phys_to_pfn(SCREEN_START),
71 .length = 2*1048576,
72 .type = MT_DEVICE
73 }, { /* IO space */
74 .virtual = (u32)IO_BASE,
75 .pfn = __phys_to_pfn(IO_START),
76 .length = IO_SIZE ,
77 .type = MT_DEVICE
78 }, { /* EASI space */
Russell King5e4cdb82011-07-07 11:40:52 +010079 .virtual = (unsigned long)EASI_BASE,
Deepak Saxenaf9258f22005-10-28 15:19:02 +010080 .pfn = __phys_to_pfn(EASI_START),
81 .length = EASI_SIZE,
82 .type = MT_DEVICE
83 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070084};
85
86static void __init rpc_map_io(void)
87{
88 iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc));
89
90 /*
91 * Turn off floppy.
92 */
Russell King13a63ab2007-07-20 10:44:02 +010093 writeb(0xc, PCIO_BASE + (0x3f2 << 2));
Linus Torvalds1da177e2005-04-16 15:20:36 -070094
95 /*
96 * RiscPC can't handle half-word loads and stores
97 */
98 elf_hwcap &= ~HWCAP_HALF;
99}
100
101static struct resource acornfb_resources[] = {
102 { /* VIDC */
103 .start = 0x03400000,
104 .end = 0x035fffff,
105 .flags = IORESOURCE_MEM,
106 }, {
107 .start = IRQ_VSYNCPULSE,
108 .end = IRQ_VSYNCPULSE,
109 .flags = IORESOURCE_IRQ,
110 },
111};
112
113static struct platform_device acornfb_device = {
114 .name = "acornfb",
115 .id = -1,
116 .dev = {
117 .coherent_dma_mask = 0xffffffff,
118 },
119 .num_resources = ARRAY_SIZE(acornfb_resources),
120 .resource = acornfb_resources,
121};
122
123static struct resource iomd_resources[] = {
124 {
125 .start = 0x03200000,
126 .end = 0x0320ffff,
127 .flags = IORESOURCE_MEM,
128 },
129};
130
131static struct platform_device iomd_device = {
132 .name = "iomd",
133 .id = -1,
134 .num_resources = ARRAY_SIZE(iomd_resources),
135 .resource = iomd_resources,
136};
137
138static struct platform_device kbd_device = {
139 .name = "kart",
140 .id = -1,
141 .dev = {
142 .parent = &iomd_device.dev,
143 },
144};
145
146static struct plat_serial8250_port serial_platform_data[] = {
147 {
148 .mapbase = 0x03010fe0,
149 .irq = 10,
150 .uartclk = 1843200,
151 .regshift = 2,
152 .iotype = UPIO_MEM,
153 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST,
154 },
155 { },
156};
157
158static struct platform_device serial_device = {
159 .name = "serial8250",
Russell King6df29de2005-09-08 16:04:41 +0100160 .id = PLAT8250_DEV_PLATFORM,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161 .dev = {
162 .platform_data = serial_platform_data,
163 },
164};
165
Russell Kinga17dba82007-04-21 15:55:06 +0100166static struct pata_platform_info pata_platform_data = {
167 .ioport_shift = 2,
168};
169
170static struct resource pata_resources[] = {
171 [0] = {
172 .start = 0x030107c0,
173 .end = 0x030107df,
174 .flags = IORESOURCE_MEM,
175 },
176 [1] = {
177 .start = 0x03010fd8,
178 .end = 0x03010fdb,
179 .flags = IORESOURCE_MEM,
180 },
181 [2] = {
182 .start = IRQ_HARDDISK,
183 .end = IRQ_HARDDISK,
184 .flags = IORESOURCE_IRQ,
185 },
186};
187
188static struct platform_device pata_device = {
189 .name = "pata_platform",
190 .id = -1,
191 .num_resources = ARRAY_SIZE(pata_resources),
192 .resource = pata_resources,
193 .dev = {
194 .platform_data = &pata_platform_data,
195 .coherent_dma_mask = ~0, /* grumble */
196 },
197};
198
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199static struct platform_device *devs[] __initdata = {
200 &iomd_device,
201 &kbd_device,
202 &serial_device,
203 &acornfb_device,
Russell Kinga17dba82007-04-21 15:55:06 +0100204 &pata_device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205};
206
Russell King531660e2009-02-24 19:19:50 +0100207static struct i2c_board_info i2c_rtc = {
208 I2C_BOARD_INFO("pcf8583", 0x50)
209};
210
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211static int __init rpc_init(void)
212{
Russell King531660e2009-02-24 19:19:50 +0100213 i2c_register_board_info(0, &i2c_rtc, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 return platform_add_devices(devs, ARRAY_SIZE(devs));
215}
216
217arch_initcall(rpc_init);
218
Russell Kinge11e9092011-11-04 16:42:37 +0000219static void rpc_restart(char mode, const char *cmd)
220{
221 iomd_writeb(0, IOMD_ROMCR0);
222
223 /*
224 * Jump into the ROM
225 */
226 soft_restart(0);
227}
228
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229extern struct sys_timer ioc_timer;
230
231MACHINE_START(RISCPC, "Acorn-RiscPC")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100232 /* Maintainer: Russell King */
Nicolas Pitre237e8872011-07-05 22:38:16 -0400233 .atag_offset = 0x100,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100234 .reserve_lp0 = 1,
235 .reserve_lp1 = 1,
236 .map_io = rpc_map_io,
237 .init_irq = rpc_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 .timer = &ioc_timer,
Russell Kinge11e9092011-11-04 16:42:37 +0000239 .restart = rpc_restart,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240MACHINE_END