cfxgareg.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. /* $OpenBSD: cfxgareg.h,v 1.5 2006/11/28 12:01:27 miod Exp $ */
  2. /*
  3. * Copyright (c) 2005, 2006, Matthieu Herrb and Miodrag Vallat
  4. *
  5. * Permission to use, copy, modify, and distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. /*
  18. * S1D13806 Registers.
  19. * Registers larger than 8 bits are little-endian.
  20. */
  21. /* Revision code register - RO */
  22. #define CFREG_REV 0x0000
  23. #define CR_REV_MASK 0x03 /* revision code */
  24. #define CR_REV_SHIFT 0
  25. #define CR_PRODUCT_MASK 0xfc /* product code */
  26. #define CR_PRODUCT_SHIFT 2
  27. #define PRODUCT_S1D13806 0x07
  28. /* Miscellaneous register - RW */
  29. #define CFREG_MISC 0x0001
  30. #define CM_MEMSEL 0x00
  31. #define CM_REGSEL 0x80 /* register/memory select */
  32. /* General IO pins configuration register - RW, 12 bits */
  33. #define CFREG_GPIO_CONF 0x0004
  34. /* General IO pins control register - RW, 12 bits */
  35. #define CFREG_GPIO_CTRL 0x0008
  36. /* Configuration status register - RO */
  37. #define CFREG_STATUS 0x000c
  38. /* Memory clock configuration register - RW, needs 16 bits access */
  39. #define CFREG_MEMCLK 0x0010
  40. #define MEMCLK_DIVIDE 0x10
  41. #define MEMCLK_SRC_CLKI 0x00
  42. #define MEMCLK_SRC_BUSCLK 0x01
  43. #define MEMCLK_SRC_CLK3 0x02
  44. /* LCD Pixel clock configuration register - RW */
  45. #define CFREG_LCD_PCLK 0x0014
  46. #define LCD_PCLK_SRC_CLKI 0x00
  47. #define LCD_PCLK_SRC_BUSCLK 0x01
  48. #define LCD_PCLK_SRC_CLKI2 0x02
  49. #define LCD_PCLK_SRC_MCLK 0x03
  50. #define LCD_PCLK_DIV_1 0x00
  51. #define LCD_PCLK_DIV_2 0x10
  52. #define LCD_PCLK_DIV_3 0x20
  53. #define LCD_PCLK_DIV_4 0x30
  54. /* CRT/TV Pixel clock configuration register - RW */
  55. #define CFREG_CRTTV_PCLK 0x0018
  56. #define CRT_PCLK_SRC_CLKI 0x00
  57. #define CRT_PCLK_SRC_BUSCLK 0x01
  58. #define CRT_PCLK_SRC_CLKI2 0x02
  59. #define CRT_PCLK_SRC_MCLK 0x03
  60. #define CRT_PCLK_DIV_1 0x00
  61. #define CRT_PCLK_DIV_2 0x10
  62. #define CRT_PCLK_DIV_3 0x20
  63. #define CRT_PCLK_DIV_4 0x30
  64. #define CRT_PCLK_DOUBLE 0x80
  65. /* MediaPlug clock configuration register - RW */
  66. #define CFREG_MPLUG_CLK 0x001c
  67. #define MPLUG_PCLK_SRC_CLKI 0x00
  68. #define MPLUG_PCLK_SRC_BUSCLK 0x01
  69. #define MPLUG_PCLK_SRC_CLKI2 0x02
  70. #define MPLUG_PCLK_SRC_MCLK 0x03
  71. #define MPLUG_PCLK_DIV_1 0x00
  72. #define MPLUG_PCLK_DIV_2 0x10
  73. #define MPLUG_PCLK_DIV_3 0x20
  74. #define MPLUG_PCLK_DIV_4 0x30
  75. /* CPU to memory wait state select register - RW */
  76. #define CFREG_WSTATE 0x001e
  77. #define WSTATE_NONE 0x00
  78. #define WSTATE_DUAL_MCLK 0x01
  79. #define WSTATE_MCLK 0x02
  80. /* Memory configuration register - RW */
  81. #define CFREG_MEMCNF 0x0020
  82. #define MEMCNF_SDRAM_INIT 0x80
  83. /* DRAM refresh rate register - RW */
  84. #define CFREG_DRAM_RFRSH 0x0021
  85. #define DRAM_RFRSH_8MHZ 0x00
  86. #define DRAM_RFRSH_16MHZ 0x01
  87. #define DRAM_RFRSH_32MHZ 0x02
  88. #define DRAM_RFRSH_50MHZ 0x03
  89. /* DRAM timing control register - RW, 10 bits */
  90. #define CFREG_DRAM_TIMING 0x002a
  91. #define DRAM_TIMING_33MHZ 0x0311
  92. #define DRAM_TIMING_44MHZ 0x0200
  93. #define DRAM_TIMING_50MHZ 0x0100
  94. /* Panel type register - RW */
  95. #define CFREG_PANEL 0x0030
  96. #define PANEL_PASSIVE 0x00
  97. #define PANEL_TFT 0x01
  98. #define PANEL_SINGLE 0x00
  99. #define PANEL_DUAL 0x02
  100. #define PANEL_MONO 0x00
  101. #define PANEL_COLOR 0x04
  102. #define PANEL_FORMAT_1X 0x00
  103. #define PANEL_FORMAT_2X 0x08
  104. #define PANEL_WIDTH_4_9 0x00 /* passive: 4 bits, TDT: 9/2x9 bits */
  105. #define PANEL_WIDTH_8_12 0x10 /* passive: 8 bits, TDT: 12/2x12 bits */
  106. #define PANEL_WIDTH_16_18 0x20 /* passive: 16 bits, TDT: 18 bits */
  107. /* MOD rate register - RW */
  108. #define CFREG_MODRATE 0x0031
  109. /* LCD horizontal display width register - RW */
  110. #define CFREG_LCD_HWIDTH 0x0032
  111. /* LCD horizontal non-display period register - RW */
  112. #define CFREG_LCD_HNDISP 0x0034
  113. /* TFT FPLINE start position register - RW */
  114. #define CFREG_TFT_FPLINE_START 0x0035
  115. /* TFT FPLINE pulse width register - RW */
  116. #define CFREG_TFT_FPLINE_WIDTH 0x0036
  117. #define TFT_FPLINE_POL_TFT_LOW 0x00
  118. #define TFT_FPLINE_POL_TFT_HIGH 0x80
  119. #define TFT_FPLINE_POL_PASSIVE_LOW 0x80
  120. #define TFT_FPLINE_POL_PASSIVE_HIGH 0x00
  121. /* LCD vertical display height - RW, 10 bits */
  122. #define CFREG_LCD_VHEIGHT 0x0038
  123. /* LCD vertical non-display period register - RW */
  124. #define CFREG_LCD_VNDISP 0x003a
  125. #define LCD_VNDISP_STATUS 0x80 /* read only */
  126. /* TFT FPFRAME start position register - RW */
  127. #define CFREG_TFT_FPFRAME_START 0x003b
  128. /* TFT FPFRAME pulse width register - RW */
  129. #define CFREG_TFT_FPFRAME_WIDTH 0x003c
  130. #define TFT_FPFRAME_POL_TFT_LOW 0x00
  131. #define TFT_FPFRAME_POL_TFT_HIGH 0x80
  132. #define TFT_FPFRAME_POL_PASSIVE_LOW 0x80
  133. #define TFT_FPFRAME_POL_PASSIVE_HIGH 0x00
  134. /* LCD line count register - RO */
  135. #define CFREG_LCD_LINECNT 0x003e
  136. /* LCD display mode register - RW */
  137. #define CFREG_LCD_MODE 0x0040
  138. #define LCD_MODE_4BPP 0x02
  139. #define LCD_MODE_8BPP 0x03
  140. #define LCD_MODE_15BPP 0x04
  141. #define LCD_MODE_16BPP 0x05
  142. #define LCD_MODE_SWIVEL_BIT1 0x10
  143. #define LCD_MODE_BLANK 0x80
  144. /* LCD miscellaneous register - RW */
  145. #define CFREG_LCD_MISC 0x0041
  146. #define LCD_MISC_DUAL_PANEL_BUFFER_DISABLE 0x01
  147. #define LCD_MISC_DITHERING_DISABLE 0x02
  148. /* LCD display start address - RW, 20 bits */
  149. #define CFREG_LCD_START_LOW 0x0042
  150. #define CFREG_LCD_START_HIGH 0x0044
  151. /* LCD memory address register - RW, 11 bits */
  152. #define CFREG_LCD_MEMORY 0x0046
  153. /* LCD pixel panning register - RW */
  154. #define CFREG_LCD_PANNING 0x0048
  155. #define PIXEL_PANNING_MASK_4BPP 0x03
  156. #define PIXEL_PANNING_MASK_8BPP 0x01
  157. #define PIXEL_PANNING_MASK_15BPP 0x00
  158. #define PIXEL_PANNING_MASK_16BPP 0x00
  159. /* LCD display FIFO high threshold control register - RW */
  160. #define CFREG_LCD_FIFO_THRESHOLD_HIGH 0x004a
  161. /* LCD display FIFO low threshold control register - RW */
  162. #define CFREG_LCD_FIFO_THRESHOLD_LOW 0x004b
  163. /* CRT/TV horizontal display width register - RW */
  164. #define CFREG_CRT_HWIDTH 0x0050
  165. /* CRT/TV horizontal non-display period register - RW */
  166. #define CFREG_CRT_HNDISP 0x0052
  167. /* CRT/TV HRTC start position register - RW */
  168. #define CFREG_CRT_HSTART 0x0053
  169. /* CRT/TV HRTC pulse width register - RW */
  170. #define CFREG_CRT_HPULSE 0x0054
  171. #define HRTC_POLARITY 0x80
  172. /* CRT/TV vertical display height register - RW, 10 bits */
  173. #define CFREG_CRT_VHEIGHT 0x0056
  174. /* CRT/TV vertical non-display period register - RW */
  175. #define CFREG_CRT_VNDISP 0x0058
  176. #define CRT_VNDISP_STATUS 0x80 /* RO */
  177. /* CRT/TV VRTC start position register - RW */
  178. #define CFREG_CRT_VSTART 0x0059
  179. /* CRT VRTC pulse width register - RW */
  180. #define CFREG_CRT_VPULSE 0x005a
  181. /* TV output control register - RW */
  182. #define CFREG_TV_CONTROL 0x005b
  183. #define TV_NTSC_OUTPUT 0x00
  184. #define TV_PAL_OUTPUT 0x01
  185. #define TV_COMPOSITE_OUTPUT 0x00
  186. #define TV_SVIDEO_OUTPUT 0x02
  187. #define TV_DAC_OUTPUT_HIGH 0x00 /* 9.2 mA IREF */
  188. #define TV_DAC_OUTPUT_LOW 0x08 /* 4.6 mA IREF - CRT only */
  189. #define TV_LUMINANCE_FILTER 0x10
  190. #define TV_CHROMINANCE_FILTER 0x20
  191. /* CRT/TV line count register - RW */
  192. #define CFREG_CRT_LINECNT 0x005e
  193. /* CRT/TV display mode register - RW */
  194. #define CFREG_CRT_MODE 0x0060
  195. #define CRT_MODE_4BPP 0x02
  196. #define CRT_MODE_8BPP 0x03
  197. #define CRT_MODE_15BPP 0x04
  198. #define CRT_MODE_16BPP 0x05
  199. #define CRT_MODE_BLANK 0x80
  200. /* CRT/TV display start address - RW, 20 bits */
  201. #define CFREG_CRT_START_LOW 0x0062
  202. #define CFREG_CRT_START_HIGH 0x0064
  203. /* CRT/TV memory address register - RW, 11 bits */
  204. #define CFREG_CRT_MEMORY 0x0066
  205. /* CRT/TV pixel panning register - RW */
  206. #define CFREG_CRT_PANNING 0x0068
  207. /* CRT/TV display FIFO high threshold control register - RW */
  208. #define CFREG_CRT_FIFO_THRESHOLD_HIGH 0x006a
  209. /* CRT/TV display FIFO low threshold control register - RW */
  210. #define CFREG_CRT_FIFO_THRESHOLD_LOW 0x006b
  211. /* LCD ink/cursor control register - RW */
  212. #define CFREG_LCD_CURSOR_CONTROL 0x0070
  213. #define CURSOR_INACTIVE 0x00
  214. #define CURSOR_CURSOR 0x01
  215. #define CURSOR_INK 0x02
  216. /* LCD ink/cursor start address register - RW */
  217. #define CFREG_LCD_CURSOR_ADDRESS 0x0071
  218. /* LCD cursor X position register - RW, 10 bits + sign */
  219. #define CFREG_LCD_CURSOR_X 0x0072
  220. #define LCD_CURSOR_X_SIGN 0x8000
  221. /* LCD cursor Y position register - RW, 10 bits + sign */
  222. #define CFREG_LCD_CURSOR_Y 0x0074
  223. #define LCD_CURSOR_Y_SIGN 0x8000
  224. /* LCD ink/cursor color registers - RW */
  225. #define CFREG_LCD_CURSOR_B0 0x0076 /* 5 bits */
  226. #define CFREG_LCD_CURSOR_G0 0x0077 /* 6 bits */
  227. #define CFREG_LCD_CURSOR_R0 0x0078 /* 5 bits */
  228. #define CFREG_LCD_CURSOR_B1 0x007a /* 5 bits */
  229. #define CFREG_LCD_CURSOR_G1 0x007b /* 6 bits */
  230. #define CFREG_LCD_CURSOR_R1 0x007c /* 5 bits */
  231. /* LCD ink/cursor FIFO threshold register - RW */
  232. #define CFREG_LCD_CURSOR_FIFO 0x007e
  233. /* CRT/TV ink/cursor control register - RW */
  234. #define CFREG_CRT_CURSOR_CONTROL 0x0080
  235. /* CRT/TV ink/cursor start address register - RW */
  236. #define CFREG_CRT_CURSOR_ADDRESS 0x0081
  237. /* CRT/TV cursor X position register - RW, 10 bits + sign */
  238. #define CFREG_CRT_CURSOR_X 0x0082
  239. #define CRT_CURSOR_X_SIGN 0x8000
  240. /* CRT/TV cursor Y position register - RW, 10 bits + sign */
  241. #define CFREG_CRT_CURSOR_Y 0x0084
  242. #define CRT_CURSOR_Y_SIGN 0x8000
  243. /* CRT/TV ink/cursor color registers - RW */
  244. #define CFREG_CRT_CURSOR_B0 0x0086 /* 5 bits */
  245. #define CFREG_CRT_CURSOR_G0 0x0087 /* 6 bits */
  246. #define CFREG_CRT_CURSOR_R0 0x0088 /* 5 bits */
  247. #define CFREG_CRT_CURSOR_B1 0x008a /* 5 bits */
  248. #define CFREG_CRT_CURSOR_G1 0x008b /* 6 bits */
  249. #define CFREG_CRT_CURSOR_R1 0x008c /* 5 bits */
  250. /* CRT/TV ink/cursor FIFO threshold register - RW */
  251. #define CFREG_CRT_CURSOR_FIFO 0x008e
  252. /* Bitblt control register - RW, 16 bits */
  253. #define CFREG_BITBLT_CONTROL 0x0100
  254. #define BITBLT_SRC_LINEAR 0x0001
  255. #define BITBLT_DST_LINEAR 0x0002
  256. #define BITBLT_FIFO_FULL 0x0010 /* RO */
  257. #define BITBLT_FIFO_HALF_FULL 0x0020 /* RO */
  258. #define BITBLT_FIFO_NOT_EMPTY 0x0040 /* RO */
  259. #define BITBLT_ACTIVE 0x0080
  260. #define BITBLT_COLOR_8 0x0000
  261. #define BITBLT_COLOR_16 0x0100
  262. /* Bitblt ROP code / color expansion register - RW */
  263. #define CFREG_BITBLT_ROP 0x0102
  264. #define CFREG_COLOR_EXPANSION 0x0102
  265. #define ROP_ZERO 0x00
  266. #define ROP_DST 0x0a
  267. #define ROP_SRC 0x0c
  268. #define ROP_ONES 0x0f
  269. /* Bitblt operation register - RW */
  270. #define CFREG_BITBLT_OPERATION 0x103
  271. #define OP_WRITE_ROP 0x00
  272. #define OP_READ 0x01
  273. #define OP_MOVE_POSITIVE_ROP 0x02
  274. #define OP_MOVE_NEGATIVE_ROP 0x03
  275. #define OP_TRANSPARENT_WRITE 0x04
  276. #define OP_TRANSPARENT_MOVE_POSITIVE 0x05
  277. #define OP_PATTERN_FILL_ROP 0x06
  278. #define OP_PATTERN_FILL_TRANSPARENCY 0x07
  279. #define OP_COLOR_EXPANSION 0x08
  280. #define OP_COLOR_EXPANSION_TRANSPARENCY 0x09
  281. #define OP_MOVE_COLOR_EXPANSION 0x0a
  282. #define OP_MOVE_COLOR_EXPANSION_TRANSPARENCY 0x0b
  283. #define OP_SOLID_FILL 0x0c
  284. /* Bitblt source address register - RW, 21 bits */
  285. #define CFREG_BITBLT_SRC_LOW 0x104
  286. #define CFREG_BITBLT_SRC_HIGH 0x106
  287. /* Bitblt destination start address register - RW, 21 bits */
  288. #define CFREG_BITBLT_DST_LOW 0x108
  289. #define CFREG_BITBLT_DST_HIGH 0x10a
  290. /* Bitblt memory address offset register - RW, 11 bits */
  291. #define CFREG_BITBLT_OFFSET 0x10c
  292. /* Bitblt width register - RW, 10 bits */
  293. #define CFREG_BITBLT_WIDTH 0x110
  294. /* Bitblt height register - RW, 10 bits */
  295. #define CFREG_BITBLT_HEIGHT 0x112
  296. /* Bitblt color registers - RW, 16 bits */
  297. #define CFREG_BITBLT_BG 0x114
  298. #define CFREG_BITBLT_FG 0x118
  299. /* Lookup table mode register - RW */
  300. #define CFREG_LUT_MODE 0x1e0
  301. #define LUT_BOTH 0x00 /* read LCD, write LCD and CRT/TV */
  302. #define LUT_LCD 0x01 /* read LCD, write LCD */
  303. #define LUT_CRT 0x02 /* read CRT/TV, write CRT/TV */
  304. /* LUT address register - RW */
  305. #define CFREG_LUT_ADDRESS 0x1e2
  306. /* LUT data register - RW */
  307. #define CFREG_LUT_DATA 0x1e4 /* data in the high 4 bits */
  308. /* Power save configuration register - RW */
  309. #define CFREG_POWER_CONF 0x1f0
  310. #define POWERSAVE_ENABLE 0x01
  311. #define POWERSAVE_MBO 0x10
  312. /* Power save status register - RW */
  313. #define CFREG_POWER_STATUS 0x1f1
  314. #define POWERSAVE_STATUS 0x01
  315. #define LCD_POWERSAVE_STATUS 0x02
  316. /* CPU to memory access watchdog timer register - RW */
  317. #define CFREG_WATCHDOG 0x1f4
  318. /* Display mode register - RW */
  319. #define CFREG_MODE 0x1fc
  320. #define MODE_NO_DISPLAY 0x00
  321. #define MODE_LCD 0x01 /* can be combined with all modes */
  322. #define MODE_CRT 0x02
  323. #define MODE_TV_NO_FLICKER 0x04
  324. #define MODE_TV_FLICKER 0x06
  325. #define LCD_MODE_SWIVEL_BIT_0 0x40
  326. /* BitBlt aperture */
  327. #define CFREG_BITBLT_DATA 0x0400
  328. #ifdef _KERNEL
  329. #define CFXGA_MEM_RANGE 0x0800
  330. #endif