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