1 /* linux/arch/arm/mach-s3c2410/mach-vr1000.c
3 * Copyright (c) 2003-2008 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/gpio.h>
22 #include <linux/dm9000.h>
23 #include <linux/i2c.h>
25 #include <linux/serial.h>
26 #include <linux/tty.h>
27 #include <linux/serial_8250.h>
28 #include <linux/serial_reg.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
33 #include <asm/mach/irq.h>
35 #include <mach/bast-map.h>
36 #include <mach/vr1000-map.h>
37 #include <mach/vr1000-irq.h>
38 #include <mach/vr1000-cpld.h>
40 #include <mach/hardware.h>
42 #include <asm/mach-types.h>
44 #include <plat/regs-serial.h>
45 #include <mach/regs-gpio.h>
46 #include <mach/leds-gpio.h>
48 #include <plat/clock.h>
49 #include <plat/devs.h>
52 #include <plat/audio-simtec.h>
57 /* macros for virtual address mods for the io space entries */
58 #define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
59 #define VA_C4(item) ((unsigned long)(item) + BAST_VAM_CS4)
60 #define VA_C3(item) ((unsigned long)(item) + BAST_VAM_CS3)
61 #define VA_C2(item) ((unsigned long)(item) + BAST_VAM_CS2)
63 /* macros to modify the physical addresses for io space */
65 #define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2))
66 #define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3))
67 #define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4))
68 #define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5))
70 static struct map_desc vr1000_iodesc
[] __initdata
= {
73 .virtual = (u32
)S3C24XX_VA_ISA_BYTE
,
74 .pfn
= PA_CS2(BAST_PA_ISAIO
),
78 .virtual = (u32
)S3C24XX_VA_ISA_WORD
,
79 .pfn
= PA_CS3(BAST_PA_ISAIO
),
84 /* CPLD control registers, and external interrupt controls */
86 .virtual = (u32
)VR1000_VA_CTRL1
,
87 .pfn
= __phys_to_pfn(VR1000_PA_CTRL1
),
91 .virtual = (u32
)VR1000_VA_CTRL2
,
92 .pfn
= __phys_to_pfn(VR1000_PA_CTRL2
),
96 .virtual = (u32
)VR1000_VA_CTRL3
,
97 .pfn
= __phys_to_pfn(VR1000_PA_CTRL3
),
101 .virtual = (u32
)VR1000_VA_CTRL4
,
102 .pfn
= __phys_to_pfn(VR1000_PA_CTRL4
),
108 #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
109 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
110 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
112 static struct s3c2410_uartcfg vr1000_uartcfgs
[] __initdata
= {
127 /* port 2 is not actually used */
137 /* definitions for the vr1000 extra 16550 serial ports */
139 #define VR1000_BAUDBASE (3692307)
141 #define VR1000_SERIAL_MAPBASE(x) (VR1000_PA_SERIAL + 0x80 + ((x) << 5))
143 static struct plat_serial8250_port serial_platform_data
[] = {
145 .mapbase
= VR1000_SERIAL_MAPBASE(0),
146 .irq
= IRQ_VR1000_SERIAL
+ 0,
147 .flags
= UPF_BOOT_AUTOCONF
| UPF_IOREMAP
,
150 .uartclk
= VR1000_BAUDBASE
,
153 .mapbase
= VR1000_SERIAL_MAPBASE(1),
154 .irq
= IRQ_VR1000_SERIAL
+ 1,
155 .flags
= UPF_BOOT_AUTOCONF
| UPF_IOREMAP
,
158 .uartclk
= VR1000_BAUDBASE
,
161 .mapbase
= VR1000_SERIAL_MAPBASE(2),
162 .irq
= IRQ_VR1000_SERIAL
+ 2,
163 .flags
= UPF_BOOT_AUTOCONF
| UPF_IOREMAP
,
166 .uartclk
= VR1000_BAUDBASE
,
169 .mapbase
= VR1000_SERIAL_MAPBASE(3),
170 .irq
= IRQ_VR1000_SERIAL
+ 3,
171 .flags
= UPF_BOOT_AUTOCONF
| UPF_IOREMAP
,
174 .uartclk
= VR1000_BAUDBASE
,
179 static struct platform_device serial_device
= {
180 .name
= "serial8250",
181 .id
= PLAT8250_DEV_PLATFORM
,
183 .platform_data
= serial_platform_data
,
187 /* DM9000 ethernet devices */
189 static struct resource vr1000_dm9k0_resource
[] = {
190 [0] = DEFINE_RES_MEM(S3C2410_CS5
+ VR1000_PA_DM9000
, 4),
191 [1] = DEFINE_RES_MEM(S3C2410_CS5
+ VR1000_PA_DM9000
+ 0x40, 0x40),
192 [2] = DEFINE_RES_NAMED(IRQ_VR1000_DM9000A
, 1, NULL
, IORESOURCE_IRQ \
193 | IORESOURCE_IRQ_HIGHLEVEL
),
196 static struct resource vr1000_dm9k1_resource
[] = {
197 [0] = DEFINE_RES_MEM(S3C2410_CS5
+ VR1000_PA_DM9000
+ 0x80, 4),
198 [1] = DEFINE_RES_MEM(S3C2410_CS5
+ VR1000_PA_DM9000
+ 0xC0, 0x40),
199 [2] = DEFINE_RES_NAMED(IRQ_VR1000_DM9000N
, 1, NULL
, IORESOURCE_IRQ \
200 | IORESOURCE_IRQ_HIGHLEVEL
),
203 /* for the moment we limit ourselves to 16bit IO until some
204 * better IO routines can be written and tested
207 static struct dm9000_plat_data vr1000_dm9k_platdata
= {
208 .flags
= DM9000_PLATF_16BITONLY
,
211 static struct platform_device vr1000_dm9k0
= {
214 .num_resources
= ARRAY_SIZE(vr1000_dm9k0_resource
),
215 .resource
= vr1000_dm9k0_resource
,
217 .platform_data
= &vr1000_dm9k_platdata
,
221 static struct platform_device vr1000_dm9k1
= {
224 .num_resources
= ARRAY_SIZE(vr1000_dm9k1_resource
),
225 .resource
= vr1000_dm9k1_resource
,
227 .platform_data
= &vr1000_dm9k_platdata
,
233 static struct s3c24xx_led_platdata vr1000_led1_pdata
= {
235 .gpio
= S3C2410_GPB(0),
239 static struct s3c24xx_led_platdata vr1000_led2_pdata
= {
241 .gpio
= S3C2410_GPB(1),
245 static struct s3c24xx_led_platdata vr1000_led3_pdata
= {
247 .gpio
= S3C2410_GPB(2),
251 static struct platform_device vr1000_led1
= {
252 .name
= "s3c24xx_led",
255 .platform_data
= &vr1000_led1_pdata
,
259 static struct platform_device vr1000_led2
= {
260 .name
= "s3c24xx_led",
263 .platform_data
= &vr1000_led2_pdata
,
267 static struct platform_device vr1000_led3
= {
268 .name
= "s3c24xx_led",
271 .platform_data
= &vr1000_led3_pdata
,
277 static struct i2c_board_info vr1000_i2c_devs
[] __initdata
= {
279 I2C_BOARD_INFO("tlv320aic23", 0x1a),
281 I2C_BOARD_INFO("tmp101", 0x48),
283 I2C_BOARD_INFO("m41st87", 0x68),
287 /* devices for this board */
289 static struct platform_device
*vr1000_devices
[] __initdata
= {
303 static struct clk
*vr1000_clocks
[] __initdata
= {
311 static void vr1000_power_off(void)
313 gpio_direction_output(S3C2410_GPB(9), 1);
316 static void __init
vr1000_map_io(void)
318 /* initialise clock sources */
320 s3c24xx_dclk0
.parent
= &clk_upll
;
321 s3c24xx_dclk0
.rate
= 12*1000*1000;
323 s3c24xx_dclk1
.parent
= NULL
;
324 s3c24xx_dclk1
.rate
= 3692307;
326 s3c24xx_clkout0
.parent
= &s3c24xx_dclk0
;
327 s3c24xx_clkout1
.parent
= &s3c24xx_dclk1
;
329 s3c24xx_uclk
.parent
= &s3c24xx_clkout1
;
331 s3c24xx_register_clocks(vr1000_clocks
, ARRAY_SIZE(vr1000_clocks
));
333 pm_power_off
= vr1000_power_off
;
335 s3c24xx_init_io(vr1000_iodesc
, ARRAY_SIZE(vr1000_iodesc
));
336 s3c24xx_init_clocks(0);
337 s3c24xx_init_uarts(vr1000_uartcfgs
, ARRAY_SIZE(vr1000_uartcfgs
));
340 static void __init
vr1000_init(void)
342 s3c_i2c0_set_platdata(NULL
);
343 platform_add_devices(vr1000_devices
, ARRAY_SIZE(vr1000_devices
));
345 i2c_register_board_info(0, vr1000_i2c_devs
,
346 ARRAY_SIZE(vr1000_i2c_devs
));
349 simtec_audio_add(NULL
, true, NULL
);
351 WARN_ON(gpio_request(S3C2410_GPB(9), "power off"));
354 MACHINE_START(VR1000
, "Thorcom-VR1000")
355 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
356 .atag_offset
= 0x100,
357 .map_io
= vr1000_map_io
,
358 .init_machine
= vr1000_init
,
359 .init_irq
= s3c24xx_init_irq
,
360 .timer
= &s3c24xx_timer
,
361 .restart
= s3c2410_restart
,