lart.c 4.0 KB

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