tdfx.h 5.3 KB

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