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)
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
);
67 /* USART2 on ttyS3. (Rx, Tx) */
68 at91_register_uart(AT91SAM9260_ID_US2
, 3, 0);
71 /* set serial console to ttyS0 (ie, DBGU) */
72 at91_set_serial_console(0);
75 static void __init
ek_init_irq(void)
77 at91sam9260_init_interrupts(NULL
);
84 static struct at91_usbh_data __initdata ek_usbh_data
= {
91 static struct at91_udc_data __initdata ek_udc_data
= {
92 .vbus_pin
= AT91_PIN_PC6
,
93 .pullup_pin
= 0, /* pull-up driven by UDC */
100 static struct spi_board_info ek_spi_devices
[] = {
101 #if defined(CONFIG_NETUS_USE_DATAFLASH)
102 { /* DataFlash chip */
103 .modalias
= "mtd_dataflash",
105 .max_speed_hz
= 15 * 1000 * 1000,
113 * MACB Ethernet device
115 static struct at91_eth_data __initdata ek_macb_data
= {
116 .phy_irq_pin
= AT91_PIN_PA29
,
123 * det_pin, wp_pin and vcc_pin are not connected
125 static struct at91_mmc_data __initdata ek_mmc_data
= {
133 static struct gpio_led ek_leds
[] = {
135 .name
= "led:red:user",
136 .gpio
= AT91_PIN_PC7
,
138 #if defined(CONFIG_NETUS_HEARTBEAT_LED)
139 .default_trigger
= "heartbeat",
141 .default_trigger
= "none",
149 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
151 static struct gpio_keys_button ek_buttons
[] = {
153 .gpio
= AT91_PIN_PC4
,
161 static struct gpio_keys_platform_data ek_button_data
= {
162 .buttons
= ek_buttons
,
163 .nbuttons
= ARRAY_SIZE(ek_buttons
),
166 static struct platform_device ek_button_device
= {
171 .platform_data
= &ek_button_data
,
175 static void __init
ek_add_device_buttons(void)
177 at91_set_gpio_input(AT91_PIN_PC4
, 1); /* btn1 */
178 at91_set_deglitch(AT91_PIN_PC4
, 1);
180 platform_device_register(&ek_button_device
);
183 static void __init
ek_add_device_buttons(void) {}
186 static struct resource gpiodev_resource
= {
190 static void __init
ek_board_init(void)
193 at91_add_device_serial();
195 at91_add_device_usbh(&ek_usbh_data
);
197 at91_add_device_udc(&ek_udc_data
);
199 at91_add_device_spi(ek_spi_devices
, ARRAY_SIZE(ek_spi_devices
));
201 at91_add_device_eth(&ek_macb_data
);
203 at91_add_device_mmc(0, &ek_mmc_data
);
205 at91_add_device_i2c(NULL
, 0);
207 at91_gpio_leds(ek_leds
, ARRAY_SIZE(ek_leds
));
209 ek_add_device_buttons();
210 /* Register GPIODEV */
211 platform_device_register_simple("GPIODEV", 0, &gpiodev_resource
, 1);
215 MACHINE_START(AT91SAM9G20EK
, "Acmesystems Netus FoxBoardG20")
216 /* Maintainer: Claudio Mignanti */
217 .phys_io
= AT91_BASE_SYS
,
218 .io_pg_offst
= (AT91_VA_BASE_SYS
>> 18) & 0xfffc,
219 .boot_params
= AT91_SDRAM_BASE
+ 0x100,
220 .timer
= &at91sam926x_timer
,
222 .init_irq
= ek_init_irq
,
223 .init_machine
= ek_board_init
,