xref: /openbmc/linux/arch/arm/mach-rpc/riscpc.c (revision 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2)
1 /*
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 
33 extern void rpc_init_irq(void);
34 
35 extern unsigned int vram_size;
36 
37 #if 0
38 
39 unsigned int memc_ctrl_reg;
40 unsigned int number_mfm_drives;
41 
42 static 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 
66 #endif
67 
68 static struct map_desc rpc_io_desc[] __initdata = {
69  { SCREEN_BASE,	SCREEN_START,	2*1048576, MT_DEVICE }, /* VRAM		*/
70  { (u32)IO_BASE, IO_START,	IO_SIZE	 , MT_DEVICE }, /* IO space	*/
71  { EASI_BASE,	EASI_START,	EASI_SIZE, MT_DEVICE }  /* EASI space	*/
72 };
73 
74 static void __init rpc_map_io(void)
75 {
76 	iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc));
77 
78 	/*
79 	 * Turn off floppy.
80 	 */
81 	outb(0xc, 0x3f2);
82 
83 	/*
84 	 * RiscPC can't handle half-word loads and stores
85 	 */
86 	elf_hwcap &= ~HWCAP_HALF;
87 }
88 
89 static struct resource acornfb_resources[] = {
90 	{	/* VIDC */
91 		.start		= 0x03400000,
92 		.end		= 0x035fffff,
93 		.flags		= IORESOURCE_MEM,
94 	}, {
95 		.start		= IRQ_VSYNCPULSE,
96 		.end		= IRQ_VSYNCPULSE,
97 		.flags		= IORESOURCE_IRQ,
98 	},
99 };
100 
101 static struct platform_device acornfb_device = {
102 	.name			= "acornfb",
103 	.id			= -1,
104 	.dev			= {
105 		.coherent_dma_mask = 0xffffffff,
106 	},
107 	.num_resources		= ARRAY_SIZE(acornfb_resources),
108 	.resource		= acornfb_resources,
109 };
110 
111 static struct resource iomd_resources[] = {
112 	{
113 		.start		= 0x03200000,
114 		.end		= 0x0320ffff,
115 		.flags		= IORESOURCE_MEM,
116 	},
117 };
118 
119 static struct platform_device iomd_device = {
120 	.name			= "iomd",
121 	.id			= -1,
122 	.num_resources		= ARRAY_SIZE(iomd_resources),
123 	.resource		= iomd_resources,
124 };
125 
126 static struct platform_device kbd_device = {
127 	.name			= "kart",
128 	.id			= -1,
129 	.dev			= {
130 		.parent 	= &iomd_device.dev,
131 	},
132 };
133 
134 static struct plat_serial8250_port serial_platform_data[] = {
135 	{
136 		.mapbase	= 0x03010fe0,
137 		.irq		= 10,
138 		.uartclk	= 1843200,
139 		.regshift	= 2,
140 		.iotype		= UPIO_MEM,
141 		.flags		= UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST,
142 	},
143 	{ },
144 };
145 
146 static struct platform_device serial_device = {
147 	.name			= "serial8250",
148 	.id			= 0,
149 	.dev			= {
150 		.platform_data	= serial_platform_data,
151 	},
152 };
153 
154 static struct platform_device *devs[] __initdata = {
155 	&iomd_device,
156 	&kbd_device,
157 	&serial_device,
158 	&acornfb_device,
159 };
160 
161 static int __init rpc_init(void)
162 {
163 	return platform_add_devices(devs, ARRAY_SIZE(devs));
164 }
165 
166 arch_initcall(rpc_init);
167 
168 extern struct sys_timer ioc_timer;
169 
170 MACHINE_START(RISCPC, "Acorn-RiscPC")
171 	MAINTAINER("Russell King")
172 	BOOT_MEM(0x10000000, 0x03000000, 0xe0000000)
173 	BOOT_PARAMS(0x10000100)
174 	DISABLE_PARPORT(0)
175 	DISABLE_PARPORT(1)
176 	MAPIO(rpc_map_io)
177 	INITIRQ(rpc_init_irq)
178 	.timer		= &ioc_timer,
179 MACHINE_END
180