ezx.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * ezx.c - Common code for the EZX platform.
  3. *
  4. * Copyright (C) 2005-2006 Harald Welte <laforge@openezx.org>,
  5. * 2007-2008 Daniel Ribeiro <drwyrm@gmail.com>,
  6. * 2007-2008 Stefan Schmidt <stefan@datenfreihafen.org>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/delay.h>
  17. #include <linux/pwm_backlight.h>
  18. #include <asm/setup.h>
  19. #include <mach/pxafb.h>
  20. #include <mach/ohci.h>
  21. #include <mach/i2c.h>
  22. #include <mach/mfp-pxa27x.h>
  23. #include <mach/pxa-regs.h>
  24. #include <mach/pxa2xx-regs.h>
  25. #include <asm/mach-types.h>
  26. #include <asm/mach/arch.h>
  27. #include "devices.h"
  28. #include "generic.h"
  29. static struct platform_pwm_backlight_data ezx_backlight_data = {
  30. .pwm_id = 0,
  31. .max_brightness = 1023,
  32. .dft_brightness = 1023,
  33. .pwm_period_ns = 78770,
  34. };
  35. static struct platform_device ezx_backlight_device = {
  36. .name = "pwm-backlight",
  37. .dev = {
  38. .parent = &pxa27x_device_pwm0.dev,
  39. .platform_data = &ezx_backlight_data,
  40. },
  41. };
  42. static struct pxafb_mode_info mode_ezx_old = {
  43. .pixclock = 150000,
  44. .xres = 240,
  45. .yres = 320,
  46. .bpp = 16,
  47. .hsync_len = 10,
  48. .left_margin = 20,
  49. .right_margin = 10,
  50. .vsync_len = 2,
  51. .upper_margin = 3,
  52. .lower_margin = 2,
  53. .sync = 0,
  54. };
  55. static struct pxafb_mach_info ezx_fb_info_1 = {
  56. .modes = &mode_ezx_old,
  57. .num_modes = 1,
  58. .lcd_conn = LCD_COLOR_TFT_16BPP,
  59. };
  60. static struct pxafb_mode_info mode_72r89803y01 = {
  61. .pixclock = 192308,
  62. .xres = 240,
  63. .yres = 320,
  64. .bpp = 32,
  65. .depth = 18,
  66. .hsync_len = 10,
  67. .left_margin = 20,
  68. .right_margin = 10,
  69. .vsync_len = 2,
  70. .upper_margin = 3,
  71. .lower_margin = 2,
  72. .sync = 0,
  73. };
  74. static struct pxafb_mach_info ezx_fb_info_2 = {
  75. .modes = &mode_72r89803y01,
  76. .num_modes = 1,
  77. .lcd_conn = LCD_COLOR_TFT_18BPP,
  78. };
  79. static struct platform_device *devices[] __initdata = {
  80. &ezx_backlight_device,
  81. };
  82. static unsigned long ezx_pin_config[] __initdata = {
  83. /* PWM backlight */
  84. GPIO16_PWM0_OUT,
  85. /* BTUART */
  86. GPIO42_BTUART_RXD,
  87. GPIO43_BTUART_TXD,
  88. GPIO44_BTUART_CTS,
  89. GPIO45_BTUART_RTS,
  90. /* STUART */
  91. GPIO46_STUART_RXD,
  92. GPIO47_STUART_TXD,
  93. /* For A780 support (connected with Neptune GSM chip) */
  94. GPIO30_USB_P3_2, /* ICL_TXENB */
  95. GPIO31_USB_P3_6, /* ICL_VPOUT */
  96. GPIO90_USB_P3_5, /* ICL_VPIN */
  97. GPIO91_USB_P3_1, /* ICL_XRXD */
  98. GPIO56_USB_P3_4, /* ICL_VMOUT */
  99. GPIO113_USB_P3_3, /* /ICL_VMIN */
  100. /* I2C */
  101. GPIO117_I2C_SCL,
  102. GPIO118_I2C_SDA,
  103. };
  104. static void __init ezx_init(void)
  105. {
  106. pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
  107. pxa_set_i2c_info(NULL);
  108. if (machine_is_ezx_a780() || machine_is_ezx_e680())
  109. set_pxa_fb_info(&ezx_fb_info_1);
  110. else
  111. set_pxa_fb_info(&ezx_fb_info_2);
  112. platform_add_devices(devices, ARRAY_SIZE(devices));
  113. }
  114. #ifdef CONFIG_MACH_EZX_A780
  115. MACHINE_START(EZX_A780, "Motorola EZX A780")
  116. .phys_io = 0x40000000,
  117. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  118. .boot_params = 0xa0000100,
  119. .map_io = pxa_map_io,
  120. .init_irq = pxa27x_init_irq,
  121. .timer = &pxa_timer,
  122. .init_machine = &ezx_init,
  123. MACHINE_END
  124. #endif
  125. #ifdef CONFIG_MACH_EZX_E680
  126. MACHINE_START(EZX_E680, "Motorola EZX E680")
  127. .phys_io = 0x40000000,
  128. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  129. .boot_params = 0xa0000100,
  130. .map_io = pxa_map_io,
  131. .init_irq = pxa27x_init_irq,
  132. .timer = &pxa_timer,
  133. .init_machine = &ezx_init,
  134. MACHINE_END
  135. #endif
  136. #ifdef CONFIG_MACH_EZX_A1200
  137. MACHINE_START(EZX_A1200, "Motorola EZX A1200")
  138. .phys_io = 0x40000000,
  139. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  140. .boot_params = 0xa0000100,
  141. .map_io = pxa_map_io,
  142. .init_irq = pxa27x_init_irq,
  143. .timer = &pxa_timer,
  144. .init_machine = &ezx_init,
  145. MACHINE_END
  146. #endif
  147. #ifdef CONFIG_MACH_EZX_A910
  148. MACHINE_START(EZX_A910, "Motorola EZX A910")
  149. .phys_io = 0x40000000,
  150. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  151. .boot_params = 0xa0000100,
  152. .map_io = pxa_map_io,
  153. .init_irq = pxa27x_init_irq,
  154. .timer = &pxa_timer,
  155. .init_machine = &ezx_init,
  156. MACHINE_END
  157. #endif
  158. #ifdef CONFIG_MACH_EZX_E6
  159. MACHINE_START(EZX_E6, "Motorola EZX E6")
  160. .phys_io = 0x40000000,
  161. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  162. .boot_params = 0xa0000100,
  163. .map_io = pxa_map_io,
  164. .init_irq = pxa27x_init_irq,
  165. .timer = &pxa_timer,
  166. .init_machine = &ezx_init,
  167. MACHINE_END
  168. #endif
  169. #ifdef CONFIG_MACH_EZX_E2
  170. MACHINE_START(EZX_E2, "Motorola EZX E2")
  171. .phys_io = 0x40000000,
  172. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  173. .boot_params = 0xa0000100,
  174. .map_io = pxa_map_io,
  175. .init_irq = pxa27x_init_irq,
  176. .timer = &pxa_timer,
  177. .init_machine = &ezx_init,
  178. MACHINE_END
  179. #endif