ezx.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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. };
  101. static void __init ezx_init(void)
  102. {
  103. pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
  104. pxa_set_i2c_info(NULL);
  105. if (machine_is_ezx_a780() || machine_is_ezx_e680())
  106. set_pxa_fb_info(&ezx_fb_info_1);
  107. else
  108. set_pxa_fb_info(&ezx_fb_info_2);
  109. platform_add_devices(devices, ARRAY_SIZE(devices));
  110. }
  111. static void __init ezx_fixup(struct machine_desc *desc, struct tag *tags,
  112. char **cmdline, struct meminfo *mi)
  113. {
  114. /* We have two ram chips. First one with 32MB at 0xA0000000 and a second
  115. * 16MB one at 0xAC000000
  116. */
  117. mi->nr_banks = 2;
  118. mi->bank[0].start = 0xa0000000;
  119. mi->bank[0].node = 0;
  120. mi->bank[0].size = (32*1024*1024);
  121. mi->bank[1].start = 0xac000000;
  122. mi->bank[1].node = 1;
  123. mi->bank[1].size = (16*1024*1024);
  124. }
  125. #ifdef CONFIG_MACH_EZX_A780
  126. MACHINE_START(EZX_A780, "Motorola EZX A780")
  127. .phys_io = 0x40000000,
  128. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  129. .fixup = ezx_fixup,
  130. .boot_params = 0xa0000100,
  131. .map_io = pxa_map_io,
  132. .init_irq = pxa27x_init_irq,
  133. .timer = &pxa_timer,
  134. .init_machine = &ezx_init,
  135. MACHINE_END
  136. #endif
  137. #ifdef CONFIG_MACH_EZX_E680
  138. MACHINE_START(EZX_E680, "Motorola EZX E680")
  139. .phys_io = 0x40000000,
  140. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  141. .fixup = ezx_fixup,
  142. .boot_params = 0xa0000100,
  143. .map_io = pxa_map_io,
  144. .init_irq = pxa27x_init_irq,
  145. .timer = &pxa_timer,
  146. .init_machine = &ezx_init,
  147. MACHINE_END
  148. #endif
  149. #ifdef CONFIG_MACH_EZX_A1200
  150. MACHINE_START(EZX_A1200, "Motorola EZX A1200")
  151. .phys_io = 0x40000000,
  152. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  153. .fixup = ezx_fixup,
  154. .boot_params = 0xa0000100,
  155. .map_io = pxa_map_io,
  156. .init_irq = pxa27x_init_irq,
  157. .timer = &pxa_timer,
  158. .init_machine = &ezx_init,
  159. MACHINE_END
  160. #endif
  161. #ifdef CONFIG_MACH_EZX_A910
  162. MACHINE_START(EZX_A910, "Motorola EZX A910")
  163. .phys_io = 0x40000000,
  164. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  165. .fixup = ezx_fixup,
  166. .boot_params = 0xa0000100,
  167. .map_io = pxa_map_io,
  168. .init_irq = pxa27x_init_irq,
  169. .timer = &pxa_timer,
  170. .init_machine = &ezx_init,
  171. MACHINE_END
  172. #endif
  173. #ifdef CONFIG_MACH_EZX_E6
  174. MACHINE_START(EZX_E6, "Motorola EZX E6")
  175. .phys_io = 0x40000000,
  176. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  177. .fixup = ezx_fixup,
  178. .boot_params = 0xa0000100,
  179. .map_io = pxa_map_io,
  180. .init_irq = pxa27x_init_irq,
  181. .timer = &pxa_timer,
  182. .init_machine = &ezx_init,
  183. MACHINE_END
  184. #endif
  185. #ifdef CONFIG_MACH_EZX_E2
  186. MACHINE_START(EZX_E2, "Motorola EZX E2")
  187. .phys_io = 0x40000000,
  188. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  189. .fixup = ezx_fixup,
  190. .boot_params = 0xa0000100,
  191. .map_io = pxa_map_io,
  192. .init_irq = pxa27x_init_irq,
  193. .timer = &pxa_timer,
  194. .init_machine = &ezx_init,
  195. MACHINE_END
  196. #endif