w100fb.h 3.7 KB

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