blob: 9b937ee4815a804cd8b92dc5e32aca82e9c04d29 [file] [log] [blame]
Andrew Victorc42dcb32007-05-11 19:24:18 +01001/*
2 * Copyright (C) 2005 SAN People
3 * Copyright (C) 2007 Atmel Corporation
4 *
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 */
9
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>
18
19#include <video/atmel_lcdc.h>
20
Andrew Victorc42dcb32007-05-11 19:24:18 +010021#include <asm/setup.h>
22#include <asm/mach-types.h>
23#include <asm/irq.h>
24
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/mach/irq.h>
28
Andrew Victore5052402008-09-21 21:30:02 +010029#include <mach/hardware.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010030#include <mach/board.h>
31#include <mach/gpio.h>
Andrew Victor8cdae512008-10-06 20:05:35 +010032#include <mach/at91_shdwc.h>
Andrew Victorc42dcb32007-05-11 19:24:18 +010033
Andrew Victor8cdae512008-10-06 20:05:35 +010034#include "sam9_smc.h"
Andrew Victorc42dcb32007-05-11 19:24:18 +010035#include "generic.h"
36
37
Andrew Victorc42dcb32007-05-11 19:24:18 +010038static void __init ek_map_io(void)
39{
40 /* Initialize processor: 12.000 MHz crystal */
41 at91sam9rl_initialize(12000000);
42
Andrew Victora3da1222008-04-02 21:47:29 +010043 /* DGBU on ttyS0. (Rx & Tx only) */
44 at91_register_uart(0, 0, 0);
45
46 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */
47 at91_register_uart(AT91SAM9RL_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
48
49 /* set serial console to ttyS0 (ie, DBGU) */
50 at91_set_serial_console(0);
Andrew Victorc42dcb32007-05-11 19:24:18 +010051}
52
53static void __init ek_init_irq(void)
54{
55 at91sam9rl_init_interrupts(NULL);
56}
57
58
59/*
Nicolas Ferreba45ca42008-04-08 13:59:18 +010060 * USB HS Device port
61 */
62static struct usba_platform_data __initdata ek_usba_udc_data = {
63 .vbus_pin = AT91_PIN_PA8,
64};
65
66
67/*
Andrew Victorc42dcb32007-05-11 19:24:18 +010068 * MCI (SD/MMC)
69 */
70static struct at91_mmc_data __initdata ek_mmc_data = {
71 .wire4 = 1,
72 .det_pin = AT91_PIN_PA15,
73// .wp_pin = ... not connected
74// .vcc_pin = ... not connected
75};
76
77
78/*
79 * NAND flash
80 */
81static struct mtd_partition __initdata ek_nand_partition[] = {
82 {
83 .name = "Partition 1",
84 .offset = 0,
Andrew Victore5052402008-09-21 21:30:02 +010085 .size = SZ_256K,
Andrew Victorc42dcb32007-05-11 19:24:18 +010086 },
87 {
88 .name = "Partition 2",
Andrew Victore5052402008-09-21 21:30:02 +010089 .offset = MTDPART_OFS_NXTBLK,
Andrew Victorc42dcb32007-05-11 19:24:18 +010090 .size = MTDPART_SIZ_FULL,
91 },
92};
93
Russell Kingcdea4602007-05-30 17:48:45 +010094static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
Andrew Victorc42dcb32007-05-11 19:24:18 +010095{
96 *num_partitions = ARRAY_SIZE(ek_nand_partition);
97 return ek_nand_partition;
98}
99
HÃ¥vard Skinnemoen3c3796c2008-06-06 18:04:53 +0200100static struct atmel_nand_data __initdata ek_nand_data = {
Andrew Victorc42dcb32007-05-11 19:24:18 +0100101 .ale = 21,
102 .cle = 22,
103// .det_pin = ... not connected
104 .rdy_pin = AT91_PIN_PD17,
105 .enable_pin = AT91_PIN_PB6,
106 .partition_info = nand_partitions,
Andrew Victorc42dcb32007-05-11 19:24:18 +0100107};
108
Andrew Victor8cdae512008-10-06 20:05:35 +0100109static struct sam9_smc_config __initdata ek_nand_smc_config = {
110 .ncs_read_setup = 0,
111 .nrd_setup = 1,
112 .ncs_write_setup = 0,
113 .nwe_setup = 1,
114
115 .ncs_read_pulse = 3,
116 .nrd_pulse = 3,
117 .ncs_write_pulse = 3,
118 .nwe_pulse = 3,
119
120 .read_cycle = 5,
121 .write_cycle = 5,
122
123 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
124 .tdf_cycles = 2,
125};
126
127static void __init ek_add_device_nand(void)
128{
129 /* configure chip-select 3 (NAND) */
130 sam9_smc_configure(3, &ek_nand_smc_config);
131
132 at91_add_device_nand(&ek_nand_data);
133}
134
Andrew Victorc42dcb32007-05-11 19:24:18 +0100135
136/*
137 * SPI devices
138 */
139static struct spi_board_info ek_spi_devices[] = {
140 { /* DataFlash chip */
141 .modalias = "mtd_dataflash",
142 .chip_select = 0,
143 .max_speed_hz = 15 * 1000 * 1000,
144 .bus_num = 0,
145 },
146};
147
148
149/*
150 * LCD Controller
151 */
152#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
153static struct fb_videomode at91_tft_vga_modes[] = {
154 {
155 .name = "TX09D50VM1CCA @ 60",
156 .refresh = 60,
157 .xres = 240, .yres = 320,
158 .pixclock = KHZ2PICOS(4965),
159
160 .left_margin = 1, .right_margin = 33,
161 .upper_margin = 1, .lower_margin = 0,
162 .hsync_len = 5, .vsync_len = 1,
163
164 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
165 .vmode = FB_VMODE_NONINTERLACED,
166 },
167};
168
169static struct fb_monspecs at91fb_default_monspecs = {
170 .manufacturer = "HIT",
171 .monitor = "TX09D50VM1CCA",
172
173 .modedb = at91_tft_vga_modes,
174 .modedb_len = ARRAY_SIZE(at91_tft_vga_modes),
175 .hfmin = 15000,
176 .hfmax = 64000,
177 .vfmin = 50,
178 .vfmax = 150,
179};
180
181#define AT91SAM9RL_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
182 | ATMEL_LCDC_DISTYPE_TFT \
183 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
184
185static void at91_lcdc_power_control(int on)
186{
187 if (on)
188 at91_set_gpio_value(AT91_PIN_PA30, 0); /* power up */
189 else
190 at91_set_gpio_value(AT91_PIN_PA30, 1); /* power down */
191}
192
193/* Driver datas */
194static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
195 .default_bpp = 16,
196 .default_dmacon = ATMEL_LCDC_DMAEN,
197 .default_lcdcon2 = AT91SAM9RL_DEFAULT_LCDCON2,
198 .default_monspecs = &at91fb_default_monspecs,
199 .atmel_lcdfb_power_control = at91_lcdc_power_control,
200 .guard_time = 1,
201};
202
203#else
204static struct atmel_lcdfb_info __initdata ek_lcdc_data;
205#endif
206
207
208static void __init ek_board_init(void)
209{
210 /* Serial */
211 at91_add_device_serial();
Nicolas Ferreba45ca42008-04-08 13:59:18 +0100212 /* USB HS */
213 at91_add_device_usba(&ek_usba_udc_data);
Andrew Victorc42dcb32007-05-11 19:24:18 +0100214 /* I2C */
Andrew Victorf230d3f2007-11-19 13:47:20 +0100215 at91_add_device_i2c(NULL, 0);
Andrew Victorc42dcb32007-05-11 19:24:18 +0100216 /* NAND */
Andrew Victor8cdae512008-10-06 20:05:35 +0100217 ek_add_device_nand();
Andrew Victorc42dcb32007-05-11 19:24:18 +0100218 /* SPI */
219 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
220 /* MMC */
221 at91_add_device_mmc(0, &ek_mmc_data);
222 /* LCD Controller */
223 at91_add_device_lcdc(&ek_lcdc_data);
Andrew Victorf7647e62008-09-18 19:45:35 +0100224 /* Touch Screen Controller */
225 at91_add_device_tsadcc();
Andrew Victorc42dcb32007-05-11 19:24:18 +0100226}
227
228MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK")
229 /* Maintainer: Atmel */
230 .phys_io = AT91_BASE_SYS,
231 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
232 .boot_params = AT91_SDRAM_BASE + 0x100,
233 .timer = &at91sam926x_timer,
234 .map_io = ek_map_io,
235 .init_irq = ek_init_irq,
236 .init_machine = ek_board_init,
237MACHINE_END