psb_intel_reg.h 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545
  1. /*
  2. * Copyright (c) 2009, Intel Corporation.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License along with
  14. * this program; if not, write to the Free Software Foundation, Inc.,
  15. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  16. */
  17. #ifndef __PSB_INTEL_REG_H__
  18. #define __PSB_INTEL_REG_H__
  19. /*
  20. * GPIO regs
  21. */
  22. #define GPIOA 0x5010
  23. #define GPIOB 0x5014
  24. #define GPIOC 0x5018
  25. #define GPIOD 0x501c
  26. #define GPIOE 0x5020
  27. #define GPIOF 0x5024
  28. #define GPIOG 0x5028
  29. #define GPIOH 0x502c
  30. # define GPIO_CLOCK_DIR_MASK (1 << 0)
  31. # define GPIO_CLOCK_DIR_IN (0 << 1)
  32. # define GPIO_CLOCK_DIR_OUT (1 << 1)
  33. # define GPIO_CLOCK_VAL_MASK (1 << 2)
  34. # define GPIO_CLOCK_VAL_OUT (1 << 3)
  35. # define GPIO_CLOCK_VAL_IN (1 << 4)
  36. # define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
  37. # define GPIO_DATA_DIR_MASK (1 << 8)
  38. # define GPIO_DATA_DIR_IN (0 << 9)
  39. # define GPIO_DATA_DIR_OUT (1 << 9)
  40. # define GPIO_DATA_VAL_MASK (1 << 10)
  41. # define GPIO_DATA_VAL_OUT (1 << 11)
  42. # define GPIO_DATA_VAL_IN (1 << 12)
  43. # define GPIO_DATA_PULLUP_DISABLE (1 << 13)
  44. #define GMBUS0 0x5100 /* clock/port select */
  45. #define GMBUS_RATE_100KHZ (0<<8)
  46. #define GMBUS_RATE_50KHZ (1<<8)
  47. #define GMBUS_RATE_400KHZ (2<<8) /* reserved on Pineview */
  48. #define GMBUS_RATE_1MHZ (3<<8) /* reserved on Pineview */
  49. #define GMBUS_HOLD_EXT (1<<7) /* 300ns hold time, rsvd on Pineview */
  50. #define GMBUS_PORT_DISABLED 0
  51. #define GMBUS_PORT_SSC 1
  52. #define GMBUS_PORT_VGADDC 2
  53. #define GMBUS_PORT_PANEL 3
  54. #define GMBUS_PORT_DPC 4 /* HDMIC */
  55. #define GMBUS_PORT_DPB 5 /* SDVO, HDMIB */
  56. /* 6 reserved */
  57. #define GMBUS_PORT_DPD 7 /* HDMID */
  58. #define GMBUS_NUM_PORTS 8
  59. #define GMBUS1 0x5104 /* command/status */
  60. #define GMBUS_SW_CLR_INT (1<<31)
  61. #define GMBUS_SW_RDY (1<<30)
  62. #define GMBUS_ENT (1<<29) /* enable timeout */
  63. #define GMBUS_CYCLE_NONE (0<<25)
  64. #define GMBUS_CYCLE_WAIT (1<<25)
  65. #define GMBUS_CYCLE_INDEX (2<<25)
  66. #define GMBUS_CYCLE_STOP (4<<25)
  67. #define GMBUS_BYTE_COUNT_SHIFT 16
  68. #define GMBUS_SLAVE_INDEX_SHIFT 8
  69. #define GMBUS_SLAVE_ADDR_SHIFT 1
  70. #define GMBUS_SLAVE_READ (1<<0)
  71. #define GMBUS_SLAVE_WRITE (0<<0)
  72. #define GMBUS2 0x5108 /* status */
  73. #define GMBUS_INUSE (1<<15)
  74. #define GMBUS_HW_WAIT_PHASE (1<<14)
  75. #define GMBUS_STALL_TIMEOUT (1<<13)
  76. #define GMBUS_INT (1<<12)
  77. #define GMBUS_HW_RDY (1<<11)
  78. #define GMBUS_SATOER (1<<10)
  79. #define GMBUS_ACTIVE (1<<9)
  80. #define GMBUS3 0x510c /* data buffer bytes 3-0 */
  81. #define GMBUS4 0x5110 /* interrupt mask (Pineview+) */
  82. #define GMBUS_SLAVE_TIMEOUT_EN (1<<4)
  83. #define GMBUS_NAK_EN (1<<3)
  84. #define GMBUS_IDLE_EN (1<<2)
  85. #define GMBUS_HW_WAIT_EN (1<<1)
  86. #define GMBUS_HW_RDY_EN (1<<0)
  87. #define GMBUS5 0x5120 /* byte index */
  88. #define GMBUS_2BYTE_INDEX_EN (1<<31)
  89. #define BLC_PWM_CTL 0x61254
  90. #define BLC_PWM_CTL2 0x61250
  91. #define PWM_ENABLE (1 << 31)
  92. #define PWM_LEGACY_MODE (1 << 30)
  93. #define PWM_PIPE_B (1 << 29)
  94. #define BLC_PWM_CTL_C 0x62254
  95. #define BLC_PWM_CTL2_C 0x62250
  96. #define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
  97. /*
  98. * This is the most significant 15 bits of the number of backlight cycles in a
  99. * complete cycle of the modulated backlight control.
  100. *
  101. * The actual value is this field multiplied by two.
  102. */
  103. #define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
  104. #define BLM_LEGACY_MODE (1 << 16)
  105. /*
  106. * This is the number of cycles out of the backlight modulation cycle for which
  107. * the backlight is on.
  108. *
  109. * This field must be no greater than the number of cycles in the complete
  110. * backlight modulation cycle.
  111. */
  112. #define BACKLIGHT_DUTY_CYCLE_SHIFT (0)
  113. #define BACKLIGHT_DUTY_CYCLE_MASK (0xffff)
  114. #define I915_GCFGC 0xf0
  115. #define I915_LOW_FREQUENCY_ENABLE (1 << 7)
  116. #define I915_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
  117. #define I915_DISPLAY_CLOCK_333_MHZ (4 << 4)
  118. #define I915_DISPLAY_CLOCK_MASK (7 << 4)
  119. #define I855_HPLLCC 0xc0
  120. #define I855_CLOCK_CONTROL_MASK (3 << 0)
  121. #define I855_CLOCK_133_200 (0 << 0)
  122. #define I855_CLOCK_100_200 (1 << 0)
  123. #define I855_CLOCK_100_133 (2 << 0)
  124. #define I855_CLOCK_166_250 (3 << 0)
  125. /* I830 CRTC registers */
  126. #define HTOTAL_A 0x60000
  127. #define HBLANK_A 0x60004
  128. #define HSYNC_A 0x60008
  129. #define VTOTAL_A 0x6000c
  130. #define VBLANK_A 0x60010
  131. #define VSYNC_A 0x60014
  132. #define PIPEASRC 0x6001c
  133. #define BCLRPAT_A 0x60020
  134. #define VSYNCSHIFT_A 0x60028
  135. #define HTOTAL_B 0x61000
  136. #define HBLANK_B 0x61004
  137. #define HSYNC_B 0x61008
  138. #define VTOTAL_B 0x6100c
  139. #define VBLANK_B 0x61010
  140. #define VSYNC_B 0x61014
  141. #define PIPEBSRC 0x6101c
  142. #define BCLRPAT_B 0x61020
  143. #define VSYNCSHIFT_B 0x61028
  144. #define HTOTAL_C 0x62000
  145. #define HBLANK_C 0x62004
  146. #define HSYNC_C 0x62008
  147. #define VTOTAL_C 0x6200c
  148. #define VBLANK_C 0x62010
  149. #define VSYNC_C 0x62014
  150. #define PIPECSRC 0x6201c
  151. #define BCLRPAT_C 0x62020
  152. #define VSYNCSHIFT_C 0x62028
  153. #define PP_STATUS 0x61200
  154. # define PP_ON (1 << 31)
  155. /*
  156. * Indicates that all dependencies of the panel are on:
  157. *
  158. * - PLL enabled
  159. * - pipe enabled
  160. * - LVDS/DVOB/DVOC on
  161. */
  162. #define PP_READY (1 << 30)
  163. #define PP_SEQUENCE_NONE (0 << 28)
  164. #define PP_SEQUENCE_ON (1 << 28)
  165. #define PP_SEQUENCE_OFF (2 << 28)
  166. #define PP_SEQUENCE_MASK 0x30000000
  167. #define PP_CYCLE_DELAY_ACTIVE (1 << 27)
  168. #define PP_SEQUENCE_STATE_ON_IDLE (1 << 3)
  169. #define PP_SEQUENCE_STATE_MASK 0x0000000f
  170. #define PP_CONTROL 0x61204
  171. #define POWER_TARGET_ON (1 << 0)
  172. #define PANEL_UNLOCK_REGS (0xabcd << 16)
  173. #define PANEL_UNLOCK_MASK (0xffff << 16)
  174. #define EDP_FORCE_VDD (1 << 3)
  175. #define EDP_BLC_ENABLE (1 << 2)
  176. #define PANEL_POWER_RESET (1 << 1)
  177. #define PANEL_POWER_OFF (0 << 0)
  178. #define PANEL_POWER_ON (1 << 0)
  179. /* Poulsbo/Oaktrail */
  180. #define LVDSPP_ON 0x61208
  181. #define LVDSPP_OFF 0x6120c
  182. #define PP_CYCLE 0x61210
  183. /* Cedartrail */
  184. #define PP_ON_DELAYS 0x61208 /* Cedartrail */
  185. #define PANEL_PORT_SELECT_MASK (3 << 30)
  186. #define PANEL_PORT_SELECT_LVDS (0 << 30)
  187. #define PANEL_PORT_SELECT_EDP (1 << 30)
  188. #define PANEL_POWER_UP_DELAY_MASK (0x1fff0000)
  189. #define PANEL_POWER_UP_DELAY_SHIFT 16
  190. #define PANEL_LIGHT_ON_DELAY_MASK (0x1fff)
  191. #define PANEL_LIGHT_ON_DELAY_SHIFT 0
  192. #define PP_OFF_DELAYS 0x6120c /* Cedartrail */
  193. #define PANEL_POWER_DOWN_DELAY_MASK (0x1fff0000)
  194. #define PANEL_POWER_DOWN_DELAY_SHIFT 16
  195. #define PANEL_LIGHT_OFF_DELAY_MASK (0x1fff)
  196. #define PANEL_LIGHT_OFF_DELAY_SHIFT 0
  197. #define PP_DIVISOR 0x61210 /* Cedartrail */
  198. #define PP_REFERENCE_DIVIDER_MASK (0xffffff00)
  199. #define PP_REFERENCE_DIVIDER_SHIFT 8
  200. #define PANEL_POWER_CYCLE_DELAY_MASK (0x1f)
  201. #define PANEL_POWER_CYCLE_DELAY_SHIFT 0
  202. #define PFIT_CONTROL 0x61230
  203. #define PFIT_ENABLE (1 << 31)
  204. #define PFIT_PIPE_MASK (3 << 29)
  205. #define PFIT_PIPE_SHIFT 29
  206. #define PFIT_SCALING_MODE_PILLARBOX (1 << 27)
  207. #define PFIT_SCALING_MODE_LETTERBOX (3 << 26)
  208. #define VERT_INTERP_DISABLE (0 << 10)
  209. #define VERT_INTERP_BILINEAR (1 << 10)
  210. #define VERT_INTERP_MASK (3 << 10)
  211. #define VERT_AUTO_SCALE (1 << 9)
  212. #define HORIZ_INTERP_DISABLE (0 << 6)
  213. #define HORIZ_INTERP_BILINEAR (1 << 6)
  214. #define HORIZ_INTERP_MASK (3 << 6)
  215. #define HORIZ_AUTO_SCALE (1 << 5)
  216. #define PANEL_8TO6_DITHER_ENABLE (1 << 3)
  217. #define PFIT_PGM_RATIOS 0x61234
  218. #define PFIT_VERT_SCALE_MASK 0xfff00000
  219. #define PFIT_HORIZ_SCALE_MASK 0x0000fff0
  220. #define PFIT_AUTO_RATIOS 0x61238
  221. #define DPLL_A 0x06014
  222. #define DPLL_B 0x06018
  223. #define DPLL_VCO_ENABLE (1 << 31)
  224. #define DPLL_DVO_HIGH_SPEED (1 << 30)
  225. #define DPLL_SYNCLOCK_ENABLE (1 << 29)
  226. #define DPLL_VGA_MODE_DIS (1 << 28)
  227. #define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */
  228. #define DPLLB_MODE_LVDS (2 << 26) /* i915 */
  229. #define DPLL_MODE_MASK (3 << 26)
  230. #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
  231. #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
  232. #define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */
  233. #define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
  234. #define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
  235. #define DPLL_FPA0h1_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
  236. #define DPLL_LOCK (1 << 15) /* CDV */
  237. /*
  238. * The i830 generation, in DAC/serial mode, defines p1 as two plus this
  239. * bitfield, or just 2 if PLL_P1_DIVIDE_BY_TWO is set.
  240. */
  241. # define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
  242. /*
  243. * The i830 generation, in LVDS mode, defines P1 as the bit number set within
  244. * this field (only one bit may be set).
  245. */
  246. #define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000
  247. #define DPLL_FPA01_P1_POST_DIV_SHIFT 16
  248. #define PLL_P2_DIVIDE_BY_4 (1 << 23) /* i830, required
  249. * in DVO non-gang */
  250. # define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */
  251. #define PLL_REF_INPUT_DREFCLK (0 << 13)
  252. #define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */
  253. #define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO
  254. * TVCLKIN */
  255. #define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
  256. #define PLL_REF_INPUT_MASK (3 << 13)
  257. #define PLL_LOAD_PULSE_PHASE_SHIFT 9
  258. /*
  259. * Parallel to Serial Load Pulse phase selection.
  260. * Selects the phase for the 10X DPLL clock for the PCIe
  261. * digital display port. The range is 4 to 13; 10 or more
  262. * is just a flip delay. The default is 6
  263. */
  264. #define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
  265. #define DISPLAY_RATE_SELECT_FPA1 (1 << 8)
  266. /*
  267. * SDVO multiplier for 945G/GM. Not used on 965.
  268. *
  269. * DPLL_MD_UDI_MULTIPLIER_MASK
  270. */
  271. #define SDVO_MULTIPLIER_MASK 0x000000ff
  272. #define SDVO_MULTIPLIER_SHIFT_HIRES 4
  273. #define SDVO_MULTIPLIER_SHIFT_VGA 0
  274. /*
  275. * PLL_MD
  276. */
  277. /* Pipe A SDVO/UDI clock multiplier/divider register for G965. */
  278. #define DPLL_A_MD 0x0601c
  279. /* Pipe B SDVO/UDI clock multiplier/divider register for G965. */
  280. #define DPLL_B_MD 0x06020
  281. /*
  282. * UDI pixel divider, controlling how many pixels are stuffed into a packet.
  283. *
  284. * Value is pixels minus 1. Must be set to 1 pixel for SDVO.
  285. */
  286. #define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000
  287. #define DPLL_MD_UDI_DIVIDER_SHIFT 24
  288. /* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
  289. #define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000
  290. #define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16
  291. /*
  292. * SDVO/UDI pixel multiplier.
  293. *
  294. * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
  295. * clock rate is 10 times the DPLL clock. At low resolution/refresh rate
  296. * modes, the bus rate would be below the limits, so SDVO allows for stuffing
  297. * dummy bytes in the datastream at an increased clock rate, with both sides of
  298. * the link knowing how many bytes are fill.
  299. *
  300. * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
  301. * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be
  302. * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
  303. * through an SDVO command.
  304. *
  305. * This register field has values of multiplication factor minus 1, with
  306. * a maximum multiplier of 5 for SDVO.
  307. */
  308. #define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00
  309. #define DPLL_MD_UDI_MULTIPLIER_SHIFT 8
  310. /*
  311. * SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
  312. * This best be set to the default value (3) or the CRT won't work. No,
  313. * I don't entirely understand what this does...
  314. */
  315. #define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
  316. #define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
  317. #define DPLL_TEST 0x606c
  318. #define DPLLB_TEST_SDVO_DIV_1 (0 << 22)
  319. #define DPLLB_TEST_SDVO_DIV_2 (1 << 22)
  320. #define DPLLB_TEST_SDVO_DIV_4 (2 << 22)
  321. #define DPLLB_TEST_SDVO_DIV_MASK (3 << 22)
  322. #define DPLLB_TEST_N_BYPASS (1 << 19)
  323. #define DPLLB_TEST_M_BYPASS (1 << 18)
  324. #define DPLLB_INPUT_BUFFER_ENABLE (1 << 16)
  325. #define DPLLA_TEST_N_BYPASS (1 << 3)
  326. #define DPLLA_TEST_M_BYPASS (1 << 2)
  327. #define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
  328. #define ADPA 0x61100
  329. #define ADPA_DAC_ENABLE (1 << 31)
  330. #define ADPA_DAC_DISABLE 0
  331. #define ADPA_PIPE_SELECT_MASK (1 << 30)
  332. #define ADPA_PIPE_A_SELECT 0
  333. #define ADPA_PIPE_B_SELECT (1 << 30)
  334. #define ADPA_USE_VGA_HVPOLARITY (1 << 15)
  335. #define ADPA_SETS_HVPOLARITY 0
  336. #define ADPA_VSYNC_CNTL_DISABLE (1 << 11)
  337. #define ADPA_VSYNC_CNTL_ENABLE 0
  338. #define ADPA_HSYNC_CNTL_DISABLE (1 << 10)
  339. #define ADPA_HSYNC_CNTL_ENABLE 0
  340. #define ADPA_VSYNC_ACTIVE_HIGH (1 << 4)
  341. #define ADPA_VSYNC_ACTIVE_LOW 0
  342. #define ADPA_HSYNC_ACTIVE_HIGH (1 << 3)
  343. #define ADPA_HSYNC_ACTIVE_LOW 0
  344. #define FPA0 0x06040
  345. #define FPA1 0x06044
  346. #define FPB0 0x06048
  347. #define FPB1 0x0604c
  348. #define FP_N_DIV_MASK 0x003f0000
  349. #define FP_N_DIV_SHIFT 16
  350. #define FP_M1_DIV_MASK 0x00003f00
  351. #define FP_M1_DIV_SHIFT 8
  352. #define FP_M2_DIV_MASK 0x0000003f
  353. #define FP_M2_DIV_SHIFT 0
  354. #define PORT_HOTPLUG_EN 0x61110
  355. #define HDMIB_HOTPLUG_INT_EN (1 << 29)
  356. #define HDMIC_HOTPLUG_INT_EN (1 << 28)
  357. #define HDMID_HOTPLUG_INT_EN (1 << 27)
  358. #define SDVOB_HOTPLUG_INT_EN (1 << 26)
  359. #define SDVOC_HOTPLUG_INT_EN (1 << 25)
  360. #define TV_HOTPLUG_INT_EN (1 << 18)
  361. #define CRT_HOTPLUG_INT_EN (1 << 9)
  362. #define CRT_HOTPLUG_FORCE_DETECT (1 << 3)
  363. /* CDV.. */
  364. #define CRT_HOTPLUG_ACTIVATION_PERIOD_64 (1 << 8)
  365. #define CRT_HOTPLUG_DAC_ON_TIME_2M (0 << 7)
  366. #define CRT_HOTPLUG_DAC_ON_TIME_4M (1 << 7)
  367. #define CRT_HOTPLUG_VOLTAGE_COMPARE_40 (0 << 5)
  368. #define CRT_HOTPLUG_VOLTAGE_COMPARE_50 (1 << 5)
  369. #define CRT_HOTPLUG_VOLTAGE_COMPARE_60 (2 << 5)
  370. #define CRT_HOTPLUG_VOLTAGE_COMPARE_70 (3 << 5)
  371. #define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK (3 << 5)
  372. #define CRT_HOTPLUG_DETECT_DELAY_1G (0 << 4)
  373. #define CRT_HOTPLUG_DETECT_DELAY_2G (1 << 4)
  374. #define CRT_HOTPLUG_DETECT_VOLTAGE_325MV (0 << 2)
  375. #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
  376. #define CRT_HOTPLUG_DETECT_MASK 0x000000F8
  377. #define PORT_HOTPLUG_STAT 0x61114
  378. #define CRT_HOTPLUG_INT_STATUS (1 << 11)
  379. #define TV_HOTPLUG_INT_STATUS (1 << 10)
  380. #define CRT_HOTPLUG_MONITOR_MASK (3 << 8)
  381. #define CRT_HOTPLUG_MONITOR_COLOR (3 << 8)
  382. #define CRT_HOTPLUG_MONITOR_MONO (2 << 8)
  383. #define CRT_HOTPLUG_MONITOR_NONE (0 << 8)
  384. #define SDVOC_HOTPLUG_INT_STATUS (1 << 7)
  385. #define SDVOB_HOTPLUG_INT_STATUS (1 << 6)
  386. #define SDVOB 0x61140
  387. #define SDVOC 0x61160
  388. #define SDVO_ENABLE (1 << 31)
  389. #define SDVO_PIPE_B_SELECT (1 << 30)
  390. #define SDVO_STALL_SELECT (1 << 29)
  391. #define SDVO_INTERRUPT_ENABLE (1 << 26)
  392. #define SDVO_COLOR_RANGE_16_235 (1 << 8)
  393. #define SDVO_AUDIO_ENABLE (1 << 6)
  394. /**
  395. * 915G/GM SDVO pixel multiplier.
  396. *
  397. * Programmed value is multiplier - 1, up to 5x.
  398. *
  399. * DPLL_MD_UDI_MULTIPLIER_MASK
  400. */
  401. #define SDVO_PORT_MULTIPLY_MASK (7 << 23)
  402. #define SDVO_PORT_MULTIPLY_SHIFT 23
  403. #define SDVO_PHASE_SELECT_MASK (15 << 19)
  404. #define SDVO_PHASE_SELECT_DEFAULT (6 << 19)
  405. #define SDVO_CLOCK_OUTPUT_INVERT (1 << 18)
  406. #define SDVOC_GANG_MODE (1 << 16)
  407. #define SDVO_BORDER_ENABLE (1 << 7)
  408. #define SDVOB_PCIE_CONCURRENCY (1 << 3)
  409. #define SDVO_DETECTED (1 << 2)
  410. /* Bits to be preserved when writing */
  411. #define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14))
  412. #define SDVOC_PRESERVE_MASK (1 << 17)
  413. /*
  414. * This register controls the LVDS output enable, pipe selection, and data
  415. * format selection.
  416. *
  417. * All of the clock/data pairs are force powered down by power sequencing.
  418. */
  419. #define LVDS 0x61180
  420. /*
  421. * Enables the LVDS port. This bit must be set before DPLLs are enabled, as
  422. * the DPLL semantics change when the LVDS is assigned to that pipe.
  423. */
  424. #define LVDS_PORT_EN (1 << 31)
  425. /* Selects pipe B for LVDS data. Must be set on pre-965. */
  426. #define LVDS_PIPEB_SELECT (1 << 30)
  427. /* Turns on border drawing to allow centered display. */
  428. #define LVDS_BORDER_EN (1 << 15)
  429. /*
  430. * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
  431. * pixel.
  432. */
  433. #define LVDS_A0A2_CLKA_POWER_MASK (3 << 8)
  434. #define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8)
  435. #define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
  436. /*
  437. * Controls the A3 data pair, which contains the additional LSBs for 24 bit
  438. * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
  439. * on.
  440. */
  441. #define LVDS_A3_POWER_MASK (3 << 6)
  442. #define LVDS_A3_POWER_DOWN (0 << 6)
  443. #define LVDS_A3_POWER_UP (3 << 6)
  444. /*
  445. * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP
  446. * is set.
  447. */
  448. #define LVDS_CLKB_POWER_MASK (3 << 4)
  449. #define LVDS_CLKB_POWER_DOWN (0 << 4)
  450. #define LVDS_CLKB_POWER_UP (3 << 4)
  451. /*
  452. * Controls the B0-B3 data pairs. This must be set to match the DPLL p2
  453. * setting for whether we are in dual-channel mode. The B3 pair will
  454. * additionally only be powered up when LVDS_A3_POWER_UP is set.
  455. */
  456. #define LVDS_B0B3_POWER_MASK (3 << 2)
  457. #define LVDS_B0B3_POWER_DOWN (0 << 2)
  458. #define LVDS_B0B3_POWER_UP (3 << 2)
  459. #define PIPEACONF 0x70008
  460. #define PIPEACONF_ENABLE (1 << 31)
  461. #define PIPEACONF_DISABLE 0
  462. #define PIPEACONF_DOUBLE_WIDE (1 << 30)
  463. #define PIPECONF_ACTIVE (1 << 30)
  464. #define PIPECONF_DSIPLL_LOCK (1 << 29)
  465. #define PIPEACONF_SINGLE_WIDE 0
  466. #define PIPEACONF_PIPE_UNLOCKED 0
  467. #define PIPEACONF_DSR (1 << 26)
  468. #define PIPEACONF_PIPE_LOCKED (1 << 25)
  469. #define PIPEACONF_PALETTE 0
  470. #define PIPECONF_FORCE_BORDER (1 << 25)
  471. #define PIPEACONF_GAMMA (1 << 24)
  472. #define PIPECONF_PROGRESSIVE (0 << 21)
  473. #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
  474. #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
  475. #define PIPECONF_PLANE_OFF (1 << 19)
  476. #define PIPECONF_CURSOR_OFF (1 << 18)
  477. #define PIPEBCONF 0x71008
  478. #define PIPEBCONF_ENABLE (1 << 31)
  479. #define PIPEBCONF_DISABLE 0
  480. #define PIPEBCONF_DOUBLE_WIDE (1 << 30)
  481. #define PIPEBCONF_DISABLE 0
  482. #define PIPEBCONF_GAMMA (1 << 24)
  483. #define PIPEBCONF_PALETTE 0
  484. #define PIPECCONF 0x72008
  485. #define PIPEBGCMAXRED 0x71010
  486. #define PIPEBGCMAXGREEN 0x71014
  487. #define PIPEBGCMAXBLUE 0x71018
  488. #define PIPEASTAT 0x70024
  489. #define PIPEBSTAT 0x71024
  490. #define PIPECSTAT 0x72024
  491. #define PIPE_VBLANK_INTERRUPT_STATUS (1UL << 1)
  492. #define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL << 2)
  493. #define PIPE_VBLANK_CLEAR (1 << 1)
  494. #define PIPE_VBLANK_STATUS (1 << 1)
  495. #define PIPE_TE_STATUS (1UL << 6)
  496. #define PIPE_DPST_EVENT_STATUS (1UL << 7)
  497. #define PIPE_VSYNC_CLEAR (1UL << 9)
  498. #define PIPE_VSYNC_STATUS (1UL << 9)
  499. #define PIPE_HDMI_AUDIO_UNDERRUN_STATUS (1UL << 10)
  500. #define PIPE_HDMI_AUDIO_BUFFER_DONE_STATUS (1UL << 11)
  501. #define PIPE_VBLANK_INTERRUPT_ENABLE (1UL << 17)
  502. #define PIPE_START_VBLANK_INTERRUPT_ENABLE (1UL << 18)
  503. #define PIPE_TE_ENABLE (1UL << 22)
  504. #define PIPE_LEGACY_BLC_EVENT_ENABLE (1UL << 22)
  505. #define PIPE_DPST_EVENT_ENABLE (1UL << 23)
  506. #define PIPE_VSYNC_ENABL (1UL << 25)
  507. #define PIPE_HDMI_AUDIO_UNDERRUN (1UL << 26)
  508. #define PIPE_HDMI_AUDIO_BUFFER_DONE (1UL << 27)
  509. #define PIPE_FIFO_UNDERRUN (1UL << 31)
  510. #define PIPE_HDMI_AUDIO_INT_MASK (PIPE_HDMI_AUDIO_UNDERRUN | \
  511. PIPE_HDMI_AUDIO_BUFFER_DONE)
  512. #define PIPE_EVENT_MASK ((1 << 29)|(1 << 28)|(1 << 27)|(1 << 26)|(1 << 24)|(1 << 23)|(1 << 22)|(1 << 21)|(1 << 20)|(1 << 16))
  513. #define PIPE_VBLANK_MASK ((1 << 25)|(1 << 24)|(1 << 18)|(1 << 17))
  514. #define HISTOGRAM_INT_CONTROL 0x61268
  515. #define HISTOGRAM_BIN_DATA 0X61264
  516. #define HISTOGRAM_LOGIC_CONTROL 0x61260
  517. #define PWM_CONTROL_LOGIC 0x61250
  518. #define PIPE_HOTPLUG_INTERRUPT_STATUS (1UL << 10)
  519. #define HISTOGRAM_INTERRUPT_ENABLE (1UL << 31)
  520. #define HISTOGRAM_LOGIC_ENABLE (1UL << 31)
  521. #define PWM_LOGIC_ENABLE (1UL << 31)
  522. #define PWM_PHASEIN_ENABLE (1UL << 25)
  523. #define PWM_PHASEIN_INT_ENABLE (1UL << 24)
  524. #define PWM_PHASEIN_VB_COUNT 0x00001f00
  525. #define PWM_PHASEIN_INC 0x0000001f
  526. #define HISTOGRAM_INT_CTRL_CLEAR (1UL << 30)
  527. #define DPST_YUV_LUMA_MODE 0
  528. struct dpst_ie_histogram_control {
  529. union {
  530. uint32_t data;
  531. struct {
  532. uint32_t bin_reg_index:7;
  533. uint32_t reserved:4;
  534. uint32_t bin_reg_func_select:1;
  535. uint32_t sync_to_phase_in:1;
  536. uint32_t alt_enhancement_mode:2;
  537. uint32_t reserved1:1;
  538. uint32_t sync_to_phase_in_count:8;
  539. uint32_t histogram_mode_select:1;
  540. uint32_t reserved2:4;
  541. uint32_t ie_pipe_assignment:1;
  542. uint32_t ie_mode_table_enabled:1;
  543. uint32_t ie_histogram_enable:1;
  544. };
  545. };
  546. };
  547. struct dpst_guardband {
  548. union {
  549. uint32_t data;
  550. struct {
  551. uint32_t guardband:22;
  552. uint32_t guardband_interrupt_delay:8;
  553. uint32_t interrupt_status:1;
  554. uint32_t interrupt_enable:1;
  555. };
  556. };
  557. };
  558. #define PIPEAFRAMEHIGH 0x70040
  559. #define PIPEAFRAMEPIXEL 0x70044
  560. #define PIPEBFRAMEHIGH 0x71040
  561. #define PIPEBFRAMEPIXEL 0x71044
  562. #define PIPECFRAMEHIGH 0x72040
  563. #define PIPECFRAMEPIXEL 0x72044
  564. #define PIPE_FRAME_HIGH_MASK 0x0000ffff
  565. #define PIPE_FRAME_HIGH_SHIFT 0
  566. #define PIPE_FRAME_LOW_MASK 0xff000000
  567. #define PIPE_FRAME_LOW_SHIFT 24
  568. #define PIPE_PIXEL_MASK 0x00ffffff
  569. #define PIPE_PIXEL_SHIFT 0
  570. #define FW_BLC_SELF 0x20e0
  571. #define FW_BLC_SELF_EN (1<<15)
  572. #define DSPARB 0x70030
  573. #define DSPFW1 0x70034
  574. #define DSP_FIFO_SR_WM_MASK 0xFF800000
  575. #define DSP_FIFO_SR_WM_SHIFT 23
  576. #define CURSOR_B_FIFO_WM_MASK 0x003F0000
  577. #define CURSOR_B_FIFO_WM_SHIFT 16
  578. #define DSPFW2 0x70038
  579. #define CURSOR_A_FIFO_WM_MASK 0x3F00
  580. #define CURSOR_A_FIFO_WM_SHIFT 8
  581. #define DSP_PLANE_C_FIFO_WM_MASK 0x7F
  582. #define DSP_PLANE_C_FIFO_WM_SHIFT 0
  583. #define DSPFW3 0x7003c
  584. #define DSPFW4 0x70050
  585. #define DSPFW5 0x70054
  586. #define DSP_PLANE_B_FIFO_WM1_SHIFT 24
  587. #define DSP_PLANE_A_FIFO_WM1_SHIFT 16
  588. #define CURSOR_B_FIFO_WM1_SHIFT 8
  589. #define CURSOR_FIFO_SR_WM1_SHIFT 0
  590. #define DSPFW6 0x70058
  591. #define DSPCHICKENBIT 0x70400
  592. #define DSPACNTR 0x70180
  593. #define DSPBCNTR 0x71180
  594. #define DSPCCNTR 0x72180
  595. #define DISPLAY_PLANE_ENABLE (1 << 31)
  596. #define DISPLAY_PLANE_DISABLE 0
  597. #define DISPPLANE_GAMMA_ENABLE (1 << 30)
  598. #define DISPPLANE_GAMMA_DISABLE 0
  599. #define DISPPLANE_PIXFORMAT_MASK (0xf << 26)
  600. #define DISPPLANE_8BPP (0x2 << 26)
  601. #define DISPPLANE_15_16BPP (0x4 << 26)
  602. #define DISPPLANE_16BPP (0x5 << 26)
  603. #define DISPPLANE_32BPP_NO_ALPHA (0x6 << 26)
  604. #define DISPPLANE_32BPP (0x7 << 26)
  605. #define DISPPLANE_STEREO_ENABLE (1 << 25)
  606. #define DISPPLANE_STEREO_DISABLE 0
  607. #define DISPPLANE_SEL_PIPE_MASK (1 << 24)
  608. #define DISPPLANE_SEL_PIPE_POS 24
  609. #define DISPPLANE_SEL_PIPE_A 0
  610. #define DISPPLANE_SEL_PIPE_B (1 << 24)
  611. #define DISPPLANE_SRC_KEY_ENABLE (1 << 22)
  612. #define DISPPLANE_SRC_KEY_DISABLE 0
  613. #define DISPPLANE_LINE_DOUBLE (1 << 20)
  614. #define DISPPLANE_NO_LINE_DOUBLE 0
  615. #define DISPPLANE_STEREO_POLARITY_FIRST 0
  616. #define DISPPLANE_STEREO_POLARITY_SECOND (1 << 18)
  617. /* plane B only */
  618. #define DISPPLANE_ALPHA_TRANS_ENABLE (1 << 15)
  619. #define DISPPLANE_ALPHA_TRANS_DISABLE 0
  620. #define DISPPLANE_SPRITE_ABOVE_DISPLAYA 0
  621. #define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
  622. #define DISPPLANE_BOTTOM (4)
  623. #define DSPABASE 0x70184
  624. #define DSPALINOFF 0x70184
  625. #define DSPASTRIDE 0x70188
  626. #define DSPBBASE 0x71184
  627. #define DSPBLINOFF 0X71184
  628. #define DSPBADDR DSPBBASE
  629. #define DSPBSTRIDE 0x71188
  630. #define DSPCBASE 0x72184
  631. #define DSPCLINOFF 0x72184
  632. #define DSPCSTRIDE 0x72188
  633. #define DSPAKEYVAL 0x70194
  634. #define DSPAKEYMASK 0x70198
  635. #define DSPAPOS 0x7018C /* reserved */
  636. #define DSPASIZE 0x70190
  637. #define DSPBPOS 0x7118C
  638. #define DSPBSIZE 0x71190
  639. #define DSPCPOS 0x7218C
  640. #define DSPCSIZE 0x72190
  641. #define DSPASURF 0x7019C
  642. #define DSPATILEOFF 0x701A4
  643. #define DSPBSURF 0x7119C
  644. #define DSPBTILEOFF 0x711A4
  645. #define DSPCSURF 0x7219C
  646. #define DSPCTILEOFF 0x721A4
  647. #define DSPCKEYMAXVAL 0x721A0
  648. #define DSPCKEYMINVAL 0x72194
  649. #define DSPCKEYMSK 0x72198
  650. #define VGACNTRL 0x71400
  651. #define VGA_DISP_DISABLE (1 << 31)
  652. #define VGA_2X_MODE (1 << 30)
  653. #define VGA_PIPE_B_SELECT (1 << 29)
  654. /*
  655. * Overlay registers
  656. */
  657. #define OV_C_OFFSET 0x08000
  658. #define OV_OVADD 0x30000
  659. #define OV_DOVASTA 0x30008
  660. # define OV_PIPE_SELECT ((1 << 6)|(1 << 7))
  661. # define OV_PIPE_SELECT_POS 6
  662. # define OV_PIPE_A 0
  663. # define OV_PIPE_C 1
  664. #define OV_OGAMC5 0x30010
  665. #define OV_OGAMC4 0x30014
  666. #define OV_OGAMC3 0x30018
  667. #define OV_OGAMC2 0x3001C
  668. #define OV_OGAMC1 0x30020
  669. #define OV_OGAMC0 0x30024
  670. #define OVC_OVADD 0x38000
  671. #define OVC_DOVCSTA 0x38008
  672. #define OVC_OGAMC5 0x38010
  673. #define OVC_OGAMC4 0x38014
  674. #define OVC_OGAMC3 0x38018
  675. #define OVC_OGAMC2 0x3801C
  676. #define OVC_OGAMC1 0x38020
  677. #define OVC_OGAMC0 0x38024
  678. /*
  679. * Some BIOS scratch area registers. The 845 (and 830?) store the amount
  680. * of video memory available to the BIOS in SWF1.
  681. */
  682. #define SWF0 0x71410
  683. #define SWF1 0x71414
  684. #define SWF2 0x71418
  685. #define SWF3 0x7141c
  686. #define SWF4 0x71420
  687. #define SWF5 0x71424
  688. #define SWF6 0x71428
  689. /*
  690. * 855 scratch registers.
  691. */
  692. #define SWF00 0x70410
  693. #define SWF01 0x70414
  694. #define SWF02 0x70418
  695. #define SWF03 0x7041c
  696. #define SWF04 0x70420
  697. #define SWF05 0x70424
  698. #define SWF06 0x70428
  699. #define SWF10 SWF0
  700. #define SWF11 SWF1
  701. #define SWF12 SWF2
  702. #define SWF13 SWF3
  703. #define SWF14 SWF4
  704. #define SWF15 SWF5
  705. #define SWF16 SWF6
  706. #define SWF30 0x72414
  707. #define SWF31 0x72418
  708. #define SWF32 0x7241c
  709. /*
  710. * Palette registers
  711. */
  712. #define PALETTE_A 0x0a000
  713. #define PALETTE_B 0x0a800
  714. #define PALETTE_C 0x0ac00
  715. /* Cursor A & B regs */
  716. #define CURACNTR 0x70080
  717. #define CURSOR_MODE_DISABLE 0x00
  718. #define CURSOR_MODE_64_32B_AX 0x07
  719. #define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX)
  720. #define MCURSOR_GAMMA_ENABLE (1 << 26)
  721. #define CURABASE 0x70084
  722. #define CURAPOS 0x70088
  723. #define CURSOR_POS_MASK 0x007FF
  724. #define CURSOR_POS_SIGN 0x8000
  725. #define CURSOR_X_SHIFT 0
  726. #define CURSOR_Y_SHIFT 16
  727. #define CURBCNTR 0x700c0
  728. #define CURBBASE 0x700c4
  729. #define CURBPOS 0x700c8
  730. #define CURCCNTR 0x700e0
  731. #define CURCBASE 0x700e4
  732. #define CURCPOS 0x700e8
  733. /*
  734. * Interrupt Registers
  735. */
  736. #define IER 0x020a0
  737. #define IIR 0x020a4
  738. #define IMR 0x020a8
  739. #define ISR 0x020ac
  740. /*
  741. * MOORESTOWN delta registers
  742. */
  743. #define MRST_DPLL_A 0x0f014
  744. #define MDFLD_DPLL_B 0x0f018
  745. #define MDFLD_INPUT_REF_SEL (1 << 14)
  746. #define MDFLD_VCO_SEL (1 << 16)
  747. #define DPLLA_MODE_LVDS (2 << 26) /* mrst */
  748. #define MDFLD_PLL_LATCHEN (1 << 28)
  749. #define MDFLD_PWR_GATE_EN (1 << 30)
  750. #define MDFLD_P1_MASK (0x1FF << 17)
  751. #define MRST_FPA0 0x0f040
  752. #define MRST_FPA1 0x0f044
  753. #define MDFLD_DPLL_DIV0 0x0f048
  754. #define MDFLD_DPLL_DIV1 0x0f04c
  755. #define MRST_PERF_MODE 0x020f4
  756. /*
  757. * MEDFIELD HDMI registers
  758. */
  759. #define HDMIPHYMISCCTL 0x61134
  760. #define HDMI_PHY_POWER_DOWN 0x7f
  761. #define HDMIB_CONTROL 0x61140
  762. #define HDMIB_PORT_EN (1 << 31)
  763. #define HDMIB_PIPE_B_SELECT (1 << 30)
  764. #define HDMIB_NULL_PACKET (1 << 9)
  765. #define HDMIB_HDCP_PORT (1 << 5)
  766. /* #define LVDS 0x61180 */
  767. #define MRST_PANEL_8TO6_DITHER_ENABLE (1 << 25)
  768. #define MRST_PANEL_24_DOT_1_FORMAT (1 << 24)
  769. #define LVDS_A3_POWER_UP_0_OUTPUT (1 << 6)
  770. #define MIPI 0x61190
  771. #define MIPI_C 0x62190
  772. #define MIPI_PORT_EN (1 << 31)
  773. /* Turns on border drawing to allow centered display. */
  774. #define SEL_FLOPPED_HSTX (1 << 23)
  775. #define PASS_FROM_SPHY_TO_AFE (1 << 16)
  776. #define MIPI_BORDER_EN (1 << 15)
  777. #define MIPIA_3LANE_MIPIC_1LANE 0x1
  778. #define MIPIA_2LANE_MIPIC_2LANE 0x2
  779. #define TE_TRIGGER_DSI_PROTOCOL (1 << 2)
  780. #define TE_TRIGGER_GPIO_PIN (1 << 3)
  781. #define MIPI_TE_COUNT 0x61194
  782. /* #define PP_CONTROL 0x61204 */
  783. #define POWER_DOWN_ON_RESET (1 << 1)
  784. /* #define PFIT_CONTROL 0x61230 */
  785. #define PFIT_PIPE_SELECT (3 << 29)
  786. #define PFIT_PIPE_SELECT_SHIFT (29)
  787. /* #define BLC_PWM_CTL 0x61254 */
  788. #define MRST_BACKLIGHT_MODULATION_FREQ_SHIFT (16)
  789. #define MRST_BACKLIGHT_MODULATION_FREQ_MASK (0xffff << 16)
  790. /* #define PIPEACONF 0x70008 */
  791. #define PIPEACONF_PIPE_STATE (1 << 30)
  792. /* #define DSPACNTR 0x70180 */
  793. #define MRST_DSPABASE 0x7019c
  794. #define MRST_DSPBBASE 0x7119c
  795. #define MDFLD_DSPCBASE 0x7219c
  796. /*
  797. * Moorestown registers.
  798. */
  799. /*
  800. * MIPI IP registers
  801. */
  802. #define MIPIC_REG_OFFSET 0x800
  803. #define DEVICE_READY_REG 0xb000
  804. #define LP_OUTPUT_HOLD (1 << 16)
  805. #define EXIT_ULPS_DEV_READY 0x3
  806. #define LP_OUTPUT_HOLD_RELEASE 0x810000
  807. # define ENTERING_ULPS (2 << 1)
  808. # define EXITING_ULPS (1 << 1)
  809. # define ULPS_MASK (3 << 1)
  810. # define BUS_POSSESSION (1 << 3)
  811. #define INTR_STAT_REG 0xb004
  812. #define RX_SOT_ERROR (1 << 0)
  813. #define RX_SOT_SYNC_ERROR (1 << 1)
  814. #define RX_ESCAPE_MODE_ENTRY_ERROR (1 << 3)
  815. #define RX_LP_TX_SYNC_ERROR (1 << 4)
  816. #define RX_HS_RECEIVE_TIMEOUT_ERROR (1 << 5)
  817. #define RX_FALSE_CONTROL_ERROR (1 << 6)
  818. #define RX_ECC_SINGLE_BIT_ERROR (1 << 7)
  819. #define RX_ECC_MULTI_BIT_ERROR (1 << 8)
  820. #define RX_CHECKSUM_ERROR (1 << 9)
  821. #define RX_DSI_DATA_TYPE_NOT_RECOGNIZED (1 << 10)
  822. #define RX_DSI_VC_ID_INVALID (1 << 11)
  823. #define TX_FALSE_CONTROL_ERROR (1 << 12)
  824. #define TX_ECC_SINGLE_BIT_ERROR (1 << 13)
  825. #define TX_ECC_MULTI_BIT_ERROR (1 << 14)
  826. #define TX_CHECKSUM_ERROR (1 << 15)
  827. #define TX_DSI_DATA_TYPE_NOT_RECOGNIZED (1 << 16)
  828. #define TX_DSI_VC_ID_INVALID (1 << 17)
  829. #define HIGH_CONTENTION (1 << 18)
  830. #define LOW_CONTENTION (1 << 19)
  831. #define DPI_FIFO_UNDER_RUN (1 << 20)
  832. #define HS_TX_TIMEOUT (1 << 21)
  833. #define LP_RX_TIMEOUT (1 << 22)
  834. #define TURN_AROUND_ACK_TIMEOUT (1 << 23)
  835. #define ACK_WITH_NO_ERROR (1 << 24)
  836. #define HS_GENERIC_WR_FIFO_FULL (1 << 27)
  837. #define LP_GENERIC_WR_FIFO_FULL (1 << 28)
  838. #define SPL_PKT_SENT (1 << 30)
  839. #define INTR_EN_REG 0xb008
  840. #define DSI_FUNC_PRG_REG 0xb00c
  841. #define DPI_CHANNEL_NUMBER_POS 0x03
  842. #define DBI_CHANNEL_NUMBER_POS 0x05
  843. #define FMT_DPI_POS 0x07
  844. #define FMT_DBI_POS 0x0A
  845. #define DBI_DATA_WIDTH_POS 0x0D
  846. /* DPI PIXEL FORMATS */
  847. #define RGB_565_FMT 0x01 /* RGB 565 FORMAT */
  848. #define RGB_666_FMT 0x02 /* RGB 666 FORMAT */
  849. #define LRGB_666_FMT 0x03 /* RGB LOOSELY PACKED
  850. * 666 FORMAT
  851. */
  852. #define RGB_888_FMT 0x04 /* RGB 888 FORMAT */
  853. #define VIRTUAL_CHANNEL_NUMBER_0 0x00 /* Virtual channel 0 */
  854. #define VIRTUAL_CHANNEL_NUMBER_1 0x01 /* Virtual channel 1 */
  855. #define VIRTUAL_CHANNEL_NUMBER_2 0x02 /* Virtual channel 2 */
  856. #define VIRTUAL_CHANNEL_NUMBER_3 0x03 /* Virtual channel 3 */
  857. #define DBI_NOT_SUPPORTED 0x00 /* command mode
  858. * is not supported
  859. */
  860. #define DBI_DATA_WIDTH_16BIT 0x01 /* 16 bit data */
  861. #define DBI_DATA_WIDTH_9BIT 0x02 /* 9 bit data */
  862. #define DBI_DATA_WIDTH_8BIT 0x03 /* 8 bit data */
  863. #define DBI_DATA_WIDTH_OPT1 0x04 /* option 1 */
  864. #define DBI_DATA_WIDTH_OPT2 0x05 /* option 2 */
  865. #define HS_TX_TIMEOUT_REG 0xb010
  866. #define LP_RX_TIMEOUT_REG 0xb014
  867. #define TURN_AROUND_TIMEOUT_REG 0xb018
  868. #define DEVICE_RESET_REG 0xb01C
  869. #define DPI_RESOLUTION_REG 0xb020
  870. #define RES_V_POS 0x10
  871. #define DBI_RESOLUTION_REG 0xb024 /* Reserved for MDFLD */
  872. #define HORIZ_SYNC_PAD_COUNT_REG 0xb028
  873. #define HORIZ_BACK_PORCH_COUNT_REG 0xb02C
  874. #define HORIZ_FRONT_PORCH_COUNT_REG 0xb030
  875. #define HORIZ_ACTIVE_AREA_COUNT_REG 0xb034
  876. #define VERT_SYNC_PAD_COUNT_REG 0xb038
  877. #define VERT_BACK_PORCH_COUNT_REG 0xb03c
  878. #define VERT_FRONT_PORCH_COUNT_REG 0xb040
  879. #define HIGH_LOW_SWITCH_COUNT_REG 0xb044
  880. #define DPI_CONTROL_REG 0xb048
  881. #define DPI_SHUT_DOWN (1 << 0)
  882. #define DPI_TURN_ON (1 << 1)
  883. #define DPI_COLOR_MODE_ON (1 << 2)
  884. #define DPI_COLOR_MODE_OFF (1 << 3)
  885. #define DPI_BACK_LIGHT_ON (1 << 4)
  886. #define DPI_BACK_LIGHT_OFF (1 << 5)
  887. #define DPI_LP (1 << 6)
  888. #define DPI_DATA_REG 0xb04c
  889. #define DPI_BACK_LIGHT_ON_DATA 0x07
  890. #define DPI_BACK_LIGHT_OFF_DATA 0x17
  891. #define INIT_COUNT_REG 0xb050
  892. #define MAX_RET_PAK_REG 0xb054
  893. #define VIDEO_FMT_REG 0xb058
  894. #define COMPLETE_LAST_PCKT (1 << 2)
  895. #define EOT_DISABLE_REG 0xb05c
  896. #define ENABLE_CLOCK_STOPPING (1 << 1)
  897. #define LP_BYTECLK_REG 0xb060
  898. #define LP_GEN_DATA_REG 0xb064
  899. #define HS_GEN_DATA_REG 0xb068
  900. #define LP_GEN_CTRL_REG 0xb06C
  901. #define HS_GEN_CTRL_REG 0xb070
  902. #define DCS_CHANNEL_NUMBER_POS 0x6
  903. #define MCS_COMMANDS_POS 0x8
  904. #define WORD_COUNTS_POS 0x8
  905. #define MCS_PARAMETER_POS 0x10
  906. #define GEN_FIFO_STAT_REG 0xb074
  907. #define HS_DATA_FIFO_FULL (1 << 0)
  908. #define HS_DATA_FIFO_HALF_EMPTY (1 << 1)
  909. #define HS_DATA_FIFO_EMPTY (1 << 2)
  910. #define LP_DATA_FIFO_FULL (1 << 8)
  911. #define LP_DATA_FIFO_HALF_EMPTY (1 << 9)
  912. #define LP_DATA_FIFO_EMPTY (1 << 10)
  913. #define HS_CTRL_FIFO_FULL (1 << 16)
  914. #define HS_CTRL_FIFO_HALF_EMPTY (1 << 17)
  915. #define HS_CTRL_FIFO_EMPTY (1 << 18)
  916. #define LP_CTRL_FIFO_FULL (1 << 24)
  917. #define LP_CTRL_FIFO_HALF_EMPTY (1 << 25)
  918. #define LP_CTRL_FIFO_EMPTY (1 << 26)
  919. #define DBI_FIFO_EMPTY (1 << 27)
  920. #define DPI_FIFO_EMPTY (1 << 28)
  921. #define HS_LS_DBI_ENABLE_REG 0xb078
  922. #define TXCLKESC_REG 0xb07c
  923. #define DPHY_PARAM_REG 0xb080
  924. #define DBI_BW_CTRL_REG 0xb084
  925. #define CLK_LANE_SWT_REG 0xb088
  926. /*
  927. * MIPI Adapter registers
  928. */
  929. #define MIPI_CONTROL_REG 0xb104
  930. #define MIPI_2X_CLOCK_BITS ((1 << 0) | (1 << 1))
  931. #define MIPI_DATA_ADDRESS_REG 0xb108
  932. #define MIPI_DATA_LENGTH_REG 0xb10C
  933. #define MIPI_COMMAND_ADDRESS_REG 0xb110
  934. #define MIPI_COMMAND_LENGTH_REG 0xb114
  935. #define MIPI_READ_DATA_RETURN_REG0 0xb118
  936. #define MIPI_READ_DATA_RETURN_REG1 0xb11C
  937. #define MIPI_READ_DATA_RETURN_REG2 0xb120
  938. #define MIPI_READ_DATA_RETURN_REG3 0xb124
  939. #define MIPI_READ_DATA_RETURN_REG4 0xb128
  940. #define MIPI_READ_DATA_RETURN_REG5 0xb12C
  941. #define MIPI_READ_DATA_RETURN_REG6 0xb130
  942. #define MIPI_READ_DATA_RETURN_REG7 0xb134
  943. #define MIPI_READ_DATA_VALID_REG 0xb138
  944. /* DBI COMMANDS */
  945. #define soft_reset 0x01
  946. /*
  947. * The display module performs a software reset.
  948. * Registers are written with their SW Reset default values.
  949. */
  950. #define get_power_mode 0x0a
  951. /*
  952. * The display module returns the current power mode
  953. */
  954. #define get_address_mode 0x0b
  955. /*
  956. * The display module returns the current status.
  957. */
  958. #define get_pixel_format 0x0c
  959. /*
  960. * This command gets the pixel format for the RGB image data
  961. * used by the interface.
  962. */
  963. #define get_display_mode 0x0d
  964. /*
  965. * The display module returns the Display Image Mode status.
  966. */
  967. #define get_signal_mode 0x0e
  968. /*
  969. * The display module returns the Display Signal Mode.
  970. */
  971. #define get_diagnostic_result 0x0f
  972. /*
  973. * The display module returns the self-diagnostic results following
  974. * a Sleep Out command.
  975. */
  976. #define enter_sleep_mode 0x10
  977. /*
  978. * This command causes the display module to enter the Sleep mode.
  979. * In this mode, all unnecessary blocks inside the display module are
  980. * disabled except interface communication. This is the lowest power
  981. * mode the display module supports.
  982. */
  983. #define exit_sleep_mode 0x11
  984. /*
  985. * This command causes the display module to exit Sleep mode.
  986. * All blocks inside the display module are enabled.
  987. */
  988. #define enter_partial_mode 0x12
  989. /*
  990. * This command causes the display module to enter the Partial Display
  991. * Mode. The Partial Display Mode window is described by the
  992. * set_partial_area command.
  993. */
  994. #define enter_normal_mode 0x13
  995. /*
  996. * This command causes the display module to enter the Normal mode.
  997. * Normal Mode is defined as Partial Display mode and Scroll mode are off
  998. */
  999. #define exit_invert_mode 0x20
  1000. /*
  1001. * This command causes the display module to stop inverting the image
  1002. * data on the display device. The frame memory contents remain unchanged.
  1003. * No status bits are changed.
  1004. */
  1005. #define enter_invert_mode 0x21
  1006. /*
  1007. * This command causes the display module to invert the image data only on
  1008. * the display device. The frame memory contents remain unchanged.
  1009. * No status bits are changed.
  1010. */
  1011. #define set_gamma_curve 0x26
  1012. /*
  1013. * This command selects the desired gamma curve for the display device.
  1014. * Four fixed gamma curves are defined in section DCS spec.
  1015. */
  1016. #define set_display_off 0x28
  1017. /* ************************************************************************* *\
  1018. This command causes the display module to stop displaying the image data
  1019. on the display device. The frame memory contents remain unchanged.
  1020. No status bits are changed.
  1021. \* ************************************************************************* */
  1022. #define set_display_on 0x29
  1023. /* ************************************************************************* *\
  1024. This command causes the display module to start displaying the image data
  1025. on the display device. The frame memory contents remain unchanged.
  1026. No status bits are changed.
  1027. \* ************************************************************************* */
  1028. #define set_column_address 0x2a
  1029. /*
  1030. * This command defines the column extent of the frame memory accessed by
  1031. * the hostprocessor with the read_memory_continue and
  1032. * write_memory_continue commands.
  1033. * No status bits are changed.
  1034. */
  1035. #define set_page_addr 0x2b
  1036. /*
  1037. * This command defines the page extent of the frame memory accessed by
  1038. * the host processor with the write_memory_continue and
  1039. * read_memory_continue command.
  1040. * No status bits are changed.
  1041. */
  1042. #define write_mem_start 0x2c
  1043. /*
  1044. * This command transfers image data from the host processor to the
  1045. * display modules frame memory starting at the pixel location specified
  1046. * by preceding set_column_address and set_page_address commands.
  1047. */
  1048. #define set_partial_area 0x30
  1049. /*
  1050. * This command defines the Partial Display mode s display area.
  1051. * There are two parameters associated with this command, the first
  1052. * defines the Start Row (SR) and the second the End Row (ER). SR and ER
  1053. * refer to the Frame Memory Line Pointer.
  1054. */
  1055. #define set_scroll_area 0x33
  1056. /*
  1057. * This command defines the display modules Vertical Scrolling Area.
  1058. */
  1059. #define set_tear_off 0x34
  1060. /*
  1061. * This command turns off the display modules Tearing Effect output
  1062. * signal on the TE signal line.
  1063. */
  1064. #define set_tear_on 0x35
  1065. /*
  1066. * This command turns on the display modules Tearing Effect output signal
  1067. * on the TE signal line.
  1068. */
  1069. #define set_address_mode 0x36
  1070. /*
  1071. * This command sets the data order for transfers from the host processor
  1072. * to display modules frame memory,bits B[7:5] and B3, and from the
  1073. * display modules frame memory to the display device, bits B[2:0] and B4.
  1074. */
  1075. #define set_scroll_start 0x37
  1076. /*
  1077. * This command sets the start of the vertical scrolling area in the frame
  1078. * memory. The vertical scrolling area is fully defined when this command
  1079. * is used with the set_scroll_area command The set_scroll_start command
  1080. * has one parameter, the Vertical Scroll Pointer. The VSP defines the
  1081. * line in the frame memory that is written to the display device as the
  1082. * first line of the vertical scroll area.
  1083. */
  1084. #define exit_idle_mode 0x38
  1085. /*
  1086. * This command causes the display module to exit Idle mode.
  1087. */
  1088. #define enter_idle_mode 0x39
  1089. /*
  1090. * This command causes the display module to enter Idle Mode.
  1091. * In Idle Mode, color expression is reduced. Colors are shown on the
  1092. * display device using the MSB of each of the R, G and B color
  1093. * components in the frame memory
  1094. */
  1095. #define set_pixel_format 0x3a
  1096. /*
  1097. * This command sets the pixel format for the RGB image data used by the
  1098. * interface.
  1099. * Bits D[6:4] DPI Pixel Format Definition
  1100. * Bits D[2:0] DBI Pixel Format Definition
  1101. * Bits D7 and D3 are not used.
  1102. */
  1103. #define DCS_PIXEL_FORMAT_3bpp 0x1
  1104. #define DCS_PIXEL_FORMAT_8bpp 0x2
  1105. #define DCS_PIXEL_FORMAT_12bpp 0x3
  1106. #define DCS_PIXEL_FORMAT_16bpp 0x5
  1107. #define DCS_PIXEL_FORMAT_18bpp 0x6
  1108. #define DCS_PIXEL_FORMAT_24bpp 0x7
  1109. #define write_mem_cont 0x3c
  1110. /*
  1111. * This command transfers image data from the host processor to the
  1112. * display module's frame memory continuing from the pixel location
  1113. * following the previous write_memory_continue or write_memory_start
  1114. * command.
  1115. */
  1116. #define set_tear_scanline 0x44
  1117. /*
  1118. * This command turns on the display modules Tearing Effect output signal
  1119. * on the TE signal line when the display module reaches line N.
  1120. */
  1121. #define get_scanline 0x45
  1122. /*
  1123. * The display module returns the current scanline, N, used to update the
  1124. * display device. The total number of scanlines on a display device is
  1125. * defined as VSYNC + VBP + VACT + VFP.The first scanline is defined as
  1126. * the first line of V Sync and is denoted as Line 0.
  1127. * When in Sleep Mode, the value returned by get_scanline is undefined.
  1128. */
  1129. /* MCS or Generic COMMANDS */
  1130. /* MCS/generic data type */
  1131. #define GEN_SHORT_WRITE_0 0x03 /* generic short write, no parameters */
  1132. #define GEN_SHORT_WRITE_1 0x13 /* generic short write, 1 parameters */
  1133. #define GEN_SHORT_WRITE_2 0x23 /* generic short write, 2 parameters */
  1134. #define GEN_READ_0 0x04 /* generic read, no parameters */
  1135. #define GEN_READ_1 0x14 /* generic read, 1 parameters */
  1136. #define GEN_READ_2 0x24 /* generic read, 2 parameters */
  1137. #define GEN_LONG_WRITE 0x29 /* generic long write */
  1138. #define MCS_SHORT_WRITE_0 0x05 /* MCS short write, no parameters */
  1139. #define MCS_SHORT_WRITE_1 0x15 /* MCS short write, 1 parameters */
  1140. #define MCS_READ 0x06 /* MCS read, no parameters */
  1141. #define MCS_LONG_WRITE 0x39 /* MCS long write */
  1142. /* MCS/generic commands */
  1143. /* TPO MCS */
  1144. #define write_display_profile 0x50
  1145. #define write_display_brightness 0x51
  1146. #define write_ctrl_display 0x53
  1147. #define write_ctrl_cabc 0x55
  1148. #define UI_IMAGE 0x01
  1149. #define STILL_IMAGE 0x02
  1150. #define MOVING_IMAGE 0x03
  1151. #define write_hysteresis 0x57
  1152. #define write_gamma_setting 0x58
  1153. #define write_cabc_min_bright 0x5e
  1154. #define write_kbbc_profile 0x60
  1155. /* TMD MCS */
  1156. #define tmd_write_display_brightness 0x8c
  1157. /*
  1158. * This command is used to control ambient light, panel backlight
  1159. * brightness and gamma settings.
  1160. */
  1161. #define BRIGHT_CNTL_BLOCK_ON (1 << 5)
  1162. #define AMBIENT_LIGHT_SENSE_ON (1 << 4)
  1163. #define DISPLAY_DIMMING_ON (1 << 3)
  1164. #define BACKLIGHT_ON (1 << 2)
  1165. #define DISPLAY_BRIGHTNESS_AUTO (1 << 1)
  1166. #define GAMMA_AUTO (1 << 0)
  1167. /* DCS Interface Pixel Formats */
  1168. #define DCS_PIXEL_FORMAT_3BPP 0x1
  1169. #define DCS_PIXEL_FORMAT_8BPP 0x2
  1170. #define DCS_PIXEL_FORMAT_12BPP 0x3
  1171. #define DCS_PIXEL_FORMAT_16BPP 0x5
  1172. #define DCS_PIXEL_FORMAT_18BPP 0x6
  1173. #define DCS_PIXEL_FORMAT_24BPP 0x7
  1174. /* ONE PARAMETER READ DATA */
  1175. #define addr_mode_data 0xfc
  1176. #define diag_res_data 0x00
  1177. #define disp_mode_data 0x23
  1178. #define pxl_fmt_data 0x77
  1179. #define pwr_mode_data 0x74
  1180. #define sig_mode_data 0x00
  1181. /* TWO PARAMETERS READ DATA */
  1182. #define scanline_data1 0xff
  1183. #define scanline_data2 0xff
  1184. #define NON_BURST_MODE_SYNC_PULSE 0x01 /* Non Burst Mode
  1185. * with Sync Pulse
  1186. */
  1187. #define NON_BURST_MODE_SYNC_EVENTS 0x02 /* Non Burst Mode
  1188. * with Sync events
  1189. */
  1190. #define BURST_MODE 0x03 /* Burst Mode */
  1191. #define DBI_COMMAND_BUFFER_SIZE 0x240 /* 0x32 */ /* 0x120 */
  1192. /* Allocate at least
  1193. * 0x100 Byte with 32
  1194. * byte alignment
  1195. */
  1196. #define DBI_DATA_BUFFER_SIZE 0x120 /* Allocate at least
  1197. * 0x100 Byte with 32
  1198. * byte alignment
  1199. */
  1200. #define DBI_CB_TIME_OUT 0xFFFF
  1201. #define GEN_FB_TIME_OUT 2000
  1202. #define SKU_83 0x01
  1203. #define SKU_100 0x02
  1204. #define SKU_100L 0x04
  1205. #define SKU_BYPASS 0x08
  1206. /* Some handy macros for playing with bitfields. */
  1207. #define PSB_MASK(high, low) (((1<<((high)-(low)+1))-1)<<(low))
  1208. #define SET_FIELD(value, field) (((value) << field ## _SHIFT) & field ## _MASK)
  1209. #define GET_FIELD(word, field) (((word) & field ## _MASK) >> field ## _SHIFT)
  1210. #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
  1211. /* PCI config space */
  1212. #define SB_PCKT 0x02100 /* cedarview */
  1213. # define SB_OPCODE_MASK PSB_MASK(31, 16)
  1214. # define SB_OPCODE_SHIFT 16
  1215. # define SB_OPCODE_READ 0
  1216. # define SB_OPCODE_WRITE 1
  1217. # define SB_DEST_MASK PSB_MASK(15, 8)
  1218. # define SB_DEST_SHIFT 8
  1219. # define SB_DEST_DPLL 0x88
  1220. # define SB_BYTE_ENABLE_MASK PSB_MASK(7, 4)
  1221. # define SB_BYTE_ENABLE_SHIFT 4
  1222. # define SB_BUSY (1 << 0)
  1223. #define DSPCLK_GATE_D 0x6200
  1224. # define VRHUNIT_CLOCK_GATE_DISABLE (1 << 28) /* Fixed value on CDV */
  1225. # define DPOUNIT_CLOCK_GATE_DISABLE (1 << 11)
  1226. # define DPIOUNIT_CLOCK_GATE_DISABLE (1 << 6)
  1227. # define DPUNIT_PIPEB_GATE_DISABLE (1 << 30)
  1228. # define DPUNIT_PIPEA_GATE_DISABLE (1 << 25)
  1229. # define DPCUNIT_CLOCK_GATE_DISABLE (1 << 24)
  1230. # define DPLSUNIT_CLOCK_GATE_DISABLE (1 << 13)
  1231. #define RAMCLK_GATE_D 0x6210
  1232. /* 32-bit value read/written from the DPIO reg. */
  1233. #define SB_DATA 0x02104 /* cedarview */
  1234. /* 32-bit address of the DPIO reg to be read/written. */
  1235. #define SB_ADDR 0x02108 /* cedarview */
  1236. #define DPIO_CFG 0x02110 /* cedarview */
  1237. # define DPIO_MODE_SELECT_1 (1 << 3)
  1238. # define DPIO_MODE_SELECT_0 (1 << 2)
  1239. # define DPIO_SFR_BYPASS (1 << 1)
  1240. /* reset is active low */
  1241. # define DPIO_CMN_RESET_N (1 << 0)
  1242. /* Cedarview sideband registers */
  1243. #define _SB_M_A 0x8008
  1244. #define _SB_M_B 0x8028
  1245. #define SB_M(pipe) _PIPE(pipe, _SB_M_A, _SB_M_B)
  1246. # define SB_M_DIVIDER_MASK (0xFF << 24)
  1247. # define SB_M_DIVIDER_SHIFT 24
  1248. #define _SB_N_VCO_A 0x8014
  1249. #define _SB_N_VCO_B 0x8034
  1250. #define SB_N_VCO(pipe) _PIPE(pipe, _SB_N_VCO_A, _SB_N_VCO_B)
  1251. #define SB_N_VCO_SEL_MASK PSB_MASK(31, 30)
  1252. #define SB_N_VCO_SEL_SHIFT 30
  1253. #define SB_N_DIVIDER_MASK PSB_MASK(29, 26)
  1254. #define SB_N_DIVIDER_SHIFT 26
  1255. #define SB_N_CB_TUNE_MASK PSB_MASK(25, 24)
  1256. #define SB_N_CB_TUNE_SHIFT 24
  1257. /* the bit 14:13 is used to select between the different reference clock for Pipe A/B */
  1258. #define SB_REF_DPLLA 0x8010
  1259. #define SB_REF_DPLLB 0x8030
  1260. #define REF_CLK_MASK (0x3 << 13)
  1261. #define REF_CLK_CORE (0 << 13)
  1262. #define REF_CLK_DPLL (1 << 13)
  1263. #define REF_CLK_DPLLA (2 << 13)
  1264. /* For the DPLL B, it will use the reference clk from DPLL A when using (2 << 13) */
  1265. #define _SB_REF_A 0x8018
  1266. #define _SB_REF_B 0x8038
  1267. #define SB_REF_SFR(pipe) _PIPE(pipe, _SB_REF_A, _SB_REF_B)
  1268. #define _SB_P_A 0x801c
  1269. #define _SB_P_B 0x803c
  1270. #define SB_P(pipe) _PIPE(pipe, _SB_P_A, _SB_P_B)
  1271. #define SB_P2_DIVIDER_MASK PSB_MASK(31, 30)
  1272. #define SB_P2_DIVIDER_SHIFT 30
  1273. #define SB_P2_10 0 /* HDMI, DP, DAC */
  1274. #define SB_P2_5 1 /* DAC */
  1275. #define SB_P2_14 2 /* LVDS single */
  1276. #define SB_P2_7 3 /* LVDS double */
  1277. #define SB_P1_DIVIDER_MASK PSB_MASK(15, 12)
  1278. #define SB_P1_DIVIDER_SHIFT 12
  1279. #define PSB_LANE0 0x120
  1280. #define PSB_LANE1 0x220
  1281. #define PSB_LANE2 0x2320
  1282. #define PSB_LANE3 0x2420
  1283. #define LANE_PLL_MASK (0x7 << 20)
  1284. #define LANE_PLL_ENABLE (0x3 << 20)
  1285. #define LANE_PLL_PIPE(p) (((p) == 0) ? (1 << 21) : (0 << 21))
  1286. #define DP_B 0x64100
  1287. #define DP_C 0x64200
  1288. #define DP_PORT_EN (1 << 31)
  1289. #define DP_PIPEB_SELECT (1 << 30)
  1290. #define DP_PIPE_MASK (1 << 30)
  1291. /* Link training mode - select a suitable mode for each stage */
  1292. #define DP_LINK_TRAIN_PAT_1 (0 << 28)
  1293. #define DP_LINK_TRAIN_PAT_2 (1 << 28)
  1294. #define DP_LINK_TRAIN_PAT_IDLE (2 << 28)
  1295. #define DP_LINK_TRAIN_OFF (3 << 28)
  1296. #define DP_LINK_TRAIN_MASK (3 << 28)
  1297. #define DP_LINK_TRAIN_SHIFT 28
  1298. /* Signal voltages. These are mostly controlled by the other end */
  1299. #define DP_VOLTAGE_0_4 (0 << 25)
  1300. #define DP_VOLTAGE_0_6 (1 << 25)
  1301. #define DP_VOLTAGE_0_8 (2 << 25)
  1302. #define DP_VOLTAGE_1_2 (3 << 25)
  1303. #define DP_VOLTAGE_MASK (7 << 25)
  1304. #define DP_VOLTAGE_SHIFT 25
  1305. /* Signal pre-emphasis levels, like voltages, the other end tells us what
  1306. * they want
  1307. */
  1308. #define DP_PRE_EMPHASIS_0 (0 << 22)
  1309. #define DP_PRE_EMPHASIS_3_5 (1 << 22)
  1310. #define DP_PRE_EMPHASIS_6 (2 << 22)
  1311. #define DP_PRE_EMPHASIS_9_5 (3 << 22)
  1312. #define DP_PRE_EMPHASIS_MASK (7 << 22)
  1313. #define DP_PRE_EMPHASIS_SHIFT 22
  1314. /* How many wires to use. I guess 3 was too hard */
  1315. #define DP_PORT_WIDTH_1 (0 << 19)
  1316. #define DP_PORT_WIDTH_2 (1 << 19)
  1317. #define DP_PORT_WIDTH_4 (3 << 19)
  1318. #define DP_PORT_WIDTH_MASK (7 << 19)
  1319. /* Mystic DPCD version 1.1 special mode */
  1320. #define DP_ENHANCED_FRAMING (1 << 18)
  1321. /** locked once port is enabled */
  1322. #define DP_PORT_REVERSAL (1 << 15)
  1323. /** sends the clock on lane 15 of the PEG for debug */
  1324. #define DP_CLOCK_OUTPUT_ENABLE (1 << 13)
  1325. #define DP_SCRAMBLING_DISABLE (1 << 12)
  1326. #define DP_SCRAMBLING_DISABLE_IRONLAKE (1 << 7)
  1327. /** limit RGB values to avoid confusing TVs */
  1328. #define DP_COLOR_RANGE_16_235 (1 << 8)
  1329. /** Turn on the audio link */
  1330. #define DP_AUDIO_OUTPUT_ENABLE (1 << 6)
  1331. /** vs and hs sync polarity */
  1332. #define DP_SYNC_VS_HIGH (1 << 4)
  1333. #define DP_SYNC_HS_HIGH (1 << 3)
  1334. /** A fantasy */
  1335. #define DP_DETECTED (1 << 2)
  1336. /** The aux channel provides a way to talk to the
  1337. * signal sink for DDC etc. Max packet size supported
  1338. * is 20 bytes in each direction, hence the 5 fixed
  1339. * data registers
  1340. */
  1341. #define DPB_AUX_CH_CTL 0x64110
  1342. #define DPB_AUX_CH_DATA1 0x64114
  1343. #define DPB_AUX_CH_DATA2 0x64118
  1344. #define DPB_AUX_CH_DATA3 0x6411c
  1345. #define DPB_AUX_CH_DATA4 0x64120
  1346. #define DPB_AUX_CH_DATA5 0x64124
  1347. #define DPC_AUX_CH_CTL 0x64210
  1348. #define DPC_AUX_CH_DATA1 0x64214
  1349. #define DPC_AUX_CH_DATA2 0x64218
  1350. #define DPC_AUX_CH_DATA3 0x6421c
  1351. #define DPC_AUX_CH_DATA4 0x64220
  1352. #define DPC_AUX_CH_DATA5 0x64224
  1353. #define DP_AUX_CH_CTL_SEND_BUSY (1 << 31)
  1354. #define DP_AUX_CH_CTL_DONE (1 << 30)
  1355. #define DP_AUX_CH_CTL_INTERRUPT (1 << 29)
  1356. #define DP_AUX_CH_CTL_TIME_OUT_ERROR (1 << 28)
  1357. #define DP_AUX_CH_CTL_TIME_OUT_400us (0 << 26)
  1358. #define DP_AUX_CH_CTL_TIME_OUT_600us (1 << 26)
  1359. #define DP_AUX_CH_CTL_TIME_OUT_800us (2 << 26)
  1360. #define DP_AUX_CH_CTL_TIME_OUT_1600us (3 << 26)
  1361. #define DP_AUX_CH_CTL_TIME_OUT_MASK (3 << 26)
  1362. #define DP_AUX_CH_CTL_RECEIVE_ERROR (1 << 25)
  1363. #define DP_AUX_CH_CTL_MESSAGE_SIZE_MASK (0x1f << 20)
  1364. #define DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT 20
  1365. #define DP_AUX_CH_CTL_PRECHARGE_2US_MASK (0xf << 16)
  1366. #define DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT 16
  1367. #define DP_AUX_CH_CTL_AUX_AKSV_SELECT (1 << 15)
  1368. #define DP_AUX_CH_CTL_MANCHESTER_TEST (1 << 14)
  1369. #define DP_AUX_CH_CTL_SYNC_TEST (1 << 13)
  1370. #define DP_AUX_CH_CTL_DEGLITCH_TEST (1 << 12)
  1371. #define DP_AUX_CH_CTL_PRECHARGE_TEST (1 << 11)
  1372. #define DP_AUX_CH_CTL_BIT_CLOCK_2X_MASK (0x7ff)
  1373. #define DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT 0
  1374. /*
  1375. * Computing GMCH M and N values for the Display Port link
  1376. *
  1377. * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes
  1378. *
  1379. * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz)
  1380. *
  1381. * The GMCH value is used internally
  1382. *
  1383. * bytes_per_pixel is the number of bytes coming out of the plane,
  1384. * which is after the LUTs, so we want the bytes for our color format.
  1385. * For our current usage, this is always 3, one byte for R, G and B.
  1386. */
  1387. #define _PIPEA_GMCH_DATA_M 0x70050
  1388. #define _PIPEB_GMCH_DATA_M 0x71050
  1389. /* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */
  1390. #define PIPE_GMCH_DATA_M_TU_SIZE_MASK (0x3f << 25)
  1391. #define PIPE_GMCH_DATA_M_TU_SIZE_SHIFT 25
  1392. #define PIPE_GMCH_DATA_M_MASK (0xffffff)
  1393. #define _PIPEA_GMCH_DATA_N 0x70054
  1394. #define _PIPEB_GMCH_DATA_N 0x71054
  1395. #define PIPE_GMCH_DATA_N_MASK (0xffffff)
  1396. /*
  1397. * Computing Link M and N values for the Display Port link
  1398. *
  1399. * Link M / N = pixel_clock / ls_clk
  1400. *
  1401. * (the DP spec calls pixel_clock the 'strm_clk')
  1402. *
  1403. * The Link value is transmitted in the Main Stream
  1404. * Attributes and VB-ID.
  1405. */
  1406. #define _PIPEA_DP_LINK_M 0x70060
  1407. #define _PIPEB_DP_LINK_M 0x71060
  1408. #define PIPEA_DP_LINK_M_MASK (0xffffff)
  1409. #define _PIPEA_DP_LINK_N 0x70064
  1410. #define _PIPEB_DP_LINK_N 0x71064
  1411. #define PIPEA_DP_LINK_N_MASK (0xffffff)
  1412. #define PIPE_GMCH_DATA_M(pipe) _PIPE(pipe, _PIPEA_GMCH_DATA_M, _PIPEB_GMCH_DATA_M)
  1413. #define PIPE_GMCH_DATA_N(pipe) _PIPE(pipe, _PIPEA_GMCH_DATA_N, _PIPEB_GMCH_DATA_N)
  1414. #define PIPE_DP_LINK_M(pipe) _PIPE(pipe, _PIPEA_DP_LINK_M, _PIPEB_DP_LINK_M)
  1415. #define PIPE_DP_LINK_N(pipe) _PIPE(pipe, _PIPEA_DP_LINK_N, _PIPEB_DP_LINK_N)
  1416. #define PIPE_BPC_MASK (7 << 5)
  1417. #define PIPE_8BPC (0 << 5)
  1418. #define PIPE_10BPC (1 << 5)
  1419. #define PIPE_6BPC (2 << 5)
  1420. #endif