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#include <linux/ata_platform.h> 21#include <linux/io.h> 22#include <linux/i2c.h> 23 24#include <asm/elf.h> 25#include <asm/mach-types.h> 26#include <mach/hardware.h> 27#include <asm/page.h> 28#include <asm/domain.h> 29#include <asm/setup.h> 30 31#include <asm/mach/map.h> 32#include <asm/mach/arch.h> 33#include <asm/mach/time.h> 34 35extern void rpc_init_irq(void); 36 37unsigned int vram_size; 38unsigned int memc_ctrl_reg; 39unsigned int number_mfm_drives; 40 41static int __init parse_tag_acorn(const struct tag *tag) 42{ 43 memc_ctrl_reg = tag->u.acorn.memc_control_reg; 44 number_mfm_drives = tag->u.acorn.adfsdrives; 45 46 switch (tag->u.acorn.vram_pages) { 47 case 512: 48 vram_size += PAGE_SIZE * 256; 49 case 256: 50 vram_size += PAGE_SIZE * 256; 51 default: 52 break; 53 } 54 return 0; 55} 56 57__tagtable(ATAG_ACORN, parse_tag_acorn); 58 59static struct map_desc rpc_io_desc[] __initdata = { 60 { /* VRAM */ 61 .virtual = SCREEN_BASE, 62 .pfn = __phys_to_pfn(SCREEN_START), 63 .length = 2*1048576, 64 .type = MT_DEVICE 65 }, { /* IO space */ 66 .virtual = (u32)IO_BASE, 67 .pfn = __phys_to_pfn(IO_START), 68 .length = IO_SIZE , 69 .type = MT_DEVICE 70 }, { /* EASI space */ 71 .virtual = EASI_BASE, 72 .pfn = __phys_to_pfn(EASI_START), 73 .length = EASI_SIZE, 74 .type = MT_DEVICE 75 } 76}; 77 78static void __init rpc_map_io(void) 79{ 80 iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc)); 81 82 /* 83 * Turn off floppy. 84 */ 85 writeb(0xc, PCIO_BASE + (0x3f2 << 2)); 86 87 /* 88 * RiscPC can't handle half-word loads and stores 89 */ 90 elf_hwcap &= ~HWCAP_HALF; 91} 92 93static struct resource acornfb_resources[] = { 94 { /* VIDC */ 95 .start = 0x03400000, 96 .end = 0x035fffff, 97 .flags = IORESOURCE_MEM, 98 }, { 99 .start = IRQ_VSYNCPULSE, 100 .end = IRQ_VSYNCPULSE, 101 .flags = IORESOURCE_IRQ, 102 }, 103}; 104 105static struct platform_device acornfb_device = { 106 .name = "acornfb", 107 .id = -1, 108 .dev = { 109 .coherent_dma_mask = 0xffffffff, 110 }, 111 .num_resources = ARRAY_SIZE(acornfb_resources), 112 .resource = acornfb_resources, 113}; 114 115static struct resource iomd_resources[] = { 116 { 117 .start = 0x03200000, 118 .end = 0x0320ffff, 119 .flags = IORESOURCE_MEM, 120 }, 121}; 122 123static struct platform_device iomd_device = { 124 .name = "iomd", 125 .id = -1, 126 .num_resources = ARRAY_SIZE(iomd_resources), 127 .resource = iomd_resources, 128}; 129 130static struct platform_device kbd_device = { 131 .name = "kart", 132 .id = -1, 133 .dev = { 134 .parent = &iomd_device.dev, 135 }, 136}; 137 138static struct plat_serial8250_port serial_platform_data[] = { 139 { 140 .mapbase = 0x03010fe0, 141 .irq = 10, 142 .uartclk = 1843200, 143 .regshift = 2, 144 .iotype = UPIO_MEM, 145 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST, 146 }, 147 { }, 148}; 149 150static struct platform_device serial_device = { 151 .name = "serial8250", 152 .id = PLAT8250_DEV_PLATFORM, 153 .dev = { 154 .platform_data = serial_platform_data, 155 }, 156}; 157 158static struct pata_platform_info pata_platform_data = { 159 .ioport_shift = 2, 160}; 161 162static struct resource pata_resources[] = { 163 [0] = { 164 .start = 0x030107c0, 165 .end = 0x030107df, 166 .flags = IORESOURCE_MEM, 167 }, 168 [1] = { 169 .start = 0x03010fd8, 170 .end = 0x03010fdb, 171 .flags = IORESOURCE_MEM, 172 }, 173 [2] = { 174 .start = IRQ_HARDDISK, 175 .end = IRQ_HARDDISK, 176 .flags = IORESOURCE_IRQ, 177 }, 178}; 179 180static struct platform_device pata_device = { 181 .name = "pata_platform", 182 .id = -1, 183 .num_resources = ARRAY_SIZE(pata_resources), 184 .resource = pata_resources, 185 .dev = { 186 .platform_data = &pata_platform_data, 187 .coherent_dma_mask = ~0, /* grumble */ 188 }, 189}; 190 191static struct platform_device *devs[] __initdata = { 192 &iomd_device, 193 &kbd_device, 194 &serial_device, 195 &acornfb_device, 196 &pata_device, 197}; 198 199static struct i2c_board_info i2c_rtc = { 200 I2C_BOARD_INFO("pcf8583", 0x50) 201}; 202 203static int __init rpc_init(void) 204{ 205 i2c_register_board_info(0, &i2c_rtc, 1); 206 return platform_add_devices(devs, ARRAY_SIZE(devs)); 207} 208 209arch_initcall(rpc_init); 210 211extern struct sys_timer ioc_timer; 212 213MACHINE_START(RISCPC, "Acorn-RiscPC") 214 /* Maintainer: Russell King */ 215 .phys_io = 0x03000000, 216 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, 217 .boot_params = 0x10000100, 218 .reserve_lp0 = 1, 219 .reserve_lp1 = 1, 220 .map_io = rpc_map_io, 221 .init_irq = rpc_init_irq, 222 .timer = &ioc_timer, 223MACHINE_END 224