w100fb.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*
  2. * Support for the w100 frame buffer.
  3. *
  4. * Copyright (c) 2004-2005 Richard Purdie
  5. * Copyright (c) 2005 Ian Molton
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #define W100_GPIO_PORT_A 0
  12. #define W100_GPIO_PORT_B 1
  13. #define CLK_SRC_XTAL 0
  14. #define CLK_SRC_PLL 1
  15. struct w100fb_par;
  16. unsigned long w100fb_gpio_read(int port);
  17. void w100fb_gpio_write(int port, unsigned long value);
  18. unsigned long w100fb_get_hsynclen(struct device *dev);
  19. /* LCD Specific Routines and Config */
  20. struct w100_tg_info {
  21. void (*change)(struct w100fb_par*);
  22. void (*suspend)(struct w100fb_par*);
  23. void (*resume)(struct w100fb_par*);
  24. };
  25. /* General Platform Specific w100 Register Values */
  26. struct w100_gen_regs {
  27. unsigned long lcd_format;
  28. unsigned long lcdd_cntl1;
  29. unsigned long lcdd_cntl2;
  30. unsigned long genlcd_cntl1;
  31. unsigned long genlcd_cntl2;
  32. unsigned long genlcd_cntl3;
  33. };
  34. struct w100_gpio_regs {
  35. unsigned long init_data1;
  36. unsigned long init_data2;
  37. unsigned long gpio_dir1;
  38. unsigned long gpio_oe1;
  39. unsigned long gpio_dir2;
  40. unsigned long gpio_oe2;
  41. };
  42. /* Optional External Memory Configuration */
  43. struct w100_mem_info {
  44. unsigned long ext_cntl;
  45. unsigned long sdram_mode_reg;
  46. unsigned long ext_timing_cntl;
  47. unsigned long io_cntl;
  48. unsigned int size;
  49. };
  50. struct w100_bm_mem_info {
  51. unsigned long ext_mem_bw;
  52. unsigned long offset;
  53. unsigned long ext_timing_ctl;
  54. unsigned long ext_cntl;
  55. unsigned long mode_reg;
  56. unsigned long io_cntl;
  57. unsigned long config;
  58. };
  59. /* LCD Mode definition */
  60. struct w100_mode {
  61. unsigned int xres;
  62. unsigned int yres;
  63. unsigned short left_margin;
  64. unsigned short right_margin;
  65. unsigned short upper_margin;
  66. unsigned short lower_margin;
  67. unsigned long crtc_ss;
  68. unsigned long crtc_ls;
  69. unsigned long crtc_gs;
  70. unsigned long crtc_vpos_gs;
  71. unsigned long crtc_rev;
  72. unsigned long crtc_dclk;
  73. unsigned long crtc_gclk;
  74. unsigned long crtc_goe;
  75. unsigned long crtc_ps1_active;
  76. char pll_freq;
  77. char fast_pll_freq;
  78. int sysclk_src;
  79. int sysclk_divider;
  80. int pixclk_src;
  81. int pixclk_divider;
  82. int pixclk_divider_rotated;
  83. };
  84. struct w100_pll_info {
  85. uint16_t freq; /* desired Fout for PLL (Mhz) */
  86. uint8_t M; /* input divider */
  87. uint8_t N_int; /* VCO multiplier */
  88. uint8_t N_fac; /* VCO multiplier fractional part */
  89. uint8_t tfgoal;
  90. uint8_t lock_time;
  91. };
  92. /* Initial Video mode orientation flags */
  93. #define INIT_MODE_ROTATED 0x1
  94. #define INIT_MODE_FLIPPED 0x2
  95. /*
  96. * This structure describes the machine which we are running on.
  97. * It is set by machine specific code and used in the probe routine
  98. * of drivers/video/w100fb.c
  99. */
  100. struct w100fb_mach_info {
  101. /* General Platform Specific Registers */
  102. struct w100_gen_regs *regs;
  103. /* Table of modes the LCD is capable of */
  104. struct w100_mode *modelist;
  105. unsigned int num_modes;
  106. /* Hooks for any platform specific tg/lcd code (optional) */
  107. struct w100_tg_info *tg;
  108. /* External memory definition (if present) */
  109. struct w100_mem_info *mem;
  110. /* Additional External memory definition (if present) */
  111. struct w100_bm_mem_info *bm_mem;
  112. /* GPIO definitions (optional) */
  113. struct w100_gpio_regs *gpio;
  114. /* Initial Mode flags */
  115. unsigned int init_mode;
  116. /* Xtal Frequency */
  117. unsigned int xtal_freq;
  118. /* Enable Xtal input doubler (1 == enable) */
  119. unsigned int xtal_dbl;
  120. };
  121. /* General frame buffer data structure */
  122. struct w100fb_par {
  123. unsigned int chip_id;
  124. unsigned int xres;
  125. unsigned int yres;
  126. unsigned int extmem_active;
  127. unsigned int flip;
  128. unsigned int blanked;
  129. unsigned int fastpll_mode;
  130. unsigned long hsync_len;
  131. struct w100_mode *mode;
  132. struct w100_pll_info *pll_table;
  133. struct w100fb_mach_info *mach;
  134. uint32_t *saved_intmem;
  135. uint32_t *saved_extmem;
  136. };