]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - arch/arm/mach-s3c/mach-vr1000.c
x86/speculation/mmio: Enable CPU Fill buffer clearing on idle
[mirror_ubuntu-jammy-kernel.git] / arch / arm / mach-s3c / mach-vr1000.c
CommitLineData
84b21701
KK
1// SPDX-License-Identifier: GPL-2.0
2//
3// Copyright (c) 2003-2008 Simtec Electronics
4// Ben Dooks <ben@simtec.co.uk>
5//
6// Machine support for Thorcom VR1000 board. Designed for Thorcom by
7// Simtec Electronics, http://www.simtec.co.uk/
1da177e4
LT
8
9#include <linux/kernel.h>
10#include <linux/types.h>
11#include <linux/interrupt.h>
12#include <linux/list.h>
13#include <linux/timer.h>
14#include <linux/init.h>
ec976d6e 15#include <linux/gpio.h>
f7f611f2 16#include <linux/gpio/machine.h>
d97a666f 17#include <linux/dm9000.h>
60d6698b 18#include <linux/i2c.h>
1da177e4
LT
19
20#include <linux/serial.h>
21#include <linux/tty.h>
22#include <linux/serial_8250.h>
23#include <linux/serial_reg.h>
334a1c70 24#include <linux/serial_s3c.h>
fced80c7 25#include <linux/io.h>
1da177e4
LT
26
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29#include <asm/mach/irq.h>
30
1da177e4
LT
31#include <asm/irq.h>
32#include <asm/mach-types.h>
33
436d42c6 34#include <linux/platform_data/leds-s3c24xx.h>
db8304ed
KK
35#include <linux/platform_data/i2c-s3c2410.h>
36#include <linux/platform_data/asoc-s3c24xx_simtec.h>
37
c6ff132d
AB
38#include "regs-gpio.h"
39#include "gpio-samsung.h"
40#include "gpio-cfg.h"
1da177e4 41
c6ff132d
AB
42#include "cpu.h"
43#include "devs.h"
9d529c6e 44
bbd7e5e1 45#include "bast.h"
71b9114d 46#include "s3c24xx.h"
bbd7e5e1 47#include "simtec.h"
db8304ed 48#include "vr1000.h"
1da177e4
LT
49
50/* macros for virtual address mods for the io space entries */
51#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
52#define VA_C4(item) ((unsigned long)(item) + BAST_VAM_CS4)
53#define VA_C3(item) ((unsigned long)(item) + BAST_VAM_CS3)
54#define VA_C2(item) ((unsigned long)(item) + BAST_VAM_CS2)
55
56/* macros to modify the physical addresses for io space */
57
df1ec6de
BD
58#define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2))
59#define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3))
60#define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4))
61#define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5))
1da177e4
LT
62
63static struct map_desc vr1000_iodesc[] __initdata = {
64 /* ISA IO areas */
df1ec6de
BD
65 {
66 .virtual = (u32)S3C24XX_VA_ISA_BYTE,
67 .pfn = PA_CS2(BAST_PA_ISAIO),
68 .length = SZ_16M,
69 .type = MT_DEVICE,
70 }, {
71 .virtual = (u32)S3C24XX_VA_ISA_WORD,
72 .pfn = PA_CS3(BAST_PA_ISAIO),
73 .length = SZ_16M,
74 .type = MT_DEVICE,
75 },
76
77 /* CPLD control registers, and external interrupt controls */
78 {
79 .virtual = (u32)VR1000_VA_CTRL1,
80 .pfn = __phys_to_pfn(VR1000_PA_CTRL1),
81 .length = SZ_1M,
82 .type = MT_DEVICE,
83 }, {
84 .virtual = (u32)VR1000_VA_CTRL2,
85 .pfn = __phys_to_pfn(VR1000_PA_CTRL2),
86 .length = SZ_1M,
87 .type = MT_DEVICE,
88 }, {
89 .virtual = (u32)VR1000_VA_CTRL3,
90 .pfn = __phys_to_pfn(VR1000_PA_CTRL3),
91 .length = SZ_1M,
92 .type = MT_DEVICE,
93 }, {
94 .virtual = (u32)VR1000_VA_CTRL4,
95 .pfn = __phys_to_pfn(VR1000_PA_CTRL4),
96 .length = SZ_1M,
97 .type = MT_DEVICE,
98 },
1da177e4
LT
99};
100
101#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
102#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
103#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
104
66a9b49a 105static struct s3c2410_uartcfg vr1000_uartcfgs[] __initdata = {
1da177e4
LT
106 [0] = {
107 .hwport = 0,
108 .flags = 0,
109 .ucon = UCON,
110 .ulcon = ULCON,
111 .ufcon = UFCON,
1da177e4
LT
112 },
113 [1] = {
114 .hwport = 1,
115 .flags = 0,
116 .ucon = UCON,
117 .ulcon = ULCON,
118 .ufcon = UFCON,
1da177e4
LT
119 },
120 /* port 2 is not actually used */
121 [2] = {
122 .hwport = 2,
123 .flags = 0,
124 .ucon = UCON,
125 .ulcon = ULCON,
126 .ufcon = UFCON,
1da177e4
LT
127 }
128};
129
130/* definitions for the vr1000 extra 16550 serial ports */
131
132#define VR1000_BAUDBASE (3692307)
133
134#define VR1000_SERIAL_MAPBASE(x) (VR1000_PA_SERIAL + 0x80 + ((x) << 5))
135
136static struct plat_serial8250_port serial_platform_data[] = {
137 [0] = {
138 .mapbase = VR1000_SERIAL_MAPBASE(0),
db8304ed 139 .irq = VR1000_IRQ_SERIAL + 0,
1da177e4
LT
140 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
141 .iotype = UPIO_MEM,
142 .regshift = 0,
143 .uartclk = VR1000_BAUDBASE,
144 },
145 [1] = {
146 .mapbase = VR1000_SERIAL_MAPBASE(1),
db8304ed 147 .irq = VR1000_IRQ_SERIAL + 1,
1da177e4
LT
148 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
149 .iotype = UPIO_MEM,
150 .regshift = 0,
151 .uartclk = VR1000_BAUDBASE,
152 },
153 [2] = {
154 .mapbase = VR1000_SERIAL_MAPBASE(2),
db8304ed 155 .irq = VR1000_IRQ_SERIAL + 2,
1da177e4
LT
156 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
157 .iotype = UPIO_MEM,
158 .regshift = 0,
159 .uartclk = VR1000_BAUDBASE,
160 },
161 [3] = {
162 .mapbase = VR1000_SERIAL_MAPBASE(3),
db8304ed 163 .irq = VR1000_IRQ_SERIAL + 3,
1da177e4
LT
164 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
165 .iotype = UPIO_MEM,
166 .regshift = 0,
167 .uartclk = VR1000_BAUDBASE,
168 },
169 { },
170};
171
172static struct platform_device serial_device = {
173 .name = "serial8250",
6df29deb 174 .id = PLAT8250_DEV_PLATFORM,
1da177e4
LT
175 .dev = {
176 .platform_data = serial_platform_data,
177 },
178};
179
d97a666f
BD
180/* DM9000 ethernet devices */
181
182static struct resource vr1000_dm9k0_resource[] = {
940e46ae
TB
183 [0] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000, 4),
184 [1] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0x40, 0x40),
db8304ed 185 [2] = DEFINE_RES_NAMED(VR1000_IRQ_DM9000A, 1, NULL, IORESOURCE_IRQ \
940e46ae 186 | IORESOURCE_IRQ_HIGHLEVEL),
d97a666f
BD
187};
188
189static struct resource vr1000_dm9k1_resource[] = {
940e46ae
TB
190 [0] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0x80, 4),
191 [1] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0xC0, 0x40),
db8304ed 192 [2] = DEFINE_RES_NAMED(VR1000_IRQ_DM9000N, 1, NULL, IORESOURCE_IRQ \
940e46ae 193 | IORESOURCE_IRQ_HIGHLEVEL),
d97a666f
BD
194};
195
196/* for the moment we limit ourselves to 16bit IO until some
197 * better IO routines can be written and tested
198*/
199
9f693d7b 200static struct dm9000_plat_data vr1000_dm9k_platdata = {
d97a666f
BD
201 .flags = DM9000_PLATF_16BITONLY,
202};
203
204static struct platform_device vr1000_dm9k0 = {
205 .name = "dm9000",
206 .id = 0,
207 .num_resources = ARRAY_SIZE(vr1000_dm9k0_resource),
208 .resource = vr1000_dm9k0_resource,
209 .dev = {
210 .platform_data = &vr1000_dm9k_platdata,
211 }
212};
213
214static struct platform_device vr1000_dm9k1 = {
215 .name = "dm9000",
216 .id = 1,
217 .num_resources = ARRAY_SIZE(vr1000_dm9k1_resource),
218 .resource = vr1000_dm9k1_resource,
219 .dev = {
220 .platform_data = &vr1000_dm9k_platdata,
221 }
222};
223
b2eba6bb
BD
224/* LEDS */
225
f7f611f2
LW
226static struct gpiod_lookup_table vr1000_led1_gpio_table = {
227 .dev_id = "s3c24xx_led.1",
228 .table = {
229 GPIO_LOOKUP("GPB", 0, NULL, GPIO_ACTIVE_HIGH),
230 { },
231 },
232};
233
234static struct gpiod_lookup_table vr1000_led2_gpio_table = {
235 .dev_id = "s3c24xx_led.2",
236 .table = {
237 GPIO_LOOKUP("GPB", 1, NULL, GPIO_ACTIVE_HIGH),
238 { },
239 },
240};
241
242static struct gpiod_lookup_table vr1000_led3_gpio_table = {
243 .dev_id = "s3c24xx_led.3",
244 .table = {
245 GPIO_LOOKUP("GPB", 2, NULL, GPIO_ACTIVE_HIGH),
246 { },
247 },
248};
249
b2eba6bb
BD
250static struct s3c24xx_led_platdata vr1000_led1_pdata = {
251 .name = "led1",
b2eba6bb
BD
252 .def_trigger = "",
253};
254
255static struct s3c24xx_led_platdata vr1000_led2_pdata = {
256 .name = "led2",
b2eba6bb
BD
257 .def_trigger = "",
258};
259
260static struct s3c24xx_led_platdata vr1000_led3_pdata = {
261 .name = "led3",
b2eba6bb
BD
262 .def_trigger = "",
263};
264
265static struct platform_device vr1000_led1 = {
266 .name = "s3c24xx_led",
267 .id = 1,
268 .dev = {
269 .platform_data = &vr1000_led1_pdata,
270 },
271};
272
273static struct platform_device vr1000_led2 = {
274 .name = "s3c24xx_led",
275 .id = 2,
276 .dev = {
277 .platform_data = &vr1000_led2_pdata,
278 },
279};
280
281static struct platform_device vr1000_led3 = {
282 .name = "s3c24xx_led",
abac08d7 283 .id = 3,
b2eba6bb
BD
284 .dev = {
285 .platform_data = &vr1000_led3_pdata,
286 },
287};
288
60d6698b
BD
289/* I2C devices. */
290
291static struct i2c_board_info vr1000_i2c_devs[] __initdata = {
292 {
293 I2C_BOARD_INFO("tlv320aic23", 0x1a),
9c3871ca
BD
294 }, {
295 I2C_BOARD_INFO("tmp101", 0x48),
60d6698b
BD
296 }, {
297 I2C_BOARD_INFO("m41st87", 0x68),
298 },
299};
300
d97a666f 301/* devices for this board */
1da177e4
LT
302
303static struct platform_device *vr1000_devices[] __initdata = {
51cb1289 304 &s3c2410_device_dclk,
b813248c 305 &s3c_device_ohci,
1da177e4
LT
306 &s3c_device_lcd,
307 &s3c_device_wdt,
3e1b776c 308 &s3c_device_i2c0,
d97a666f 309 &s3c_device_adc,
1da177e4 310 &serial_device,
d97a666f 311 &vr1000_dm9k0,
b2eba6bb
BD
312 &vr1000_dm9k1,
313 &vr1000_led1,
314 &vr1000_led2,
315 &vr1000_led3,
1da177e4
LT
316};
317
1da177e4
LT
318static void vr1000_power_off(void)
319{
7614e1d9 320 gpio_direction_output(S3C2410_GPB(9), 1);
1da177e4
LT
321}
322
5fe10ab1 323static void __init vr1000_map_io(void)
1da177e4 324{
1da177e4
LT
325 pm_power_off = vr1000_power_off;
326
327 s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
1da177e4 328 s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
a1342f6a 329 s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
1da177e4
LT
330}
331
07ee5e7c
HS
332static void __init vr1000_init_time(void)
333{
334 s3c2410_init_clocks(12000000);
a1342f6a 335 s3c24xx_timer_init();
07ee5e7c
HS
336}
337
57e5171c
BD
338static void __init vr1000_init(void)
339{
3e1b776c 340 s3c_i2c0_set_platdata(NULL);
f7f611f2
LW
341
342 /* Disable pull-up on LED lines and register GPIO lookups */
343 s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
344 s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_NONE);
345 s3c_gpio_setpull(S3C2410_GPB(2), S3C_GPIO_PULL_NONE);
346 gpiod_add_lookup_table(&vr1000_led1_gpio_table);
347 gpiod_add_lookup_table(&vr1000_led2_gpio_table);
348 gpiod_add_lookup_table(&vr1000_led3_gpio_table);
349
57e5171c 350 platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices));
9d529c6e 351
60d6698b
BD
352 i2c_register_board_info(0, vr1000_i2c_devs,
353 ARRAY_SIZE(vr1000_i2c_devs));
354
9d529c6e 355 nor_simtec_init();
4d3a3469 356 simtec_audio_add(NULL, true, NULL);
7614e1d9
BD
357
358 WARN_ON(gpio_request(S3C2410_GPB(9), "power off"));
57e5171c 359}
1da177e4
LT
360
361MACHINE_START(VR1000, "Thorcom-VR1000")
e9dea0c6 362 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
69d50710 363 .atag_offset = 0x100,
6904b246 364 .map_io = vr1000_map_io,
57e5171c 365 .init_machine = vr1000_init,
f182aa1d 366 .init_irq = s3c2410_init_irq,
07ee5e7c 367 .init_time = vr1000_init_time,
1da177e4 368MACHINE_END