tdfx.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. #ifndef _TDFX_H
  2. #define _TDFX_H
  3. #include <linux/i2c.h>
  4. #include <linux/i2c-algo-bit.h>
  5. /* membase0 register offsets */
  6. #define STATUS 0x00
  7. #define PCIINIT0 0x04
  8. #define SIPMONITOR 0x08
  9. #define LFBMEMORYCONFIG 0x0c
  10. #define MISCINIT0 0x10
  11. #define MISCINIT1 0x14
  12. #define DRAMINIT0 0x18
  13. #define DRAMINIT1 0x1c
  14. #define AGPINIT 0x20
  15. #define TMUGBEINIT 0x24
  16. #define VGAINIT0 0x28
  17. #define VGAINIT1 0x2c
  18. #define DRAMCOMMAND 0x30
  19. #define DRAMDATA 0x34
  20. /* reserved 0x38 */
  21. /* reserved 0x3c */
  22. #define PLLCTRL0 0x40
  23. #define PLLCTRL1 0x44
  24. #define PLLCTRL2 0x48
  25. #define DACMODE 0x4c
  26. #define DACADDR 0x50
  27. #define DACDATA 0x54
  28. #define RGBMAXDELTA 0x58
  29. #define VIDPROCCFG 0x5c
  30. #define HWCURPATADDR 0x60
  31. #define HWCURLOC 0x64
  32. #define HWCURC0 0x68
  33. #define HWCURC1 0x6c
  34. #define VIDINFORMAT 0x70
  35. #define VIDINSTATUS 0x74
  36. #define VIDSERPARPORT 0x78
  37. #define VIDINXDELTA 0x7c
  38. #define VIDININITERR 0x80
  39. #define VIDINYDELTA 0x84
  40. #define VIDPIXBUFTHOLD 0x88
  41. #define VIDCHRMIN 0x8c
  42. #define VIDCHRMAX 0x90
  43. #define VIDCURLIN 0x94
  44. #define VIDSCREENSIZE 0x98
  45. #define VIDOVRSTARTCRD 0x9c
  46. #define VIDOVRENDCRD 0xa0
  47. #define VIDOVRDUDX 0xa4
  48. #define VIDOVRDUDXOFF 0xa8
  49. #define VIDOVRDVDY 0xac
  50. /* ... */
  51. #define VIDOVRDVDYOFF 0xe0
  52. #define VIDDESKSTART 0xe4
  53. #define VIDDESKSTRIDE 0xe8
  54. #define VIDINADDR0 0xec
  55. #define VIDINADDR1 0xf0
  56. #define VIDINADDR2 0xf4
  57. #define VIDINSTRIDE 0xf8
  58. #define VIDCUROVRSTART 0xfc
  59. #define INTCTRL (0x00100000 + 0x04)
  60. #define CLIP0MIN (0x00100000 + 0x08)
  61. #define CLIP0MAX (0x00100000 + 0x0c)
  62. #define DSTBASE (0x00100000 + 0x10)
  63. #define DSTFORMAT (0x00100000 + 0x14)
  64. #define SRCBASE (0x00100000 + 0x34)
  65. #define COMMANDEXTRA_2D (0x00100000 + 0x38)
  66. #define CLIP1MIN (0x00100000 + 0x4c)
  67. #define CLIP1MAX (0x00100000 + 0x50)
  68. #define SRCFORMAT (0x00100000 + 0x54)
  69. #define SRCSIZE (0x00100000 + 0x58)
  70. #define SRCXY (0x00100000 + 0x5c)
  71. #define COLORBACK (0x00100000 + 0x60)
  72. #define COLORFORE (0x00100000 + 0x64)
  73. #define DSTSIZE (0x00100000 + 0x68)
  74. #define DSTXY (0x00100000 + 0x6c)
  75. #define COMMAND_2D (0x00100000 + 0x70)
  76. #define LAUNCH_2D (0x00100000 + 0x80)
  77. #define COMMAND_3D (0x00200000 + 0x120)
  78. /* register bitfields (not all, only as needed) */
  79. /* COMMAND_2D reg. values */
  80. #define TDFX_ROP_COPY 0xcc /* src */
  81. #define TDFX_ROP_INVERT 0x55 /* NOT dst */
  82. #define TDFX_ROP_XOR 0x66 /* src XOR dst */
  83. #define AUTOINC_DSTX BIT(10)
  84. #define AUTOINC_DSTY BIT(11)
  85. #define COMMAND_2D_FILLRECT 0x05
  86. #define COMMAND_2D_S2S_BITBLT 0x01 /* screen to screen */
  87. #define COMMAND_2D_H2S_BITBLT 0x03 /* host to screen */
  88. #define COMMAND_3D_NOP 0x00
  89. #define STATUS_RETRACE BIT(6)
  90. #define STATUS_BUSY BIT(9)
  91. #define MISCINIT1_CLUT_INV BIT(0)
  92. #define MISCINIT1_2DBLOCK_DIS BIT(15)
  93. #define DRAMINIT0_SGRAM_NUM BIT(26)
  94. #define DRAMINIT0_SGRAM_TYPE BIT(27)
  95. #define DRAMINIT0_SGRAM_TYPE_MASK (BIT(27) | BIT(28) | BIT(29))
  96. #define DRAMINIT0_SGRAM_TYPE_SHIFT 27
  97. #define DRAMINIT1_MEM_SDRAM BIT(30)
  98. #define VGAINIT0_VGA_DISABLE BIT(0)
  99. #define VGAINIT0_EXT_TIMING BIT(1)
  100. #define VGAINIT0_8BIT_DAC BIT(2)
  101. #define VGAINIT0_EXT_ENABLE BIT(6)
  102. #define VGAINIT0_WAKEUP_3C3 BIT(8)
  103. #define VGAINIT0_LEGACY_DISABLE BIT(9)
  104. #define VGAINIT0_ALT_READBACK BIT(10)
  105. #define VGAINIT0_FAST_BLINK BIT(11)
  106. #define VGAINIT0_EXTSHIFTOUT BIT(12)
  107. #define VGAINIT0_DECODE_3C6 BIT(13)
  108. #define VGAINIT0_SGRAM_HBLANK_DISABLE BIT(22)
  109. #define VGAINIT1_MASK 0x1fffff
  110. #define VIDCFG_VIDPROC_ENABLE BIT(0)
  111. #define VIDCFG_CURS_X11 BIT(1)
  112. #define VIDCFG_INTERLACE BIT(3)
  113. #define VIDCFG_HALF_MODE BIT(4)
  114. #define VIDCFG_DESK_ENABLE BIT(7)
  115. #define VIDCFG_CLUT_BYPASS BIT(10)
  116. #define VIDCFG_2X BIT(26)
  117. #define VIDCFG_HWCURSOR_ENABLE BIT(27)
  118. #define VIDCFG_PIXFMT_SHIFT 18
  119. #define DACMODE_2X BIT(0)
  120. /* I2C bit locations in the VIDSERPARPORT register */
  121. #define DDC_ENAB 0x00040000
  122. #define DDC_SCL_OUT 0x00080000
  123. #define DDC_SDA_OUT 0x00100000
  124. #define DDC_SCL_IN 0x00200000
  125. #define DDC_SDA_IN 0x00400000
  126. #define I2C_ENAB 0x00800000
  127. #define I2C_SCL_OUT 0x01000000
  128. #define I2C_SDA_OUT 0x02000000
  129. #define I2C_SCL_IN 0x04000000
  130. #define I2C_SDA_IN 0x08000000
  131. /* VGA rubbish, need to change this for multihead support */
  132. #define MISC_W 0x3c2
  133. #define MISC_R 0x3cc
  134. #define SEQ_I 0x3c4
  135. #define SEQ_D 0x3c5
  136. #define CRT_I 0x3d4
  137. #define CRT_D 0x3d5
  138. #define ATT_IW 0x3c0
  139. #define IS1_R 0x3da
  140. #define GRA_I 0x3ce
  141. #define GRA_D 0x3cf
  142. #ifdef __KERNEL__
  143. struct banshee_reg {
  144. /* VGA rubbish */
  145. unsigned char att[21];
  146. unsigned char crt[25];
  147. unsigned char gra[9];
  148. unsigned char misc[1];
  149. unsigned char seq[5];
  150. /* Banshee extensions */
  151. unsigned char ext[2];
  152. unsigned long vidcfg;
  153. unsigned long vidpll;
  154. unsigned long mempll;
  155. unsigned long gfxpll;
  156. unsigned long dacmode;
  157. unsigned long vgainit0;
  158. unsigned long vgainit1;
  159. unsigned long screensize;
  160. unsigned long stride;
  161. unsigned long cursloc;
  162. unsigned long curspataddr;
  163. unsigned long cursc0;
  164. unsigned long cursc1;
  165. unsigned long startaddr;
  166. unsigned long clip0min;
  167. unsigned long clip0max;
  168. unsigned long clip1min;
  169. unsigned long clip1max;
  170. unsigned long miscinit0;
  171. };
  172. struct tdfx_par;
  173. struct tdfxfb_i2c_chan {
  174. struct tdfx_par *par;
  175. struct i2c_adapter adapter;
  176. struct i2c_algo_bit_data algo;
  177. };
  178. struct tdfx_par {
  179. u32 max_pixclock;
  180. u32 palette[16];
  181. void __iomem *regbase_virt;
  182. unsigned long iobase;
  183. int wc_cookie;
  184. #ifdef CONFIG_FB_3DFX_I2C
  185. struct tdfxfb_i2c_chan chan[2];
  186. #endif
  187. };
  188. #endif /* __KERNEL__ */
  189. #endif /* _TDFX_H */