Commit | Line | Data |
---|---|---|
10233a93 EB |
1 | /* |
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> | |
2f8163ba | 22 | #include <linux/gpio.h> |
10233a93 EB |
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> | |
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> | |
10233a93 | 40 | #include <mach/at91rm9200_mc.h> |
f363c407 | 41 | #include <mach/at91_ramc.h> |
e57556e3 | 42 | #include <mach/cpu.h> |
10233a93 EB |
43 | |
44 | #include "generic.h" | |
45 | ||
46 | static struct gpio_led cpuat91_leds[] = { | |
47 | { | |
48 | .name = "led1", | |
49 | .default_trigger = "heartbeat", | |
50 | .active_low = 1, | |
51 | .gpio = AT91_PIN_PC0, | |
52 | }, | |
53 | }; | |
54 | ||
1b021a3b | 55 | static void __init cpuat91_init_early(void) |
10233a93 | 56 | { |
e57556e3 JCPV |
57 | /* Set cpu type: PQFP */ |
58 | at91rm9200_set_type(ARCH_REVISON_9200_PQFP); | |
59 | ||
10233a93 | 60 | /* Initialize processor: 18.432 MHz crystal */ |
21d08b9d | 61 | at91_initialize(18432000); |
10233a93 EB |
62 | |
63 | /* DBGU on ttyS0. (Rx & Tx only) */ | |
64 | at91_register_uart(0, 0, 0); | |
65 | ||
66 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */ | |
67 | at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS | | |
68 | ATMEL_UART_RTS); | |
69 | ||
70 | /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ | |
71 | at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | | |
72 | ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR | | |
73 | ATMEL_UART_DCD | ATMEL_UART_RI); | |
74 | ||
75 | /* USART2 on ttyS3 (Rx, Tx) */ | |
76 | at91_register_uart(AT91RM9200_ID_US2, 3, 0); | |
77 | ||
78 | /* USART3 on ttyS4 (Rx, Tx, CTS, RTS) */ | |
79 | at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_CTS | | |
80 | ATMEL_UART_RTS); | |
81 | ||
82 | /* set serial console to ttyS0 (ie, DBGU) */ | |
83 | at91_set_serial_console(0); | |
84 | } | |
85 | ||
84e0cdb0 | 86 | static struct macb_platform_data __initdata cpuat91_eth_data = { |
63b4c296 | 87 | .phy_irq_pin = -EINVAL, |
10233a93 EB |
88 | .is_rmii = 1, |
89 | }; | |
90 | ||
91 | static struct at91_usbh_data __initdata cpuat91_usbh_data = { | |
92 | .ports = 1, | |
63b4c296 JCPV |
93 | .vbus_pin = {-EINVAL, -EINVAL}, |
94 | .overcurrent_pin= {-EINVAL, -EINVAL}, | |
10233a93 EB |
95 | }; |
96 | ||
97 | static struct at91_udc_data __initdata cpuat91_udc_data = { | |
98 | .vbus_pin = AT91_PIN_PC15, | |
99 | .pullup_pin = AT91_PIN_PC14, | |
100 | }; | |
101 | ||
102 | static struct at91_mmc_data __initdata cpuat91_mmc_data = { | |
103 | .det_pin = AT91_PIN_PC2, | |
104 | .wire4 = 1, | |
63b4c296 JCPV |
105 | .wp_pin = -EINVAL, |
106 | .vcc_pin = -EINVAL, | |
10233a93 EB |
107 | }; |
108 | ||
109 | static struct physmap_flash_data cpuat91_flash_data = { | |
110 | .width = 2, | |
111 | }; | |
112 | ||
113 | static struct resource cpuat91_flash_resource = { | |
114 | .start = AT91_CHIPSELECT_0, | |
115 | .end = AT91_CHIPSELECT_0 + SZ_16M - 1, | |
116 | .flags = IORESOURCE_MEM, | |
117 | }; | |
118 | ||
119 | static struct platform_device cpuat91_norflash = { | |
120 | .name = "physmap-flash", | |
121 | .id = 0, | |
122 | .dev = { | |
123 | .platform_data = &cpuat91_flash_data, | |
124 | }, | |
125 | .resource = &cpuat91_flash_resource, | |
126 | .num_resources = 1, | |
127 | }; | |
128 | ||
129 | #ifdef CONFIG_MTD_PLATRAM | |
130 | struct platdata_mtd_ram at91_sram_pdata = { | |
131 | .mapname = "SRAM", | |
132 | .bankwidth = 2, | |
133 | }; | |
134 | ||
135 | static struct resource at91_sram_resource[] = { | |
136 | [0] = { | |
137 | .start = AT91RM9200_SRAM_BASE, | |
138 | .end = AT91RM9200_SRAM_BASE + AT91RM9200_SRAM_SIZE - 1, | |
139 | .flags = IORESOURCE_MEM, | |
140 | }, | |
141 | }; | |
142 | ||
143 | static struct platform_device at91_sram = { | |
144 | .name = "mtd-ram", | |
145 | .id = 0, | |
146 | .resource = at91_sram_resource, | |
147 | .num_resources = ARRAY_SIZE(at91_sram_resource), | |
148 | .dev = { | |
149 | .platform_data = &at91_sram_pdata, | |
150 | }, | |
151 | }; | |
152 | #endif /* MTD_PLATRAM */ | |
153 | ||
154 | static struct platform_device *platform_devices[] __initdata = { | |
155 | &cpuat91_norflash, | |
156 | #ifdef CONFIG_MTD_PLATRAM | |
157 | &at91_sram, | |
158 | #endif /* CONFIG_MTD_PLATRAM */ | |
159 | }; | |
160 | ||
161 | static void __init cpuat91_board_init(void) | |
162 | { | |
163 | /* Serial */ | |
164 | at91_add_device_serial(); | |
165 | /* LEDs. */ | |
166 | at91_gpio_leds(cpuat91_leds, ARRAY_SIZE(cpuat91_leds)); | |
167 | /* Ethernet */ | |
168 | at91_add_device_eth(&cpuat91_eth_data); | |
169 | /* USB Host */ | |
170 | at91_add_device_usbh(&cpuat91_usbh_data); | |
171 | /* USB Device */ | |
172 | at91_add_device_udc(&cpuat91_udc_data); | |
173 | /* MMC */ | |
174 | at91_add_device_mmc(0, &cpuat91_mmc_data); | |
175 | /* I2C */ | |
176 | at91_add_device_i2c(NULL, 0); | |
177 | /* Platform devices */ | |
178 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | |
179 | } | |
180 | ||
181 | MACHINE_START(CPUAT91, "Eukrea") | |
182 | /* Maintainer: Eric Benard - EUKREA Electromatique */ | |
10233a93 | 183 | .timer = &at91rm9200_timer, |
21d08b9d | 184 | .map_io = at91_map_io, |
1b021a3b | 185 | .init_early = cpuat91_init_early, |
92100c12 | 186 | .init_irq = at91_init_irq_default, |
10233a93 EB |
187 | .init_machine = cpuat91_board_init, |
188 | MACHINE_END |