himalaya.c 4.1 KB

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