1 /* linux/arch/arm/mach-s3c2410/mach-vr1000.c
3 * Copyright (c) 2003-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * Machine support for Thorcom VR1000 board. Designed for Thorcom by
7 * Simtec Electronics, http://www.simtec.co.uk/
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
15 #include <linux/kernel.h>
16 #include <linux/types.h>
17 #include <linux/interrupt.h>
18 #include <linux/list.h>
19 #include <linux/timer.h>
20 #include <linux/init.h>
21 #include <linux/dm9000.h>
23 #include <linux/serial.h>
24 #include <linux/tty.h>
25 #include <linux/serial_8250.h>
26 #include <linux/serial_reg.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/map.h>
30 #include <asm/mach/irq.h>
32 #include <asm/arch/bast-map.h>
33 #include <asm/arch/vr1000-map.h>
34 #include <asm/arch/vr1000-irq.h>
35 #include <asm/arch/vr1000-cpld.h>
37 #include <asm/hardware.h>
40 #include <asm/mach-types.h>
42 #include <asm/plat-s3c/regs-serial.h>
43 #include <asm/arch/regs-gpio.h>
44 #include <asm/arch/leds-gpio.h>
46 #include <asm/plat-s3c24xx/clock.h>
47 #include <asm/plat-s3c24xx/devs.h>
48 #include <asm/plat-s3c24xx/cpu.h>
50 #include "usb-simtec.h"
51 #include "nor-simtec.h"
53 /* macros for virtual address mods for the io space entries */
54 #define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
55 #define VA_C4(item) ((unsigned long)(item) + BAST_VAM_CS4)
56 #define VA_C3(item) ((unsigned long)(item) + BAST_VAM_CS3)
57 #define VA_C2(item) ((unsigned long)(item) + BAST_VAM_CS2)
59 /* macros to modify the physical addresses for io space */
61 #define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2))
62 #define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3))
63 #define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4))
64 #define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5))
66 static struct map_desc vr1000_iodesc
[] __initdata
= {
69 .virtual = (u32
)S3C24XX_VA_ISA_BYTE
,
70 .pfn
= PA_CS2(BAST_PA_ISAIO
),
74 .virtual = (u32
)S3C24XX_VA_ISA_WORD
,
75 .pfn
= PA_CS3(BAST_PA_ISAIO
),
80 /* CPLD control registers, and external interrupt controls */
82 .virtual = (u32
)VR1000_VA_CTRL1
,
83 .pfn
= __phys_to_pfn(VR1000_PA_CTRL1
),
87 .virtual = (u32
)VR1000_VA_CTRL2
,
88 .pfn
= __phys_to_pfn(VR1000_PA_CTRL2
),
92 .virtual = (u32
)VR1000_VA_CTRL3
,
93 .pfn
= __phys_to_pfn(VR1000_PA_CTRL3
),
97 .virtual = (u32
)VR1000_VA_CTRL4
,
98 .pfn
= __phys_to_pfn(VR1000_PA_CTRL4
),
104 #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
105 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
106 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
108 /* uart clock source(s) */
110 static struct s3c24xx_uart_clksrc vr1000_serial_clocks
[] = {
125 static struct s3c2410_uartcfg vr1000_uartcfgs
[] __initdata
= {
132 .clocks
= vr1000_serial_clocks
,
133 .clocks_size
= ARRAY_SIZE(vr1000_serial_clocks
),
141 .clocks
= vr1000_serial_clocks
,
142 .clocks_size
= ARRAY_SIZE(vr1000_serial_clocks
),
144 /* port 2 is not actually used */
151 .clocks
= vr1000_serial_clocks
,
152 .clocks_size
= ARRAY_SIZE(vr1000_serial_clocks
),
157 /* definitions for the vr1000 extra 16550 serial ports */
159 #define VR1000_BAUDBASE (3692307)
161 #define VR1000_SERIAL_MAPBASE(x) (VR1000_PA_SERIAL + 0x80 + ((x) << 5))
163 static struct plat_serial8250_port serial_platform_data
[] = {
165 .mapbase
= VR1000_SERIAL_MAPBASE(0),
166 .irq
= IRQ_VR1000_SERIAL
+ 0,
167 .flags
= UPF_BOOT_AUTOCONF
| UPF_IOREMAP
,
170 .uartclk
= VR1000_BAUDBASE
,
173 .mapbase
= VR1000_SERIAL_MAPBASE(1),
174 .irq
= IRQ_VR1000_SERIAL
+ 1,
175 .flags
= UPF_BOOT_AUTOCONF
| UPF_IOREMAP
,
178 .uartclk
= VR1000_BAUDBASE
,
181 .mapbase
= VR1000_SERIAL_MAPBASE(2),
182 .irq
= IRQ_VR1000_SERIAL
+ 2,
183 .flags
= UPF_BOOT_AUTOCONF
| UPF_IOREMAP
,
186 .uartclk
= VR1000_BAUDBASE
,
189 .mapbase
= VR1000_SERIAL_MAPBASE(3),
190 .irq
= IRQ_VR1000_SERIAL
+ 3,
191 .flags
= UPF_BOOT_AUTOCONF
| UPF_IOREMAP
,
194 .uartclk
= VR1000_BAUDBASE
,
199 static struct platform_device serial_device
= {
200 .name
= "serial8250",
201 .id
= PLAT8250_DEV_PLATFORM
,
203 .platform_data
= serial_platform_data
,
207 /* DM9000 ethernet devices */
209 static struct resource vr1000_dm9k0_resource
[] = {
211 .start
= S3C2410_CS5
+ VR1000_PA_DM9000
,
212 .end
= S3C2410_CS5
+ VR1000_PA_DM9000
+ 3,
213 .flags
= IORESOURCE_MEM
216 .start
= S3C2410_CS5
+ VR1000_PA_DM9000
+ 0x40,
217 .end
= S3C2410_CS5
+ VR1000_PA_DM9000
+ 0x7f,
218 .flags
= IORESOURCE_MEM
221 .start
= IRQ_VR1000_DM9000A
,
222 .end
= IRQ_VR1000_DM9000A
,
223 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
228 static struct resource vr1000_dm9k1_resource
[] = {
230 .start
= S3C2410_CS5
+ VR1000_PA_DM9000
+ 0x80,
231 .end
= S3C2410_CS5
+ VR1000_PA_DM9000
+ 0x83,
232 .flags
= IORESOURCE_MEM
235 .start
= S3C2410_CS5
+ VR1000_PA_DM9000
+ 0xC0,
236 .end
= S3C2410_CS5
+ VR1000_PA_DM9000
+ 0xFF,
237 .flags
= IORESOURCE_MEM
240 .start
= IRQ_VR1000_DM9000N
,
241 .end
= IRQ_VR1000_DM9000N
,
242 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
246 /* for the moment we limit ourselves to 16bit IO until some
247 * better IO routines can be written and tested
250 static struct dm9000_plat_data vr1000_dm9k_platdata
= {
251 .flags
= DM9000_PLATF_16BITONLY
,
254 static struct platform_device vr1000_dm9k0
= {
257 .num_resources
= ARRAY_SIZE(vr1000_dm9k0_resource
),
258 .resource
= vr1000_dm9k0_resource
,
260 .platform_data
= &vr1000_dm9k_platdata
,
264 static struct platform_device vr1000_dm9k1
= {
267 .num_resources
= ARRAY_SIZE(vr1000_dm9k1_resource
),
268 .resource
= vr1000_dm9k1_resource
,
270 .platform_data
= &vr1000_dm9k_platdata
,
276 static struct s3c24xx_led_platdata vr1000_led1_pdata
= {
278 .gpio
= S3C2410_GPB0
,
282 static struct s3c24xx_led_platdata vr1000_led2_pdata
= {
284 .gpio
= S3C2410_GPB1
,
288 static struct s3c24xx_led_platdata vr1000_led3_pdata
= {
290 .gpio
= S3C2410_GPB2
,
294 static struct platform_device vr1000_led1
= {
295 .name
= "s3c24xx_led",
298 .platform_data
= &vr1000_led1_pdata
,
302 static struct platform_device vr1000_led2
= {
303 .name
= "s3c24xx_led",
306 .platform_data
= &vr1000_led2_pdata
,
310 static struct platform_device vr1000_led3
= {
311 .name
= "s3c24xx_led",
314 .platform_data
= &vr1000_led3_pdata
,
318 /* devices for this board */
320 static struct platform_device
*vr1000_devices
[] __initdata
= {
334 static struct clk
*vr1000_clocks
[] = {
342 static void vr1000_power_off(void)
344 s3c2410_gpio_cfgpin(S3C2410_GPB9
, S3C2410_GPB9_OUTP
);
345 s3c2410_gpio_setpin(S3C2410_GPB9
, 1);
348 static void __init
vr1000_map_io(void)
350 /* initialise clock sources */
352 s3c24xx_dclk0
.parent
= &clk_upll
;
353 s3c24xx_dclk0
.rate
= 12*1000*1000;
355 s3c24xx_dclk1
.parent
= NULL
;
356 s3c24xx_dclk1
.rate
= 3692307;
358 s3c24xx_clkout0
.parent
= &s3c24xx_dclk0
;
359 s3c24xx_clkout1
.parent
= &s3c24xx_dclk1
;
361 s3c24xx_uclk
.parent
= &s3c24xx_clkout1
;
363 s3c24xx_register_clocks(vr1000_clocks
, ARRAY_SIZE(vr1000_clocks
));
365 pm_power_off
= vr1000_power_off
;
367 s3c24xx_init_io(vr1000_iodesc
, ARRAY_SIZE(vr1000_iodesc
));
368 s3c24xx_init_clocks(0);
369 s3c24xx_init_uarts(vr1000_uartcfgs
, ARRAY_SIZE(vr1000_uartcfgs
));
372 static void __init
vr1000_init(void)
374 platform_add_devices(vr1000_devices
, ARRAY_SIZE(vr1000_devices
));
379 MACHINE_START(VR1000
, "Thorcom-VR1000")
380 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
381 .phys_io
= S3C2410_PA_UART
,
382 .io_pg_offst
= (((u32
)S3C24XX_VA_UART
) >> 18) & 0xfffc,
383 .boot_params
= S3C2410_SDRAM_PA
+ 0x100,
384 .map_io
= vr1000_map_io
,
385 .init_machine
= vr1000_init
,
386 .init_irq
= s3c24xx_init_irq
,
387 .timer
= &s3c24xx_timer
,