2 * Copyright (C) 2005 SAN People
3 * Copyright (C) 2006 Atmel
4 * Copyright (C) 2009-2010 Claudio Mignanti <c.mignanti@gmail.com>
6 * Strongly based on arch/arm/mach-at91/board-sam9260ek.c
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/init.h>
26 #include <linux/module.h>
27 #include <linux/platform_device.h>
28 #include <linux/spi/spi.h>
29 #include <linux/gpio.h>
30 #include <linux/gpio_keys.h>
31 #include <linux/input.h>
32 #include <linux/clk.h>
34 #include <mach/hardware.h>
35 #include <asm/setup.h>
36 #include <asm/mach-types.h>
39 #include <asm/mach/arch.h>
40 #include <asm/mach/map.h>
41 #include <asm/mach/irq.h>
43 #include <mach/board.h>
44 #include <mach/at91sam9_smc.h>
50 static void __init
ek_map_io(void)
52 /* Initialize processor: 18.432 MHz crystal */
53 at91sam9260_initialize(18432000);
55 /* DGBU on ttyS0. (Rx & Tx only) */
56 at91_register_uart(0, 0, 0);
58 #if defined(CONFIG_NETUS_SERIALS) || defined(CONFIG_NETUS_FOXGM)
59 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
60 at91_register_uart(AT91SAM9260_ID_US0
, 1, ATMEL_UART_CTS
| ATMEL_UART_RTS
61 | ATMEL_UART_DTR
| ATMEL_UART_DSR
| ATMEL_UART_DCD
64 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
65 at91_register_uart(AT91SAM9260_ID_US1
, 2, ATMEL_UART_CTS
| ATMEL_UART_RTS
);
68 #if defined(CONFIG_NETUS_SERIALS)
69 /* USART2 on ttyS3. (Rx, Tx) */
70 at91_register_uart(AT91SAM9260_ID_US2
, 3, 0);
73 /* set serial console to ttyS0 (ie, DBGU) */
74 at91_set_serial_console(0);
77 static void __init
ek_init_irq(void)
79 at91sam9260_init_interrupts(NULL
);
86 static struct at91_usbh_data __initdata ek_usbh_data
= {
93 static struct at91_udc_data __initdata ek_udc_data
= {
94 .vbus_pin
= AT91_PIN_PC6
,
95 .pullup_pin
= 0, /* pull-up driven by UDC */
102 static struct spi_board_info ek_spi_devices
[] = {
103 #if defined(CONFIG_NETUS_USE_DATAFLASH)
104 { /* DataFlash chip */
105 .modalias
= "mtd_dataflash",
107 .max_speed_hz
= 15 * 1000 * 1000,
115 * MACB Ethernet device
117 static struct at91_eth_data __initdata ek_macb_data
= {
118 .phy_irq_pin
= AT91_PIN_PA29
,
125 * det_pin, wp_pin and vcc_pin are not connected
127 static struct at91_mmc_data __initdata ek_mmc_data
= {
135 static struct gpio_led ek_leds
[] = {
136 #if defined(CONFIG_NETUS_FOXGM)
138 .name
= "led:red:L4",
139 .gpio
= AT91_PIN_PC9
,
141 .default_trigger
= "heartbeat",
144 .name
= "led:red:L5",
145 .gpio
= AT91_PIN_PC13
,
147 .default_trigger
= "none",
149 #endif //CONFIG_NETUS_FOXGM
151 .name
= "led:red:user",
152 .gpio
= AT91_PIN_PC7
,
154 #if defined(CONFIG_NETUS_HEARTBEAT_LED)
155 .default_trigger
= "heartbeat",
157 .default_trigger
= "none",
158 #endif //CONFIG_NETUS_HEARTBEAT_LED
165 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
167 static struct gpio_keys_button ek_buttons
[] = {
169 .gpio
= AT91_PIN_PC4
,
177 static struct gpio_keys_platform_data ek_button_data
= {
178 .buttons
= ek_buttons
,
179 .nbuttons
= ARRAY_SIZE(ek_buttons
),
182 static struct platform_device ek_button_device
= {
187 .platform_data
= &ek_button_data
,
191 static void __init
ek_add_device_buttons(void)
193 at91_set_gpio_input(AT91_PIN_PC4
, 1); /* btn1 */
194 at91_set_deglitch(AT91_PIN_PC4
, 1);
196 platform_device_register(&ek_button_device
);
199 static void __init
ek_add_device_buttons(void) {}
202 static struct resource gpiodev_resource
= {
206 static void __init
ek_board_init(void)
209 at91_add_device_serial();
211 at91_add_device_usbh(&ek_usbh_data
);
213 at91_add_device_udc(&ek_udc_data
);
215 at91_add_device_spi(ek_spi_devices
, ARRAY_SIZE(ek_spi_devices
));
217 at91_add_device_eth(&ek_macb_data
);
219 at91_add_device_mmc(0, &ek_mmc_data
);
221 at91_add_device_i2c(NULL
, 0);
223 at91_gpio_leds(ek_leds
, ARRAY_SIZE(ek_leds
));
225 ek_add_device_buttons();
226 /* Register GPIODEV */
227 platform_device_register_simple("GPIODEV", 0, &gpiodev_resource
, 1);
231 MACHINE_START(AT91SAM9G20EK
, "Acmesystems Netus FoxBoardG20")
232 /* Maintainer: Claudio Mignanti */
233 .phys_io
= AT91_BASE_SYS
,
234 .io_pg_offst
= (AT91_VA_BASE_SYS
>> 18) & 0xfffc,
235 .boot_params
= AT91_SDRAM_BASE
+ 0x100,
236 .timer
= &at91sam926x_timer
,
238 .init_irq
= ek_init_irq
,
239 .init_machine
= ek_board_init
,