himalaya.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. * linux/arch/arm/mach-pxa/himalaya.c
  3. *
  4. * Hardware definitions for the HTC Himalaya
  5. *
  6. * Based on 2.6.21-hh20's himalaya.c and himalaya_lcd.c
  7. *
  8. * Copyright (c) 2008 Zbynek Michl <Zbynek.Michl@seznam.cz>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/device.h>
  17. #include <linux/fb.h>
  18. #include <linux/platform_device.h>
  19. #include <video/w100fb.h>
  20. #include <asm/setup.h>
  21. #include <asm/mach-types.h>
  22. #include <asm/mach/arch.h>
  23. #include <mach/mfp-pxa25x.h>
  24. #include <mach/hardware.h>
  25. #include "generic.h"
  26. /* ---------------------- Himalaya LCD definitions -------------------- */
  27. static struct w100_gen_regs himalaya_lcd_regs = {
  28. .lcd_format = 0x00000003,
  29. .lcdd_cntl1 = 0x00000000,
  30. .lcdd_cntl2 = 0x0003ffff,
  31. .genlcd_cntl1 = 0x00fff003,
  32. .genlcd_cntl2 = 0x00000003,
  33. .genlcd_cntl3 = 0x000102aa,
  34. };
  35. static struct w100_mode himalaya4_lcd_mode = {
  36. .xres = 240,
  37. .yres = 320,
  38. .left_margin = 0,
  39. .right_margin = 31,
  40. .upper_margin = 15,
  41. .lower_margin = 0,
  42. .crtc_ss = 0x80150014,
  43. .crtc_ls = 0xa0fb00f7,
  44. .crtc_gs = 0xc0080007,
  45. .crtc_vpos_gs = 0x00080007,
  46. .crtc_rev = 0x0000000a,
  47. .crtc_dclk = 0x81700030,
  48. .crtc_gclk = 0x8015010f,
  49. .crtc_goe = 0x00000000,
  50. .pll_freq = 80,
  51. .pixclk_divider = 15,
  52. .pixclk_divider_rotated = 15,
  53. .pixclk_src = CLK_SRC_PLL,
  54. .sysclk_divider = 0,
  55. .sysclk_src = CLK_SRC_PLL,
  56. };
  57. static struct w100_mode himalaya6_lcd_mode = {
  58. .xres = 240,
  59. .yres = 320,
  60. .left_margin = 9,
  61. .right_margin = 8,
  62. .upper_margin = 5,
  63. .lower_margin = 4,
  64. .crtc_ss = 0x80150014,
  65. .crtc_ls = 0xa0fb00f7,
  66. .crtc_gs = 0xc0080007,
  67. .crtc_vpos_gs = 0x00080007,
  68. .crtc_rev = 0x0000000a,
  69. .crtc_dclk = 0xa1700030,
  70. .crtc_gclk = 0x8015010f,
  71. .crtc_goe = 0x00000000,
  72. .pll_freq = 95,
  73. .pixclk_divider = 0xb,
  74. .pixclk_divider_rotated = 4,
  75. .pixclk_src = CLK_SRC_PLL,
  76. .sysclk_divider = 1,
  77. .sysclk_src = CLK_SRC_PLL,
  78. };
  79. static struct w100_gpio_regs himalaya_w100_gpio_info = {
  80. .init_data1 = 0xffff0000, /* GPIO_DATA */
  81. .gpio_dir1 = 0x00000000, /* GPIO_CNTL1 */
  82. .gpio_oe1 = 0x003c0000, /* GPIO_CNTL2 */
  83. .init_data2 = 0x00000000, /* GPIO_DATA2 */
  84. .gpio_dir2 = 0x00000000, /* GPIO_CNTL3 */
  85. .gpio_oe2 = 0x00000000, /* GPIO_CNTL4 */
  86. };
  87. static struct w100fb_mach_info himalaya_fb_info = {
  88. .num_modes = 1,
  89. .regs = &himalaya_lcd_regs,
  90. .gpio = &himalaya_w100_gpio_info,
  91. .xtal_freq = 16000000,
  92. };
  93. static struct resource himalaya_fb_resources[] = {
  94. [0] = {
  95. .start = 0x08000000,
  96. .end = 0x08ffffff,
  97. .flags = IORESOURCE_MEM,
  98. },
  99. };
  100. static struct platform_device himalaya_fb_device = {
  101. .name = "w100fb",
  102. .id = -1,
  103. .dev = {
  104. .platform_data = &himalaya_fb_info,
  105. },
  106. .num_resources = ARRAY_SIZE(himalaya_fb_resources),
  107. .resource = himalaya_fb_resources,
  108. };
  109. /* ----------------------------------------------------------------------- */
  110. static struct platform_device *devices[] __initdata = {
  111. &himalaya_fb_device,
  112. };
  113. static void __init himalaya_lcd_init(void)
  114. {
  115. int himalaya_boardid;
  116. himalaya_boardid = 0x4; /* hardcoded (detection needs ASIC3 functions) */
  117. printk(KERN_INFO "himalaya LCD Driver init. boardid=%d\n",
  118. himalaya_boardid);
  119. switch (himalaya_boardid) {
  120. case 0x4:
  121. himalaya_fb_info.modelist = &himalaya4_lcd_mode;
  122. break;
  123. case 0x6:
  124. himalaya_fb_info.modelist = &himalaya6_lcd_mode;
  125. break;
  126. default:
  127. printk(KERN_INFO "himalaya lcd_init: unknown boardid=%d. Using 0x4\n",
  128. himalaya_boardid);
  129. himalaya_fb_info.modelist = &himalaya4_lcd_mode;
  130. }
  131. }
  132. static void __init himalaya_init(void)
  133. {
  134. himalaya_lcd_init();
  135. platform_add_devices(devices, ARRAY_SIZE(devices));
  136. }
  137. MACHINE_START(HIMALAYA, "HTC Himalaya")
  138. .phys_io = 0x40000000,
  139. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  140. .boot_params = 0xa0000100,
  141. .map_io = pxa_map_io,
  142. .init_irq = pxa25x_init_irq,
  143. .init_machine = himalaya_init,
  144. .timer = &pxa_timer,
  145. MACHINE_END