[malta] enable perf counter support
[openwrt.git] / target / linux / at91 / files / arch / arm / mach-at91 / board-netus-foxboard.c
1 /*
2 * Copyright (C) 2005 SAN People
3 * Copyright (C) 2006 Atmel
4 * Copyright (C) 2009-2010 Claudio Mignanti <c.mignanti@gmail.com>
5 *
6 * Strongly based on arch/arm/mach-at91/board-sam9260ek.c
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23 #include <linux/types.h>
24 #include <linux/init.h>
25 #include <linux/mm.h>
26 #include <linux/module.h>
27 #include <linux/platform_device.h>
28 #include <linux/spi/spi.h>
29 #include <linux/gpio.h>
30 #include <linux/gpio_keys.h>
31 #include <linux/input.h>
32 #include <linux/clk.h>
33
34 #include <mach/hardware.h>
35 #include <asm/setup.h>
36 #include <asm/mach-types.h>
37 #include <asm/irq.h>
38
39 #include <asm/mach/arch.h>
40 #include <asm/mach/map.h>
41 #include <asm/mach/irq.h>
42
43 #include <mach/board.h>
44 #include <mach/at91sam9_smc.h>
45
46 #include "sam9_smc.h"
47 #include "generic.h"
48
49
50 static void __init ek_map_io(void)
51 {
52 /* Initialize processor: 18.432 MHz crystal */
53 at91sam9260_initialize(18432000);
54
55 /* DGBU on ttyS0. (Rx & Tx only) */
56 at91_register_uart(0, 0, 0);
57
58 #if defined(CONFIG_NETUS_SERIALS) || defined(CONFIG_NETUS_FOXGM)
59 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
60 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
61 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
62 | ATMEL_UART_RI);
63
64 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
65 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
66 #endif
67
68 #if defined(CONFIG_NETUS_SERIALS)
69 /* USART2 on ttyS3. (Rx, Tx) */
70 at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
71 #endif
72
73 /* set serial console to ttyS0 (ie, DBGU) */
74 at91_set_serial_console(0);
75 }
76
77 static void __init ek_init_irq(void)
78 {
79 at91sam9260_init_interrupts(NULL);
80 }
81
82
83 /*
84 * USB Host port
85 */
86 static struct at91_usbh_data __initdata ek_usbh_data = {
87 .ports = 2,
88 };
89
90 /*
91 * USB Device port
92 */
93 static struct at91_udc_data __initdata ek_udc_data = {
94 .vbus_pin = AT91_PIN_PC6,
95 .pullup_pin = 0, /* pull-up driven by UDC */
96 };
97
98
99 /*
100 * SPI devices.
101 */
102 static struct spi_board_info ek_spi_devices[] = {
103 #if defined(CONFIG_NETUS_USE_DATAFLASH)
104 { /* DataFlash chip */
105 .modalias = "mtd_dataflash",
106 .chip_select = 1,
107 .max_speed_hz = 15 * 1000 * 1000,
108 .bus_num = 0,
109 },
110 #endif
111 };
112
113
114 /*
115 * MACB Ethernet device
116 */
117 static struct at91_eth_data __initdata ek_macb_data = {
118 .phy_irq_pin = AT91_PIN_PA29,
119 .is_rmii = 1,
120 };
121
122
123 /*
124 * MCI (SD/MMC)
125 * det_pin, wp_pin and vcc_pin are not connected
126 */
127 static struct at91_mmc_data __initdata ek_mmc_data = {
128 .slot_b = 1,
129 .wire4 = 1,
130 };
131
132 /*
133 * LEDs
134 */
135 static struct gpio_led ek_leds[] = {
136 #if defined(CONFIG_NETUS_FOXGM)
137 {
138 .name = "led:red:L4",
139 .gpio = AT91_PIN_PC9,
140 .active_low = 0,
141 .default_trigger = "heartbeat",
142 },
143 {
144 .name = "led:red:L5",
145 .gpio = AT91_PIN_PC13,
146 .active_low = 0,
147 .default_trigger = "none",
148 },
149 #endif //CONFIG_NETUS_FOXGM
150 {
151 .name = "led:red:user",
152 .gpio = AT91_PIN_PC7,
153 .active_low = 0,
154 #if defined(CONFIG_NETUS_HEARTBEAT_LED)
155 .default_trigger = "heartbeat",
156 #else
157 .default_trigger = "none",
158 #endif //CONFIG_NETUS_HEARTBEAT_LED
159 },
160 };
161
162 /*
163 * GPIO Buttons
164 */
165 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
166
167 static struct gpio_keys_button ek_buttons[] = {
168 {
169 .gpio = AT91_PIN_PC4,
170 .code = BTN_1,
171 .desc = "Button 1",
172 .active_low = 1,
173 .wakeup = 1,
174 },
175 };
176
177 static struct gpio_keys_platform_data ek_button_data = {
178 .buttons = ek_buttons,
179 .nbuttons = ARRAY_SIZE(ek_buttons),
180 };
181
182 static struct platform_device ek_button_device = {
183 .name = "gpio-keys",
184 .id = -1,
185 .num_resources = 0,
186 .dev = {
187 .platform_data = &ek_button_data,
188 }
189 };
190
191 static void __init ek_add_device_buttons(void)
192 {
193 at91_set_gpio_input(AT91_PIN_PC4, 1); /* btn1 */
194 at91_set_deglitch(AT91_PIN_PC4, 1);
195
196 platform_device_register(&ek_button_device);
197 }
198 #else
199 static void __init ek_add_device_buttons(void) {}
200 #endif
201
202 static struct resource gpiodev_resource = {
203 .start = 0xFFFFFFFF,
204 };
205
206 static void __init ek_board_init(void)
207 {
208 /* Serial */
209 at91_add_device_serial();
210 /* USB Host */
211 at91_add_device_usbh(&ek_usbh_data);
212 /* USB Device */
213 at91_add_device_udc(&ek_udc_data);
214 /* SPI */
215 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
216 /* Ethernet */
217 at91_add_device_eth(&ek_macb_data);
218 /* MMC */
219 at91_add_device_mmc(0, &ek_mmc_data);
220 /* I2C */
221 at91_add_device_i2c(NULL, 0);
222 /* LEDs */
223 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
224 /* Push Buttons */
225 ek_add_device_buttons();
226 /* Register GPIODEV */
227 platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1);
228
229 }
230
231 MACHINE_START(AT91SAM9G20EK, "Acmesystems Netus FoxBoardG20")
232 /* Maintainer: Claudio Mignanti */
233 .phys_io = AT91_BASE_SYS,
234 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
235 .boot_params = AT91_SDRAM_BASE + 0x100,
236 .timer = &at91sam926x_timer,
237 .map_io = ek_map_io,
238 .init_irq = ek_init_irq,
239 .init_machine = ek_board_init,
240 MACHINE_END
241
242
This page took 0.061017 seconds and 5 git commands to generate.