AT91: Added a generic way to setup AT91 serial ports in Kconfig
[linux-2.6/pdupreez.git] / arch / arm / mach-at91 / board-sam9rlek.c
blobfd414c1417bc8d07c8a6f325b3c5c25a7b181ff3
1 /*
2 * Copyright (C) 2005 SAN People
3 * Copyright (C) 2007 Atmel Corporation
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file COPYING in the main directory of this archive for
7 * more details.
8 */
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/mm.h>
13 #include <linux/module.h>
14 #include <linux/platform_device.h>
15 #include <linux/spi/spi.h>
16 #include <linux/fb.h>
17 #include <linux/clk.h>
19 #include <video/atmel_lcdc.h>
21 #include <mach/hardware.h>
22 #include <asm/setup.h>
23 #include <asm/mach-types.h>
24 #include <asm/irq.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/map.h>
28 #include <asm/mach/irq.h>
30 #include <mach/board.h>
31 #include <mach/gpio.h>
32 #include <mach/at91sam9_smc.h>
34 #include "generic.h"
37 static void __init ek_map_io(void)
39 /* Initialize processor: 12.000 MHz crystal */
40 at91sam9rl_initialize(12000000);
42 /* Setup the serial ports and console */
43 at91_init_uarts();
46 static void __init ek_init_irq(void)
48 at91sam9rl_init_interrupts(NULL);
53 * USB HS Device port
55 static struct usba_platform_data __initdata ek_usba_udc_data = {
56 .vbus_pin = AT91_PIN_PA8,
61 * MCI (SD/MMC)
63 static struct at91_mmc_data __initdata ek_mmc_data = {
64 .wire4 = 1,
65 .det_pin = AT91_PIN_PA15,
66 // .wp_pin = ... not connected
67 // .vcc_pin = ... not connected
72 * NAND flash
74 static struct mtd_partition __initdata ek_nand_partition[] = {
76 .name = "Partition 1",
77 .offset = 0,
78 .size = 256 * 1024,
81 .name = "Partition 2",
82 .offset = 256 * 1024 ,
83 .size = MTDPART_SIZ_FULL,
87 static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
89 *num_partitions = ARRAY_SIZE(ek_nand_partition);
90 return ek_nand_partition;
93 static struct atmel_nand_data __initdata ek_nand_data = {
94 .ale = 21,
95 .cle = 22,
96 // .det_pin = ... not connected
97 .rdy_pin = AT91_PIN_PD17,
98 .enable_pin = AT91_PIN_PB6,
99 .partition_info = nand_partitions,
100 .bus_width_16 = 0,
105 * SPI devices
107 static struct spi_board_info ek_spi_devices[] = {
108 { /* DataFlash chip */
109 .modalias = "mtd_dataflash",
110 .chip_select = 0,
111 .max_speed_hz = 15 * 1000 * 1000,
112 .bus_num = 0,
118 * LCD Controller
120 #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
121 static struct fb_videomode at91_tft_vga_modes[] = {
123 .name = "TX09D50VM1CCA @ 60",
124 .refresh = 60,
125 .xres = 240, .yres = 320,
126 .pixclock = KHZ2PICOS(4965),
128 .left_margin = 1, .right_margin = 33,
129 .upper_margin = 1, .lower_margin = 0,
130 .hsync_len = 5, .vsync_len = 1,
132 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
133 .vmode = FB_VMODE_NONINTERLACED,
137 static struct fb_monspecs at91fb_default_monspecs = {
138 .manufacturer = "HIT",
139 .monitor = "TX09D50VM1CCA",
141 .modedb = at91_tft_vga_modes,
142 .modedb_len = ARRAY_SIZE(at91_tft_vga_modes),
143 .hfmin = 15000,
144 .hfmax = 64000,
145 .vfmin = 50,
146 .vfmax = 150,
149 #define AT91SAM9RL_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
150 | ATMEL_LCDC_DISTYPE_TFT \
151 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
153 static void at91_lcdc_power_control(int on)
155 if (on)
156 at91_set_gpio_value(AT91_PIN_PA30, 0); /* power up */
157 else
158 at91_set_gpio_value(AT91_PIN_PA30, 1); /* power down */
161 /* Driver datas */
162 static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
163 .default_bpp = 16,
164 .default_dmacon = ATMEL_LCDC_DMAEN,
165 .default_lcdcon2 = AT91SAM9RL_DEFAULT_LCDCON2,
166 .default_monspecs = &at91fb_default_monspecs,
167 .atmel_lcdfb_power_control = at91_lcdc_power_control,
168 .guard_time = 1,
171 #else
172 static struct atmel_lcdfb_info __initdata ek_lcdc_data;
173 #endif
176 static void __init ek_board_init(void)
178 /* Serial */
179 at91_add_device_serial();
180 /* USB HS */
181 at91_add_device_usba(&ek_usba_udc_data);
182 /* I2C */
183 at91_add_device_i2c(NULL, 0);
184 /* NAND */
185 at91_add_device_nand(&ek_nand_data);
186 /* SPI */
187 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
188 /* MMC */
189 at91_add_device_mmc(0, &ek_mmc_data);
190 /* LCD Controller */
191 at91_add_device_lcdc(&ek_lcdc_data);
194 MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK")
195 /* Maintainer: Atmel */
196 .phys_io = AT91_BASE_SYS,
197 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
198 .boot_params = AT91_SDRAM_BASE + 0x100,
199 .timer = &at91sam926x_timer,
200 .map_io = ek_map_io,
201 .init_irq = ek_init_irq,
202 .init_machine = ek_board_init,
203 MACHINE_END