1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include <linux/types.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/spi/spi.h>
28#include <linux/spi/at73c213.h>
29#include <linux/gpio.h>
30#include <linux/gpio_keys.h>
31#include <linux/input.h>
32#include <linux/clk.h>
33#include <linux/w1-gpio.h>
34
35#include <mach/hardware.h>
36#include <asm/setup.h>
37#include <asm/mach-types.h>
38#include <asm/irq.h>
39
40#include <asm/mach/arch.h>
41#include <asm/mach/map.h>
42#include <asm/mach/irq.h>
43
44#include <mach/board.h>
45#include <mach/at91sam9_smc.h>
46
47#include "sam9_smc.h"
48#include "generic.h"
49
50
51
52
53
54
55
56
57
58
59
60static void __init foxg20_map_io(void)
61{
62
63 at91sam9260_initialize(18432000);
64
65
66 at91_register_uart(0, 0, 0);
67
68
69 at91_register_uart(AT91SAM9260_ID_US0, 1,
70 ATMEL_UART_CTS
71 | ATMEL_UART_RTS
72 | ATMEL_UART_DTR
73 | ATMEL_UART_DSR
74 | ATMEL_UART_DCD
75 | ATMEL_UART_RI);
76
77
78 at91_register_uart(AT91SAM9260_ID_US1, 2,
79 ATMEL_UART_CTS
80 | ATMEL_UART_RTS);
81
82
83 at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
84
85
86 at91_register_uart(AT91SAM9260_ID_US3, 4,
87 ATMEL_UART_CTS
88 | ATMEL_UART_RTS);
89
90
91 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
92
93
94 at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
95
96
97 at91_set_serial_console(0);
98
99
100 at91_set_A_periph(AT91_PIN_PB14, 1);
101
102}
103
104static void __init foxg20_init_irq(void)
105{
106 at91sam9260_init_interrupts(NULL);
107}
108
109
110
111
112
113static struct at91_usbh_data __initdata foxg20_usbh_data = {
114 .ports = 2,
115};
116
117
118
119
120static struct at91_udc_data __initdata foxg20_udc_data = {
121 .vbus_pin = AT91_PIN_PC6,
122 .pullup_pin = 0,
123};
124
125
126
127
128
129static struct spi_board_info foxg20_spi_devices[] = {
130#if !defined(CONFIG_MMC_AT91)
131 {
132 .modalias = "mtd_dataflash",
133 .chip_select = 1,
134 .max_speed_hz = 15 * 1000 * 1000,
135 .bus_num = 0,
136 },
137#endif
138};
139
140
141
142
143
144static struct at91_eth_data __initdata foxg20_macb_data = {
145 .phy_irq_pin = AT91_PIN_PA7,
146 .is_rmii = 1,
147};
148
149
150
151
152
153static struct at91_mmc_data __initdata foxg20_mmc_data = {
154 .slot_b = 1,
155 .wire4 = 1,
156};
157
158
159
160
161
162static struct gpio_led foxg20_leds[] = {
163 {
164 .name = "user_led",
165 .gpio = AT91_PIN_PC7,
166 .active_low = 0,
167 .default_trigger = "heartbeat",
168 },
169};
170
171
172
173
174
175#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
176static struct gpio_keys_button foxg20_buttons[] = {
177 {
178 .gpio = AT91_PIN_PC4,
179 .code = BTN_1,
180 .desc = "Button 1",
181 .active_low = 1,
182 .wakeup = 1,
183 },
184};
185
186static struct gpio_keys_platform_data foxg20_button_data = {
187 .buttons = foxg20_buttons,
188 .nbuttons = ARRAY_SIZE(foxg20_buttons),
189};
190
191static struct platform_device foxg20_button_device = {
192 .name = "gpio-keys",
193 .id = -1,
194 .num_resources = 0,
195 .dev = {
196 .platform_data = &foxg20_button_data,
197 }
198};
199
200static void __init foxg20_add_device_buttons(void)
201{
202 at91_set_gpio_input(AT91_PIN_PC4, 1);
203 at91_set_deglitch(AT91_PIN_PC4, 1);
204
205 platform_device_register(&foxg20_button_device);
206}
207#else
208static void __init foxg20_add_device_buttons(void) {}
209#endif
210
211
212#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
213static struct w1_gpio_platform_data w1_gpio_pdata = {
214
215 .pin = AT91_PIN_PB16,
216 .is_open_drain = 1,
217};
218
219static struct platform_device w1_device = {
220 .name = "w1-gpio",
221 .id = -1,
222 .dev.platform_data = &w1_gpio_pdata,
223};
224
225static void __init at91_add_device_w1(void)
226{
227 at91_set_GPIO_periph(w1_gpio_pdata.pin, 1);
228 at91_set_multi_drive(w1_gpio_pdata.pin, 1);
229 platform_device_register(&w1_device);
230}
231
232#endif
233
234
235static struct i2c_board_info __initdata foxg20_i2c_devices[] = {
236 {
237 I2C_BOARD_INFO("24c512", 0x50),
238 },
239};
240
241
242static void __init foxg20_board_init(void)
243{
244
245 at91_add_device_serial();
246
247 at91_add_device_usbh(&foxg20_usbh_data);
248
249 at91_add_device_udc(&foxg20_udc_data);
250
251 at91_add_device_spi(foxg20_spi_devices, ARRAY_SIZE(foxg20_spi_devices));
252
253 at91_add_device_eth(&foxg20_macb_data);
254
255 at91_add_device_mmc(0, &foxg20_mmc_data);
256
257 at91_add_device_i2c(foxg20_i2c_devices, ARRAY_SIZE(foxg20_i2c_devices));
258
259 at91_gpio_leds(foxg20_leds, ARRAY_SIZE(foxg20_leds));
260
261 foxg20_add_device_buttons();
262#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
263 at91_add_device_w1();
264#endif
265}
266
267MACHINE_START(ACMENETUSFOXG20, "Acme Systems srl FOX Board G20")
268
269 .boot_params = AT91_SDRAM_BASE + 0x100,
270 .timer = &at91sam926x_timer,
271 .map_io = foxg20_map_io,
272 .init_irq = foxg20_init_irq,
273 .init_machine = foxg20_board_init,
274MACHINE_END
275