e800.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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 <video/w100fb.h>
  18. #include <asm/setup.h>
  19. #include <asm/mach/arch.h>
  20. #include <asm/mach-types.h>
  21. #include <mach/mfp-pxa25x.h>
  22. #include <mach/hardware.h>
  23. #include <mach/eseries-gpio.h>
  24. #include <mach/udc.h>
  25. #include "generic.h"
  26. #include "eseries.h"
  27. /* ------------------------ e800 LCD definitions ------------------------- */
  28. static struct w100_gen_regs e800_lcd_regs = {
  29. .lcd_format = 0x00008003,
  30. .lcdd_cntl1 = 0x02a00000,
  31. .lcdd_cntl2 = 0x0003ffff,
  32. .genlcd_cntl1 = 0x000ff2a3,
  33. .genlcd_cntl2 = 0x000002a3,
  34. .genlcd_cntl3 = 0x000102aa,
  35. };
  36. static struct w100_mode e800_lcd_mode[2] = {
  37. [0] = {
  38. .xres = 480,
  39. .yres = 640,
  40. .left_margin = 52,
  41. .right_margin = 148,
  42. .upper_margin = 2,
  43. .lower_margin = 6,
  44. .crtc_ss = 0x80350034,
  45. .crtc_ls = 0x802b0026,
  46. .crtc_gs = 0x80160016,
  47. .crtc_vpos_gs = 0x00020003,
  48. .crtc_rev = 0x0040001d,
  49. .crtc_dclk = 0xe0000000,
  50. .crtc_gclk = 0x82a50049,
  51. .crtc_goe = 0x80ee001c,
  52. .crtc_ps1_active = 0x00000000,
  53. .pll_freq = 128,
  54. .pixclk_divider = 4,
  55. .pixclk_divider_rotated = 6,
  56. .pixclk_src = CLK_SRC_PLL,
  57. .sysclk_divider = 0,
  58. .sysclk_src = CLK_SRC_PLL,
  59. },
  60. [1] = {
  61. .xres = 240,
  62. .yres = 320,
  63. .left_margin = 15,
  64. .right_margin = 88,
  65. .upper_margin = 0,
  66. .lower_margin = 7,
  67. .crtc_ss = 0xd010000f,
  68. .crtc_ls = 0x80070003,
  69. .crtc_gs = 0x80000000,
  70. .crtc_vpos_gs = 0x01460147,
  71. .crtc_rev = 0x00400003,
  72. .crtc_dclk = 0xa1700030,
  73. .crtc_gclk = 0x814b0008,
  74. .crtc_goe = 0x80cc0015,
  75. .crtc_ps1_active = 0x00000000,
  76. .pll_freq = 100,
  77. .pixclk_divider = 6, /* Wince uses 14 which gives a */
  78. .pixclk_divider_rotated = 6, /* 7MHz Pclk. We use a 14MHz one */
  79. .pixclk_src = CLK_SRC_PLL,
  80. .sysclk_divider = 0,
  81. .sysclk_src = CLK_SRC_PLL,
  82. }
  83. };
  84. static struct w100_gpio_regs e800_w100_gpio_info = {
  85. .init_data1 = 0xc13fc019,
  86. .gpio_dir1 = 0x3e40df7f,
  87. .gpio_oe1 = 0x003c3000,
  88. .init_data2 = 0x00000000,
  89. .gpio_dir2 = 0x00000000,
  90. .gpio_oe2 = 0x00000000,
  91. };
  92. static struct w100_mem_info e800_w100_mem_info = {
  93. .ext_cntl = 0x09640011,
  94. .sdram_mode_reg = 0x00600021,
  95. .ext_timing_cntl = 0x10001545,
  96. .io_cntl = 0x7ddd7333,
  97. .size = 0x1fffff,
  98. };
  99. static void e800_tg_change(struct w100fb_par *par)
  100. {
  101. unsigned long tmp;
  102. tmp = w100fb_gpio_read(W100_GPIO_PORT_A);
  103. if (par->mode->xres == 480)
  104. tmp |= 0x100;
  105. else
  106. tmp &= ~0x100;
  107. w100fb_gpio_write(W100_GPIO_PORT_A, tmp);
  108. }
  109. static struct w100_tg_info e800_tg_info = {
  110. .change = e800_tg_change,
  111. };
  112. static struct w100fb_mach_info e800_fb_info = {
  113. .modelist = e800_lcd_mode,
  114. .num_modes = 2,
  115. .regs = &e800_lcd_regs,
  116. .gpio = &e800_w100_gpio_info,
  117. .mem = &e800_w100_mem_info,
  118. .tg = &e800_tg_info,
  119. .xtal_freq = 16000000,
  120. };
  121. static struct resource e800_fb_resources[] = {
  122. [0] = {
  123. .start = 0x0c000000,
  124. .end = 0x0cffffff,
  125. .flags = IORESOURCE_MEM,
  126. },
  127. };
  128. static struct platform_device e800_fb_device = {
  129. .name = "w100fb",
  130. .id = -1,
  131. .dev = {
  132. .platform_data = &e800_fb_info,
  133. },
  134. .num_resources = ARRAY_SIZE(e800_fb_resources),
  135. .resource = e800_fb_resources,
  136. };
  137. /* --------------------------- UDC definitions --------------------------- */
  138. static struct pxa2xx_udc_mach_info e800_udc_mach_info = {
  139. .gpio_vbus = GPIO_E800_USB_DISC,
  140. .gpio_pullup = GPIO_E800_USB_PULLUP,
  141. .gpio_pullup_inverted = 1
  142. };
  143. /* ----------------------------------------------------------------------- */
  144. static struct platform_device *devices[] __initdata = {
  145. &e800_fb_device,
  146. };
  147. static void __init e800_init(void)
  148. {
  149. platform_add_devices(devices, ARRAY_SIZE(devices));
  150. pxa_set_udc_info(&e800_udc_mach_info);
  151. }
  152. MACHINE_START(E800, "Toshiba e800")
  153. /* Maintainer: Ian Molton (spyro@f2s.com) */
  154. .phys_io = 0x40000000,
  155. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  156. .boot_params = 0xa0000100,
  157. .map_io = pxa_map_io,
  158. .init_irq = pxa25x_init_irq,
  159. .fixup = eseries_fixup,
  160. .init_machine = e800_init,
  161. .timer = &pxa_timer,
  162. MACHINE_END