]>
Commit | Line | Data |
---|---|---|
d2912cb1 | 1 | // SPDX-License-Identifier: GPL-2.0-only |
1da177e4 LT |
2 | /* |
3 | * linux/arch/arm/mach-rpc/riscpc.c | |
4 | * | |
5 | * Copyright (C) 1998-2001 Russell King | |
6 | * | |
1da177e4 LT |
7 | * Architecture specific fixups. |
8 | */ | |
9 | #include <linux/kernel.h> | |
10 | #include <linux/tty.h> | |
11 | #include <linux/delay.h> | |
12 | #include <linux/pm.h> | |
13 | #include <linux/init.h> | |
14 | #include <linux/sched.h> | |
15 | #include <linux/device.h> | |
16 | #include <linux/serial_8250.h> | |
0a87e3e9 | 17 | #include <linux/ata_platform.h> |
fced80c7 | 18 | #include <linux/io.h> |
531660ef | 19 | #include <linux/i2c.h> |
7b6d864b | 20 | #include <linux/reboot.h> |
1da177e4 LT |
21 | |
22 | #include <asm/elf.h> | |
1da177e4 | 23 | #include <asm/mach-types.h> |
a09e64fb | 24 | #include <mach/hardware.h> |
e11e909d | 25 | #include <asm/hardware/iomd.h> |
1da177e4 LT |
26 | #include <asm/page.h> |
27 | #include <asm/domain.h> | |
28 | #include <asm/setup.h> | |
9f97da78 | 29 | #include <asm/system_misc.h> |
1da177e4 LT |
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 | ||
ebe2a9ff | 37 | unsigned int vram_size; |
1da177e4 LT |
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; | |
df561f66 | 49 | fallthrough; /* ??? */ |
1da177e4 LT |
50 | case 256: |
51 | vram_size += PAGE_SIZE * 256; | |
696e572d | 52 | break; |
1da177e4 LT |
53 | default: |
54 | break; | |
55 | } | |
56 | #if 0 | |
57 | if (vram_size) { | |
58 | desc->video_start = 0x02000000; | |
59 | desc->video_end = 0x02000000 + vram_size; | |
60 | } | |
61 | #endif | |
62 | return 0; | |
63 | } | |
64 | ||
65 | __tagtable(ATAG_ACORN, parse_tag_acorn); | |
66 | ||
1da177e4 | 67 | static struct map_desc rpc_io_desc[] __initdata = { |
f9258f22 DS |
68 | { /* VRAM */ |
69 | .virtual = SCREEN_BASE, | |
70 | .pfn = __phys_to_pfn(SCREEN_START), | |
71 | .length = 2*1048576, | |
72 | .type = MT_DEVICE | |
73 | }, { /* IO space */ | |
74 | .virtual = (u32)IO_BASE, | |
75 | .pfn = __phys_to_pfn(IO_START), | |
76 | .length = IO_SIZE , | |
77 | .type = MT_DEVICE | |
78 | }, { /* EASI space */ | |
5e4cdb83 | 79 | .virtual = (unsigned long)EASI_BASE, |
f9258f22 DS |
80 | .pfn = __phys_to_pfn(EASI_START), |
81 | .length = EASI_SIZE, | |
82 | .type = MT_DEVICE | |
83 | } | |
1da177e4 LT |
84 | }; |
85 | ||
86 | static void __init rpc_map_io(void) | |
87 | { | |
88 | iotable_init(rpc_io_desc, ARRAY_SIZE(rpc_io_desc)); | |
89 | ||
90 | /* | |
91 | * Turn off floppy. | |
92 | */ | |
13a63ab2 | 93 | writeb(0xc, PCIO_BASE + (0x3f2 << 2)); |
1da177e4 LT |
94 | |
95 | /* | |
96 | * RiscPC can't handle half-word loads and stores | |
97 | */ | |
98 | elf_hwcap &= ~HWCAP_HALF; | |
99 | } | |
100 | ||
101 | static struct resource acornfb_resources[] = { | |
2b7da084 RK |
102 | /* VIDC */ |
103 | DEFINE_RES_MEM(0x03400000, 0x00200000), | |
104 | DEFINE_RES_IRQ(IRQ_VSYNCPULSE), | |
1da177e4 LT |
105 | }; |
106 | ||
107 | static struct platform_device acornfb_device = { | |
108 | .name = "acornfb", | |
109 | .id = -1, | |
110 | .dev = { | |
111 | .coherent_dma_mask = 0xffffffff, | |
112 | }, | |
113 | .num_resources = ARRAY_SIZE(acornfb_resources), | |
114 | .resource = acornfb_resources, | |
115 | }; | |
116 | ||
117 | static struct resource iomd_resources[] = { | |
2b7da084 | 118 | DEFINE_RES_MEM(0x03200000, 0x10000), |
1da177e4 LT |
119 | }; |
120 | ||
121 | static struct platform_device iomd_device = { | |
122 | .name = "iomd", | |
123 | .id = -1, | |
124 | .num_resources = ARRAY_SIZE(iomd_resources), | |
125 | .resource = iomd_resources, | |
126 | }; | |
127 | ||
8c6d9d0a RK |
128 | static struct resource iomd_kart_resources[] = { |
129 | DEFINE_RES_IRQ(IRQ_KEYBOARDRX), | |
130 | DEFINE_RES_IRQ(IRQ_KEYBOARDTX), | |
131 | }; | |
132 | ||
1da177e4 LT |
133 | static struct platform_device kbd_device = { |
134 | .name = "kart", | |
135 | .id = -1, | |
136 | .dev = { | |
137 | .parent = &iomd_device.dev, | |
138 | }, | |
8c6d9d0a RK |
139 | .num_resources = ARRAY_SIZE(iomd_kart_resources), |
140 | .resource = iomd_kart_resources, | |
1da177e4 LT |
141 | }; |
142 | ||
143 | static struct plat_serial8250_port serial_platform_data[] = { | |
144 | { | |
145 | .mapbase = 0x03010fe0, | |
18a66d5a | 146 | .irq = IRQ_SERIALPORT, |
1da177e4 LT |
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", | |
6df29deb | 157 | .id = PLAT8250_DEV_PLATFORM, |
1da177e4 LT |
158 | .dev = { |
159 | .platform_data = serial_platform_data, | |
160 | }, | |
161 | }; | |
162 | ||
a17dba8d RK |
163 | static struct pata_platform_info pata_platform_data = { |
164 | .ioport_shift = 2, | |
165 | }; | |
166 | ||
167 | static struct resource pata_resources[] = { | |
2b7da084 RK |
168 | DEFINE_RES_MEM(0x030107c0, 0x20), |
169 | DEFINE_RES_MEM(0x03010fd8, 0x04), | |
170 | DEFINE_RES_IRQ(IRQ_HARDDISK), | |
a17dba8d RK |
171 | }; |
172 | ||
173 | static struct platform_device pata_device = { | |
174 | .name = "pata_platform", | |
175 | .id = -1, | |
176 | .num_resources = ARRAY_SIZE(pata_resources), | |
177 | .resource = pata_resources, | |
178 | .dev = { | |
179 | .platform_data = &pata_platform_data, | |
180 | .coherent_dma_mask = ~0, /* grumble */ | |
181 | }, | |
182 | }; | |
183 | ||
1da177e4 LT |
184 | static struct platform_device *devs[] __initdata = { |
185 | &iomd_device, | |
186 | &kbd_device, | |
187 | &serial_device, | |
188 | &acornfb_device, | |
a17dba8d | 189 | &pata_device, |
1da177e4 LT |
190 | }; |
191 | ||
531660ef RK |
192 | static struct i2c_board_info i2c_rtc = { |
193 | I2C_BOARD_INFO("pcf8583", 0x50) | |
194 | }; | |
195 | ||
1da177e4 LT |
196 | static int __init rpc_init(void) |
197 | { | |
531660ef | 198 | i2c_register_board_info(0, &i2c_rtc, 1); |
1da177e4 LT |
199 | return platform_add_devices(devs, ARRAY_SIZE(devs)); |
200 | } | |
201 | ||
202 | arch_initcall(rpc_init); | |
203 | ||
7b6d864b | 204 | static void rpc_restart(enum reboot_mode mode, const char *cmd) |
e11e909d RK |
205 | { |
206 | iomd_writeb(0, IOMD_ROMCR0); | |
207 | ||
208 | /* | |
209 | * Jump into the ROM | |
210 | */ | |
211 | soft_restart(0); | |
212 | } | |
213 | ||
6bb27d73 | 214 | void ioc_timer_init(void); |
1da177e4 LT |
215 | |
216 | MACHINE_START(RISCPC, "Acorn-RiscPC") | |
e9dea0c6 | 217 | /* Maintainer: Russell King */ |
237e8873 | 218 | .atag_offset = 0x100, |
e9dea0c6 RK |
219 | .reserve_lp0 = 1, |
220 | .reserve_lp1 = 1, | |
221 | .map_io = rpc_map_io, | |
222 | .init_irq = rpc_init_irq, | |
6bb27d73 | 223 | .init_time = ioc_timer_init, |
e11e909d | 224 | .restart = rpc_restart, |
1da177e4 | 225 | MACHINE_END |