Commit | Line | Data |
---|---|---|
022cbd73 | 1 | /* |
d0760b3b | 2 | * linux/arch/arm/mach-at91/board-sam9261ek.c |
022cbd73 AV |
3 | * |
4 | * Copyright (C) 2005 SAN People | |
5 | * Copyright (C) 2006 Atmel | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program; if not, write to the Free Software | |
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 | */ | |
21 | ||
22 | #include <linux/types.h> | |
2f8163ba | 23 | #include <linux/gpio.h> |
022cbd73 AV |
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> | |
23522728 | 29 | #include <linux/spi/ads7846.h> |
5e9df924 AV |
30 | #include <linux/spi/at73c213.h> |
31 | #include <linux/clk.h> | |
022cbd73 | 32 | #include <linux/dm9000.h> |
cdf95c73 | 33 | #include <linux/fb.h> |
d0f9b55e AV |
34 | #include <linux/gpio_keys.h> |
35 | #include <linux/input.h> | |
cdf95c73 AV |
36 | |
37 | #include <video/atmel_lcdc.h> | |
022cbd73 | 38 | |
022cbd73 AV |
39 | #include <asm/setup.h> |
40 | #include <asm/mach-types.h> | |
41 | #include <asm/irq.h> | |
42 | ||
43 | #include <asm/mach/arch.h> | |
44 | #include <asm/mach/map.h> | |
45 | #include <asm/mach/irq.h> | |
46 | ||
e505240b | 47 | #include <mach/hardware.h> |
a09e64fb | 48 | #include <mach/at91sam9_smc.h> |
76b2ab76 | 49 | #include <mach/system_rev.h> |
022cbd73 | 50 | |
a510b9ba | 51 | #include "at91_aic.h" |
176bdd2c | 52 | #include "at91_shdwc.h" |
43d2f532 | 53 | #include "board.h" |
8cdae51a | 54 | #include "sam9_smc.h" |
022cbd73 | 55 | #include "generic.h" |
cf2e933c | 56 | #include "gpio.h" |
022cbd73 AV |
57 | |
58 | ||
1b021a3b | 59 | static void __init ek_init_early(void) |
022cbd73 AV |
60 | { |
61 | /* Initialize processor: 18.432 MHz crystal */ | |
21d08b9d | 62 | at91_initialize(18432000); |
022cbd73 AV |
63 | } |
64 | ||
022cbd73 AV |
65 | /* |
66 | * DM9000 ethernet device | |
67 | */ | |
68 | #if defined(CONFIG_DM9000) | |
8cdae51a | 69 | static struct resource dm9000_resource[] = { |
022cbd73 AV |
70 | [0] = { |
71 | .start = AT91_CHIPSELECT_2, | |
72 | .end = AT91_CHIPSELECT_2 + 3, | |
73 | .flags = IORESOURCE_MEM | |
74 | }, | |
75 | [1] = { | |
76 | .start = AT91_CHIPSELECT_2 + 0x44, | |
77 | .end = AT91_CHIPSELECT_2 + 0xFF, | |
78 | .flags = IORESOURCE_MEM | |
79 | }, | |
80 | [2] = { | |
022cbd73 | 81 | .flags = IORESOURCE_IRQ |
1879c45c | 82 | | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE, |
022cbd73 AV |
83 | } |
84 | }; | |
85 | ||
86 | static struct dm9000_plat_data dm9000_platdata = { | |
1879c45c | 87 | .flags = DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM, |
022cbd73 AV |
88 | }; |
89 | ||
8cdae51a | 90 | static struct platform_device dm9000_device = { |
022cbd73 AV |
91 | .name = "dm9000", |
92 | .id = 0, | |
8cdae51a AV |
93 | .num_resources = ARRAY_SIZE(dm9000_resource), |
94 | .resource = dm9000_resource, | |
022cbd73 AV |
95 | .dev = { |
96 | .platform_data = &dm9000_platdata, | |
97 | } | |
98 | }; | |
99 | ||
8cdae51a AV |
100 | /* |
101 | * SMC timings for the DM9000. | |
102 | * Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings. | |
103 | */ | |
104 | static struct sam9_smc_config __initdata dm9000_smc_config = { | |
105 | .ncs_read_setup = 0, | |
106 | .nrd_setup = 2, | |
107 | .ncs_write_setup = 0, | |
108 | .nwe_setup = 2, | |
109 | ||
110 | .ncs_read_pulse = 8, | |
111 | .nrd_pulse = 4, | |
112 | .ncs_write_pulse = 8, | |
113 | .nwe_pulse = 4, | |
114 | ||
115 | .read_cycle = 16, | |
116 | .write_cycle = 16, | |
117 | ||
118 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16, | |
119 | .tdf_cycles = 1, | |
120 | }; | |
121 | ||
022cbd73 AV |
122 | static void __init ek_add_device_dm9000(void) |
123 | { | |
ee9dd763 JCPV |
124 | struct resource *r = &dm9000_resource[2]; |
125 | ||
8cdae51a | 126 | /* Configure chip-select 2 (DM9000) */ |
faee0cc3 | 127 | sam9_smc_configure(0, 2, &dm9000_smc_config); |
022cbd73 AV |
128 | |
129 | /* Configure Reset signal as output */ | |
130 | at91_set_gpio_output(AT91_PIN_PC10, 0); | |
131 | ||
132 | /* Configure Interrupt pin as input, no pull-up */ | |
133 | at91_set_gpio_input(AT91_PIN_PC11, 0); | |
134 | ||
ee9dd763 | 135 | r->start = r->end = gpio_to_irq(AT91_PIN_PC11); |
8cdae51a | 136 | platform_device_register(&dm9000_device); |
022cbd73 AV |
137 | } |
138 | #else | |
139 | static void __init ek_add_device_dm9000(void) {} | |
140 | #endif /* CONFIG_DM9000 */ | |
141 | ||
142 | ||
143 | /* | |
144 | * USB Host Port | |
145 | */ | |
146 | static struct at91_usbh_data __initdata ek_usbh_data = { | |
147 | .ports = 2, | |
63b4c296 JCPV |
148 | .vbus_pin = {-EINVAL, -EINVAL}, |
149 | .overcurrent_pin= {-EINVAL, -EINVAL}, | |
022cbd73 AV |
150 | }; |
151 | ||
152 | ||
153 | /* | |
154 | * USB Device Port | |
155 | */ | |
156 | static struct at91_udc_data __initdata ek_udc_data = { | |
157 | .vbus_pin = AT91_PIN_PB29, | |
63b4c296 | 158 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
022cbd73 AV |
159 | }; |
160 | ||
161 | ||
022cbd73 AV |
162 | /* |
163 | * NAND flash | |
164 | */ | |
165 | static struct mtd_partition __initdata ek_nand_partition[] = { | |
166 | { | |
167 | .name = "Partition 1", | |
168 | .offset = 0, | |
e505240b | 169 | .size = SZ_256K, |
022cbd73 AV |
170 | }, |
171 | { | |
172 | .name = "Partition 2", | |
e505240b | 173 | .offset = MTDPART_OFS_NXTBLK, |
022cbd73 AV |
174 | .size = MTDPART_SIZ_FULL, |
175 | }, | |
176 | }; | |
177 | ||
3c3796cc | 178 | static struct atmel_nand_data __initdata ek_nand_data = { |
022cbd73 AV |
179 | .ale = 22, |
180 | .cle = 21, | |
63b4c296 | 181 | .det_pin = -EINVAL, |
022cbd73 AV |
182 | .rdy_pin = AT91_PIN_PC15, |
183 | .enable_pin = AT91_PIN_PC14, | |
bf4289cb | 184 | .ecc_mode = NAND_ECC_SOFT, |
98619dcb | 185 | .on_flash_bbt = 1, |
1754aab9 DES |
186 | .parts = ek_nand_partition, |
187 | .num_parts = ARRAY_SIZE(ek_nand_partition), | |
022cbd73 AV |
188 | }; |
189 | ||
8cdae51a AV |
190 | static struct sam9_smc_config __initdata ek_nand_smc_config = { |
191 | .ncs_read_setup = 0, | |
192 | .nrd_setup = 1, | |
193 | .ncs_write_setup = 0, | |
194 | .nwe_setup = 1, | |
195 | ||
196 | .ncs_read_pulse = 3, | |
197 | .nrd_pulse = 3, | |
198 | .ncs_write_pulse = 3, | |
199 | .nwe_pulse = 3, | |
200 | ||
201 | .read_cycle = 5, | |
202 | .write_cycle = 5, | |
203 | ||
204 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, | |
205 | .tdf_cycles = 2, | |
206 | }; | |
207 | ||
208 | static void __init ek_add_device_nand(void) | |
209 | { | |
64393b3a | 210 | ek_nand_data.bus_width_16 = board_have_nand_16bit(); |
8cdae51a AV |
211 | /* setup bus-width (8 or 16) */ |
212 | if (ek_nand_data.bus_width_16) | |
213 | ek_nand_smc_config.mode |= AT91_SMC_DBW_16; | |
214 | else | |
215 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; | |
216 | ||
217 | /* configure chip-select 3 (NAND) */ | |
faee0cc3 | 218 | sam9_smc_configure(0, 3, &ek_nand_smc_config); |
8cdae51a AV |
219 | |
220 | at91_add_device_nand(&ek_nand_data); | |
221 | } | |
222 | ||
64d72bbe NF |
223 | /* |
224 | * SPI related devices | |
225 | */ | |
226 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) | |
8cdae51a | 227 | |
23522728 AV |
228 | /* |
229 | * ADS7846 Touchscreen | |
230 | */ | |
231 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) | |
232 | ||
233 | static int ads7843_pendown_state(void) | |
234 | { | |
235 | return !at91_get_gpio_value(AT91_PIN_PC2); /* Touchscreen PENIRQ */ | |
236 | } | |
237 | ||
238 | static struct ads7846_platform_data ads_info = { | |
239 | .model = 7843, | |
240 | .x_min = 150, | |
241 | .x_max = 3830, | |
242 | .y_min = 190, | |
243 | .y_max = 3830, | |
244 | .vref_delay_usecs = 100, | |
245 | .x_plate_ohms = 450, | |
246 | .y_plate_ohms = 250, | |
247 | .pressure_max = 15000, | |
248 | .debounce_max = 1, | |
249 | .debounce_rep = 0, | |
250 | .debounce_tol = (~0), | |
251 | .get_pendown_state = ads7843_pendown_state, | |
252 | }; | |
253 | ||
254 | static void __init ek_add_device_ts(void) | |
255 | { | |
256 | at91_set_B_periph(AT91_PIN_PC2, 1); /* External IRQ0, with pullup */ | |
257 | at91_set_gpio_input(AT91_PIN_PA11, 1); /* Touchscreen BUSY signal */ | |
258 | } | |
259 | #else | |
260 | static void __init ek_add_device_ts(void) {} | |
261 | #endif | |
262 | ||
5e9df924 AV |
263 | /* |
264 | * Audio | |
265 | */ | |
266 | static struct at73c213_board_info at73c213_data = { | |
267 | .ssc_id = 1, | |
b3f442b0 | 268 | .shortname = "AT91SAM9261/9G10-EK external DAC", |
5e9df924 AV |
269 | }; |
270 | ||
271 | #if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE) | |
272 | static void __init at73c213_set_clk(struct at73c213_board_info *info) | |
273 | { | |
274 | struct clk *pck2; | |
275 | struct clk *plla; | |
276 | ||
277 | pck2 = clk_get(NULL, "pck2"); | |
278 | plla = clk_get(NULL, "plla"); | |
279 | ||
280 | /* AT73C213 MCK Clock */ | |
281 | at91_set_B_periph(AT91_PIN_PB31, 0); /* PCK2 */ | |
282 | ||
283 | clk_set_parent(pck2, plla); | |
284 | clk_put(plla); | |
285 | ||
286 | info->dac_clk = pck2; | |
287 | } | |
288 | #else | |
289 | static void __init at73c213_set_clk(struct at73c213_board_info *info) {} | |
290 | #endif | |
291 | ||
022cbd73 AV |
292 | /* |
293 | * SPI devices | |
294 | */ | |
295 | static struct spi_board_info ek_spi_devices[] = { | |
296 | { /* DataFlash chip */ | |
297 | .modalias = "mtd_dataflash", | |
298 | .chip_select = 0, | |
299 | .max_speed_hz = 15 * 1000 * 1000, | |
300 | .bus_num = 0, | |
301 | }, | |
23522728 AV |
302 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) |
303 | { | |
304 | .modalias = "ads7846", | |
305 | .chip_select = 2, | |
306 | .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */ | |
307 | .bus_num = 0, | |
308 | .platform_data = &ads_info, | |
69e7ea04 | 309 | .irq = NR_IRQS_LEGACY + AT91SAM9261_ID_IRQ0, |
5e9df924 | 310 | .controller_data = (void *) AT91_PIN_PA28, /* CS pin */ |
23522728 AV |
311 | }, |
312 | #endif | |
022cbd73 AV |
313 | #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD) |
314 | { /* DataFlash card - jumper (J12) configurable to CS3 or CS0 */ | |
315 | .modalias = "mtd_dataflash", | |
316 | .chip_select = 3, | |
317 | .max_speed_hz = 15 * 1000 * 1000, | |
318 | .bus_num = 0, | |
319 | }, | |
23522728 | 320 | #elif defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE) |
022cbd73 | 321 | { /* AT73C213 DAC */ |
23522728 | 322 | .modalias = "at73c213", |
022cbd73 AV |
323 | .chip_select = 3, |
324 | .max_speed_hz = 10 * 1000 * 1000, | |
325 | .bus_num = 0, | |
5e9df924 AV |
326 | .mode = SPI_MODE_1, |
327 | .platform_data = &at73c213_data, | |
328 | .controller_data = (void*) AT91_PIN_PA29, /* default for CS3 is PA6, but it must be PA29 */ | |
022cbd73 AV |
329 | }, |
330 | #endif | |
331 | }; | |
332 | ||
64d72bbe | 333 | #else /* CONFIG_SPI_ATMEL_* */ |
4deb22a6 | 334 | /* spi0 and mmc/sd share the same PIO pins: cannot be used at the same time */ |
64d72bbe NF |
335 | |
336 | /* | |
337 | * MCI (SD/MMC) | |
4deb22a6 | 338 | * det_pin, wp_pin and vcc_pin are not connected |
64d72bbe | 339 | */ |
4cf3326a LD |
340 | static struct mci_platform_data __initdata mci0_data = { |
341 | .slot[0] = { | |
342 | .bus_width = 4, | |
343 | .detect_pin = -EINVAL, | |
344 | .wp_pin = -EINVAL, | |
345 | }, | |
64d72bbe NF |
346 | }; |
347 | ||
348 | #endif /* CONFIG_SPI_ATMEL_* */ | |
349 | ||
022cbd73 | 350 | |
cdf95c73 AV |
351 | /* |
352 | * LCD Controller | |
353 | */ | |
354 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) | |
51708748 AV |
355 | |
356 | #if defined(CONFIG_FB_ATMEL_STN) | |
357 | ||
358 | /* STN */ | |
359 | static struct fb_videomode at91_stn_modes[] = { | |
360 | { | |
361 | .name = "SP06Q002 @ 75", | |
362 | .refresh = 75, | |
363 | .xres = 320, .yres = 240, | |
364 | .pixclock = KHZ2PICOS(1440), | |
365 | ||
366 | .left_margin = 1, .right_margin = 1, | |
367 | .upper_margin = 0, .lower_margin = 0, | |
368 | .hsync_len = 1, .vsync_len = 1, | |
369 | ||
370 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | |
371 | .vmode = FB_VMODE_NONINTERLACED, | |
372 | }, | |
373 | }; | |
374 | ||
375 | static struct fb_monspecs at91fb_default_stn_monspecs = { | |
376 | .manufacturer = "HIT", | |
377 | .monitor = "SP06Q002", | |
378 | ||
379 | .modedb = at91_stn_modes, | |
380 | .modedb_len = ARRAY_SIZE(at91_stn_modes), | |
381 | .hfmin = 15000, | |
382 | .hfmax = 64000, | |
383 | .vfmin = 50, | |
384 | .vfmax = 150, | |
385 | }; | |
386 | ||
387 | #define AT91SAM9261_DEFAULT_STN_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ | |
388 | | ATMEL_LCDC_DISTYPE_STNMONO \ | |
389 | | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE \ | |
390 | | ATMEL_LCDC_IFWIDTH_4 \ | |
391 | | ATMEL_LCDC_SCANMOD_SINGLE) | |
392 | ||
ce3b64f5 | 393 | static void at91_lcdc_stn_power_control(struct atmel_lcdfb_pdata *pdata, int on) |
51708748 AV |
394 | { |
395 | /* backlight */ | |
396 | if (on) { /* power up */ | |
397 | at91_set_gpio_value(AT91_PIN_PC14, 0); | |
398 | at91_set_gpio_value(AT91_PIN_PC15, 0); | |
399 | } else { /* power down */ | |
400 | at91_set_gpio_value(AT91_PIN_PC14, 1); | |
401 | at91_set_gpio_value(AT91_PIN_PC15, 1); | |
402 | } | |
403 | } | |
404 | ||
8af2c286 | 405 | static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = { |
51708748 AV |
406 | .default_bpp = 1, |
407 | .default_dmacon = ATMEL_LCDC_DMAEN, | |
408 | .default_lcdcon2 = AT91SAM9261_DEFAULT_STN_LCDCON2, | |
409 | .default_monspecs = &at91fb_default_stn_monspecs, | |
410 | .atmel_lcdfb_power_control = at91_lcdc_stn_power_control, | |
411 | .guard_time = 1, | |
412 | }; | |
413 | ||
414 | #else | |
415 | ||
416 | /* TFT */ | |
cdf95c73 AV |
417 | static struct fb_videomode at91_tft_vga_modes[] = { |
418 | { | |
419 | .name = "TX09D50VM1CCA @ 60", | |
420 | .refresh = 60, | |
421 | .xres = 240, .yres = 320, | |
422 | .pixclock = KHZ2PICOS(4965), | |
423 | ||
424 | .left_margin = 1, .right_margin = 33, | |
425 | .upper_margin = 1, .lower_margin = 0, | |
426 | .hsync_len = 5, .vsync_len = 1, | |
427 | ||
428 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | |
429 | .vmode = FB_VMODE_NONINTERLACED, | |
430 | }, | |
431 | }; | |
432 | ||
51708748 | 433 | static struct fb_monspecs at91fb_default_tft_monspecs = { |
cdf95c73 AV |
434 | .manufacturer = "HIT", |
435 | .monitor = "TX09D50VM1CCA", | |
436 | ||
437 | .modedb = at91_tft_vga_modes, | |
438 | .modedb_len = ARRAY_SIZE(at91_tft_vga_modes), | |
439 | .hfmin = 15000, | |
440 | .hfmax = 64000, | |
441 | .vfmin = 50, | |
442 | .vfmax = 150, | |
443 | }; | |
444 | ||
51708748 | 445 | #define AT91SAM9261_DEFAULT_TFT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ |
cdf95c73 AV |
446 | | ATMEL_LCDC_DISTYPE_TFT \ |
447 | | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) | |
448 | ||
ce3b64f5 | 449 | static void at91_lcdc_tft_power_control(struct atmel_lcdfb_pdata *pdata, int on) |
cdf95c73 AV |
450 | { |
451 | if (on) | |
452 | at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */ | |
453 | else | |
454 | at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */ | |
455 | } | |
456 | ||
8af2c286 | 457 | static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = { |
a9a84c37 | 458 | .lcdcon_is_backlight = true, |
cdf95c73 AV |
459 | .default_bpp = 16, |
460 | .default_dmacon = ATMEL_LCDC_DMAEN, | |
51708748 AV |
461 | .default_lcdcon2 = AT91SAM9261_DEFAULT_TFT_LCDCON2, |
462 | .default_monspecs = &at91fb_default_tft_monspecs, | |
463 | .atmel_lcdfb_power_control = at91_lcdc_tft_power_control, | |
cdf95c73 AV |
464 | .guard_time = 1, |
465 | }; | |
51708748 | 466 | #endif |
cdf95c73 AV |
467 | |
468 | #else | |
8af2c286 | 469 | static struct atmel_lcdfb_pdata __initdata ek_lcdc_data; |
cdf95c73 AV |
470 | #endif |
471 | ||
472 | ||
d0f9b55e AV |
473 | /* |
474 | * GPIO Buttons | |
475 | */ | |
476 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | |
477 | static struct gpio_keys_button ek_buttons[] = { | |
478 | { | |
479 | .gpio = AT91_PIN_PA27, | |
eaf858a9 | 480 | .code = BTN_0, |
d0f9b55e AV |
481 | .desc = "Button 0", |
482 | .active_low = 1, | |
77789ad8 | 483 | .wakeup = 1, |
d0f9b55e AV |
484 | }, |
485 | { | |
486 | .gpio = AT91_PIN_PA26, | |
eaf858a9 | 487 | .code = BTN_1, |
d0f9b55e AV |
488 | .desc = "Button 1", |
489 | .active_low = 1, | |
77789ad8 | 490 | .wakeup = 1, |
d0f9b55e AV |
491 | }, |
492 | { | |
493 | .gpio = AT91_PIN_PA25, | |
eaf858a9 | 494 | .code = BTN_2, |
d0f9b55e AV |
495 | .desc = "Button 2", |
496 | .active_low = 1, | |
77789ad8 | 497 | .wakeup = 1, |
d0f9b55e AV |
498 | }, |
499 | { | |
500 | .gpio = AT91_PIN_PA24, | |
eaf858a9 | 501 | .code = BTN_3, |
d0f9b55e AV |
502 | .desc = "Button 3", |
503 | .active_low = 1, | |
77789ad8 | 504 | .wakeup = 1, |
d0f9b55e AV |
505 | } |
506 | }; | |
507 | ||
508 | static struct gpio_keys_platform_data ek_button_data = { | |
509 | .buttons = ek_buttons, | |
510 | .nbuttons = ARRAY_SIZE(ek_buttons), | |
511 | }; | |
512 | ||
513 | static struct platform_device ek_button_device = { | |
514 | .name = "gpio-keys", | |
515 | .id = -1, | |
516 | .num_resources = 0, | |
517 | .dev = { | |
518 | .platform_data = &ek_button_data, | |
519 | } | |
520 | }; | |
521 | ||
522 | static void __init ek_add_device_buttons(void) | |
523 | { | |
77789ad8 | 524 | at91_set_gpio_input(AT91_PIN_PA27, 1); /* btn0 */ |
302edfd0 | 525 | at91_set_deglitch(AT91_PIN_PA27, 1); |
77789ad8 | 526 | at91_set_gpio_input(AT91_PIN_PA26, 1); /* btn1 */ |
302edfd0 | 527 | at91_set_deglitch(AT91_PIN_PA26, 1); |
77789ad8 | 528 | at91_set_gpio_input(AT91_PIN_PA25, 1); /* btn2 */ |
302edfd0 | 529 | at91_set_deglitch(AT91_PIN_PA25, 1); |
77789ad8 | 530 | at91_set_gpio_input(AT91_PIN_PA24, 1); /* btn3 */ |
302edfd0 | 531 | at91_set_deglitch(AT91_PIN_PA24, 1); |
d0f9b55e AV |
532 | |
533 | platform_device_register(&ek_button_device); | |
534 | } | |
535 | #else | |
536 | static void __init ek_add_device_buttons(void) {} | |
537 | #endif | |
538 | ||
5b7659d1 AV |
539 | /* |
540 | * LEDs | |
541 | */ | |
542 | static struct gpio_led ek_leds[] = { | |
543 | { /* "bottom" led, green, userled1 to be defined */ | |
544 | .name = "ds7", | |
545 | .gpio = AT91_PIN_PA14, | |
546 | .active_low = 1, | |
547 | .default_trigger = "none", | |
548 | }, | |
549 | { /* "top" led, green, userled2 to be defined */ | |
550 | .name = "ds8", | |
551 | .gpio = AT91_PIN_PA13, | |
552 | .active_low = 1, | |
553 | .default_trigger = "none", | |
554 | }, | |
555 | { /* "power" led, yellow */ | |
556 | .name = "ds1", | |
557 | .gpio = AT91_PIN_PA23, | |
558 | .default_trigger = "heartbeat", | |
559 | } | |
560 | }; | |
561 | ||
022cbd73 AV |
562 | static void __init ek_board_init(void) |
563 | { | |
564 | /* Serial */ | |
71b149b3 JCPV |
565 | /* DBGU on ttyS0. (Rx & Tx only) */ |
566 | at91_register_uart(0, 0, 0); | |
022cbd73 | 567 | at91_add_device_serial(); |
b3f442b0 JCPV |
568 | |
569 | if (cpu_is_at91sam9g10()) | |
570 | ek_lcdc_data.lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB; | |
571 | ||
022cbd73 AV |
572 | /* USB Host */ |
573 | at91_add_device_usbh(&ek_usbh_data); | |
574 | /* USB Device */ | |
575 | at91_add_device_udc(&ek_udc_data); | |
576 | /* I2C */ | |
f230d3f5 | 577 | at91_add_device_i2c(NULL, 0); |
022cbd73 | 578 | /* NAND */ |
8cdae51a | 579 | ek_add_device_nand(); |
022cbd73 AV |
580 | /* DM9000 ethernet */ |
581 | ek_add_device_dm9000(); | |
582 | ||
583 | /* spi0 and mmc/sd share the same PIO pins */ | |
584 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) | |
585 | /* SPI */ | |
586 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); | |
23522728 AV |
587 | /* Touchscreen */ |
588 | ek_add_device_ts(); | |
5e9df924 AV |
589 | /* SSC (to AT73C213) */ |
590 | at73c213_set_clk(&at73c213_data); | |
591 | at91_add_device_ssc(AT91SAM9261_ID_SSC1, ATMEL_SSC_TX); | |
022cbd73 AV |
592 | #else |
593 | /* MMC */ | |
4cf3326a | 594 | at91_add_device_mci(0, &mci0_data); |
022cbd73 | 595 | #endif |
cdf95c73 AV |
596 | /* LCD Controller */ |
597 | at91_add_device_lcdc(&ek_lcdc_data); | |
d0f9b55e AV |
598 | /* Push Buttons */ |
599 | ek_add_device_buttons(); | |
5b7659d1 AV |
600 | /* LEDs */ |
601 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); | |
022cbd73 AV |
602 | } |
603 | ||
604 | MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK") | |
b3f442b0 JCPV |
605 | /* Maintainer: Atmel */ |
606 | .init_time = at91sam926x_pit_init, | |
607 | .map_io = at91_map_io, | |
608 | .handle_irq = at91_aic_handle_irq, | |
609 | .init_early = ek_init_early, | |
610 | .init_irq = at91_init_irq_default, | |
611 | .init_machine = ek_board_init, | |
612 | MACHINE_END | |
613 | ||
b319ff80 | 614 | MACHINE_START(AT91SAM9G10EK, "Atmel AT91SAM9G10-EK") |
022cbd73 | 615 | /* Maintainer: Atmel */ |
6bb27d73 | 616 | .init_time = at91sam926x_pit_init, |
21d08b9d | 617 | .map_io = at91_map_io, |
3e135466 | 618 | .handle_irq = at91_aic_handle_irq, |
1b021a3b | 619 | .init_early = ek_init_early, |
92100c12 | 620 | .init_irq = at91_init_irq_default, |
022cbd73 AV |
621 | .init_machine = ek_board_init, |
622 | MACHINE_END |