Merge remote-tracking branch 's5p/for-next'
[linux-2.6/next.git] / arch / arm / mach-at91 / board-cpuat91.c
blobd35e65b08ccde481aeac88978fd83d7ca1a329c1
1 /*
2 * linux/arch/arm/mach-at91/board-cpuat91.c
4 * Copyright (C) 2009 Eric Benard - eric@eukrea.com
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <linux/types.h>
22 #include <linux/gpio.h>
23 #include <linux/init.h>
24 #include <linux/mm.h>
25 #include <linux/module.h>
26 #include <linux/platform_device.h>
27 #include <linux/mtd/physmap.h>
28 #include <linux/mtd/plat-ram.h>
30 #include <mach/hardware.h>
31 #include <asm/setup.h>
32 #include <asm/mach-types.h>
33 #include <asm/irq.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/map.h>
37 #include <asm/mach/irq.h>
39 #include <mach/board.h>
40 #include <mach/at91rm9200_mc.h>
41 #include <mach/cpu.h>
43 #include "generic.h"
45 static struct gpio_led cpuat91_leds[] = {
47 .name = "led1",
48 .default_trigger = "heartbeat",
49 .active_low = 1,
50 .gpio = AT91_PIN_PC0,
54 static void __init cpuat91_init_early(void)
56 /* Set cpu type: PQFP */
57 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
59 /* Initialize processor: 18.432 MHz crystal */
60 at91_initialize(18432000);
62 /* DBGU on ttyS0. (Rx & Tx only) */
63 at91_register_uart(0, 0, 0);
65 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */
66 at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS |
67 ATMEL_UART_RTS);
69 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
70 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS |
71 ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR |
72 ATMEL_UART_DCD | ATMEL_UART_RI);
74 /* USART2 on ttyS3 (Rx, Tx) */
75 at91_register_uart(AT91RM9200_ID_US2, 3, 0);
77 /* USART3 on ttyS4 (Rx, Tx, CTS, RTS) */
78 at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_CTS |
79 ATMEL_UART_RTS);
81 /* set serial console to ttyS0 (ie, DBGU) */
82 at91_set_serial_console(0);
85 static struct at91_eth_data __initdata cpuat91_eth_data = {
86 .is_rmii = 1,
89 static struct at91_usbh_data __initdata cpuat91_usbh_data = {
90 .ports = 1,
93 static struct at91_udc_data __initdata cpuat91_udc_data = {
94 .vbus_pin = AT91_PIN_PC15,
95 .pullup_pin = AT91_PIN_PC14,
98 static struct at91_mmc_data __initdata cpuat91_mmc_data = {
99 .det_pin = AT91_PIN_PC2,
100 .wire4 = 1,
103 static struct physmap_flash_data cpuat91_flash_data = {
104 .width = 2,
107 static struct resource cpuat91_flash_resource = {
108 .start = AT91_CHIPSELECT_0,
109 .end = AT91_CHIPSELECT_0 + SZ_16M - 1,
110 .flags = IORESOURCE_MEM,
113 static struct platform_device cpuat91_norflash = {
114 .name = "physmap-flash",
115 .id = 0,
116 .dev = {
117 .platform_data = &cpuat91_flash_data,
119 .resource = &cpuat91_flash_resource,
120 .num_resources = 1,
123 #ifdef CONFIG_MTD_PLATRAM
124 struct platdata_mtd_ram at91_sram_pdata = {
125 .mapname = "SRAM",
126 .bankwidth = 2,
129 static struct resource at91_sram_resource[] = {
130 [0] = {
131 .start = AT91RM9200_SRAM_BASE,
132 .end = AT91RM9200_SRAM_BASE + AT91RM9200_SRAM_SIZE - 1,
133 .flags = IORESOURCE_MEM,
137 static struct platform_device at91_sram = {
138 .name = "mtd-ram",
139 .id = 0,
140 .resource = at91_sram_resource,
141 .num_resources = ARRAY_SIZE(at91_sram_resource),
142 .dev = {
143 .platform_data = &at91_sram_pdata,
146 #endif /* MTD_PLATRAM */
148 static struct platform_device *platform_devices[] __initdata = {
149 &cpuat91_norflash,
150 #ifdef CONFIG_MTD_PLATRAM
151 &at91_sram,
152 #endif /* CONFIG_MTD_PLATRAM */
155 static void __init cpuat91_board_init(void)
157 /* Serial */
158 at91_add_device_serial();
159 /* LEDs. */
160 at91_gpio_leds(cpuat91_leds, ARRAY_SIZE(cpuat91_leds));
161 /* Ethernet */
162 at91_add_device_eth(&cpuat91_eth_data);
163 /* USB Host */
164 at91_add_device_usbh(&cpuat91_usbh_data);
165 /* USB Device */
166 at91_add_device_udc(&cpuat91_udc_data);
167 /* MMC */
168 at91_add_device_mmc(0, &cpuat91_mmc_data);
169 /* I2C */
170 at91_add_device_i2c(NULL, 0);
171 /* Platform devices */
172 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
175 MACHINE_START(CPUAT91, "Eukrea")
176 /* Maintainer: Eric Benard - EUKREA Electromatique */
177 .timer = &at91rm9200_timer,
178 .map_io = at91_map_io,
179 .init_early = cpuat91_init_early,
180 .init_irq = at91_init_irq_default,
181 .init_machine = cpuat91_board_init,
182 MACHINE_END