psb_intel_reg.h 48 KB

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