zylonite.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /*
  2. * linux/arch/arm/mach-pxa/zylonite.c
  3. *
  4. * Support for the PXA3xx Development Platform (aka Zylonite)
  5. *
  6. * Copyright (C) 2006 Marvell International Ltd.
  7. *
  8. * 2007-09-04: eric miao <eric.y.miao@gmail.com>
  9. * rewrite to align with latest kernel
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #include <linux/module.h>
  16. #include <linux/kernel.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/init.h>
  19. #include <linux/platform_device.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/hardware.h>
  23. #include <asm/arch/gpio.h>
  24. #include <asm/arch/pxafb.h>
  25. #include <asm/arch/zylonite.h>
  26. #include "generic.h"
  27. int gpio_backlight;
  28. int gpio_eth_irq;
  29. int lcd_id;
  30. int lcd_orientation;
  31. static struct resource smc91x_resources[] = {
  32. [0] = {
  33. .start = ZYLONITE_ETH_PHYS + 0x300,
  34. .end = ZYLONITE_ETH_PHYS + 0xfffff,
  35. .flags = IORESOURCE_MEM,
  36. },
  37. [1] = {
  38. .start = -1, /* for run-time assignment */
  39. .end = -1,
  40. .flags = IORESOURCE_IRQ,
  41. }
  42. };
  43. static struct platform_device smc91x_device = {
  44. .name = "smc91x",
  45. .id = 0,
  46. .num_resources = ARRAY_SIZE(smc91x_resources),
  47. .resource = smc91x_resources,
  48. };
  49. #if defined(CONFIG_FB_PXA) || (CONFIG_FB_PXA_MODULES)
  50. static void zylonite_backlight_power(int on)
  51. {
  52. gpio_set_value(gpio_backlight, on);
  53. }
  54. static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
  55. .pixclock = 110000,
  56. .xres = 240,
  57. .yres = 320,
  58. .bpp = 16,
  59. .hsync_len = 4,
  60. .left_margin = 6,
  61. .right_margin = 4,
  62. .vsync_len = 2,
  63. .upper_margin = 2,
  64. .lower_margin = 3,
  65. .sync = FB_SYNC_VERT_HIGH_ACT,
  66. };
  67. static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
  68. .pixclock = 50000,
  69. .xres = 640,
  70. .yres = 480,
  71. .bpp = 16,
  72. .hsync_len = 1,
  73. .left_margin = 0x9f,
  74. .right_margin = 1,
  75. .vsync_len = 44,
  76. .upper_margin = 0,
  77. .lower_margin = 0,
  78. .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
  79. };
  80. static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
  81. .num_modes = 1,
  82. .lccr0 = LCCR0_Act,
  83. .lccr3 = LCCR3_PCP,
  84. .pxafb_backlight_power = zylonite_backlight_power,
  85. };
  86. static struct pxafb_mode_info sharp_ls037_modes[] = {
  87. [0] = {
  88. .pixclock = 158000,
  89. .xres = 240,
  90. .yres = 320,
  91. .bpp = 16,
  92. .hsync_len = 4,
  93. .left_margin = 39,
  94. .right_margin = 39,
  95. .vsync_len = 1,
  96. .upper_margin = 2,
  97. .lower_margin = 3,
  98. .sync = 0,
  99. },
  100. [1] = {
  101. .pixclock = 39700,
  102. .xres = 480,
  103. .yres = 640,
  104. .bpp = 16,
  105. .hsync_len = 8,
  106. .left_margin = 81,
  107. .right_margin = 81,
  108. .vsync_len = 1,
  109. .upper_margin = 2,
  110. .lower_margin = 7,
  111. .sync = 0,
  112. },
  113. };
  114. static struct pxafb_mach_info zylonite_sharp_lcd_info = {
  115. .modes = sharp_ls037_modes,
  116. .num_modes = 2,
  117. .lccr0 = LCCR0_Act,
  118. .lccr3 = LCCR3_PCP | LCCR3_HSP | LCCR3_VSP,
  119. .pxafb_backlight_power = zylonite_backlight_power,
  120. };
  121. static void __init zylonite_init_lcd(void)
  122. {
  123. /* backlight GPIO: output, default on */
  124. gpio_direction_output(gpio_backlight, 1);
  125. if (lcd_id & 0x20) {
  126. set_pxa_fb_info(&zylonite_sharp_lcd_info);
  127. return;
  128. }
  129. /* legacy LCD panels, it would be handy here if LCD panel type can
  130. * be decided at run-time
  131. */
  132. if (1)
  133. zylonite_toshiba_lcd_info.modes = &toshiba_ltm035a776c_mode;
  134. else
  135. zylonite_toshiba_lcd_info.modes = &toshiba_ltm04c380k_mode;
  136. set_pxa_fb_info(&zylonite_toshiba_lcd_info);
  137. }
  138. #else
  139. static inline void zylonite_init_lcd(void) {}
  140. #endif
  141. static void __init zylonite_init(void)
  142. {
  143. /* board-processor specific initialization */
  144. zylonite_pxa300_init();
  145. zylonite_pxa320_init();
  146. /*
  147. * Note: We depend that the bootloader set
  148. * the correct value to MSC register for SMC91x.
  149. */
  150. smc91x_resources[1].start = gpio_to_irq(gpio_eth_irq);
  151. smc91x_resources[1].end = gpio_to_irq(gpio_eth_irq);
  152. platform_device_register(&smc91x_device);
  153. zylonite_init_lcd();
  154. }
  155. MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
  156. .phys_io = 0x40000000,
  157. .boot_params = 0xa0000100,
  158. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  159. .map_io = pxa_map_io,
  160. .init_irq = pxa3xx_init_irq,
  161. .timer = &pxa_timer,
  162. .init_machine = zylonite_init,
  163. MACHINE_END