2 * linux/arch/arm/mach-at91/board-neocore926.c
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2007 Atmel Corporation
6 * Copyright (C) 2008 ADENEO.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <linux/types.h>
24 #include <linux/gpio.h>
25 #include <linux/init.h>
27 #include <linux/module.h>
28 #include <linux/platform_device.h>
29 #include <linux/spi/spi.h>
30 #include <linux/spi/ads7846.h>
32 #include <linux/gpio_keys.h>
33 #include <linux/input.h>
35 #include <video/atmel_lcdc.h>
37 #include <asm/setup.h>
38 #include <asm/mach-types.h>
40 #include <asm/sizes.h>
42 #include <asm/mach/arch.h>
43 #include <asm/mach/map.h>
44 #include <asm/mach/irq.h>
46 #include <mach/hardware.h>
47 #include <mach/board.h>
48 #include <mach/at91sam9_smc.h>
54 static void __init neocore926_init_early(void)
56 /* Initialize processor: 20 MHz crystal */
57 at91_initialize(20000000);
59 /* DBGU on ttyS0. (Rx & Tx only) */
60 at91_register_uart(0, 0, 0);
62 /* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */
63 at91_register_uart(AT91SAM9263_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
65 /* set serial console to ttyS0 (ie, DBGU) */
66 at91_set_serial_console(0);
72 static struct at91_usbh_data __initdata neocore926_usbh_data = {
74 .vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 },
80 static struct at91_udc_data __initdata neocore926_udc_data = {
81 .vbus_pin = AT91_PIN_PA25,
82 .pullup_pin = 0, /* pull-up driven by UDC */
89 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
90 static int ads7843_pendown_state(void)
92 return !at91_get_gpio_value(AT91_PIN_PA15); /* Touchscreen PENIRQ */
95 static struct ads7846_platform_data ads_info = {
101 .vref_delay_usecs = 100,
104 .pressure_max = 15000,
107 .debounce_tol = (~0),
108 .get_pendown_state = ads7843_pendown_state,
111 static void __init neocore926_add_device_ts(void)
113 at91_set_B_periph(AT91_PIN_PA15, 1); /* External IRQ1, with pullup */
114 at91_set_gpio_input(AT91_PIN_PC13, 1); /* Touchscreen BUSY signal */
117 static void __init neocore926_add_device_ts(void) {}
123 static struct spi_board_info neocore926_spi_devices[] = {
124 #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
125 { /* DataFlash card */
126 .modalias = "mtd_dataflash",
128 .max_speed_hz = 15 * 1000 * 1000,
132 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
134 .modalias = "ads7846",
136 .max_speed_hz = 125000 * 16,
138 .platform_data = &ads_info,
139 .irq = AT91SAM9263_ID_IRQ1,
148 static struct at91_mmc_data __initdata neocore926_mmc_data = {
150 .det_pin = AT91_PIN_PE18,
151 .wp_pin = AT91_PIN_PE19,
156 * MACB Ethernet device
158 static struct at91_eth_data __initdata neocore926_macb_data = {
159 .phy_irq_pin = AT91_PIN_PE31,
167 static struct mtd_partition __initdata neocore926_nand_partition[] = {
169 .name = "Linux Kernel", /* "Partition 1", */
174 .name = "Filesystem", /* "Partition 2", */
175 .offset = MTDPART_OFS_NXTBLK,
179 .name = "Free", /* "Partition 3", */
180 .offset = MTDPART_OFS_NXTBLK,
181 .size = MTDPART_SIZ_FULL,
185 static struct atmel_nand_data __initdata neocore926_nand_data = {
188 .rdy_pin = AT91_PIN_PB19,
189 .rdy_pin_active_low = 1,
190 .enable_pin = AT91_PIN_PD15,
191 .parts = neocore926_nand_partition,
192 .num_parts = ARRAY_SIZE(neocore926_nand_partition),
195 static struct sam9_smc_config __initdata neocore926_nand_smc_config = {
198 .ncs_write_setup = 0,
203 .ncs_write_pulse = 4,
209 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
213 static void __init neocore926_add_device_nand(void)
215 /* configure chip-select 3 (NAND) */
216 sam9_smc_configure(3, &neocore926_nand_smc_config);
218 at91_add_device_nand(&neocore926_nand_data);
225 #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
226 static struct fb_videomode at91_tft_vga_modes[] = {
228 .name = "TX09D50VM1CCA @ 60",
230 .xres = 240, .yres = 320,
231 .pixclock = KHZ2PICOS(5000),
233 .left_margin = 1, .right_margin = 33,
234 .upper_margin = 1, .lower_margin = 0,
235 .hsync_len = 5, .vsync_len = 1,
237 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
238 .vmode = FB_VMODE_NONINTERLACED,
242 static struct fb_monspecs at91fb_default_monspecs = {
243 .manufacturer = "HIT",
244 .monitor = "TX09D70VM1CCA",
246 .modedb = at91_tft_vga_modes,
247 .modedb_len = ARRAY_SIZE(at91_tft_vga_modes),
254 #define AT91SAM9263_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
255 | ATMEL_LCDC_DISTYPE_TFT \
256 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
258 static void at91_lcdc_power_control(int on)
260 at91_set_gpio_value(AT91_PIN_PA30, on);
264 static struct atmel_lcdfb_info __initdata neocore926_lcdc_data = {
265 .lcdcon_is_backlight = true,
267 .default_dmacon = ATMEL_LCDC_DMAEN,
268 .default_lcdcon2 = AT91SAM9263_DEFAULT_LCDCON2,
269 .default_monspecs = &at91fb_default_monspecs,
270 .atmel_lcdfb_power_control = at91_lcdc_power_control,
272 .lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB555,
276 static struct atmel_lcdfb_info __initdata neocore926_lcdc_data;
283 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
284 static struct gpio_keys_button neocore926_buttons[] = {
285 { /* BP1, "leftclic" */
287 .gpio = AT91_PIN_PC5,
289 .desc = "left_click",
292 { /* BP2, "rightclic" */
294 .gpio = AT91_PIN_PC4,
296 .desc = "right_click",
301 static struct gpio_keys_platform_data neocore926_button_data = {
302 .buttons = neocore926_buttons,
303 .nbuttons = ARRAY_SIZE(neocore926_buttons),
306 static struct platform_device neocore926_button_device = {
311 .platform_data = &neocore926_button_data,
315 static void __init neocore926_add_device_buttons(void)
317 at91_set_GPIO_periph(AT91_PIN_PC5, 0); /* left button */
318 at91_set_deglitch(AT91_PIN_PC5, 1);
319 at91_set_GPIO_periph(AT91_PIN_PC4, 0); /* right button */
320 at91_set_deglitch(AT91_PIN_PC4, 1);
322 platform_device_register(&neocore926_button_device);
325 static void __init neocore926_add_device_buttons(void) {}
332 static struct ac97c_platform_data neocore926_ac97_data = {
333 .reset_pin = AT91_PIN_PA13,
337 static void __init neocore926_board_init(void)
340 at91_add_device_serial();
343 at91_add_device_usbh(&neocore926_usbh_data);
346 at91_add_device_udc(&neocore926_udc_data);
349 at91_set_gpio_output(AT91_PIN_PE20, 1); /* select spi0 clock */
350 at91_add_device_spi(neocore926_spi_devices, ARRAY_SIZE(neocore926_spi_devices));
353 neocore926_add_device_ts();
356 at91_add_device_mmc(1, &neocore926_mmc_data);
359 at91_add_device_eth(&neocore926_macb_data);
362 neocore926_add_device_nand();
365 at91_add_device_i2c(NULL, 0);
368 at91_add_device_lcdc(&neocore926_lcdc_data);
371 neocore926_add_device_buttons();
374 at91_add_device_ac97(&neocore926_ac97_data);
377 MACHINE_START(NEOCORE926, "ADENEO NEOCORE 926")
378 /* Maintainer: ADENEO */
379 .timer = &at91sam926x_timer,
380 .map_io = at91_map_io,
381 .init_early = neocore926_init_early,
382 .init_irq = at91_init_irq_default,
383 .init_machine = neocore926_board_init,