diff options
Diffstat (limited to 'arch/arm/mach-at91/board-sam9261ek.c')
-rw-r--r-- | arch/arm/mach-at91/board-sam9261ek.c | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c index 26ca8ab3f62a..42e172cb0f49 100644 --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c | |||
@@ -27,6 +27,11 @@ | |||
27 | #include <linux/spi/spi.h> | 27 | #include <linux/spi/spi.h> |
28 | #include <linux/spi/ads7846.h> | 28 | #include <linux/spi/ads7846.h> |
29 | #include <linux/dm9000.h> | 29 | #include <linux/dm9000.h> |
30 | #include <linux/fb.h> | ||
31 | #include <linux/gpio_keys.h> | ||
32 | #include <linux/input.h> | ||
33 | |||
34 | #include <video/atmel_lcdc.h> | ||
30 | 35 | ||
31 | #include <asm/hardware.h> | 36 | #include <asm/hardware.h> |
32 | #include <asm/setup.h> | 37 | #include <asm/setup.h> |
@@ -271,6 +276,127 @@ static struct spi_board_info ek_spi_devices[] = { | |||
271 | }; | 276 | }; |
272 | 277 | ||
273 | 278 | ||
279 | /* | ||
280 | * LCD Controller | ||
281 | */ | ||
282 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) | ||
283 | static struct fb_videomode at91_tft_vga_modes[] = { | ||
284 | { | ||
285 | .name = "TX09D50VM1CCA @ 60", | ||
286 | .refresh = 60, | ||
287 | .xres = 240, .yres = 320, | ||
288 | .pixclock = KHZ2PICOS(4965), | ||
289 | |||
290 | .left_margin = 1, .right_margin = 33, | ||
291 | .upper_margin = 1, .lower_margin = 0, | ||
292 | .hsync_len = 5, .vsync_len = 1, | ||
293 | |||
294 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
295 | .vmode = FB_VMODE_NONINTERLACED, | ||
296 | }, | ||
297 | }; | ||
298 | |||
299 | static struct fb_monspecs at91fb_default_monspecs = { | ||
300 | .manufacturer = "HIT", | ||
301 | .monitor = "TX09D50VM1CCA", | ||
302 | |||
303 | .modedb = at91_tft_vga_modes, | ||
304 | .modedb_len = ARRAY_SIZE(at91_tft_vga_modes), | ||
305 | .hfmin = 15000, | ||
306 | .hfmax = 64000, | ||
307 | .vfmin = 50, | ||
308 | .vfmax = 150, | ||
309 | }; | ||
310 | |||
311 | #define AT91SAM9261_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ | ||
312 | | ATMEL_LCDC_DISTYPE_TFT \ | ||
313 | | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) | ||
314 | |||
315 | static void at91_lcdc_power_control(int on) | ||
316 | { | ||
317 | if (on) | ||
318 | at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */ | ||
319 | else | ||
320 | at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */ | ||
321 | } | ||
322 | |||
323 | /* Driver datas */ | ||
324 | static struct atmel_lcdfb_info __initdata ek_lcdc_data = { | ||
325 | .default_bpp = 16, | ||
326 | .default_dmacon = ATMEL_LCDC_DMAEN, | ||
327 | .default_lcdcon2 = AT91SAM9261_DEFAULT_LCDCON2, | ||
328 | .default_monspecs = &at91fb_default_monspecs, | ||
329 | .atmel_lcdfb_power_control = at91_lcdc_power_control, | ||
330 | .guard_time = 1, | ||
331 | }; | ||
332 | |||
333 | #else | ||
334 | static struct atmel_lcdfb_info __initdata ek_lcdc_data; | ||
335 | #endif | ||
336 | |||
337 | |||
338 | /* | ||
339 | * GPIO Buttons | ||
340 | */ | ||
341 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
342 | static struct gpio_keys_button ek_buttons[] = { | ||
343 | { | ||
344 | .gpio = AT91_PIN_PA27, | ||
345 | .keycode = BTN_0, | ||
346 | .desc = "Button 0", | ||
347 | .active_low = 1, | ||
348 | }, | ||
349 | { | ||
350 | .gpio = AT91_PIN_PA26, | ||
351 | .keycode = BTN_1, | ||
352 | .desc = "Button 1", | ||
353 | .active_low = 1, | ||
354 | }, | ||
355 | { | ||
356 | .gpio = AT91_PIN_PA25, | ||
357 | .keycode = BTN_2, | ||
358 | .desc = "Button 2", | ||
359 | .active_low = 1, | ||
360 | }, | ||
361 | { | ||
362 | .gpio = AT91_PIN_PA24, | ||
363 | .keycode = BTN_3, | ||
364 | .desc = "Button 3", | ||
365 | .active_low = 1, | ||
366 | } | ||
367 | }; | ||
368 | |||
369 | static struct gpio_keys_platform_data ek_button_data = { | ||
370 | .buttons = ek_buttons, | ||
371 | .nbuttons = ARRAY_SIZE(ek_buttons), | ||
372 | }; | ||
373 | |||
374 | static struct platform_device ek_button_device = { | ||
375 | .name = "gpio-keys", | ||
376 | .id = -1, | ||
377 | .num_resources = 0, | ||
378 | .dev = { | ||
379 | .platform_data = &ek_button_data, | ||
380 | } | ||
381 | }; | ||
382 | |||
383 | static void __init ek_add_device_buttons(void) | ||
384 | { | ||
385 | at91_set_gpio_input(AT91_PIN_PB27, 0); /* btn0 */ | ||
386 | at91_set_deglitch(AT91_PIN_PB27, 1); | ||
387 | at91_set_gpio_input(AT91_PIN_PB26, 0); /* btn1 */ | ||
388 | at91_set_deglitch(AT91_PIN_PB26, 1); | ||
389 | at91_set_gpio_input(AT91_PIN_PB25, 0); /* btn2 */ | ||
390 | at91_set_deglitch(AT91_PIN_PB25, 1); | ||
391 | at91_set_gpio_input(AT91_PIN_PB24, 0); /* btn3 */ | ||
392 | at91_set_deglitch(AT91_PIN_PB24, 1); | ||
393 | |||
394 | platform_device_register(&ek_button_device); | ||
395 | } | ||
396 | #else | ||
397 | static void __init ek_add_device_buttons(void) {} | ||
398 | #endif | ||
399 | |||
274 | static void __init ek_board_init(void) | 400 | static void __init ek_board_init(void) |
275 | { | 401 | { |
276 | /* Serial */ | 402 | /* Serial */ |
@@ -296,6 +422,10 @@ static void __init ek_board_init(void) | |||
296 | /* MMC */ | 422 | /* MMC */ |
297 | at91_add_device_mmc(0, &ek_mmc_data); | 423 | at91_add_device_mmc(0, &ek_mmc_data); |
298 | #endif | 424 | #endif |
425 | /* LCD Controller */ | ||
426 | at91_add_device_lcdc(&ek_lcdc_data); | ||
427 | /* Push Buttons */ | ||
428 | ek_add_device_buttons(); | ||
299 | } | 429 | } |
300 | 430 | ||
301 | MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK") | 431 | MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK") |