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>
54 #include "usb-simtec.h"
55 #include "nor-simtec.h"
58 /* macros for virtual address mods for the io space entries */
59 #define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
60 #define VA_C4(item) ((unsigned long)(item) + BAST_VAM_CS4)
61 #define VA_C3(item) ((unsigned long)(item) + BAST_VAM_CS3)
62 #define VA_C2(item) ((unsigned long)(item) + BAST_VAM_CS2)
64 /* macros to modify the physical addresses for io space */
66 #define PA_CS2(item) (__phys_to_pfn((item) + S3C2410_CS2))
67 #define PA_CS3(item) (__phys_to_pfn((item) + S3C2410_CS3))
68 #define PA_CS4(item) (__phys_to_pfn((item) + S3C2410_CS4))
69 #define PA_CS5(item) (__phys_to_pfn((item) + S3C2410_CS5))
71 static struct map_desc vr1000_iodesc[] __initdata = {
74 .virtual = (u32)S3C24XX_VA_ISA_BYTE,
75 .pfn = PA_CS2(BAST_PA_ISAIO),
79 .virtual = (u32)S3C24XX_VA_ISA_WORD,
80 .pfn = PA_CS3(BAST_PA_ISAIO),
85 /* CPLD control registers, and external interrupt controls */
87 .virtual = (u32)VR1000_VA_CTRL1,
88 .pfn = __phys_to_pfn(VR1000_PA_CTRL1),
92 .virtual = (u32)VR1000_VA_CTRL2,
93 .pfn = __phys_to_pfn(VR1000_PA_CTRL2),
97 .virtual = (u32)VR1000_VA_CTRL3,
98 .pfn = __phys_to_pfn(VR1000_PA_CTRL3),
102 .virtual = (u32)VR1000_VA_CTRL4,
103 .pfn = __phys_to_pfn(VR1000_PA_CTRL4),
109 #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
110 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
111 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
113 /* uart clock source(s) */
115 static struct s3c24xx_uart_clksrc vr1000_serial_clocks[] = {
130 static struct s3c2410_uartcfg vr1000_uartcfgs[] __initdata = {
137 .clocks = vr1000_serial_clocks,
138 .clocks_size = ARRAY_SIZE(vr1000_serial_clocks),
146 .clocks = vr1000_serial_clocks,
147 .clocks_size = ARRAY_SIZE(vr1000_serial_clocks),
149 /* port 2 is not actually used */
156 .clocks = vr1000_serial_clocks,
157 .clocks_size = ARRAY_SIZE(vr1000_serial_clocks),
162 /* definitions for the vr1000 extra 16550 serial ports */
164 #define VR1000_BAUDBASE (3692307)
166 #define VR1000_SERIAL_MAPBASE(x) (VR1000_PA_SERIAL + 0x80 + ((x) << 5))
168 static struct plat_serial8250_port serial_platform_data[] = {
170 .mapbase = VR1000_SERIAL_MAPBASE(0),
171 .irq = IRQ_VR1000_SERIAL + 0,
172 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
175 .uartclk = VR1000_BAUDBASE,
178 .mapbase = VR1000_SERIAL_MAPBASE(1),
179 .irq = IRQ_VR1000_SERIAL + 1,
180 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
183 .uartclk = VR1000_BAUDBASE,
186 .mapbase = VR1000_SERIAL_MAPBASE(2),
187 .irq = IRQ_VR1000_SERIAL + 2,
188 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
191 .uartclk = VR1000_BAUDBASE,
194 .mapbase = VR1000_SERIAL_MAPBASE(3),
195 .irq = IRQ_VR1000_SERIAL + 3,
196 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
199 .uartclk = VR1000_BAUDBASE,
204 static struct platform_device serial_device = {
205 .name = "serial8250",
206 .id = PLAT8250_DEV_PLATFORM,
208 .platform_data = serial_platform_data,
212 /* DM9000 ethernet devices */
214 static struct resource vr1000_dm9k0_resource[] = {
216 .start = S3C2410_CS5 + VR1000_PA_DM9000,
217 .end = S3C2410_CS5 + VR1000_PA_DM9000 + 3,
218 .flags = IORESOURCE_MEM
221 .start = S3C2410_CS5 + VR1000_PA_DM9000 + 0x40,
222 .end = S3C2410_CS5 + VR1000_PA_DM9000 + 0x7f,
223 .flags = IORESOURCE_MEM
226 .start = IRQ_VR1000_DM9000A,
227 .end = IRQ_VR1000_DM9000A,
228 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
233 static struct resource vr1000_dm9k1_resource[] = {
235 .start = S3C2410_CS5 + VR1000_PA_DM9000 + 0x80,
236 .end = S3C2410_CS5 + VR1000_PA_DM9000 + 0x83,
237 .flags = IORESOURCE_MEM
240 .start = S3C2410_CS5 + VR1000_PA_DM9000 + 0xC0,
241 .end = S3C2410_CS5 + VR1000_PA_DM9000 + 0xFF,
242 .flags = IORESOURCE_MEM
245 .start = IRQ_VR1000_DM9000N,
246 .end = IRQ_VR1000_DM9000N,
247 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
251 /* for the moment we limit ourselves to 16bit IO until some
252 * better IO routines can be written and tested
255 static struct dm9000_plat_data vr1000_dm9k_platdata = {
256 .flags = DM9000_PLATF_16BITONLY,
259 static struct platform_device vr1000_dm9k0 = {
262 .num_resources = ARRAY_SIZE(vr1000_dm9k0_resource),
263 .resource = vr1000_dm9k0_resource,
265 .platform_data = &vr1000_dm9k_platdata,
269 static struct platform_device vr1000_dm9k1 = {
272 .num_resources = ARRAY_SIZE(vr1000_dm9k1_resource),
273 .resource = vr1000_dm9k1_resource,
275 .platform_data = &vr1000_dm9k_platdata,
281 static struct s3c24xx_led_platdata vr1000_led1_pdata = {
283 .gpio = S3C2410_GPB(0),
287 static struct s3c24xx_led_platdata vr1000_led2_pdata = {
289 .gpio = S3C2410_GPB(1),
293 static struct s3c24xx_led_platdata vr1000_led3_pdata = {
295 .gpio = S3C2410_GPB(2),
299 static struct platform_device vr1000_led1 = {
300 .name = "s3c24xx_led",
303 .platform_data = &vr1000_led1_pdata,
307 static struct platform_device vr1000_led2 = {
308 .name = "s3c24xx_led",
311 .platform_data = &vr1000_led2_pdata,
315 static struct platform_device vr1000_led3 = {
316 .name = "s3c24xx_led",
319 .platform_data = &vr1000_led3_pdata,
325 static struct i2c_board_info vr1000_i2c_devs[] __initdata = {
327 I2C_BOARD_INFO("tlv320aic23", 0x1a),
329 I2C_BOARD_INFO("tmp101", 0x48),
331 I2C_BOARD_INFO("m41st87", 0x68),
335 /* devices for this board */
337 static struct platform_device *vr1000_devices[] __initdata = {
351 static struct clk *vr1000_clocks[] __initdata = {
359 static void vr1000_power_off(void)
361 gpio_direction_output(S3C2410_GPB(9), 1);
364 static void __init vr1000_map_io(void)
366 /* initialise clock sources */
368 s3c24xx_dclk0.parent = &clk_upll;
369 s3c24xx_dclk0.rate = 12*1000*1000;
371 s3c24xx_dclk1.parent = NULL;
372 s3c24xx_dclk1.rate = 3692307;
374 s3c24xx_clkout0.parent = &s3c24xx_dclk0;
375 s3c24xx_clkout1.parent = &s3c24xx_dclk1;
377 s3c24xx_uclk.parent = &s3c24xx_clkout1;
379 s3c24xx_register_clocks(vr1000_clocks, ARRAY_SIZE(vr1000_clocks));
381 pm_power_off = vr1000_power_off;
383 s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
384 s3c24xx_init_clocks(0);
385 s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
388 static void __init vr1000_init(void)
390 s3c_i2c0_set_platdata(NULL);
391 platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices));
393 i2c_register_board_info(0, vr1000_i2c_devs,
394 ARRAY_SIZE(vr1000_i2c_devs));
397 simtec_audio_add(NULL, true, NULL);
399 WARN_ON(gpio_request(S3C2410_GPB(9), "power off"));
402 MACHINE_START(VR1000, "Thorcom-VR1000")
403 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
404 .atag_offset = 0x100,
405 .map_io = vr1000_map_io,
406 .init_machine = vr1000_init,
407 .init_irq = s3c24xx_init_irq,
408 .timer = &s3c24xx_timer,
409 .restart = s3c2410_restart,