ezx.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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/hardware.h>
  23. #include <mach/mfp-pxa27x.h>
  24. #include <mach/pxa-regs.h>
  25. #include <mach/pxa2xx-regs.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/mach/arch.h>
  28. #include "devices.h"
  29. #include "generic.h"
  30. static struct platform_pwm_backlight_data ezx_backlight_data = {
  31. .pwm_id = 0,
  32. .max_brightness = 1023,
  33. .dft_brightness = 1023,
  34. .pwm_period_ns = 78770,
  35. };
  36. static struct platform_device ezx_backlight_device = {
  37. .name = "pwm-backlight",
  38. .dev = {
  39. .parent = &pxa27x_device_pwm0.dev,
  40. .platform_data = &ezx_backlight_data,
  41. },
  42. };
  43. static struct pxafb_mode_info mode_ezx_old = {
  44. .pixclock = 150000,
  45. .xres = 240,
  46. .yres = 320,
  47. .bpp = 16,
  48. .hsync_len = 10,
  49. .left_margin = 20,
  50. .right_margin = 10,
  51. .vsync_len = 2,
  52. .upper_margin = 3,
  53. .lower_margin = 2,
  54. .sync = 0,
  55. };
  56. static struct pxafb_mach_info ezx_fb_info_1 = {
  57. .modes = &mode_ezx_old,
  58. .num_modes = 1,
  59. .lcd_conn = LCD_COLOR_TFT_16BPP,
  60. };
  61. static struct pxafb_mode_info mode_72r89803y01 = {
  62. .pixclock = 192308,
  63. .xres = 240,
  64. .yres = 320,
  65. .bpp = 32,
  66. .depth = 18,
  67. .hsync_len = 10,
  68. .left_margin = 20,
  69. .right_margin = 10,
  70. .vsync_len = 2,
  71. .upper_margin = 3,
  72. .lower_margin = 2,
  73. .sync = 0,
  74. };
  75. static struct pxafb_mach_info ezx_fb_info_2 = {
  76. .modes = &mode_72r89803y01,
  77. .num_modes = 1,
  78. .lcd_conn = LCD_COLOR_TFT_18BPP,
  79. };
  80. static struct platform_device *devices[] __initdata = {
  81. &ezx_backlight_device,
  82. };
  83. static unsigned long ezx_pin_config[] __initdata = {
  84. /* PWM backlight */
  85. GPIO16_PWM0_OUT,
  86. /* BTUART */
  87. GPIO42_BTUART_RXD,
  88. GPIO43_BTUART_TXD,
  89. GPIO44_BTUART_CTS,
  90. GPIO45_BTUART_RTS,
  91. /* STUART */
  92. GPIO46_STUART_RXD,
  93. GPIO47_STUART_TXD,
  94. /* For A780 support (connected with Neptune GSM chip) */
  95. GPIO30_USB_P3_2, /* ICL_TXENB */
  96. GPIO31_USB_P3_6, /* ICL_VPOUT */
  97. GPIO90_USB_P3_5, /* ICL_VPIN */
  98. GPIO91_USB_P3_1, /* ICL_XRXD */
  99. GPIO56_USB_P3_4, /* ICL_VMOUT */
  100. GPIO113_USB_P3_3, /* /ICL_VMIN */
  101. };
  102. static void __init ezx_init(void)
  103. {
  104. pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
  105. pxa_set_i2c_info(NULL);
  106. if (machine_is_ezx_a780() || machine_is_ezx_e680())
  107. set_pxa_fb_info(&ezx_fb_info_1);
  108. else
  109. set_pxa_fb_info(&ezx_fb_info_2);
  110. platform_add_devices(devices, ARRAY_SIZE(devices));
  111. }
  112. static void __init ezx_fixup(struct machine_desc *desc, struct tag *tags,
  113. char **cmdline, struct meminfo *mi)
  114. {
  115. /* We have two ram chips. First one with 32MB at 0xA0000000 and a second
  116. * 16MB one at 0xAC000000
  117. */
  118. mi->nr_banks = 2;
  119. mi->bank[0].start = 0xa0000000;
  120. mi->bank[0].node = 0;
  121. mi->bank[0].size = (32*1024*1024);
  122. mi->bank[1].start = 0xac000000;
  123. mi->bank[1].node = 1;
  124. mi->bank[1].size = (16*1024*1024);
  125. }
  126. #ifdef CONFIG_MACH_EZX_A780
  127. MACHINE_START(EZX_A780, "Motorola EZX A780")
  128. .phys_io = 0x40000000,
  129. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  130. .fixup = ezx_fixup,
  131. .boot_params = 0xa0000100,
  132. .map_io = pxa_map_io,
  133. .init_irq = pxa27x_init_irq,
  134. .timer = &pxa_timer,
  135. .init_machine = &ezx_init,
  136. MACHINE_END
  137. #endif
  138. #ifdef CONFIG_MACH_EZX_E680
  139. MACHINE_START(EZX_E680, "Motorola EZX E680")
  140. .phys_io = 0x40000000,
  141. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  142. .fixup = ezx_fixup,
  143. .boot_params = 0xa0000100,
  144. .map_io = pxa_map_io,
  145. .init_irq = pxa27x_init_irq,
  146. .timer = &pxa_timer,
  147. .init_machine = &ezx_init,
  148. MACHINE_END
  149. #endif
  150. #ifdef CONFIG_MACH_EZX_A1200
  151. MACHINE_START(EZX_A1200, "Motorola EZX A1200")
  152. .phys_io = 0x40000000,
  153. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  154. .fixup = ezx_fixup,
  155. .boot_params = 0xa0000100,
  156. .map_io = pxa_map_io,
  157. .init_irq = pxa27x_init_irq,
  158. .timer = &pxa_timer,
  159. .init_machine = &ezx_init,
  160. MACHINE_END
  161. #endif
  162. #ifdef CONFIG_MACH_EZX_A910
  163. MACHINE_START(EZX_A910, "Motorola EZX A910")
  164. .phys_io = 0x40000000,
  165. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  166. .fixup = ezx_fixup,
  167. .boot_params = 0xa0000100,
  168. .map_io = pxa_map_io,
  169. .init_irq = pxa27x_init_irq,
  170. .timer = &pxa_timer,
  171. .init_machine = &ezx_init,
  172. MACHINE_END
  173. #endif
  174. #ifdef CONFIG_MACH_EZX_E6
  175. MACHINE_START(EZX_E6, "Motorola EZX E6")
  176. .phys_io = 0x40000000,
  177. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  178. .fixup = ezx_fixup,
  179. .boot_params = 0xa0000100,
  180. .map_io = pxa_map_io,
  181. .init_irq = pxa27x_init_irq,
  182. .timer = &pxa_timer,
  183. .init_machine = &ezx_init,
  184. MACHINE_END
  185. #endif
  186. #ifdef CONFIG_MACH_EZX_E2
  187. MACHINE_START(EZX_E2, "Motorola EZX E2")
  188. .phys_io = 0x40000000,
  189. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  190. .fixup = ezx_fixup,
  191. .boot_params = 0xa0000100,
  192. .map_io = pxa_map_io,
  193. .init_irq = pxa27x_init_irq,
  194. .timer = &pxa_timer,
  195. .init_machine = &ezx_init,
  196. MACHINE_END
  197. #endif