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