2 * linux/arch/arm/mach-at91rm9200/board-ek.c
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <linux/types.h>
23 #include <linux/init.h>
25 #include <linux/module.h>
26 #include <linux/platform_device.h>
27 #include <linux/spi/spi.h>
28 #include <linux/dm9000.h>
30 #include <asm/hardware.h>
31 #include <asm/setup.h>
32 #include <asm/mach-types.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/map.h>
37 #include <asm/mach/irq.h>
39 #include <asm/arch/board.h>
40 #include <asm/arch/gpio.h>
41 #include <asm/arch/at91sam926x_mc.h>
47 * Serial port configuration.
48 * 0 .. 2 = USART0 .. USART2
51 static struct at91_uart_config __initdata ek_uart_config = {
52 .console_tty = 0, /* ttyS0 */
54 .tty_map = { 3, -1, -1, -1 } /* ttyS0, ..., ttyS3 */
57 static void __init ek_map_io(void)
59 /* Initialize processor: 18.432 MHz crystal */
60 at91sam9261_initialize(18432000);
62 /* Setup the serial ports and console */
63 at91_init_serial(&ek_uart_config);
66 static void __init ek_init_irq(void)
68 at91sam9261_init_interrupts(NULL);
73 * DM9000 ethernet device
75 #if defined(CONFIG_DM9000)
76 static struct resource at91sam9261_dm9000_resource[] = {
78 .start = AT91_CHIPSELECT_2,
79 .end = AT91_CHIPSELECT_2 + 3,
80 .flags = IORESOURCE_MEM
83 .start = AT91_CHIPSELECT_2 + 0x44,
84 .end = AT91_CHIPSELECT_2 + 0xFF,
85 .flags = IORESOURCE_MEM
88 .start = AT91_PIN_PC11,
90 .flags = IORESOURCE_IRQ
94 static struct dm9000_plat_data dm9000_platdata = {
95 .flags = DM9000_PLATF_16BITONLY,
98 static struct platform_device at91sam9261_dm9000_device = {
101 .num_resources = ARRAY_SIZE(at91sam9261_dm9000_resource),
102 .resource = at91sam9261_dm9000_resource,
104 .platform_data = &dm9000_platdata,
108 static void __init ek_add_device_dm9000(void)
111 * Configure Chip-Select 2 on SMC for the DM9000.
112 * Note: These timings were calculated for MASTER_CLOCK = 100000000
113 * according to the DM9000 timings.
115 at91_sys_write(AT91_SMC_SETUP(2), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(0) | AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(0));
116 at91_sys_write(AT91_SMC_PULSE(2), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(8) | AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(8));
117 at91_sys_write(AT91_SMC_CYCLE(2), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16));
118 at91_sys_write(AT91_SMC_MODE(2), AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16 | AT91_SMC_TDF_(1));
120 /* Configure Reset signal as output */
121 at91_set_gpio_output(AT91_PIN_PC10, 0);
123 /* Configure Interrupt pin as input, no pull-up */
124 at91_set_gpio_input(AT91_PIN_PC11, 0);
126 platform_device_register(&at91sam9261_dm9000_device);
129 static void __init ek_add_device_dm9000(void) {}
130 #endif /* CONFIG_DM9000 */
136 static struct at91_usbh_data __initdata ek_usbh_data = {
144 static struct at91_udc_data __initdata ek_udc_data = {
145 .vbus_pin = AT91_PIN_PB29,
146 .pullup_pin = 0, /* pull-up driven by UDC */
153 static struct at91_mmc_data __initdata ek_mmc_data = {
155 // .det_pin = ... not connected
156 // .wp_pin = ... not connected
157 // .vcc_pin = ... not connected
164 static struct mtd_partition __initdata ek_nand_partition[] = {
166 .name = "Partition 1",
171 .name = "Partition 2",
172 .offset = 256 * 1024 ,
173 .size = MTDPART_SIZ_FULL,
177 static struct mtd_partition *nand_partitions(int size, int *num_partitions)
179 *num_partitions = ARRAY_SIZE(ek_nand_partition);
180 return ek_nand_partition;
183 static struct at91_nand_data __initdata ek_nand_data = {
186 // .det_pin = ... not connected
187 .rdy_pin = AT91_PIN_PC15,
188 .enable_pin = AT91_PIN_PC14,
189 .partition_info = nand_partitions,
190 #if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
200 static struct spi_board_info ek_spi_devices[] = {
201 { /* DataFlash chip */
202 .modalias = "mtd_dataflash",
204 .max_speed_hz = 15 * 1000 * 1000,
207 #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
208 { /* DataFlash card - jumper (J12) configurable to CS3 or CS0 */
209 .modalias = "mtd_dataflash",
211 .max_speed_hz = 15 * 1000 * 1000,
214 #elif defined(CONFIG_SND_AT73C213)
216 .modalias = "snd_at73c213",
218 .max_speed_hz = 10 * 1000 * 1000,
225 static void __init ek_board_init(void)
228 at91_add_device_serial();
230 at91_add_device_usbh(&ek_usbh_data);
232 at91_add_device_udc(&ek_udc_data);
234 at91_add_device_i2c();
236 at91_add_device_nand(&ek_nand_data);
237 /* DM9000 ethernet */
238 ek_add_device_dm9000();
240 /* spi0 and mmc/sd share the same PIO pins */
241 #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
243 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
246 at91_add_device_mmc(&ek_mmc_data);
250 MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK")
251 /* Maintainer: Atmel */
252 .phys_io = AT91_BASE_SYS,
253 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
254 .boot_params = AT91_SDRAM_BASE + 0x100,
255 .timer = &at91sam926x_timer,
257 .init_irq = ek_init_irq,
258 .init_machine = ek_board_init,