gxfb.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. /*
  2. * Copyright (C) 2008 Andres Salomon <dilinger@debian.org>
  3. *
  4. * Geode GX2 register tables
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #ifndef _GXFB_H_
  12. #define _GXFB_H_
  13. #include <linux/io.h>
  14. /* Display Controller registers (table 6-38 from the data book) */
  15. enum dc_registers {
  16. DC_UNLOCK = 0,
  17. DC_GENERAL_CFG,
  18. DC_DISPLAY_CFG,
  19. DC_RSVD_0,
  20. DC_FB_ST_OFFSET,
  21. DC_CB_ST_OFFSET,
  22. DC_CURS_ST_OFFSET,
  23. DC_ICON_ST_OFFSET,
  24. DC_VID_Y_ST_OFFSET,
  25. DC_VID_U_ST_OFFSET,
  26. DC_VID_V_ST_OFFSET,
  27. DC_RSVD_1,
  28. DC_LINE_SIZE,
  29. DC_GFX_PITCH,
  30. DC_VID_YUV_PITCH,
  31. DC_RSVD_2,
  32. DC_H_ACTIVE_TIMING,
  33. DC_H_BLANK_TIMING,
  34. DC_H_SYNC_TIMING,
  35. DC_RSVD_3,
  36. DC_V_ACTIVE_TIMING,
  37. DC_V_BLANK_TIMING,
  38. DC_V_SYNC_TIMING,
  39. DC_RSVD_4,
  40. DC_CURSOR_X,
  41. DC_CURSOR_Y,
  42. DC_ICON_X,
  43. DC_LINE_CNT,
  44. DC_PAL_ADDRESS,
  45. DC_PAL_DATA,
  46. DC_DFIFO_DIAG,
  47. DC_CFIFO_DIAG,
  48. DC_VID_DS_DELTA,
  49. DC_GLIU0_MEM_OFFSET,
  50. DC_RSVD_5,
  51. DC_DV_ACC, /* 0x8c */
  52. };
  53. #define DC_UNLOCK_LOCK 0x00000000
  54. #define DC_UNLOCK_UNLOCK 0x00004758 /* magic value */
  55. #define DC_GENERAL_CFG_YUVM (1 << 20)
  56. #define DC_GENERAL_CFG_VDSE (1 << 19)
  57. #define DC_GENERAL_CFG_DFHPEL_SHIFT 12
  58. #define DC_GENERAL_CFG_DFHPSL_SHIFT 8
  59. #define DC_GENERAL_CFG_DECE (1 << 6)
  60. #define DC_GENERAL_CFG_CMPE (1 << 5)
  61. #define DC_GENERAL_CFG_VIDE (1 << 3)
  62. #define DC_GENERAL_CFG_ICNE (1 << 2)
  63. #define DC_GENERAL_CFG_CURE (1 << 1)
  64. #define DC_GENERAL_CFG_DFLE (1 << 0)
  65. #define DC_DISPLAY_CFG_A20M (1 << 31)
  66. #define DC_DISPLAY_CFG_A18M (1 << 30)
  67. #define DC_DISPLAY_CFG_PALB (1 << 25)
  68. #define DC_DISPLAY_CFG_DISP_MODE_24BPP (1 << 9)
  69. #define DC_DISPLAY_CFG_DISP_MODE_16BPP (1 << 8)
  70. #define DC_DISPLAY_CFG_DISP_MODE_8BPP (0)
  71. #define DC_DISPLAY_CFG_VDEN (1 << 4)
  72. #define DC_DISPLAY_CFG_GDEN (1 << 3)
  73. #define DC_DISPLAY_CFG_TGEN (1 << 0)
  74. /*
  75. * Video Processor registers (table 6-54).
  76. * There is space for 64 bit values, but we never use more than the
  77. * lower 32 bits. The actual register save/restore code only bothers
  78. * to restore those 32 bits.
  79. */
  80. enum vp_registers {
  81. VP_VCFG = 0,
  82. VP_DCFG,
  83. VP_VX,
  84. VP_VY,
  85. VP_VS,
  86. VP_VCK,
  87. VP_VCM,
  88. VP_GAR,
  89. VP_GDR,
  90. VP_RSVD_0,
  91. VP_MISC,
  92. VP_CCS,
  93. VP_RSVD_1,
  94. VP_RSVD_2,
  95. VP_RSVD_3,
  96. VP_VDC,
  97. VP_VCO,
  98. VP_CRC,
  99. VP_CRC32,
  100. VP_VDE,
  101. VP_CCK,
  102. VP_CCM,
  103. VP_CC1,
  104. VP_CC2,
  105. VP_A1X,
  106. VP_A1Y,
  107. VP_A1C,
  108. VP_A1T,
  109. VP_A2X,
  110. VP_A2Y,
  111. VP_A2C,
  112. VP_A2T,
  113. VP_A3X,
  114. VP_A3Y,
  115. VP_A3C,
  116. VP_A3T,
  117. VP_VRR,
  118. VP_AWT,
  119. VP_VTM, /* 0x130 */
  120. };
  121. #define VP_VCFG_VID_EN (1 << 0)
  122. #define VP_DCFG_DAC_VREF (1 << 26)
  123. #define VP_DCFG_GV_GAM (1 << 21)
  124. #define VP_DCFG_VG_CK (1 << 20)
  125. #define VP_DCFG_CRT_SYNC_SKW_DEFAULT (1 << 16)
  126. #define VP_DCFG_CRT_SYNC_SKW ((1 << 14) | (1 << 15) | (1 << 16))
  127. #define VP_DCFG_CRT_VSYNC_POL (1 << 9)
  128. #define VP_DCFG_CRT_HSYNC_POL (1 << 8)
  129. #define VP_DCFG_FP_DATA_EN (1 << 7) /* undocumented */
  130. #define VP_DCFG_FP_PWR_EN (1 << 6) /* undocumented */
  131. #define VP_DCFG_DAC_BL_EN (1 << 3)
  132. #define VP_DCFG_VSYNC_EN (1 << 2)
  133. #define VP_DCFG_HSYNC_EN (1 << 1)
  134. #define VP_DCFG_CRT_EN (1 << 0)
  135. #define VP_MISC_GAM_EN (1 << 0)
  136. #define VP_MISC_DACPWRDN (1 << 10)
  137. #define VP_MISC_APWRDN (1 << 11)
  138. /*
  139. * Flat Panel registers (table 6-55).
  140. * Also 64 bit registers; see above note about 32-bit handling.
  141. */
  142. /* we're actually in the VP register space, starting at address 0x400 */
  143. #define VP_FP_START 0x400
  144. enum fp_registers {
  145. FP_PT1 = 0,
  146. FP_PT2,
  147. FP_PM,
  148. FP_DFC,
  149. FP_BLFSR,
  150. FP_RLFSR,
  151. FP_FMI,
  152. FP_FMD,
  153. FP_RSVD_0,
  154. FP_DCA,
  155. FP_DMD,
  156. FP_CRC,
  157. FP_FBB, /* 0x460 */
  158. };
  159. #define FP_PT1_VSIZE_SHIFT 16 /* undocumented? */
  160. #define FP_PT1_VSIZE_MASK 0x7FF0000 /* undocumented? */
  161. #define FP_PT2_HSP (1 << 22)
  162. #define FP_PT2_VSP (1 << 23)
  163. #define FP_PM_P (1 << 24) /* panel power on */
  164. #define FP_PM_PANEL_PWR_UP (1 << 3) /* r/o */
  165. #define FP_PM_PANEL_PWR_DOWN (1 << 2) /* r/o */
  166. #define FP_PM_PANEL_OFF (1 << 1) /* r/o */
  167. #define FP_PM_PANEL_ON (1 << 0) /* r/o */
  168. #define FP_DFC_NFI ((1 << 4) | (1 << 5) | (1 << 6))
  169. /* register access functions */
  170. static inline uint32_t read_dc(struct geodefb_par *par, int reg)
  171. {
  172. return readl(par->dc_regs + 4*reg);
  173. }
  174. static inline void write_dc(struct geodefb_par *par, int reg, uint32_t val)
  175. {
  176. writel(val, par->dc_regs + 4*reg);
  177. }
  178. static inline uint32_t read_vp(struct geodefb_par *par, int reg)
  179. {
  180. return readl(par->vid_regs + 8*reg);
  181. }
  182. static inline void write_vp(struct geodefb_par *par, int reg, uint32_t val)
  183. {
  184. writel(val, par->vid_regs + 8*reg);
  185. }
  186. static inline uint32_t read_fp(struct geodefb_par *par, int reg)
  187. {
  188. return readl(par->vid_regs + 8*reg + VP_FP_START);
  189. }
  190. static inline void write_fp(struct geodefb_par *par, int reg, uint32_t val)
  191. {
  192. writel(val, par->vid_regs + 8*reg + VP_FP_START);
  193. }
  194. /* MSRs are defined in asm/geode.h; their bitfields are here */
  195. #define MSR_GLCP_SYS_RSTPLL_DOTPOSTDIV3 (1 << 3)
  196. #define MSR_GLCP_SYS_RSTPLL_DOTPREMULT2 (1 << 2)
  197. #define MSR_GLCP_SYS_RSTPLL_DOTPREDIV2 (1 << 1)
  198. #define MSR_GLCP_DOTPLL_LOCK (1 << 25) /* r/o */
  199. #define MSR_GLCP_DOTPLL_BYPASS (1 << 15)
  200. #define MSR_GLCP_DOTPLL_DOTRESET (1 << 0)
  201. #define MSR_GX_MSR_PADSEL_MASK 0x3FFFFFFF /* undocumented? */
  202. #define MSR_GX_MSR_PADSEL_TFT 0x1FFFFFFF /* undocumented? */
  203. #define MSR_GX_GLD_MSR_CONFIG_FP (1 << 3)
  204. #endif