himalaya.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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 <mach/pxa-regs.h>
  26. #include <mach/pxa2xx-regs.h>
  27. #include "generic.h"
  28. /* ---------------------- Himalaya LCD definitions -------------------- */
  29. static struct w100_gen_regs himalaya_lcd_regs = {
  30. .lcd_format = 0x00000003,
  31. .lcdd_cntl1 = 0x00000000,
  32. .lcdd_cntl2 = 0x0003ffff,
  33. .genlcd_cntl1 = 0x00fff003,
  34. .genlcd_cntl2 = 0x00000003,
  35. .genlcd_cntl3 = 0x000102aa,
  36. };
  37. static struct w100_mode himalaya4_lcd_mode = {
  38. .xres = 240,
  39. .yres = 320,
  40. .left_margin = 0,
  41. .right_margin = 31,
  42. .upper_margin = 15,
  43. .lower_margin = 0,
  44. .crtc_ss = 0x80150014,
  45. .crtc_ls = 0xa0fb00f7,
  46. .crtc_gs = 0xc0080007,
  47. .crtc_vpos_gs = 0x00080007,
  48. .crtc_rev = 0x0000000a,
  49. .crtc_dclk = 0x81700030,
  50. .crtc_gclk = 0x8015010f,
  51. .crtc_goe = 0x00000000,
  52. .pll_freq = 80,
  53. .pixclk_divider = 15,
  54. .pixclk_divider_rotated = 15,
  55. .pixclk_src = CLK_SRC_PLL,
  56. .sysclk_divider = 0,
  57. .sysclk_src = CLK_SRC_PLL,
  58. };
  59. static struct w100_mode himalaya6_lcd_mode = {
  60. .xres = 240,
  61. .yres = 320,
  62. .left_margin = 9,
  63. .right_margin = 8,
  64. .upper_margin = 5,
  65. .lower_margin = 4,
  66. .crtc_ss = 0x80150014,
  67. .crtc_ls = 0xa0fb00f7,
  68. .crtc_gs = 0xc0080007,
  69. .crtc_vpos_gs = 0x00080007,
  70. .crtc_rev = 0x0000000a,
  71. .crtc_dclk = 0xa1700030,
  72. .crtc_gclk = 0x8015010f,
  73. .crtc_goe = 0x00000000,
  74. .pll_freq = 95,
  75. .pixclk_divider = 0xb,
  76. .pixclk_divider_rotated = 4,
  77. .pixclk_src = CLK_SRC_PLL,
  78. .sysclk_divider = 1,
  79. .sysclk_src = CLK_SRC_PLL,
  80. };
  81. static struct w100_gpio_regs himalaya_w100_gpio_info = {
  82. .init_data1 = 0xffff0000, /* GPIO_DATA */
  83. .gpio_dir1 = 0x00000000, /* GPIO_CNTL1 */
  84. .gpio_oe1 = 0x003c0000, /* GPIO_CNTL2 */
  85. .init_data2 = 0x00000000, /* GPIO_DATA2 */
  86. .gpio_dir2 = 0x00000000, /* GPIO_CNTL3 */
  87. .gpio_oe2 = 0x00000000, /* GPIO_CNTL4 */
  88. };
  89. static struct w100fb_mach_info himalaya_fb_info = {
  90. .num_modes = 1,
  91. .regs = &himalaya_lcd_regs,
  92. .gpio = &himalaya_w100_gpio_info,
  93. .xtal_freq = 16000000,
  94. };
  95. static struct resource himalaya_fb_resources[] = {
  96. [0] = {
  97. .start = 0x08000000,
  98. .end = 0x08ffffff,
  99. .flags = IORESOURCE_MEM,
  100. },
  101. };
  102. static struct platform_device himalaya_fb_device = {
  103. .name = "w100fb",
  104. .id = -1,
  105. .dev = {
  106. .platform_data = &himalaya_fb_info,
  107. },
  108. .num_resources = ARRAY_SIZE(himalaya_fb_resources),
  109. .resource = himalaya_fb_resources,
  110. };
  111. /* ----------------------------------------------------------------------- */
  112. static struct platform_device *devices[] __initdata = {
  113. &himalaya_fb_device,
  114. };
  115. static void __init himalaya_lcd_init(void)
  116. {
  117. int himalaya_boardid;
  118. himalaya_boardid = 0x4; /* hardcoded (detection needs ASIC3 functions) */
  119. printk(KERN_INFO "himalaya LCD Driver init. boardid=%d\n",
  120. himalaya_boardid);
  121. switch (himalaya_boardid) {
  122. case 0x4:
  123. himalaya_fb_info.modelist = &himalaya4_lcd_mode;
  124. break;
  125. case 0x6:
  126. himalaya_fb_info.modelist = &himalaya6_lcd_mode;
  127. break;
  128. default:
  129. printk(KERN_INFO "himalaya lcd_init: unknown boardid=%d. Using 0x4\n",
  130. himalaya_boardid);
  131. himalaya_fb_info.modelist = &himalaya4_lcd_mode;
  132. }
  133. }
  134. static void __init himalaya_init(void)
  135. {
  136. himalaya_lcd_init();
  137. platform_add_devices(devices, ARRAY_SIZE(devices));
  138. }
  139. MACHINE_START(HIMALAYA, "HTC Himalaya")
  140. .phys_io = 0x40000000,
  141. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  142. .boot_params = 0xa0000100,
  143. .map_io = pxa_map_io,
  144. .init_irq = pxa25x_init_irq,
  145. .init_machine = himalaya_init,
  146. .timer = &pxa_timer,
  147. MACHINE_END