0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/kernel.h>
0010 #include <linux/tty.h>
0011 #include <linux/delay.h>
0012 #include <linux/pm.h>
0013 #include <linux/init.h>
0014 #include <linux/sched.h>
0015 #include <linux/device.h>
0016 #include <linux/serial_8250.h>
0017 #include <linux/ata_platform.h>
0018 #include <linux/io.h>
0019 #include <linux/i2c.h>
0020 #include <linux/reboot.h>
0021
0022 #include <asm/elf.h>
0023 #include <asm/mach-types.h>
0024 #include <mach/hardware.h>
0025 #include <asm/hardware/iomd.h>
0026 #include <asm/page.h>
0027 #include <asm/domain.h>
0028 #include <asm/setup.h>
0029 #include <asm/system_misc.h>
0030
0031 #include <asm/mach/map.h>
0032 #include <asm/mach/arch.h>
0033 #include <asm/mach/time.h>
0034
0035 extern void rpc_init_irq(void);
0036
0037 unsigned int vram_size;
0038 unsigned int memc_ctrl_reg;
0039 unsigned int number_mfm_drives;
0040
0041 static int __init parse_tag_acorn(const struct tag *tag)
0042 {
0043 memc_ctrl_reg = tag->u.acorn.memc_control_reg;
0044 number_mfm_drives = tag->u.acorn.adfsdrives;
0045
0046 switch (tag->u.acorn.vram_pages) {
0047 case 512:
0048 vram_size += PAGE_SIZE * 256;
0049 fallthrough;
0050 case 256:
0051 vram_size += PAGE_SIZE * 256;
0052 break;
0053 default:
0054 break;
0055 }
0056 #if 0
0057 if (vram_size) {
0058 desc->video_start = 0x02000000;
0059 desc->video_end = 0x02000000 + vram_size;
0060 }
0061 #endif
0062 return 0;
0063 }
0064
0065 __tagtable(ATAG_ACORN, parse_tag_acorn);
0066
0067 static struct map_desc rpc_io_desc[] __initdata = {
0068 {
0069 .virtual = SCREEN_BASE,
0070 .pfn = __phys_to_pfn(SCREEN_START),
0071 .length = 2*1048576,
0072 .type = MT_DEVICE
0073 }, {
0074 .virtual = (u32)IO_BASE,
0075 .pfn = __phys_to_pfn(IO_START),
0076 .length = IO_SIZE ,
0077 .type = MT_DEVICE
0078 }, {
0079 .virtual = (unsigned long)EASI_BASE,
0080 .pfn = __phys_to_pfn(EASI_START),
0081 .length = EASI_SIZE,
0082 .type = MT_DEVICE
0083 }
0084 };
0085
0086 static void __init rpc_map_io(void)
0087 {
0088 iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc));
0089
0090
0091
0092
0093 writeb(0xc, PCIO_BASE + (0x3f2 << 2));
0094
0095
0096
0097
0098 elf_hwcap &= ~HWCAP_HALF;
0099 }
0100
0101 static struct resource acornfb_resources[] = {
0102
0103 DEFINE_RES_MEM(0x03400000, 0x00200000),
0104 DEFINE_RES_IRQ(IRQ_VSYNCPULSE),
0105 };
0106
0107 static struct platform_device acornfb_device = {
0108 .name = "acornfb",
0109 .id = -1,
0110 .dev = {
0111 .coherent_dma_mask = 0xffffffff,
0112 },
0113 .num_resources = ARRAY_SIZE(acornfb_resources),
0114 .resource = acornfb_resources,
0115 };
0116
0117 static struct resource iomd_resources[] = {
0118 DEFINE_RES_MEM(0x03200000, 0x10000),
0119 };
0120
0121 static struct platform_device iomd_device = {
0122 .name = "iomd",
0123 .id = -1,
0124 .num_resources = ARRAY_SIZE(iomd_resources),
0125 .resource = iomd_resources,
0126 };
0127
0128 static struct resource iomd_kart_resources[] = {
0129 DEFINE_RES_IRQ(IRQ_KEYBOARDRX),
0130 DEFINE_RES_IRQ(IRQ_KEYBOARDTX),
0131 };
0132
0133 static struct platform_device kbd_device = {
0134 .name = "kart",
0135 .id = -1,
0136 .dev = {
0137 .parent = &iomd_device.dev,
0138 },
0139 .num_resources = ARRAY_SIZE(iomd_kart_resources),
0140 .resource = iomd_kart_resources,
0141 };
0142
0143 static struct plat_serial8250_port serial_platform_data[] = {
0144 {
0145 .mapbase = 0x03010fe0,
0146 .irq = IRQ_SERIALPORT,
0147 .uartclk = 1843200,
0148 .regshift = 2,
0149 .iotype = UPIO_MEM,
0150 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST,
0151 },
0152 { },
0153 };
0154
0155 static struct platform_device serial_device = {
0156 .name = "serial8250",
0157 .id = PLAT8250_DEV_PLATFORM,
0158 .dev = {
0159 .platform_data = serial_platform_data,
0160 },
0161 };
0162
0163 static struct pata_platform_info pata_platform_data = {
0164 .ioport_shift = 2,
0165 };
0166
0167 static struct resource pata_resources[] = {
0168 DEFINE_RES_MEM(0x030107c0, 0x20),
0169 DEFINE_RES_MEM(0x03010fd8, 0x04),
0170 DEFINE_RES_IRQ(IRQ_HARDDISK),
0171 };
0172
0173 static struct platform_device pata_device = {
0174 .name = "pata_platform",
0175 .id = -1,
0176 .num_resources = ARRAY_SIZE(pata_resources),
0177 .resource = pata_resources,
0178 .dev = {
0179 .platform_data = &pata_platform_data,
0180 .coherent_dma_mask = ~0,
0181 },
0182 };
0183
0184 static struct platform_device *devs[] __initdata = {
0185 &iomd_device,
0186 &kbd_device,
0187 &serial_device,
0188 &acornfb_device,
0189 &pata_device,
0190 };
0191
0192 static struct i2c_board_info i2c_rtc = {
0193 I2C_BOARD_INFO("pcf8583", 0x50)
0194 };
0195
0196 static int __init rpc_init(void)
0197 {
0198 i2c_register_board_info(0, &i2c_rtc, 1);
0199 return platform_add_devices(devs, ARRAY_SIZE(devs));
0200 }
0201
0202 arch_initcall(rpc_init);
0203
0204 static void rpc_restart(enum reboot_mode mode, const char *cmd)
0205 {
0206 iomd_writeb(0, IOMD_ROMCR0);
0207
0208
0209
0210
0211 soft_restart(0);
0212 }
0213
0214 void ioc_timer_init(void);
0215
0216 MACHINE_START(RISCPC, "Acorn-RiscPC")
0217
0218 .atag_offset = 0x100,
0219 .reserve_lp0 = 1,
0220 .reserve_lp1 = 1,
0221 .map_io = rpc_map_io,
0222 .init_irq = rpc_init_irq,
0223 .init_time = ioc_timer_init,
0224 .restart = rpc_restart,
0225 MACHINE_END