blob: 2cbd1a2b6c35d33bed32f776f52e640742611fc8 [file] [log] [blame]
Eric Bénard10233a92009-07-30 07:23:42 +01001/*
2 * linux/arch/arm/mach-at91/board-cpuat91.c
3 *
4 * Copyright (C) 2009 Eric Benard - eric@eukrea.com
5 *
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.
10 *
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.
15 *
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
19 */
20
21#include <linux/types.h>
Russell King2f8163b2011-07-26 10:53:52 +010022#include <linux/gpio.h>
Eric Bénard10233a92009-07-30 07:23:42 +010023#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>
29
30#include <mach/hardware.h>
31#include <asm/setup.h>
32#include <asm/mach-types.h>
33#include <asm/irq.h>
34
35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37#include <asm/mach/irq.h>
38
39#include <mach/board.h>
Ludovic Desroches3e135462012-06-11 15:38:03 +020040#include <mach/at91_aic.h>
Eric Bénard10233a92009-07-30 07:23:42 +010041#include <mach/at91rm9200_mc.h>
Jean-Christophe PLAGNIOL-VILLARDf363c402012-02-13 12:58:53 +080042#include <mach/at91_ramc.h>
Jean-Christophe PLAGNIOL-VILLARDe57556e32011-04-24 11:40:22 +080043#include <mach/cpu.h>
Eric Bénard10233a92009-07-30 07:23:42 +010044
45#include "generic.h"
46
47static struct gpio_led cpuat91_leds[] = {
48 {
49 .name = "led1",
50 .default_trigger = "heartbeat",
51 .active_low = 1,
52 .gpio = AT91_PIN_PC0,
53 },
54};
55
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +080056static void __init cpuat91_init_early(void)
Eric Bénard10233a92009-07-30 07:23:42 +010057{
Jean-Christophe PLAGNIOL-VILLARDe57556e32011-04-24 11:40:22 +080058 /* Set cpu type: PQFP */
59 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
60
Eric Bénard10233a92009-07-30 07:23:42 +010061 /* Initialize processor: 18.432 MHz crystal */
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +080062 at91_initialize(18432000);
Eric Bénard10233a92009-07-30 07:23:42 +010063}
64
Jamie Iles84e0cdb2011-03-08 20:17:06 +000065static struct macb_platform_data __initdata cpuat91_eth_data = {
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080066 .phy_irq_pin = -EINVAL,
Eric Bénard10233a92009-07-30 07:23:42 +010067 .is_rmii = 1,
68};
69
70static struct at91_usbh_data __initdata cpuat91_usbh_data = {
71 .ports = 1,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +080072 .vbus_pin = {-EINVAL, -EINVAL},
73 .overcurrent_pin= {-EINVAL, -EINVAL},
Eric Bénard10233a92009-07-30 07:23:42 +010074};
75
76static struct at91_udc_data __initdata cpuat91_udc_data = {
77 .vbus_pin = AT91_PIN_PC15,
78 .pullup_pin = AT91_PIN_PC14,
79};
80
Ludovic Desroches4cf33262012-05-21 12:23:27 +020081static struct mci_platform_data __initdata cpuat91_mci0_data = {
82 .slot[0] = {
83 .bus_width = 4,
84 .detect_pin = AT91_PIN_PC2,
85 .wp_pin = -EINVAL,
86 },
Eric Bénard10233a92009-07-30 07:23:42 +010087};
88
89static struct physmap_flash_data cpuat91_flash_data = {
90 .width = 2,
91};
92
93static struct resource cpuat91_flash_resource = {
94 .start = AT91_CHIPSELECT_0,
95 .end = AT91_CHIPSELECT_0 + SZ_16M - 1,
96 .flags = IORESOURCE_MEM,
97};
98
99static struct platform_device cpuat91_norflash = {
100 .name = "physmap-flash",
101 .id = 0,
102 .dev = {
103 .platform_data = &cpuat91_flash_data,
104 },
105 .resource = &cpuat91_flash_resource,
106 .num_resources = 1,
107};
108
109#ifdef CONFIG_MTD_PLATRAM
110struct platdata_mtd_ram at91_sram_pdata = {
111 .mapname = "SRAM",
112 .bankwidth = 2,
113};
114
115static struct resource at91_sram_resource[] = {
116 [0] = {
117 .start = AT91RM9200_SRAM_BASE,
118 .end = AT91RM9200_SRAM_BASE + AT91RM9200_SRAM_SIZE - 1,
119 .flags = IORESOURCE_MEM,
120 },
121};
122
123static struct platform_device at91_sram = {
124 .name = "mtd-ram",
125 .id = 0,
126 .resource = at91_sram_resource,
127 .num_resources = ARRAY_SIZE(at91_sram_resource),
128 .dev = {
129 .platform_data = &at91_sram_pdata,
130 },
131};
132#endif /* MTD_PLATRAM */
133
134static struct platform_device *platform_devices[] __initdata = {
135 &cpuat91_norflash,
136#ifdef CONFIG_MTD_PLATRAM
137 &at91_sram,
138#endif /* CONFIG_MTD_PLATRAM */
139};
140
141static void __init cpuat91_board_init(void)
142{
143 /* Serial */
Jean-Christophe PLAGNIOL-VILLARD71b149b2012-04-05 14:14:28 +0800144 /* DBGU on ttyS0. (Rx & Tx only) */
145 at91_register_uart(0, 0, 0);
146
147 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */
148 at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS |
149 ATMEL_UART_RTS);
150
151 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
152 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS |
153 ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR |
154 ATMEL_UART_DCD | ATMEL_UART_RI);
155
156 /* USART2 on ttyS3 (Rx, Tx) */
157 at91_register_uart(AT91RM9200_ID_US2, 3, 0);
158
159 /* USART3 on ttyS4 (Rx, Tx, CTS, RTS) */
160 at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_CTS |
161 ATMEL_UART_RTS);
Eric Bénard10233a92009-07-30 07:23:42 +0100162 at91_add_device_serial();
163 /* LEDs. */
164 at91_gpio_leds(cpuat91_leds, ARRAY_SIZE(cpuat91_leds));
165 /* Ethernet */
166 at91_add_device_eth(&cpuat91_eth_data);
167 /* USB Host */
168 at91_add_device_usbh(&cpuat91_usbh_data);
169 /* USB Device */
170 at91_add_device_udc(&cpuat91_udc_data);
171 /* MMC */
Ludovic Desroches4cf33262012-05-21 12:23:27 +0200172 at91_add_device_mci(0, &cpuat91_mci0_data);
Eric Bénard10233a92009-07-30 07:23:42 +0100173 /* I2C */
174 at91_add_device_i2c(NULL, 0);
175 /* Platform devices */
176 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
177}
178
179MACHINE_START(CPUAT91, "Eukrea")
180 /* Maintainer: Eric Benard - EUKREA Electromatique */
Eric Bénard10233a92009-07-30 07:23:42 +0100181 .timer = &at91rm9200_timer,
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +0800182 .map_io = at91_map_io,
Ludovic Desroches3e135462012-06-11 15:38:03 +0200183 .handle_irq = at91_aic_handle_irq,
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +0800184 .init_early = cpuat91_init_early,
Jean-Christophe PLAGNIOL-VILLARD92100c12011-04-23 15:28:34 +0800185 .init_irq = at91_init_irq_default,
Eric Bénard10233a92009-07-30 07:23:42 +0100186 .init_machine = cpuat91_board_init,
187MACHINE_END