spi-topcliff-pch: supports a spi mode setup and bit order setup by IO control
[zen-stable.git] / arch / arm / mach-rpc / riscpc.c
blob3d44a59fc0df38e10bcf492f987c274e17c5da1e
1 /*
2 * linux/arch/arm/mach-rpc/riscpc.c
4 * Copyright (C) 1998-2001 Russell King
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.
10 * Architecture specific fixups.
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 #include <linux/ata_platform.h>
21 #include <linux/io.h>
22 #include <linux/i2c.h>
24 #include <asm/elf.h>
25 #include <asm/mach-types.h>
26 #include <mach/hardware.h>
27 #include <asm/hardware/iomd.h>
28 #include <asm/page.h>
29 #include <asm/domain.h>
30 #include <asm/setup.h>
32 #include <asm/mach/map.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/time.h>
36 extern void rpc_init_irq(void);
38 unsigned int vram_size;
39 unsigned int memc_ctrl_reg;
40 unsigned int number_mfm_drives;
42 static int __init parse_tag_acorn(const struct tag *tag)
44 memc_ctrl_reg = tag->u.acorn.memc_control_reg;
45 number_mfm_drives = tag->u.acorn.adfsdrives;
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;
55 #if 0
56 if (vram_size) {
57 desc->video_start = 0x02000000;
58 desc->video_end = 0x02000000 + vram_size;
60 #endif
61 return 0;
64 __tagtable(ATAG_ACORN, parse_tag_acorn);
66 static struct map_desc rpc_io_desc[] __initdata = {
67 { /* 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 */
78 .virtual = (unsigned long)EASI_BASE,
79 .pfn = __phys_to_pfn(EASI_START),
80 .length = EASI_SIZE,
81 .type = MT_DEVICE
85 static void __init rpc_map_io(void)
87 iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc));
90 * Turn off floppy.
92 writeb(0xc, PCIO_BASE + (0x3f2 << 2));
95 * RiscPC can't handle half-word loads and stores
97 elf_hwcap &= ~HWCAP_HALF;
100 static 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,
112 static struct platform_device acornfb_device = {
113 .name = "acornfb",
114 .id = -1,
115 .dev = {
116 .coherent_dma_mask = 0xffffffff,
118 .num_resources = ARRAY_SIZE(acornfb_resources),
119 .resource = acornfb_resources,
122 static struct resource iomd_resources[] = {
124 .start = 0x03200000,
125 .end = 0x0320ffff,
126 .flags = IORESOURCE_MEM,
130 static struct platform_device iomd_device = {
131 .name = "iomd",
132 .id = -1,
133 .num_resources = ARRAY_SIZE(iomd_resources),
134 .resource = iomd_resources,
137 static struct platform_device kbd_device = {
138 .name = "kart",
139 .id = -1,
140 .dev = {
141 .parent = &iomd_device.dev,
145 static struct plat_serial8250_port serial_platform_data[] = {
147 .mapbase = 0x03010fe0,
148 .irq = 10,
149 .uartclk = 1843200,
150 .regshift = 2,
151 .iotype = UPIO_MEM,
152 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST,
154 { },
157 static struct platform_device serial_device = {
158 .name = "serial8250",
159 .id = PLAT8250_DEV_PLATFORM,
160 .dev = {
161 .platform_data = serial_platform_data,
165 static struct pata_platform_info pata_platform_data = {
166 .ioport_shift = 2,
169 static struct resource pata_resources[] = {
170 [0] = {
171 .start = 0x030107c0,
172 .end = 0x030107df,
173 .flags = IORESOURCE_MEM,
175 [1] = {
176 .start = 0x03010fd8,
177 .end = 0x03010fdb,
178 .flags = IORESOURCE_MEM,
180 [2] = {
181 .start = IRQ_HARDDISK,
182 .end = IRQ_HARDDISK,
183 .flags = IORESOURCE_IRQ,
187 static struct platform_device pata_device = {
188 .name = "pata_platform",
189 .id = -1,
190 .num_resources = ARRAY_SIZE(pata_resources),
191 .resource = pata_resources,
192 .dev = {
193 .platform_data = &pata_platform_data,
194 .coherent_dma_mask = ~0, /* grumble */
198 static struct platform_device *devs[] __initdata = {
199 &iomd_device,
200 &kbd_device,
201 &serial_device,
202 &acornfb_device,
203 &pata_device,
206 static struct i2c_board_info i2c_rtc = {
207 I2C_BOARD_INFO("pcf8583", 0x50)
210 static int __init rpc_init(void)
212 i2c_register_board_info(0, &i2c_rtc, 1);
213 return platform_add_devices(devs, ARRAY_SIZE(devs));
216 arch_initcall(rpc_init);
218 static void rpc_restart(char mode, const char *cmd)
220 iomd_writeb(0, IOMD_ROMCR0);
223 * Jump into the ROM
225 soft_restart(0);
228 extern struct sys_timer ioc_timer;
230 MACHINE_START(RISCPC, "Acorn-RiscPC")
231 /* Maintainer: Russell King */
232 .atag_offset = 0x100,
233 .reserve_lp0 = 1,
234 .reserve_lp1 = 1,
235 .map_io = rpc_map_io,
236 .init_irq = rpc_init_irq,
237 .timer = &ioc_timer,
238 .restart = rpc_restart,
239 MACHINE_END