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/pxa25x.h>
  23. #include <mach/eseries-gpio.h>
  24. #include <mach/udc.h>
  25. #include <mach/irqs.h>
  26. #include <mach/audio.h>
  27. #include "generic.h"
  28. #include "eseries.h"
  29. #include "clock.h"
  30. /* ------------------------ e800 LCD definitions ------------------------- */
  31. static struct w100_gen_regs e800_lcd_regs = {
  32. .lcd_format = 0x00008003,
  33. .lcdd_cntl1 = 0x02a00000,
  34. .lcdd_cntl2 = 0x0003ffff,
  35. .genlcd_cntl1 = 0x000ff2a3,
  36. .genlcd_cntl2 = 0x000002a3,
  37. .genlcd_cntl3 = 0x000102aa,
  38. };
  39. static struct w100_mode e800_lcd_mode[2] = {
  40. [0] = {
  41. .xres = 480,
  42. .yres = 640,
  43. .left_margin = 52,
  44. .right_margin = 148,
  45. .upper_margin = 2,
  46. .lower_margin = 6,
  47. .crtc_ss = 0x80350034,
  48. .crtc_ls = 0x802b0026,
  49. .crtc_gs = 0x80160016,
  50. .crtc_vpos_gs = 0x00020003,
  51. .crtc_rev = 0x0040001d,
  52. .crtc_dclk = 0xe0000000,
  53. .crtc_gclk = 0x82a50049,
  54. .crtc_goe = 0x80ee001c,
  55. .crtc_ps1_active = 0x00000000,
  56. .pll_freq = 128,
  57. .pixclk_divider = 4,
  58. .pixclk_divider_rotated = 6,
  59. .pixclk_src = CLK_SRC_PLL,
  60. .sysclk_divider = 0,
  61. .sysclk_src = CLK_SRC_PLL,
  62. },
  63. [1] = {
  64. .xres = 240,
  65. .yres = 320,
  66. .left_margin = 15,
  67. .right_margin = 88,
  68. .upper_margin = 0,
  69. .lower_margin = 7,
  70. .crtc_ss = 0xd010000f,
  71. .crtc_ls = 0x80070003,
  72. .crtc_gs = 0x80000000,
  73. .crtc_vpos_gs = 0x01460147,
  74. .crtc_rev = 0x00400003,
  75. .crtc_dclk = 0xa1700030,
  76. .crtc_gclk = 0x814b0008,
  77. .crtc_goe = 0x80cc0015,
  78. .crtc_ps1_active = 0x00000000,
  79. .pll_freq = 100,
  80. .pixclk_divider = 6, /* Wince uses 14 which gives a */
  81. .pixclk_divider_rotated = 6, /* 7MHz Pclk. We use a 14MHz one */
  82. .pixclk_src = CLK_SRC_PLL,
  83. .sysclk_divider = 0,
  84. .sysclk_src = CLK_SRC_PLL,
  85. }
  86. };
  87. static struct w100_gpio_regs e800_w100_gpio_info = {
  88. .init_data1 = 0xc13fc019,
  89. .gpio_dir1 = 0x3e40df7f,
  90. .gpio_oe1 = 0x003c3000,
  91. .init_data2 = 0x00000000,
  92. .gpio_dir2 = 0x00000000,
  93. .gpio_oe2 = 0x00000000,
  94. };
  95. static struct w100_mem_info e800_w100_mem_info = {
  96. .ext_cntl = 0x09640011,
  97. .sdram_mode_reg = 0x00600021,
  98. .ext_timing_cntl = 0x10001545,
  99. .io_cntl = 0x7ddd7333,
  100. .size = 0x1fffff,
  101. };
  102. static void e800_tg_change(struct w100fb_par *par)
  103. {
  104. unsigned long tmp;
  105. tmp = w100fb_gpio_read(W100_GPIO_PORT_A);
  106. if (par->mode->xres == 480)
  107. tmp |= 0x100;
  108. else
  109. tmp &= ~0x100;
  110. w100fb_gpio_write(W100_GPIO_PORT_A, tmp);
  111. }
  112. static struct w100_tg_info e800_tg_info = {
  113. .change = e800_tg_change,
  114. };
  115. static struct w100fb_mach_info e800_fb_info = {
  116. .modelist = e800_lcd_mode,
  117. .num_modes = 2,
  118. .regs = &e800_lcd_regs,
  119. .gpio = &e800_w100_gpio_info,
  120. .mem = &e800_w100_mem_info,
  121. .tg = &e800_tg_info,
  122. .xtal_freq = 16000000,
  123. };
  124. static struct resource e800_fb_resources[] = {
  125. [0] = {
  126. .start = 0x0c000000,
  127. .end = 0x0cffffff,
  128. .flags = IORESOURCE_MEM,
  129. },
  130. };
  131. static struct platform_device e800_fb_device = {
  132. .name = "w100fb",
  133. .id = -1,
  134. .dev = {
  135. .platform_data = &e800_fb_info,
  136. },
  137. .num_resources = ARRAY_SIZE(e800_fb_resources),
  138. .resource = e800_fb_resources,
  139. };
  140. /* --------------------------- UDC definitions --------------------------- */
  141. static struct pxa2xx_udc_mach_info e800_udc_mach_info = {
  142. .gpio_vbus = GPIO_E800_USB_DISC,
  143. .gpio_pullup = GPIO_E800_USB_PULLUP,
  144. .gpio_pullup_inverted = 1
  145. };
  146. /* ----------------- e800 tc6393xb parameters ------------------ */
  147. static struct tc6393xb_platform_data e800_tc6393xb_info = {
  148. .irq_base = IRQ_BOARD_START,
  149. .scr_pll2cr = 0x0cc1,
  150. .scr_gper = 0,
  151. .gpio_base = -1,
  152. .suspend = &eseries_tmio_suspend,
  153. .resume = &eseries_tmio_resume,
  154. .enable = &eseries_tmio_enable,
  155. .disable = &eseries_tmio_disable,
  156. };
  157. static struct platform_device e800_tc6393xb_device = {
  158. .name = "tc6393xb",
  159. .id = -1,
  160. .dev = {
  161. .platform_data = &e800_tc6393xb_info,
  162. },
  163. .num_resources = 2,
  164. .resource = eseries_tmio_resources,
  165. };
  166. /* ----------------------------------------------------------------------- */
  167. static struct platform_device *devices[] __initdata = {
  168. &e800_fb_device,
  169. &e800_tc6393xb_device,
  170. };
  171. static void __init e800_init(void)
  172. {
  173. clk_add_alias("CLK_CK3P6MI", e800_tc6393xb_device.name,
  174. "GPIO11_CLK", NULL),
  175. eseries_get_tmio_gpios();
  176. platform_add_devices(devices, ARRAY_SIZE(devices));
  177. pxa_set_udc_info(&e800_udc_mach_info);
  178. pxa_set_ac97_info(NULL);
  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