lart.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /*
  2. * linux/arch/arm/mach-sa1100/lart.c
  3. */
  4. #include <linux/init.h>
  5. #include <linux/kernel.h>
  6. #include <linux/platform_data/sa11x0-serial.h>
  7. #include <linux/tty.h>
  8. #include <linux/gpio.h>
  9. #include <linux/leds.h>
  10. #include <linux/platform_device.h>
  11. #include <video/sa1100fb.h>
  12. #include <mach/hardware.h>
  13. #include <asm/setup.h>
  14. #include <asm/mach-types.h>
  15. #include <asm/page.h>
  16. #include <asm/mach/arch.h>
  17. #include <asm/mach/map.h>
  18. #include <linux/platform_data/mfd-mcp-sa11x0.h>
  19. #include <mach/irqs.h>
  20. #include "generic.h"
  21. static struct mcp_plat_data lart_mcp_data = {
  22. .mccr0 = MCCR0_ADM,
  23. .sclk_rate = 11981000,
  24. };
  25. #ifdef LART_GREY_LCD
  26. static struct sa1100fb_mach_info lart_grey_info = {
  27. .pixclock = 150000, .bpp = 4,
  28. .xres = 320, .yres = 240,
  29. .hsync_len = 1, .vsync_len = 1,
  30. .left_margin = 4, .upper_margin = 0,
  31. .right_margin = 2, .lower_margin = 0,
  32. .cmap_greyscale = 1,
  33. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
  34. .lccr0 = LCCR0_Mono | LCCR0_Sngl | LCCR0_Pas | LCCR0_4PixMono,
  35. .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512),
  36. };
  37. #endif
  38. #ifdef LART_COLOR_LCD
  39. static struct sa1100fb_mach_info lart_color_info = {
  40. .pixclock = 150000, .bpp = 16,
  41. .xres = 320, .yres = 240,
  42. .hsync_len = 2, .vsync_len = 3,
  43. .left_margin = 69, .upper_margin = 14,
  44. .right_margin = 8, .lower_margin = 4,
  45. .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
  46. .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512),
  47. };
  48. #endif
  49. #ifdef LART_VIDEO_OUT
  50. static struct sa1100fb_mach_info lart_video_info = {
  51. .pixclock = 39721, .bpp = 16,
  52. .xres = 640, .yres = 480,
  53. .hsync_len = 95, .vsync_len = 2,
  54. .left_margin = 40, .upper_margin = 32,
  55. .right_margin = 24, .lower_margin = 11,
  56. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
  57. .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
  58. .lccr3 = LCCR3_OutEnL | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512),
  59. };
  60. #endif
  61. #ifdef LART_KIT01_LCD
  62. static struct sa1100fb_mach_info lart_kit01_info = {
  63. .pixclock = 63291, .bpp = 16,
  64. .xres = 640, .yres = 480,
  65. .hsync_len = 64, .vsync_len = 3,
  66. .left_margin = 122, .upper_margin = 45,
  67. .right_margin = 10, .lower_margin = 10,
  68. .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
  69. .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg
  70. };
  71. #endif
  72. static void __init lart_init(void)
  73. {
  74. struct sa1100fb_mach_info *inf = NULL;
  75. #ifdef LART_GREY_LCD
  76. inf = &lart_grey_info;
  77. #endif
  78. #ifdef LART_COLOR_LCD
  79. inf = &lart_color_info;
  80. #endif
  81. #ifdef LART_VIDEO_OUT
  82. inf = &lart_video_info;
  83. #endif
  84. #ifdef LART_KIT01_LCD
  85. inf = &lart_kit01_info;
  86. #endif
  87. if (inf)
  88. sa11x0_register_lcd(inf);
  89. sa11x0_ppc_configure_mcp();
  90. sa11x0_register_mcp(&lart_mcp_data);
  91. }
  92. static struct map_desc lart_io_desc[] __initdata = {
  93. { /* main flash memory */
  94. .virtual = 0xe8000000,
  95. .pfn = __phys_to_pfn(0x00000000),
  96. .length = 0x00400000,
  97. .type = MT_DEVICE
  98. }, { /* main flash, alternative location */
  99. .virtual = 0xec000000,
  100. .pfn = __phys_to_pfn(0x08000000),
  101. .length = 0x00400000,
  102. .type = MT_DEVICE
  103. }
  104. };
  105. /* LEDs */
  106. struct gpio_led lart_gpio_leds[] = {
  107. {
  108. .name = "lart:red",
  109. .default_trigger = "cpu0",
  110. .gpio = 23,
  111. },
  112. };
  113. static struct gpio_led_platform_data lart_gpio_led_info = {
  114. .leds = lart_gpio_leds,
  115. .num_leds = ARRAY_SIZE(lart_gpio_leds),
  116. };
  117. static struct platform_device lart_leds = {
  118. .name = "leds-gpio",
  119. .id = -1,
  120. .dev = {
  121. .platform_data = &lart_gpio_led_info,
  122. }
  123. };
  124. static void __init lart_map_io(void)
  125. {
  126. sa1100_map_io();
  127. iotable_init(lart_io_desc, ARRAY_SIZE(lart_io_desc));
  128. sa1100_register_uart(0, 3);
  129. sa1100_register_uart(1, 1);
  130. sa1100_register_uart(2, 2);
  131. GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD);
  132. GPDR |= GPIO_UART_TXD;
  133. GPDR &= ~GPIO_UART_RXD;
  134. PPAR |= PPAR_UPR;
  135. platform_device_register(&lart_leds);
  136. }
  137. MACHINE_START(LART, "LART")
  138. .atag_offset = 0x100,
  139. .map_io = lart_map_io,
  140. .nr_irqs = SA1100_NR_IRQS,
  141. .init_irq = sa1100_init_irq,
  142. .init_machine = lart_init,
  143. .init_late = sa11x0_init_late,
  144. .init_time = sa1100_timer_init,
  145. .restart = sa11x0_restart,
  146. MACHINE_END