1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-rpc/riscpc.c
5 * Copyright (C) 1998-2001 Russell King
7 * Architecture specific fixups.
9 #include <linux/kernel.h>
10 #include <linux/tty.h>
11 #include <linux/delay.h>
13 #include <linux/init.h>
14 #include <linux/sched.h>
15 #include <linux/device.h>
16 #include <linux/serial_8250.h>
17 #include <linux/ata_platform.h>
19 #include <linux/i2c.h>
20 #include <linux/reboot.h>
23 #include <asm/mach-types.h>
24 #include <mach/hardware.h>
25 #include <asm/hardware/iomd.h>
27 #include <asm/domain.h>
28 #include <asm/setup.h>
29 #include <asm/system_misc.h>
31 #include <asm/mach/map.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/time.h>
35 extern void rpc_init_irq(void);
37 unsigned int vram_size;
38 unsigned int memc_ctrl_reg;
39 unsigned int number_mfm_drives;
41 static int __init parse_tag_acorn(const struct tag *tag)
43 memc_ctrl_reg = tag->u.acorn.memc_control_reg;
44 number_mfm_drives = tag->u.acorn.adfsdrives;
46 switch (tag->u.acorn.vram_pages) {
48 vram_size += PAGE_SIZE * 256;
49 fallthrough; /* ??? */
51 vram_size += PAGE_SIZE * 256;
57 desc->video_start = 0x02000000;
58 desc->video_end = 0x02000000 + vram_size;
64 __tagtable(ATAG_ACORN, parse_tag_acorn);
66 static struct map_desc rpc_io_desc[] __initdata = {
68 .virtual = SCREEN_BASE,
69 .pfn = __phys_to_pfn(SCREEN_START),
73 .virtual = (u32)IO_BASE,
74 .pfn = __phys_to_pfn(IO_START),
78 .virtual = (unsigned long)EASI_BASE,
79 .pfn = __phys_to_pfn(EASI_START),
85 static void __init rpc_map_io(void)
87 iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc));
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[] = {
102 DEFINE_RES_MEM(0x03400000, 0x00200000),
103 DEFINE_RES_IRQ(IRQ_VSYNCPULSE),
106 static struct platform_device acornfb_device = {
110 .coherent_dma_mask = 0xffffffff,
112 .num_resources = ARRAY_SIZE(acornfb_resources),
113 .resource = acornfb_resources,
116 static struct resource iomd_resources[] = {
117 DEFINE_RES_MEM(0x03200000, 0x10000),
120 static struct platform_device iomd_device = {
123 .num_resources = ARRAY_SIZE(iomd_resources),
124 .resource = iomd_resources,
127 static struct resource iomd_kart_resources[] = {
128 DEFINE_RES_IRQ(IRQ_KEYBOARDRX),
129 DEFINE_RES_IRQ(IRQ_KEYBOARDTX),
132 static struct platform_device kbd_device = {
136 .parent = &iomd_device.dev,
138 .num_resources = ARRAY_SIZE(iomd_kart_resources),
139 .resource = iomd_kart_resources,
142 static struct plat_serial8250_port serial_platform_data[] = {
144 .mapbase = 0x03010fe0,
145 .irq = IRQ_SERIALPORT,
149 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SKIP_TEST,
154 static struct platform_device serial_device = {
155 .name = "serial8250",
156 .id = PLAT8250_DEV_PLATFORM,
158 .platform_data = serial_platform_data,
162 static struct pata_platform_info pata_platform_data = {
166 static struct resource pata_resources[] = {
167 DEFINE_RES_MEM(0x030107c0, 0x20),
168 DEFINE_RES_MEM(0x03010fd8, 0x04),
169 DEFINE_RES_IRQ(IRQ_HARDDISK),
172 static struct platform_device pata_device = {
173 .name = "pata_platform",
175 .num_resources = ARRAY_SIZE(pata_resources),
176 .resource = pata_resources,
178 .platform_data = &pata_platform_data,
179 .coherent_dma_mask = ~0, /* grumble */
183 static struct platform_device *devs[] __initdata = {
191 static struct i2c_board_info i2c_rtc = {
192 I2C_BOARD_INFO("pcf8583", 0x50)
195 static int __init rpc_init(void)
197 i2c_register_board_info(0, &i2c_rtc, 1);
198 return platform_add_devices(devs, ARRAY_SIZE(devs));
201 arch_initcall(rpc_init);
203 static void rpc_restart(enum reboot_mode mode, const char *cmd)
205 iomd_writeb(0, IOMD_ROMCR0);
213 void ioc_timer_init(void);
215 MACHINE_START(RISCPC, "Acorn-RiscPC")
216 /* Maintainer: Russell King */
217 .atag_offset = 0x100,
220 .map_io = rpc_map_io,
221 .init_irq = rpc_init_irq,
222 .init_time = ioc_timer_init,
223 .restart = rpc_restart,