blob: 208a2b5dba1b009b4515463812a2b686c287db3e [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>
20
21#include <asm/elf.h>
22#include <asm/io.h>
23#include <asm/mach-types.h>
24#include <asm/hardware.h>
25#include <asm/page.h>
26#include <asm/domain.h>
27#include <asm/setup.h>
28
29#include <asm/mach/map.h>
30#include <asm/mach/arch.h>
31#include <asm/mach/time.h>
32
33extern void rpc_init_irq(void);
34
Russell Kingebe2a9f2005-06-22 09:55:04 +010035unsigned int vram_size;
Linus Torvalds1da177e2005-04-16 15:20:36 -070036unsigned int memc_ctrl_reg;
37unsigned int number_mfm_drives;
38
39static int __init parse_tag_acorn(const struct tag *tag)
40{
41 memc_ctrl_reg = tag->u.acorn.memc_control_reg;
42 number_mfm_drives = tag->u.acorn.adfsdrives;
43
44 switch (tag->u.acorn.vram_pages) {
45 case 512:
46 vram_size += PAGE_SIZE * 256;
47 case 256:
48 vram_size += PAGE_SIZE * 256;
49 default:
50 break;
51 }
52#if 0
53 if (vram_size) {
54 desc->video_start = 0x02000000;
55 desc->video_end = 0x02000000 + vram_size;
56 }
57#endif
58 return 0;
59}
60
61__tagtable(ATAG_ACORN, parse_tag_acorn);
62
Linus Torvalds1da177e2005-04-16 15:20:36 -070063static struct map_desc rpc_io_desc[] __initdata = {
Deepak Saxenaf9258f22005-10-28 15:19:02 +010064 { /* VRAM */
65 .virtual = SCREEN_BASE,
66 .pfn = __phys_to_pfn(SCREEN_START),
67 .length = 2*1048576,
68 .type = MT_DEVICE
69 }, { /* IO space */
70 .virtual = (u32)IO_BASE,
71 .pfn = __phys_to_pfn(IO_START),
72 .length = IO_SIZE ,
73 .type = MT_DEVICE
74 }, { /* EASI space */
75 .virtual = EASI_BASE,
76 .pfn = __phys_to_pfn(EASI_START),
77 .length = EASI_SIZE,
78 .type = MT_DEVICE
79 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070080};
81
82static void __init rpc_map_io(void)
83{
84 iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc));
85
86 /*
87 * Turn off floppy.
88 */
89 outb(0xc, 0x3f2);
90
91 /*
92 * RiscPC can't handle half-word loads and stores
93 */
94 elf_hwcap &= ~HWCAP_HALF;
95}
96
97static struct resource acornfb_resources[] = {
98 { /* VIDC */
99 .start = 0x03400000,
100 .end = 0x035fffff,
101 .flags = IORESOURCE_MEM,
102 }, {
103 .start = IRQ_VSYNCPULSE,
104 .end = IRQ_VSYNCPULSE,
105 .flags = IORESOURCE_IRQ,
106 },
107};
108
109static struct platform_device acornfb_device = {
110 .name = "acornfb",
111 .id = -1,
112 .dev = {
113 .coherent_dma_mask = 0xffffffff,
114 },
115 .num_resources = ARRAY_SIZE(acornfb_resources),
116 .resource = acornfb_resources,
117};
118
119static struct resource iomd_resources[] = {
120 {
121 .start = 0x03200000,
122 .end = 0x0320ffff,
123 .flags = IORESOURCE_MEM,
124 },
125};
126
127static struct platform_device iomd_device = {
128 .name = "iomd",
129 .id = -1,
130 .num_resources = ARRAY_SIZE(iomd_resources),
131 .resource = iomd_resources,
132};
133
134static struct platform_device kbd_device = {
135 .name = "kart",
136 .id = -1,
137 .dev = {
138 .parent = &iomd_device.dev,
139 },
140};
141
142static struct plat_serial8250_port serial_platform_data[] = {
143 {
144 .mapbase = 0x03010fe0,
145 .irq = 10,
146 .uartclk = 1843200,
147 .regshift = 2,
148 .iotype = UPIO_MEM,
149 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST,
150 },
151 { },
152};
153
154static struct platform_device serial_device = {
155 .name = "serial8250",
Russell King6df29de2005-09-08 16:04:41 +0100156 .id = PLAT8250_DEV_PLATFORM,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 .dev = {
158 .platform_data = serial_platform_data,
159 },
160};
161
162static struct platform_device *devs[] __initdata = {
163 &iomd_device,
164 &kbd_device,
165 &serial_device,
166 &acornfb_device,
167};
168
169static int __init rpc_init(void)
170{
171 return platform_add_devices(devs, ARRAY_SIZE(devs));
172}
173
174arch_initcall(rpc_init);
175
176extern struct sys_timer ioc_timer;
177
178MACHINE_START(RISCPC, "Acorn-RiscPC")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100179 /* Maintainer: Russell King */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100180 .phys_io = 0x03000000,
181 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
182 .boot_params = 0x10000100,
183 .reserve_lp0 = 1,
184 .reserve_lp1 = 1,
185 .map_io = rpc_map_io,
186 .init_irq = rpc_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187 .timer = &ioc_timer,
188MACHINE_END