2 * Copyright (C) 2005 SAN People
3 * Copyright (C) 2008 Atmel
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include <linux/types.h>
21 #include <linux/init.h>
23 #include <linux/module.h>
24 #include <linux/platform_device.h>
25 #include <linux/spi/spi.h>
26 #include <linux/spi/at73c213.h>
27 #include <linux/clk.h>
29 #include <mach/hardware.h>
30 #include <asm/setup.h>
31 #include <asm/mach-types.h>
34 #include <asm/mach/arch.h>
35 #include <asm/mach/map.h>
36 #include <asm/mach/irq.h>
38 #include <mach/board.h>
39 #include <mach/gpio.h>
44 static void __init
ek_map_io(void)
46 /* Initialize processor: 18.432 MHz crystal */
47 at91sam9260_initialize(18432000);
49 /* DGBU on ttyS0. (Rx & Tx only) */
50 at91_register_uart(0, 0, 0);
52 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
53 at91_register_uart(AT91SAM9260_ID_US0
, 1, ATMEL_UART_CTS
| ATMEL_UART_RTS
54 | ATMEL_UART_DTR
| ATMEL_UART_DSR
| ATMEL_UART_DCD
57 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
58 at91_register_uart(AT91SAM9260_ID_US1
, 2, ATMEL_UART_CTS
| ATMEL_UART_RTS
);
60 /* set serial console to ttyS0 (ie, DBGU) */
61 at91_set_serial_console(0);
64 static void __init
ek_init_irq(void)
66 at91sam9260_init_interrupts(NULL
);
73 static struct at91_usbh_data __initdata ek_usbh_data
= {
80 static struct at91_udc_data __initdata ek_udc_data
= {
81 .vbus_pin
= AT91_PIN_PC5
,
82 .pullup_pin
= 0, /* pull-up driven by UDC */
89 static struct spi_board_info ek_spi_devices
[] = {
90 #if !defined(CONFIG_MMC_AT91)
91 { /* DataFlash chip */
92 .modalias
= "mtd_dataflash",
94 .max_speed_hz
= 15 * 1000 * 1000,
97 #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
98 { /* DataFlash card */
99 .modalias
= "mtd_dataflash",
101 .max_speed_hz
= 15 * 1000 * 1000,
110 * MACB Ethernet device
112 static struct at91_eth_data __initdata ek_macb_data
= {
113 .phy_irq_pin
= AT91_PIN_PA7
,
121 static struct mtd_partition __initdata ek_nand_partition
[] = {
125 .size
= 4 * 1024 * 1024,
128 .name
= "Partition 1",
129 .offset
= 4 * 1024 * 1024,
130 .size
= 60 * 1024 * 1024,
133 .name
= "Partition 2",
134 .offset
= 64 * 1024 * 1024,
135 .size
= MTDPART_SIZ_FULL
,
139 static struct mtd_partition
* __init
nand_partitions(int size
, int *num_partitions
)
141 *num_partitions
= ARRAY_SIZE(ek_nand_partition
);
142 return ek_nand_partition
;
145 /* det_pin is not connected */
146 static struct atmel_nand_data __initdata ek_nand_data
= {
149 .rdy_pin
= AT91_PIN_PC13
,
150 .enable_pin
= AT91_PIN_PC14
,
151 .partition_info
= nand_partitions
,
152 #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
162 * det_pin, wp_pin and vcc_pin are not connected
164 static struct at91_mmc_data __initdata ek_mmc_data
= {
173 static struct gpio_led ek_leds
[] = {
174 { /* "bottom" led, green, userled1 to be defined */
176 .gpio
= AT91_PIN_PA6
,
178 .default_trigger
= "none",
180 { /* "power" led, yellow */
182 .gpio
= AT91_PIN_PA9
,
183 .default_trigger
= "heartbeat",
187 static void __init
ek_board_init(void)
190 at91_add_device_serial();
192 at91_add_device_usbh(&ek_usbh_data
);
194 at91_add_device_udc(&ek_udc_data
);
196 at91_add_device_spi(ek_spi_devices
, ARRAY_SIZE(ek_spi_devices
));
198 at91_add_device_nand(&ek_nand_data
);
200 at91_add_device_eth(&ek_macb_data
);
202 at91_add_device_mmc(0, &ek_mmc_data
);
204 at91_add_device_i2c(NULL
, 0);
206 at91_gpio_leds(ek_leds
, ARRAY_SIZE(ek_leds
));
209 MACHINE_START(AT91SAM9G20EK
, "Atmel AT91SAM9G20-EK")
210 /* Maintainer: Atmel */
211 .phys_io
= AT91_BASE_SYS
,
212 .io_pg_offst
= (AT91_VA_BASE_SYS
>> 18) & 0xfffc,
213 .boot_params
= AT91_SDRAM_BASE
+ 0x100,
214 .timer
= &at91sam926x_timer
,
216 .init_irq
= ek_init_irq
,
217 .init_machine
= ek_board_init
,