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