e800.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. /*
  2. * Hardware definitions for the Toshiba eseries PDAs
  3. *
  4. * Copyright (c) 2003 Ian Molton <spyro@f2s.com>
  5. *
  6. * This file is licensed under
  7. * the terms of the GNU General Public License version 2. This program
  8. * is licensed "as is" without any warranty of any kind, whether express
  9. * or implied.
  10. *
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/device.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/fb.h>
  17. #include <linux/mfd/tc6393xb.h>
  18. #include <video/w100fb.h>
  19. #include <asm/setup.h>
  20. #include <asm/mach/arch.h>
  21. #include <asm/mach-types.h>
  22. #include <mach/mfp-pxa25x.h>
  23. #include <mach/pxa-regs.h>
  24. #include <mach/hardware.h>
  25. #include <mach/eseries-gpio.h>
  26. #include <mach/udc.h>
  27. #include <mach/irqs.h>
  28. #include "generic.h"
  29. #include "eseries.h"
  30. #include "clock.h"
  31. /* ------------------------ e800 LCD definitions ------------------------- */
  32. static struct w100_gen_regs e800_lcd_regs = {
  33. .lcd_format = 0x00008003,
  34. .lcdd_cntl1 = 0x02a00000,
  35. .lcdd_cntl2 = 0x0003ffff,
  36. .genlcd_cntl1 = 0x000ff2a3,
  37. .genlcd_cntl2 = 0x000002a3,
  38. .genlcd_cntl3 = 0x000102aa,
  39. };
  40. static struct w100_mode e800_lcd_mode[2] = {
  41. [0] = {
  42. .xres = 480,
  43. .yres = 640,
  44. .left_margin = 52,
  45. .right_margin = 148,
  46. .upper_margin = 2,
  47. .lower_margin = 6,
  48. .crtc_ss = 0x80350034,
  49. .crtc_ls = 0x802b0026,
  50. .crtc_gs = 0x80160016,
  51. .crtc_vpos_gs = 0x00020003,
  52. .crtc_rev = 0x0040001d,
  53. .crtc_dclk = 0xe0000000,
  54. .crtc_gclk = 0x82a50049,
  55. .crtc_goe = 0x80ee001c,
  56. .crtc_ps1_active = 0x00000000,
  57. .pll_freq = 128,
  58. .pixclk_divider = 4,
  59. .pixclk_divider_rotated = 6,
  60. .pixclk_src = CLK_SRC_PLL,
  61. .sysclk_divider = 0,
  62. .sysclk_src = CLK_SRC_PLL,
  63. },
  64. [1] = {
  65. .xres = 240,
  66. .yres = 320,
  67. .left_margin = 15,
  68. .right_margin = 88,
  69. .upper_margin = 0,
  70. .lower_margin = 7,
  71. .crtc_ss = 0xd010000f,
  72. .crtc_ls = 0x80070003,
  73. .crtc_gs = 0x80000000,
  74. .crtc_vpos_gs = 0x01460147,
  75. .crtc_rev = 0x00400003,
  76. .crtc_dclk = 0xa1700030,
  77. .crtc_gclk = 0x814b0008,
  78. .crtc_goe = 0x80cc0015,
  79. .crtc_ps1_active = 0x00000000,
  80. .pll_freq = 100,
  81. .pixclk_divider = 6, /* Wince uses 14 which gives a */
  82. .pixclk_divider_rotated = 6, /* 7MHz Pclk. We use a 14MHz one */
  83. .pixclk_src = CLK_SRC_PLL,
  84. .sysclk_divider = 0,
  85. .sysclk_src = CLK_SRC_PLL,
  86. }
  87. };
  88. static struct w100_gpio_regs e800_w100_gpio_info = {
  89. .init_data1 = 0xc13fc019,
  90. .gpio_dir1 = 0x3e40df7f,
  91. .gpio_oe1 = 0x003c3000,
  92. .init_data2 = 0x00000000,
  93. .gpio_dir2 = 0x00000000,
  94. .gpio_oe2 = 0x00000000,
  95. };
  96. static struct w100_mem_info e800_w100_mem_info = {
  97. .ext_cntl = 0x09640011,
  98. .sdram_mode_reg = 0x00600021,
  99. .ext_timing_cntl = 0x10001545,
  100. .io_cntl = 0x7ddd7333,
  101. .size = 0x1fffff,
  102. };
  103. static void e800_tg_change(struct w100fb_par *par)
  104. {
  105. unsigned long tmp;
  106. tmp = w100fb_gpio_read(W100_GPIO_PORT_A);
  107. if (par->mode->xres == 480)
  108. tmp |= 0x100;
  109. else
  110. tmp &= ~0x100;
  111. w100fb_gpio_write(W100_GPIO_PORT_A, tmp);
  112. }
  113. static struct w100_tg_info e800_tg_info = {
  114. .change = e800_tg_change,
  115. };
  116. static struct w100fb_mach_info e800_fb_info = {
  117. .modelist = e800_lcd_mode,
  118. .num_modes = 2,
  119. .regs = &e800_lcd_regs,
  120. .gpio = &e800_w100_gpio_info,
  121. .mem = &e800_w100_mem_info,
  122. .tg = &e800_tg_info,
  123. .xtal_freq = 16000000,
  124. };
  125. static struct resource e800_fb_resources[] = {
  126. [0] = {
  127. .start = 0x0c000000,
  128. .end = 0x0cffffff,
  129. .flags = IORESOURCE_MEM,
  130. },
  131. };
  132. static struct platform_device e800_fb_device = {
  133. .name = "w100fb",
  134. .id = -1,
  135. .dev = {
  136. .platform_data = &e800_fb_info,
  137. },
  138. .num_resources = ARRAY_SIZE(e800_fb_resources),
  139. .resource = e800_fb_resources,
  140. };
  141. /* --------------------------- UDC definitions --------------------------- */
  142. static struct pxa2xx_udc_mach_info e800_udc_mach_info = {
  143. .gpio_vbus = GPIO_E800_USB_DISC,
  144. .gpio_pullup = GPIO_E800_USB_PULLUP,
  145. .gpio_pullup_inverted = 1
  146. };
  147. /* ----------------- e800 tc6393xb parameters ------------------ */
  148. static struct tc6393xb_platform_data e800_tc6393xb_info = {
  149. .irq_base = IRQ_BOARD_START,
  150. .scr_pll2cr = 0x0cc1,
  151. .scr_gper = 0,
  152. .gpio_base = -1,
  153. .suspend = &eseries_tmio_suspend,
  154. .resume = &eseries_tmio_resume,
  155. .enable = &eseries_tmio_enable,
  156. .disable = &eseries_tmio_disable,
  157. };
  158. static struct platform_device e800_tc6393xb_device = {
  159. .name = "tc6393xb",
  160. .id = -1,
  161. .dev = {
  162. .platform_data = &e800_tc6393xb_info,
  163. },
  164. .num_resources = 2,
  165. .resource = eseries_tmio_resources,
  166. };
  167. /* ----------------------------------------------------------------------- */
  168. static struct platform_device *devices[] __initdata = {
  169. &e800_fb_device,
  170. &e800_tc6393xb_device,
  171. };
  172. static void __init e800_init(void)
  173. {
  174. clk_add_alias("CLK_CK3P6MI", &e800_tc6393xb_device.dev,
  175. "GPIO11_CLK", NULL),
  176. eseries_get_tmio_gpios();
  177. platform_add_devices(devices, ARRAY_SIZE(devices));
  178. pxa_set_udc_info(&e800_udc_mach_info);
  179. }
  180. MACHINE_START(E800, "Toshiba e800")
  181. /* Maintainer: Ian Molton (spyro@f2s.com) */
  182. .phys_io = 0x40000000,
  183. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  184. .boot_params = 0xa0000100,
  185. .map_io = pxa_map_io,
  186. .init_irq = pxa25x_init_irq,
  187. .fixup = eseries_fixup,
  188. .init_machine = e800_init,
  189. .timer = &pxa_timer,
  190. MACHINE_END