setup.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * ATSTK1000 board-specific setup code.
  3. *
  4. * Copyright (C) 2005-2006 Atmel Corporation
  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 version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/bootmem.h>
  11. #include <linux/fb.h>
  12. #include <linux/init.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/types.h>
  15. #include <linux/linkage.h>
  16. #include <video/atmel_lcdc.h>
  17. #include <asm/setup.h>
  18. #include <mach/at32ap700x.h>
  19. #include <mach/board.h>
  20. #include <mach/portmux.h>
  21. #include "atstk1000.h"
  22. /* Initialized by bootloader-specific startup code. */
  23. struct tag *bootloader_tags __initdata;
  24. static struct fb_videomode __initdata ltv350qv_modes[] = {
  25. {
  26. .name = "320x240 @ 75",
  27. .refresh = 75,
  28. .xres = 320, .yres = 240,
  29. .pixclock = KHZ2PICOS(6891),
  30. .left_margin = 17, .right_margin = 33,
  31. .upper_margin = 10, .lower_margin = 10,
  32. .hsync_len = 16, .vsync_len = 1,
  33. .sync = 0,
  34. .vmode = FB_VMODE_NONINTERLACED,
  35. },
  36. };
  37. static struct fb_monspecs __initdata atstk1000_default_monspecs = {
  38. .manufacturer = "SNG",
  39. .monitor = "LTV350QV",
  40. .modedb = ltv350qv_modes,
  41. .modedb_len = ARRAY_SIZE(ltv350qv_modes),
  42. .hfmin = 14820,
  43. .hfmax = 22230,
  44. .vfmin = 60,
  45. .vfmax = 90,
  46. .dclkmax = 30000000,
  47. };
  48. struct atmel_lcdfb_info __initdata atstk1000_lcdc_data = {
  49. .default_bpp = 24,
  50. .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
  51. .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
  52. | ATMEL_LCDC_INVCLK
  53. | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
  54. | ATMEL_LCDC_MEMOR_BIG),
  55. .default_monspecs = &atstk1000_default_monspecs,
  56. .guard_time = 2,
  57. };
  58. #ifdef CONFIG_BOARD_ATSTK1000_J2_LED
  59. #include <linux/leds.h>
  60. static struct gpio_led stk1000_j2_led[] = {
  61. #ifdef CONFIG_BOARD_ATSTK1000_J2_LED8
  62. #define LEDSTRING "J2 jumpered to LED8"
  63. { .name = "led0:amber", .gpio = GPIO_PIN_PB( 8), },
  64. { .name = "led1:amber", .gpio = GPIO_PIN_PB( 9), },
  65. { .name = "led2:amber", .gpio = GPIO_PIN_PB(10), },
  66. { .name = "led3:amber", .gpio = GPIO_PIN_PB(13), },
  67. { .name = "led4:amber", .gpio = GPIO_PIN_PB(14), },
  68. { .name = "led5:amber", .gpio = GPIO_PIN_PB(15), },
  69. { .name = "led6:amber", .gpio = GPIO_PIN_PB(16), },
  70. { .name = "led7:amber", .gpio = GPIO_PIN_PB(30),
  71. .default_trigger = "heartbeat", },
  72. #else /* RGB */
  73. #define LEDSTRING "J2 jumpered to RGB LEDs"
  74. { .name = "r1:red", .gpio = GPIO_PIN_PB( 8), },
  75. { .name = "g1:green", .gpio = GPIO_PIN_PB(10), },
  76. { .name = "b1:blue", .gpio = GPIO_PIN_PB(14), },
  77. { .name = "r2:red", .gpio = GPIO_PIN_PB( 9),
  78. .default_trigger = "heartbeat", },
  79. { .name = "g2:green", .gpio = GPIO_PIN_PB(13), },
  80. { .name = "b2:blue", .gpio = GPIO_PIN_PB(15),
  81. .default_trigger = "heartbeat", },
  82. /* PB16, PB30 unused */
  83. #endif
  84. };
  85. static struct gpio_led_platform_data stk1000_j2_led_data = {
  86. .num_leds = ARRAY_SIZE(stk1000_j2_led),
  87. .leds = stk1000_j2_led,
  88. };
  89. static struct platform_device stk1000_j2_led_dev = {
  90. .name = "leds-gpio",
  91. .id = 2, /* gpio block J2 */
  92. .dev = {
  93. .platform_data = &stk1000_j2_led_data,
  94. },
  95. };
  96. void __init atstk1000_setup_j2_leds(void)
  97. {
  98. unsigned i;
  99. for (i = 0; i < ARRAY_SIZE(stk1000_j2_led); i++)
  100. at32_select_gpio(stk1000_j2_led[i].gpio, AT32_GPIOF_OUTPUT);
  101. printk("STK1000: " LEDSTRING "\n");
  102. platform_device_register(&stk1000_j2_led_dev);
  103. }
  104. #else /* CONFIG_BOARD_ATSTK1000_J2_LED */
  105. void __init atstk1000_setup_j2_leds(void)
  106. {
  107. }
  108. #endif /* CONFIG_BOARD_ATSTK1000_J2_LED */