w100fb.h 3.6 KB

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