himalaya.c 3.9 KB

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