mmp_ctrl.h 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974
  1. /*
  2. * drivers/video/mmp/hw/mmp_ctrl.h
  3. *
  4. *
  5. * Copyright (C) 2012 Marvell Technology Group Ltd.
  6. * Authors: Guoqing Li <ligq@marvell.com>
  7. * Lisa Du <cldu@marvell.com>
  8. * Zhou Zhu <zzhu3@marvell.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but WITHOUT
  16. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  17. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  18. * more details.
  19. *
  20. * You should have received a copy of the GNU General Public License along with
  21. * this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. #ifndef _MMP_CTRL_H_
  25. #define _MMP_CTRL_H_
  26. #include <video/mmp_disp.h>
  27. /* ------------< LCD register >------------ */
  28. struct lcd_regs {
  29. /* TV patch register for MMP2 */
  30. /* 32 bit TV Video Frame0 Y Starting Address */
  31. #define LCD_TVD_START_ADDR_Y0 (0x0000)
  32. /* 32 bit TV Video Frame0 U Starting Address */
  33. #define LCD_TVD_START_ADDR_U0 (0x0004)
  34. /* 32 bit TV Video Frame0 V Starting Address */
  35. #define LCD_TVD_START_ADDR_V0 (0x0008)
  36. /* 32 bit TV Video Frame0 Command Starting Address */
  37. #define LCD_TVD_START_ADDR_C0 (0x000C)
  38. /* 32 bit TV Video Frame1 Y Starting Address Register*/
  39. #define LCD_TVD_START_ADDR_Y1 (0x0010)
  40. /* 32 bit TV Video Frame1 U Starting Address Register*/
  41. #define LCD_TVD_START_ADDR_U1 (0x0014)
  42. /* 32 bit TV Video Frame1 V Starting Address Register*/
  43. #define LCD_TVD_START_ADDR_V1 (0x0018)
  44. /* 32 bit TV Video Frame1 Command Starting Address Register*/
  45. #define LCD_TVD_START_ADDR_C1 (0x001C)
  46. /* 32 bit TV Video Y andC Line Length(Pitch)Register*/
  47. #define LCD_TVD_PITCH_YC (0x0020)
  48. /* 32 bit TV Video U andV Line Length(Pitch)Register*/
  49. #define LCD_TVD_PITCH_UV (0x0024)
  50. /* 32 bit TV Video Starting Point on Screen Register*/
  51. #define LCD_TVD_OVSA_HPXL_VLN (0x0028)
  52. /* 32 bit TV Video Source Size Register*/
  53. #define LCD_TVD_HPXL_VLN (0x002C)
  54. /* 32 bit TV Video Destination Size (After Zooming)Register*/
  55. #define LCD_TVDZM_HPXL_VLN (0x0030)
  56. u32 v_y0;
  57. u32 v_u0;
  58. u32 v_v0;
  59. u32 v_c0;
  60. u32 v_y1;
  61. u32 v_u1;
  62. u32 v_v1;
  63. u32 v_c1;
  64. u32 v_pitch_yc; /* Video Y and C Line Length (Pitch) */
  65. u32 v_pitch_uv; /* Video U and V Line Length (Pitch) */
  66. u32 v_start; /* Video Starting Point on Screen */
  67. u32 v_size; /* Video Source Size */
  68. u32 v_size_z; /* Video Destination Size (After Zooming) */
  69. /* 32 bit TV Graphic Frame 0 Starting Address Register*/
  70. #define LCD_TVG_START_ADDR0 (0x0034)
  71. /* 32 bit TV Graphic Frame 1 Starting Address Register*/
  72. #define LCD_TVG_START_ADDR1 (0x0038)
  73. /* 32 bit TV Graphic Line Length(Pitch)Register*/
  74. #define LCD_TVG_PITCH (0x003C)
  75. /* 32 bit TV Graphic Starting Point on Screen Register*/
  76. #define LCD_TVG_OVSA_HPXL_VLN (0x0040)
  77. /* 32 bit TV Graphic Source Size Register*/
  78. #define LCD_TVG_HPXL_VLN (0x0044)
  79. /* 32 bit TV Graphic Destination size (after Zooming)Register*/
  80. #define LCD_TVGZM_HPXL_VLN (0x0048)
  81. u32 g_0; /* Graphic Frame 0/1 Starting Address */
  82. u32 g_1;
  83. u32 g_pitch; /* Graphic Line Length (Pitch) */
  84. u32 g_start; /* Graphic Starting Point on Screen */
  85. u32 g_size; /* Graphic Source Size */
  86. u32 g_size_z; /* Graphic Destination Size (After Zooming) */
  87. /* 32 bit TV Hardware Cursor Starting Point on screen Register*/
  88. #define LCD_TVC_OVSA_HPXL_VLN (0x004C)
  89. /* 32 bit TV Hardware Cursor Size Register */
  90. #define LCD_TVC_HPXL_VLN (0x0050)
  91. u32 hc_start; /* Hardware Cursor */
  92. u32 hc_size; /* Hardware Cursor */
  93. /* 32 bit TV Total Screen Size Register*/
  94. #define LCD_TV_V_H_TOTAL (0x0054)
  95. /* 32 bit TV Screen Active Size Register*/
  96. #define LCD_TV_V_H_ACTIVE (0x0058)
  97. /* 32 bit TV Screen Horizontal Porch Register*/
  98. #define LCD_TV_H_PORCH (0x005C)
  99. /* 32 bit TV Screen Vertical Porch Register*/
  100. #define LCD_TV_V_PORCH (0x0060)
  101. u32 screen_size; /* Screen Total Size */
  102. u32 screen_active; /* Screen Active Size */
  103. u32 screen_h_porch; /* Screen Horizontal Porch */
  104. u32 screen_v_porch; /* Screen Vertical Porch */
  105. /* 32 bit TV Screen Blank Color Register*/
  106. #define LCD_TV_BLANKCOLOR (0x0064)
  107. /* 32 bit TV Hardware Cursor Color1 Register*/
  108. #define LCD_TV_ALPHA_COLOR1 (0x0068)
  109. /* 32 bit TV Hardware Cursor Color2 Register*/
  110. #define LCD_TV_ALPHA_COLOR2 (0x006C)
  111. u32 blank_color; /* Screen Blank Color */
  112. u32 hc_Alpha_color1; /* Hardware Cursor Color1 */
  113. u32 hc_Alpha_color2; /* Hardware Cursor Color2 */
  114. /* 32 bit TV Video Y Color Key Control*/
  115. #define LCD_TV_COLORKEY_Y (0x0070)
  116. /* 32 bit TV Video U Color Key Control*/
  117. #define LCD_TV_COLORKEY_U (0x0074)
  118. /* 32 bit TV Video V Color Key Control*/
  119. #define LCD_TV_COLORKEY_V (0x0078)
  120. u32 v_colorkey_y; /* Video Y Color Key Control */
  121. u32 v_colorkey_u; /* Video U Color Key Control */
  122. u32 v_colorkey_v; /* Video V Color Key Control */
  123. /* 32 bit TV VSYNC PulsePixel Edge Control Register*/
  124. #define LCD_TV_SEPXLCNT (0x007C)
  125. u32 vsync_ctrl; /* VSYNC PulsePixel Edge Control */
  126. };
  127. #define intf_ctrl(id) ((id) ? (((id) & 1) ? LCD_TVIF_CTRL : \
  128. LCD_DUMB2_CTRL) : LCD_SPU_DUMB_CTRL)
  129. #define dma_ctrl0(id) ((id) ? (((id) & 1) ? LCD_TV_CTRL0 : \
  130. LCD_PN2_CTRL0) : LCD_SPU_DMA_CTRL0)
  131. #define dma_ctrl1(id) ((id) ? (((id) & 1) ? LCD_TV_CTRL1 : \
  132. LCD_PN2_CTRL1) : LCD_SPU_DMA_CTRL1)
  133. #define dma_ctrl(ctrl1, id) (ctrl1 ? dma_ctrl1(id) : dma_ctrl0(id))
  134. /* 32 bit TV Path DMA Control 0*/
  135. #define LCD_TV_CTRL0 (0x0080)
  136. /* 32 bit TV Path DMA Control 1*/
  137. #define LCD_TV_CTRL1 (0x0084)
  138. /* 32 bit TV Path Video Contrast*/
  139. #define LCD_TV_CONTRAST (0x0088)
  140. /* 32 bit TV Path Video Saturation*/
  141. #define LCD_TV_SATURATION (0x008C)
  142. /* 32 bit TV Path Video Hue Adjust*/
  143. #define LCD_TV_CBSH_HUE (0x0090)
  144. /* 32 bit TV Path TVIF Control Register */
  145. #define LCD_TVIF_CTRL (0x0094)
  146. #define TV_VBLNK_VALID_EN (1 << 12)
  147. /* 32 bit TV Path I/O Pad Control*/
  148. #define LCD_TVIOPAD_CTRL (0x0098)
  149. /* 32 bit TV Path Cloc Divider */
  150. #define LCD_TCLK_DIV (0x009C)
  151. #define LCD_SCLK(path) ((PATH_PN == path->id) ? LCD_CFG_SCLK_DIV :\
  152. ((PATH_TV == path->id) ? LCD_TCLK_DIV : LCD_PN2_SCLK_DIV))
  153. /* dither configure */
  154. #ifdef CONFIG_CPU_PXA988
  155. #define LCD_DITHER_CTRL (0x01EC)
  156. #else
  157. #define LCD_DITHER_CTRL (0x00A0)
  158. #endif
  159. #define DITHER_TBL_INDEX_SEL(s) ((s) << 16)
  160. #define DITHER_MODE2(m) ((m) << 12)
  161. #define DITHER_MODE2_SHIFT (12)
  162. #define DITHER_4X8_EN2 (1 << 9)
  163. #define DITHER_4X8_EN2_SHIFT (9)
  164. #define DITHER_EN2 (1 << 8)
  165. #define DITHER_MODE1(m) ((m) << 4)
  166. #define DITHER_MODE1_SHIFT (4)
  167. #define DITHER_4X8_EN1 (1 << 1)
  168. #define DITHER_4X8_EN1_SHIFT (1)
  169. #define DITHER_EN1 (1)
  170. /* dither table data was fixed by video bpp of input and output*/
  171. #ifdef CONFIG_CPU_PXA988
  172. #define DITHER_TB_4X4_INDEX0 (0x6e4ca280)
  173. #define DITHER_TB_4X4_INDEX1 (0x5d7f91b3)
  174. #define DITHER_TB_4X8_INDEX0 (0xb391a280)
  175. #define DITHER_TB_4X8_INDEX1 (0x7f5d6e4c)
  176. #define DITHER_TB_4X8_INDEX2 (0x80a291b3)
  177. #define DITHER_TB_4X8_INDEX3 (0x4c6e5d7f)
  178. #define LCD_DITHER_TBL_DATA (0x01F0)
  179. #else
  180. #define DITHER_TB_4X4_INDEX0 (0x3b19f7d5)
  181. #define DITHER_TB_4X4_INDEX1 (0x082ac4e6)
  182. #define DITHER_TB_4X8_INDEX0 (0xf7d508e6)
  183. #define DITHER_TB_4X8_INDEX1 (0x3b194c2a)
  184. #define DITHER_TB_4X8_INDEX2 (0xc4e6d5f7)
  185. #define DITHER_TB_4X8_INDEX3 (0x082a193b)
  186. #define LCD_DITHER_TBL_DATA (0x00A4)
  187. #endif
  188. /* Video Frame 0&1 start address registers */
  189. #define LCD_SPU_DMA_START_ADDR_Y0 0x00C0
  190. #define LCD_SPU_DMA_START_ADDR_U0 0x00C4
  191. #define LCD_SPU_DMA_START_ADDR_V0 0x00C8
  192. #define LCD_CFG_DMA_START_ADDR_0 0x00CC /* Cmd address */
  193. #define LCD_SPU_DMA_START_ADDR_Y1 0x00D0
  194. #define LCD_SPU_DMA_START_ADDR_U1 0x00D4
  195. #define LCD_SPU_DMA_START_ADDR_V1 0x00D8
  196. #define LCD_CFG_DMA_START_ADDR_1 0x00DC /* Cmd address */
  197. /* YC & UV Pitch */
  198. #define LCD_SPU_DMA_PITCH_YC 0x00E0
  199. #define SPU_DMA_PITCH_C(c) ((c)<<16)
  200. #define SPU_DMA_PITCH_Y(y) (y)
  201. #define LCD_SPU_DMA_PITCH_UV 0x00E4
  202. #define SPU_DMA_PITCH_V(v) ((v)<<16)
  203. #define SPU_DMA_PITCH_U(u) (u)
  204. /* Video Starting Point on Screen Register */
  205. #define LCD_SPUT_DMA_OVSA_HPXL_VLN 0x00E8
  206. #define CFG_DMA_OVSA_VLN(y) ((y)<<16) /* 0~0xfff */
  207. #define CFG_DMA_OVSA_HPXL(x) (x) /* 0~0xfff */
  208. /* Video Size Register */
  209. #define LCD_SPU_DMA_HPXL_VLN 0x00EC
  210. #define CFG_DMA_VLN(y) ((y)<<16)
  211. #define CFG_DMA_HPXL(x) (x)
  212. /* Video Size After zooming Register */
  213. #define LCD_SPU_DZM_HPXL_VLN 0x00F0
  214. #define CFG_DZM_VLN(y) ((y)<<16)
  215. #define CFG_DZM_HPXL(x) (x)
  216. /* Graphic Frame 0&1 Starting Address Register */
  217. #define LCD_CFG_GRA_START_ADDR0 0x00F4
  218. #define LCD_CFG_GRA_START_ADDR1 0x00F8
  219. /* Graphic Frame Pitch */
  220. #define LCD_CFG_GRA_PITCH 0x00FC
  221. /* Graphic Starting Point on Screen Register */
  222. #define LCD_SPU_GRA_OVSA_HPXL_VLN 0x0100
  223. #define CFG_GRA_OVSA_VLN(y) ((y)<<16)
  224. #define CFG_GRA_OVSA_HPXL(x) (x)
  225. /* Graphic Size Register */
  226. #define LCD_SPU_GRA_HPXL_VLN 0x0104
  227. #define CFG_GRA_VLN(y) ((y)<<16)
  228. #define CFG_GRA_HPXL(x) (x)
  229. /* Graphic Size after Zooming Register */
  230. #define LCD_SPU_GZM_HPXL_VLN 0x0108
  231. #define CFG_GZM_VLN(y) ((y)<<16)
  232. #define CFG_GZM_HPXL(x) (x)
  233. /* HW Cursor Starting Point on Screen Register */
  234. #define LCD_SPU_HWC_OVSA_HPXL_VLN 0x010C
  235. #define CFG_HWC_OVSA_VLN(y) ((y)<<16)
  236. #define CFG_HWC_OVSA_HPXL(x) (x)
  237. /* HW Cursor Size */
  238. #define LCD_SPU_HWC_HPXL_VLN 0x0110
  239. #define CFG_HWC_VLN(y) ((y)<<16)
  240. #define CFG_HWC_HPXL(x) (x)
  241. /* Total Screen Size Register */
  242. #define LCD_SPUT_V_H_TOTAL 0x0114
  243. #define CFG_V_TOTAL(y) ((y)<<16)
  244. #define CFG_H_TOTAL(x) (x)
  245. /* Total Screen Active Size Register */
  246. #define LCD_SPU_V_H_ACTIVE 0x0118
  247. #define CFG_V_ACTIVE(y) ((y)<<16)
  248. #define CFG_H_ACTIVE(x) (x)
  249. /* Screen H&V Porch Register */
  250. #define LCD_SPU_H_PORCH 0x011C
  251. #define CFG_H_BACK_PORCH(b) ((b)<<16)
  252. #define CFG_H_FRONT_PORCH(f) (f)
  253. #define LCD_SPU_V_PORCH 0x0120
  254. #define CFG_V_BACK_PORCH(b) ((b)<<16)
  255. #define CFG_V_FRONT_PORCH(f) (f)
  256. /* Screen Blank Color Register */
  257. #define LCD_SPU_BLANKCOLOR 0x0124
  258. #define CFG_BLANKCOLOR_MASK 0x00FFFFFF
  259. #define CFG_BLANKCOLOR_R_MASK 0x000000FF
  260. #define CFG_BLANKCOLOR_G_MASK 0x0000FF00
  261. #define CFG_BLANKCOLOR_B_MASK 0x00FF0000
  262. /* HW Cursor Color 1&2 Register */
  263. #define LCD_SPU_ALPHA_COLOR1 0x0128
  264. #define CFG_HWC_COLOR1 0x00FFFFFF
  265. #define CFG_HWC_COLOR1_R(red) ((red)<<16)
  266. #define CFG_HWC_COLOR1_G(green) ((green)<<8)
  267. #define CFG_HWC_COLOR1_B(blue) (blue)
  268. #define CFG_HWC_COLOR1_R_MASK 0x000000FF
  269. #define CFG_HWC_COLOR1_G_MASK 0x0000FF00
  270. #define CFG_HWC_COLOR1_B_MASK 0x00FF0000
  271. #define LCD_SPU_ALPHA_COLOR2 0x012C
  272. #define CFG_HWC_COLOR2 0x00FFFFFF
  273. #define CFG_HWC_COLOR2_R_MASK 0x000000FF
  274. #define CFG_HWC_COLOR2_G_MASK 0x0000FF00
  275. #define CFG_HWC_COLOR2_B_MASK 0x00FF0000
  276. /* Video YUV Color Key Control */
  277. #define LCD_SPU_COLORKEY_Y 0x0130
  278. #define CFG_CKEY_Y2(y2) ((y2)<<24)
  279. #define CFG_CKEY_Y2_MASK 0xFF000000
  280. #define CFG_CKEY_Y1(y1) ((y1)<<16)
  281. #define CFG_CKEY_Y1_MASK 0x00FF0000
  282. #define CFG_CKEY_Y(y) ((y)<<8)
  283. #define CFG_CKEY_Y_MASK 0x0000FF00
  284. #define CFG_ALPHA_Y(y) (y)
  285. #define CFG_ALPHA_Y_MASK 0x000000FF
  286. #define LCD_SPU_COLORKEY_U 0x0134
  287. #define CFG_CKEY_U2(u2) ((u2)<<24)
  288. #define CFG_CKEY_U2_MASK 0xFF000000
  289. #define CFG_CKEY_U1(u1) ((u1)<<16)
  290. #define CFG_CKEY_U1_MASK 0x00FF0000
  291. #define CFG_CKEY_U(u) ((u)<<8)
  292. #define CFG_CKEY_U_MASK 0x0000FF00
  293. #define CFG_ALPHA_U(u) (u)
  294. #define CFG_ALPHA_U_MASK 0x000000FF
  295. #define LCD_SPU_COLORKEY_V 0x0138
  296. #define CFG_CKEY_V2(v2) ((v2)<<24)
  297. #define CFG_CKEY_V2_MASK 0xFF000000
  298. #define CFG_CKEY_V1(v1) ((v1)<<16)
  299. #define CFG_CKEY_V1_MASK 0x00FF0000
  300. #define CFG_CKEY_V(v) ((v)<<8)
  301. #define CFG_CKEY_V_MASK 0x0000FF00
  302. #define CFG_ALPHA_V(v) (v)
  303. #define CFG_ALPHA_V_MASK 0x000000FF
  304. /* Graphics/Video DMA color key enable bits in LCD_TV_CTRL1 */
  305. #define CFG_CKEY_GRA 0x2
  306. #define CFG_CKEY_DMA 0x1
  307. /* Interlace mode enable bits in LCD_TV_CTRL1 */
  308. #define CFG_TV_INTERLACE_EN (1 << 22)
  309. #define CFG_TV_NIB (1 << 0)
  310. #define LCD_PN_SEPXLCNT 0x013c /* MMP2 */
  311. /* SPI Read Data Register */
  312. #define LCD_SPU_SPI_RXDATA 0x0140
  313. /* Smart Panel Read Data Register */
  314. #define LCD_SPU_ISA_RSDATA 0x0144
  315. #define ISA_RXDATA_16BIT_1_DATA_MASK 0x000000FF
  316. #define ISA_RXDATA_16BIT_2_DATA_MASK 0x0000FF00
  317. #define ISA_RXDATA_16BIT_3_DATA_MASK 0x00FF0000
  318. #define ISA_RXDATA_16BIT_4_DATA_MASK 0xFF000000
  319. #define ISA_RXDATA_32BIT_1_DATA_MASK 0x00FFFFFF
  320. #define LCD_SPU_DBG_ISA (0x0148) /* TTC */
  321. #define LCD_SPU_DMAVLD_YC (0x014C)
  322. #define LCD_SPU_DMAVLD_UV (0x0150)
  323. #define LCD_SPU_DMAVLD_UVSPU_GRAVLD (0x0154)
  324. #define LCD_READ_IOPAD (0x0148) /* MMP2*/
  325. #define LCD_DMAVLD_YC (0x014C)
  326. #define LCD_DMAVLD_UV (0x0150)
  327. #define LCD_TVGGRAVLD_HLEN (0x0154)
  328. /* HWC SRAM Read Data Register */
  329. #define LCD_SPU_HWC_RDDAT 0x0158
  330. /* Gamma Table SRAM Read Data Register */
  331. #define LCD_SPU_GAMMA_RDDAT 0x015c
  332. #define CFG_GAMMA_RDDAT_MASK 0x000000FF
  333. /* Palette Table SRAM Read Data Register */
  334. #define LCD_SPU_PALETTE_RDDAT 0x0160
  335. #define CFG_PALETTE_RDDAT_MASK 0x00FFFFFF
  336. #define LCD_SPU_DBG_DMATOP (0x0164) /* TTC */
  337. #define LCD_SPU_DBG_GRATOP (0x0168)
  338. #define LCD_SPU_DBG_TXCTRL (0x016C)
  339. #define LCD_SPU_DBG_SLVTOP (0x0170)
  340. #define LCD_SPU_DBG_MUXTOP (0x0174)
  341. #define LCD_SLV_DBG (0x0164) /* MMP2 */
  342. #define LCD_TVDVLD_YC (0x0168)
  343. #define LCD_TVDVLD_UV (0x016C)
  344. #define LCD_TVC_RDDAT (0x0170)
  345. #define LCD_TV_GAMMA_RDDAT (0x0174)
  346. /* I/O Pads Input Read Only Register */
  347. #define LCD_SPU_IOPAD_IN 0x0178
  348. #define CFG_IOPAD_IN_MASK 0x0FFFFFFF
  349. #define LCD_TV_PALETTE_RDDAT (0x0178) /* MMP2 */
  350. /* Reserved Read Only Registers */
  351. #define LCD_CFG_RDREG5F 0x017C
  352. #define IRE_FRAME_CNT_MASK 0x000000C0
  353. #define IPE_FRAME_CNT_MASK 0x00000030
  354. #define GRA_FRAME_CNT_MASK 0x0000000C /* Graphic */
  355. #define DMA_FRAME_CNT_MASK 0x00000003 /* Video */
  356. #define LCD_FRAME_CNT (0x017C) /* MMP2 */
  357. /* SPI Control Register. */
  358. #define LCD_SPU_SPI_CTRL 0x0180
  359. #define CFG_SCLKCNT(div) ((div)<<24) /* 0xFF~0x2 */
  360. #define CFG_SCLKCNT_MASK 0xFF000000
  361. #define CFG_RXBITS(rx) (((rx) - 1)<<16) /* 0x1F~0x1 */
  362. #define CFG_RXBITS_MASK 0x00FF0000
  363. #define CFG_TXBITS(tx) (((tx) - 1)<<8) /* 0x1F~0x1 */
  364. #define CFG_TXBITS_MASK 0x0000FF00
  365. #define CFG_CLKINV(clk) ((clk)<<7)
  366. #define CFG_CLKINV_MASK 0x00000080
  367. #define CFG_KEEPXFER(transfer) ((transfer)<<6)
  368. #define CFG_KEEPXFER_MASK 0x00000040
  369. #define CFG_RXBITSTO0(rx) ((rx)<<5)
  370. #define CFG_RXBITSTO0_MASK 0x00000020
  371. #define CFG_TXBITSTO0(tx) ((tx)<<4)
  372. #define CFG_TXBITSTO0_MASK 0x00000010
  373. #define CFG_SPI_ENA(spi) ((spi)<<3)
  374. #define CFG_SPI_ENA_MASK 0x00000008
  375. #define CFG_SPI_SEL(spi) ((spi)<<2)
  376. #define CFG_SPI_SEL_MASK 0x00000004
  377. #define CFG_SPI_3W4WB(wire) ((wire)<<1)
  378. #define CFG_SPI_3W4WB_MASK 0x00000002
  379. #define CFG_SPI_START(start) (start)
  380. #define CFG_SPI_START_MASK 0x00000001
  381. /* SPI Tx Data Register */
  382. #define LCD_SPU_SPI_TXDATA 0x0184
  383. /*
  384. 1. Smart Pannel 8-bit Bus Control Register.
  385. 2. AHB Slave Path Data Port Register
  386. */
  387. #define LCD_SPU_SMPN_CTRL 0x0188
  388. /* DMA Control 0 Register */
  389. #define LCD_SPU_DMA_CTRL0 0x0190
  390. #define CFG_NOBLENDING(nb) ((nb)<<31)
  391. #define CFG_NOBLENDING_MASK 0x80000000
  392. #define CFG_GAMMA_ENA(gn) ((gn)<<30)
  393. #define CFG_GAMMA_ENA_MASK 0x40000000
  394. #define CFG_CBSH_ENA(cn) ((cn)<<29)
  395. #define CFG_CBSH_ENA_MASK 0x20000000
  396. #define CFG_PALETTE_ENA(pn) ((pn)<<28)
  397. #define CFG_PALETTE_ENA_MASK 0x10000000
  398. #define CFG_ARBFAST_ENA(an) ((an)<<27)
  399. #define CFG_ARBFAST_ENA_MASK 0x08000000
  400. #define CFG_HWC_1BITMOD(mode) ((mode)<<26)
  401. #define CFG_HWC_1BITMOD_MASK 0x04000000
  402. #define CFG_HWC_1BITENA(mn) ((mn)<<25)
  403. #define CFG_HWC_1BITENA_MASK 0x02000000
  404. #define CFG_HWC_ENA(cn) ((cn)<<24)
  405. #define CFG_HWC_ENA_MASK 0x01000000
  406. #define CFG_DMAFORMAT(dmaformat) ((dmaformat)<<20)
  407. #define CFG_DMAFORMAT_MASK 0x00F00000
  408. #define CFG_GRAFORMAT(graformat) ((graformat)<<16)
  409. #define CFG_GRAFORMAT_MASK 0x000F0000
  410. /* for graphic part */
  411. #define CFG_GRA_FTOGGLE(toggle) ((toggle)<<15)
  412. #define CFG_GRA_FTOGGLE_MASK 0x00008000
  413. #define CFG_GRA_HSMOOTH(smooth) ((smooth)<<14)
  414. #define CFG_GRA_HSMOOTH_MASK 0x00004000
  415. #define CFG_GRA_TSTMODE(test) ((test)<<13)
  416. #define CFG_GRA_TSTMODE_MASK 0x00002000
  417. #define CFG_GRA_SWAPRB(swap) ((swap)<<12)
  418. #define CFG_GRA_SWAPRB_MASK 0x00001000
  419. #define CFG_GRA_SWAPUV(swap) ((swap)<<11)
  420. #define CFG_GRA_SWAPUV_MASK 0x00000800
  421. #define CFG_GRA_SWAPYU(swap) ((swap)<<10)
  422. #define CFG_GRA_SWAPYU_MASK 0x00000400
  423. #define CFG_GRA_SWAP_MASK 0x00001C00
  424. #define CFG_YUV2RGB_GRA(cvrt) ((cvrt)<<9)
  425. #define CFG_YUV2RGB_GRA_MASK 0x00000200
  426. #define CFG_GRA_ENA(gra) ((gra)<<8)
  427. #define CFG_GRA_ENA_MASK 0x00000100
  428. #define dma0_gfx_masks (CFG_GRAFORMAT_MASK | CFG_GRA_FTOGGLE_MASK | \
  429. CFG_GRA_HSMOOTH_MASK | CFG_GRA_TSTMODE_MASK | CFG_GRA_SWAP_MASK | \
  430. CFG_YUV2RGB_GRA_MASK | CFG_GRA_ENA_MASK)
  431. /* for video part */
  432. #define CFG_DMA_FTOGGLE(toggle) ((toggle)<<7)
  433. #define CFG_DMA_FTOGGLE_MASK 0x00000080
  434. #define CFG_DMA_HSMOOTH(smooth) ((smooth)<<6)
  435. #define CFG_DMA_HSMOOTH_MASK 0x00000040
  436. #define CFG_DMA_TSTMODE(test) ((test)<<5)
  437. #define CFG_DMA_TSTMODE_MASK 0x00000020
  438. #define CFG_DMA_SWAPRB(swap) ((swap)<<4)
  439. #define CFG_DMA_SWAPRB_MASK 0x00000010
  440. #define CFG_DMA_SWAPUV(swap) ((swap)<<3)
  441. #define CFG_DMA_SWAPUV_MASK 0x00000008
  442. #define CFG_DMA_SWAPYU(swap) ((swap)<<2)
  443. #define CFG_DMA_SWAPYU_MASK 0x00000004
  444. #define CFG_DMA_SWAP_MASK 0x0000001C
  445. #define CFG_YUV2RGB_DMA(cvrt) ((cvrt)<<1)
  446. #define CFG_YUV2RGB_DMA_MASK 0x00000002
  447. #define CFG_DMA_ENA(video) (video)
  448. #define CFG_DMA_ENA_MASK 0x00000001
  449. #define dma0_vid_masks (CFG_DMAFORMAT_MASK | CFG_DMA_FTOGGLE_MASK | \
  450. CFG_DMA_HSMOOTH_MASK | CFG_DMA_TSTMODE_MASK | CFG_DMA_SWAP_MASK | \
  451. CFG_YUV2RGB_DMA_MASK | CFG_DMA_ENA_MASK)
  452. #define dma_palette(val) ((val ? 1 : 0) << 28)
  453. #define dma_fmt(vid, val) ((val & 0xf) << ((vid) ? 20 : 16))
  454. #define dma_swaprb(vid, val) ((val ? 1 : 0) << ((vid) ? 4 : 12))
  455. #define dma_swapuv(vid, val) ((val ? 1 : 0) << ((vid) ? 3 : 11))
  456. #define dma_swapyuv(vid, val) ((val ? 1 : 0) << ((vid) ? 2 : 10))
  457. #define dma_csc(vid, val) ((val ? 1 : 0) << ((vid) ? 1 : 9))
  458. #define dma_hsmooth(vid, val) ((val ? 1 : 0) << ((vid) ? 6 : 14))
  459. #define dma_mask(vid) (dma_palette(1) | dma_fmt(vid, 0xf) | dma_csc(vid, 1) \
  460. | dma_swaprb(vid, 1) | dma_swapuv(vid, 1) | dma_swapyuv(vid, 1))
  461. /* DMA Control 1 Register */
  462. #define LCD_SPU_DMA_CTRL1 0x0194
  463. #define CFG_FRAME_TRIG(trig) ((trig)<<31)
  464. #define CFG_FRAME_TRIG_MASK 0x80000000
  465. #define CFG_VSYNC_TRIG(trig) ((trig)<<28)
  466. #define CFG_VSYNC_TRIG_MASK 0x70000000
  467. #define CFG_VSYNC_INV(inv) ((inv)<<27)
  468. #define CFG_VSYNC_INV_MASK 0x08000000
  469. #define CFG_COLOR_KEY_MODE(cmode) ((cmode)<<24)
  470. #define CFG_COLOR_KEY_MASK 0x07000000
  471. #define CFG_CARRY(carry) ((carry)<<23)
  472. #define CFG_CARRY_MASK 0x00800000
  473. #define CFG_LNBUF_ENA(lnbuf) ((lnbuf)<<22)
  474. #define CFG_LNBUF_ENA_MASK 0x00400000
  475. #define CFG_GATED_ENA(gated) ((gated)<<21)
  476. #define CFG_GATED_ENA_MASK 0x00200000
  477. #define CFG_PWRDN_ENA(power) ((power)<<20)
  478. #define CFG_PWRDN_ENA_MASK 0x00100000
  479. #define CFG_DSCALE(dscale) ((dscale)<<18)
  480. #define CFG_DSCALE_MASK 0x000C0000
  481. #define CFG_ALPHA_MODE(amode) ((amode)<<16)
  482. #define CFG_ALPHA_MODE_MASK 0x00030000
  483. #define CFG_ALPHA(alpha) ((alpha)<<8)
  484. #define CFG_ALPHA_MASK 0x0000FF00
  485. #define CFG_PXLCMD(pxlcmd) (pxlcmd)
  486. #define CFG_PXLCMD_MASK 0x000000FF
  487. /* SRAM Control Register */
  488. #define LCD_SPU_SRAM_CTRL 0x0198
  489. #define CFG_SRAM_INIT_WR_RD(mode) ((mode)<<14)
  490. #define CFG_SRAM_INIT_WR_RD_MASK 0x0000C000
  491. #define CFG_SRAM_ADDR_LCDID(id) ((id)<<8)
  492. #define CFG_SRAM_ADDR_LCDID_MASK 0x00000F00
  493. #define CFG_SRAM_ADDR(addr) (addr)
  494. #define CFG_SRAM_ADDR_MASK 0x000000FF
  495. /* SRAM Write Data Register */
  496. #define LCD_SPU_SRAM_WRDAT 0x019C
  497. /* SRAM RTC/WTC Control Register */
  498. #define LCD_SPU_SRAM_PARA0 0x01A0
  499. /* SRAM Power Down Control Register */
  500. #define LCD_SPU_SRAM_PARA1 0x01A4
  501. #define CFG_CSB_256x32(hwc) ((hwc)<<15) /* HWC */
  502. #define CFG_CSB_256x32_MASK 0x00008000
  503. #define CFG_CSB_256x24(palette) ((palette)<<14) /* Palette */
  504. #define CFG_CSB_256x24_MASK 0x00004000
  505. #define CFG_CSB_256x8(gamma) ((gamma)<<13) /* Gamma */
  506. #define CFG_CSB_256x8_MASK 0x00002000
  507. #define CFG_PDWN256x32(pdwn) ((pdwn)<<7) /* HWC */
  508. #define CFG_PDWN256x32_MASK 0x00000080
  509. #define CFG_PDWN256x24(pdwn) ((pdwn)<<6) /* Palette */
  510. #define CFG_PDWN256x24_MASK 0x00000040
  511. #define CFG_PDWN256x8(pdwn) ((pdwn)<<5) /* Gamma */
  512. #define CFG_PDWN256x8_MASK 0x00000020
  513. #define CFG_PDWN32x32(pdwn) ((pdwn)<<3)
  514. #define CFG_PDWN32x32_MASK 0x00000008
  515. #define CFG_PDWN16x66(pdwn) ((pdwn)<<2)
  516. #define CFG_PDWN16x66_MASK 0x00000004
  517. #define CFG_PDWN32x66(pdwn) ((pdwn)<<1)
  518. #define CFG_PDWN32x66_MASK 0x00000002
  519. #define CFG_PDWN64x66(pdwn) (pdwn)
  520. #define CFG_PDWN64x66_MASK 0x00000001
  521. /* Smart or Dumb Panel Clock Divider */
  522. #define LCD_CFG_SCLK_DIV 0x01A8
  523. #define SCLK_SRC_SEL(src) ((src)<<31)
  524. #define SCLK_SRC_SEL_MASK 0x80000000
  525. #define SCLK_DISABLE (1<<28)
  526. #define CLK_FRACDIV(frac) ((frac)<<16)
  527. #define CLK_FRACDIV_MASK 0x0FFF0000
  528. #define DSI1_BITCLK_DIV(div) (div<<8)
  529. #define DSI1_BITCLK_DIV_MASK 0x00000F00
  530. #define CLK_INT_DIV(div) (div)
  531. #define CLK_INT_DIV_MASK 0x000000FF
  532. /* Video Contrast Register */
  533. #define LCD_SPU_CONTRAST 0x01AC
  534. #define CFG_BRIGHTNESS(bright) ((bright)<<16)
  535. #define CFG_BRIGHTNESS_MASK 0xFFFF0000
  536. #define CFG_CONTRAST(contrast) (contrast)
  537. #define CFG_CONTRAST_MASK 0x0000FFFF
  538. /* Video Saturation Register */
  539. #define LCD_SPU_SATURATION 0x01B0
  540. #define CFG_C_MULTS(mult) ((mult)<<16)
  541. #define CFG_C_MULTS_MASK 0xFFFF0000
  542. #define CFG_SATURATION(sat) (sat)
  543. #define CFG_SATURATION_MASK 0x0000FFFF
  544. /* Video Hue Adjust Register */
  545. #define LCD_SPU_CBSH_HUE 0x01B4
  546. #define CFG_SIN0(sin0) ((sin0)<<16)
  547. #define CFG_SIN0_MASK 0xFFFF0000
  548. #define CFG_COS0(con0) (con0)
  549. #define CFG_COS0_MASK 0x0000FFFF
  550. /* Dump LCD Panel Control Register */
  551. #define LCD_SPU_DUMB_CTRL 0x01B8
  552. #define CFG_DUMBMODE(mode) ((mode)<<28)
  553. #define CFG_DUMBMODE_MASK 0xF0000000
  554. #define CFG_LCDGPIO_O(data) ((data)<<20)
  555. #define CFG_LCDGPIO_O_MASK 0x0FF00000
  556. #define CFG_LCDGPIO_ENA(gpio) ((gpio)<<12)
  557. #define CFG_LCDGPIO_ENA_MASK 0x000FF000
  558. #define CFG_BIAS_OUT(bias) ((bias)<<8)
  559. #define CFG_BIAS_OUT_MASK 0x00000100
  560. #define CFG_REVERSE_RGB(RGB) ((RGB)<<7)
  561. #define CFG_REVERSE_RGB_MASK 0x00000080
  562. #define CFG_INV_COMPBLANK(blank) ((blank)<<6)
  563. #define CFG_INV_COMPBLANK_MASK 0x00000040
  564. #define CFG_INV_COMPSYNC(sync) ((sync)<<5)
  565. #define CFG_INV_COMPSYNC_MASK 0x00000020
  566. #define CFG_INV_HENA(hena) ((hena)<<4)
  567. #define CFG_INV_HENA_MASK 0x00000010
  568. #define CFG_INV_VSYNC(vsync) ((vsync)<<3)
  569. #define CFG_INV_VSYNC_MASK 0x00000008
  570. #define CFG_INV_HSYNC(hsync) ((hsync)<<2)
  571. #define CFG_INV_HSYNC_MASK 0x00000004
  572. #define CFG_INV_PCLK(pclk) ((pclk)<<1)
  573. #define CFG_INV_PCLK_MASK 0x00000002
  574. #define CFG_DUMB_ENA(dumb) (dumb)
  575. #define CFG_DUMB_ENA_MASK 0x00000001
  576. /* LCD I/O Pads Control Register */
  577. #define SPU_IOPAD_CONTROL 0x01BC
  578. #define CFG_GRA_VM_ENA(vm) ((vm)<<15)
  579. #define CFG_GRA_VM_ENA_MASK 0x00008000
  580. #define CFG_DMA_VM_ENA(vm) ((vm)<<13)
  581. #define CFG_DMA_VM_ENA_MASK 0x00002000
  582. #define CFG_CMD_VM_ENA(vm) ((vm)<<12)
  583. #define CFG_CMD_VM_ENA_MASK 0x00001000
  584. #define CFG_CSC(csc) ((csc)<<8)
  585. #define CFG_CSC_MASK 0x00000300
  586. #define CFG_BOUNDARY(size) ((size)<<5)
  587. #define CFG_BOUNDARY_MASK 0x00000020
  588. #define CFG_BURST(len) ((len)<<4)
  589. #define CFG_BURST_MASK 0x00000010
  590. #define CFG_IOPADMODE(iopad) (iopad)
  591. #define CFG_IOPADMODE_MASK 0x0000000F
  592. /* LCD Interrupt Control Register */
  593. #define SPU_IRQ_ENA 0x01C0
  594. #define DMA_FRAME_IRQ0_ENA(irq) ((irq)<<31)
  595. #define DMA_FRAME_IRQ0_ENA_MASK 0x80000000
  596. #define DMA_FRAME_IRQ1_ENA(irq) ((irq)<<30)
  597. #define DMA_FRAME_IRQ1_ENA_MASK 0x40000000
  598. #define DMA_FF_UNDERFLOW_ENA(ff) ((ff)<<29)
  599. #define DMA_FF_UNDERFLOW_ENA_MASK 0x20000000
  600. #define AXI_BUS_ERROR_IRQ_ENA(irq) ((irq)<<28)
  601. #define AXI_BUS_ERROR_IRQ_ENA_MASK 0x10000000
  602. #define GRA_FRAME_IRQ0_ENA(irq) ((irq)<<27)
  603. #define GRA_FRAME_IRQ0_ENA_MASK 0x08000000
  604. #define GRA_FRAME_IRQ1_ENA(irq) ((irq)<<26)
  605. #define GRA_FRAME_IRQ1_ENA_MASK 0x04000000
  606. #define GRA_FF_UNDERFLOW_ENA(ff) ((ff)<<25)
  607. #define GRA_FF_UNDERFLOW_ENA_MASK 0x02000000
  608. #define VSYNC_IRQ_ENA(vsync_irq) ((vsync_irq)<<23)
  609. #define VSYNC_IRQ_ENA_MASK 0x00800000
  610. #define DUMB_FRAMEDONE_ENA(fdone) ((fdone)<<22)
  611. #define DUMB_FRAMEDONE_ENA_MASK 0x00400000
  612. #define TWC_FRAMEDONE_ENA(fdone) ((fdone)<<21)
  613. #define TWC_FRAMEDONE_ENA_MASK 0x00200000
  614. #define HWC_FRAMEDONE_ENA(fdone) ((fdone)<<20)
  615. #define HWC_FRAMEDONE_ENA_MASK 0x00100000
  616. #define SLV_IRQ_ENA(irq) ((irq)<<19)
  617. #define SLV_IRQ_ENA_MASK 0x00080000
  618. #define SPI_IRQ_ENA(irq) ((irq)<<18)
  619. #define SPI_IRQ_ENA_MASK 0x00040000
  620. #define PWRDN_IRQ_ENA(irq) ((irq)<<17)
  621. #define PWRDN_IRQ_ENA_MASK 0x00020000
  622. #define AXI_LATENCY_TOO_LONG_IRQ_ENA(irq) ((irq)<<16)
  623. #define AXI_LATENCY_TOO_LONG_IRQ_ENA_MASK 0x00010000
  624. #define CLEAN_SPU_IRQ_ISR(irq) (irq)
  625. #define CLEAN_SPU_IRQ_ISR_MASK 0x0000FFFF
  626. #define TV_DMA_FRAME_IRQ0_ENA(irq) ((irq)<<15)
  627. #define TV_DMA_FRAME_IRQ0_ENA_MASK 0x00008000
  628. #define TV_DMA_FRAME_IRQ1_ENA(irq) ((irq)<<14)
  629. #define TV_DMA_FRAME_IRQ1_ENA_MASK 0x00004000
  630. #define TV_DMA_FF_UNDERFLOW_ENA(unerrun) ((unerrun)<<13)
  631. #define TV_DMA_FF_UNDERFLOW_ENA_MASK 0x00002000
  632. #define TVSYNC_IRQ_ENA(irq) ((irq)<<12)
  633. #define TVSYNC_IRQ_ENA_MASK 0x00001000
  634. #define TV_FRAME_IRQ0_ENA(irq) ((irq)<<11)
  635. #define TV_FRAME_IRQ0_ENA_MASK 0x00000800
  636. #define TV_FRAME_IRQ1_ENA(irq) ((irq)<<10)
  637. #define TV_FRAME_IRQ1_ENA_MASK 0x00000400
  638. #define TV_GRA_FF_UNDERFLOW_ENA(unerrun) ((unerrun)<<9)
  639. #define TV_GRA_FF_UNDERFLOW_ENA_MASK 0x00000200
  640. #define TV_FRAMEDONE_ENA(irq) ((irq)<<8)
  641. #define TV_FRAMEDONE_ENA_MASK 0x00000100
  642. /* FIXME - JUST GUESS */
  643. #define PN2_DMA_FRAME_IRQ0_ENA(irq) ((irq)<<7)
  644. #define PN2_DMA_FRAME_IRQ0_ENA_MASK 0x00000080
  645. #define PN2_DMA_FRAME_IRQ1_ENA(irq) ((irq)<<6)
  646. #define PN2_DMA_FRAME_IRQ1_ENA_MASK 0x00000040
  647. #define PN2_DMA_FF_UNDERFLOW_ENA(ff) ((ff)<<5)
  648. #define PN2_DMA_FF_UNDERFLOW_ENA_MASK 0x00000020
  649. #define PN2_GRA_FRAME_IRQ0_ENA(irq) ((irq)<<3)
  650. #define PN2_GRA_FRAME_IRQ0_ENA_MASK 0x00000008
  651. #define PN2_GRA_FRAME_IRQ1_ENA(irq) ((irq)<<2)
  652. #define PN2_GRA_FRAME_IRQ1_ENA_MASK 0x04000004
  653. #define PN2_GRA_FF_UNDERFLOW_ENA(ff) ((ff)<<1)
  654. #define PN2_GRA_FF_UNDERFLOW_ENA_MASK 0x00000002
  655. #define PN2_VSYNC_IRQ_ENA(irq) ((irq)<<0)
  656. #define PN2_SYNC_IRQ_ENA_MASK 0x00000001
  657. #define gf0_imask(id) ((id) ? (((id) & 1) ? TV_FRAME_IRQ0_ENA_MASK \
  658. : PN2_GRA_FRAME_IRQ0_ENA_MASK) : GRA_FRAME_IRQ0_ENA_MASK)
  659. #define gf1_imask(id) ((id) ? (((id) & 1) ? TV_FRAME_IRQ1_ENA_MASK \
  660. : PN2_GRA_FRAME_IRQ1_ENA_MASK) : GRA_FRAME_IRQ1_ENA_MASK)
  661. #define vsync_imask(id) ((id) ? (((id) & 1) ? TVSYNC_IRQ_ENA_MASK \
  662. : PN2_SYNC_IRQ_ENA_MASK) : VSYNC_IRQ_ENA_MASK)
  663. #define vsync_imasks (vsync_imask(0) | vsync_imask(1))
  664. #define display_done_imask(id) ((id) ? (((id) & 1) ? TV_FRAMEDONE_ENA_MASK\
  665. : (PN2_DMA_FRAME_IRQ0_ENA_MASK | PN2_DMA_FRAME_IRQ1_ENA_MASK))\
  666. : DUMB_FRAMEDONE_ENA_MASK)
  667. #define display_done_imasks (display_done_imask(0) | display_done_imask(1))
  668. #define vf0_imask(id) ((id) ? (((id) & 1) ? TV_DMA_FRAME_IRQ0_ENA_MASK \
  669. : PN2_DMA_FRAME_IRQ0_ENA_MASK) : DMA_FRAME_IRQ0_ENA_MASK)
  670. #define vf1_imask(id) ((id) ? (((id) & 1) ? TV_DMA_FRAME_IRQ1_ENA_MASK \
  671. : PN2_DMA_FRAME_IRQ1_ENA_MASK) : DMA_FRAME_IRQ1_ENA_MASK)
  672. #define gfx_imasks (gf0_imask(0) | gf1_imask(0) | gf0_imask(1) | \
  673. gf1_imask(1))
  674. #define vid_imasks (vf0_imask(0) | vf1_imask(0) | vf0_imask(1) | \
  675. vf1_imask(1))
  676. #define vid_imask(id) (display_done_imask(id))
  677. #define pn1_imasks (gf0_imask(0) | gf1_imask(0) | vsync_imask(0) | \
  678. display_done_imask(0) | vf0_imask(0) | vf1_imask(0))
  679. #define tv_imasks (gf0_imask(1) | gf1_imask(1) | vsync_imask(1) | \
  680. display_done_imask(1) | vf0_imask(1) | vf1_imask(1))
  681. #define path_imasks(id) ((id) ? (tv_imasks) : (pn1_imasks))
  682. /* error indications */
  683. #define vid_udflow_imask(id) ((id) ? (((id) & 1) ? \
  684. (TV_DMA_FF_UNDERFLOW_ENA_MASK) : (PN2_DMA_FF_UNDERFLOW_ENA_MASK)) : \
  685. (DMA_FF_UNDERFLOW_ENA_MASK))
  686. #define gfx_udflow_imask(id) ((id) ? (((id) & 1) ? \
  687. (TV_GRA_FF_UNDERFLOW_ENA_MASK) : (PN2_GRA_FF_UNDERFLOW_ENA_MASK)) : \
  688. (GRA_FF_UNDERFLOW_ENA_MASK))
  689. #define err_imask(id) (vid_udflow_imask(id) | gfx_udflow_imask(id) | \
  690. AXI_BUS_ERROR_IRQ_ENA_MASK | AXI_LATENCY_TOO_LONG_IRQ_ENA_MASK)
  691. #define err_imasks (err_imask(0) | err_imask(1) | err_imask(2))
  692. /* LCD Interrupt Status Register */
  693. #define SPU_IRQ_ISR 0x01C4
  694. #define DMA_FRAME_IRQ0(irq) ((irq)<<31)
  695. #define DMA_FRAME_IRQ0_MASK 0x80000000
  696. #define DMA_FRAME_IRQ1(irq) ((irq)<<30)
  697. #define DMA_FRAME_IRQ1_MASK 0x40000000
  698. #define DMA_FF_UNDERFLOW(ff) ((ff)<<29)
  699. #define DMA_FF_UNDERFLOW_MASK 0x20000000
  700. #define AXI_BUS_ERROR_IRQ(irq) ((irq)<<28)
  701. #define AXI_BUS_ERROR_IRQ_MASK 0x10000000
  702. #define GRA_FRAME_IRQ0(irq) ((irq)<<27)
  703. #define GRA_FRAME_IRQ0_MASK 0x08000000
  704. #define GRA_FRAME_IRQ1(irq) ((irq)<<26)
  705. #define GRA_FRAME_IRQ1_MASK 0x04000000
  706. #define GRA_FF_UNDERFLOW(ff) ((ff)<<25)
  707. #define GRA_FF_UNDERFLOW_MASK 0x02000000
  708. #define VSYNC_IRQ(vsync_irq) ((vsync_irq)<<23)
  709. #define VSYNC_IRQ_MASK 0x00800000
  710. #define DUMB_FRAMEDONE(fdone) ((fdone)<<22)
  711. #define DUMB_FRAMEDONE_MASK 0x00400000
  712. #define TWC_FRAMEDONE(fdone) ((fdone)<<21)
  713. #define TWC_FRAMEDONE_MASK 0x00200000
  714. #define HWC_FRAMEDONE(fdone) ((fdone)<<20)
  715. #define HWC_FRAMEDONE_MASK 0x00100000
  716. #define SLV_IRQ(irq) ((irq)<<19)
  717. #define SLV_IRQ_MASK 0x00080000
  718. #define SPI_IRQ(irq) ((irq)<<18)
  719. #define SPI_IRQ_MASK 0x00040000
  720. #define PWRDN_IRQ(irq) ((irq)<<17)
  721. #define PWRDN_IRQ_MASK 0x00020000
  722. #define AXI_LATENCY_TOO_LONGR_IRQ(irq) ((irq)<<16)
  723. #define AXI_LATENCY_TOO_LONGR_IRQ_MASK 0x00010000
  724. #define TV_DMA_FRAME_IRQ0(irq) ((irq)<<15)
  725. #define TV_DMA_FRAME_IRQ0_MASK 0x00008000
  726. #define TV_DMA_FRAME_IRQ1(irq) ((irq)<<14)
  727. #define TV_DMA_FRAME_IRQ1_MASK 0x00004000
  728. #define TV_DMA_FF_UNDERFLOW(unerrun) ((unerrun)<<13)
  729. #define TV_DMA_FF_UNDERFLOW_MASK 0x00002000
  730. #define TVSYNC_IRQ(irq) ((irq)<<12)
  731. #define TVSYNC_IRQ_MASK 0x00001000
  732. #define TV_FRAME_IRQ0(irq) ((irq)<<11)
  733. #define TV_FRAME_IRQ0_MASK 0x00000800
  734. #define TV_FRAME_IRQ1(irq) ((irq)<<10)
  735. #define TV_FRAME_IRQ1_MASK 0x00000400
  736. #define TV_GRA_FF_UNDERFLOW(unerrun) ((unerrun)<<9)
  737. #define TV_GRA_FF_UNDERFLOW_MASK 0x00000200
  738. #define PN2_DMA_FRAME_IRQ0(irq) ((irq)<<7)
  739. #define PN2_DMA_FRAME_IRQ0_MASK 0x00000080
  740. #define PN2_DMA_FRAME_IRQ1(irq) ((irq)<<6)
  741. #define PN2_DMA_FRAME_IRQ1_MASK 0x00000040
  742. #define PN2_DMA_FF_UNDERFLOW(ff) ((ff)<<5)
  743. #define PN2_DMA_FF_UNDERFLOW_MASK 0x00000020
  744. #define PN2_GRA_FRAME_IRQ0(irq) ((irq)<<3)
  745. #define PN2_GRA_FRAME_IRQ0_MASK 0x00000008
  746. #define PN2_GRA_FRAME_IRQ1(irq) ((irq)<<2)
  747. #define PN2_GRA_FRAME_IRQ1_MASK 0x04000004
  748. #define PN2_GRA_FF_UNDERFLOW(ff) ((ff)<<1)
  749. #define PN2_GRA_FF_UNDERFLOW_MASK 0x00000002
  750. #define PN2_VSYNC_IRQ(irq) ((irq)<<0)
  751. #define PN2_SYNC_IRQ_MASK 0x00000001
  752. /* LCD FIFO Depth register */
  753. #define LCD_FIFO_DEPTH 0x01c8
  754. #define VIDEO_FIFO(fi) ((fi) << 0)
  755. #define VIDEO_FIFO_MASK 0x00000003
  756. #define GRAPHIC_FIFO(fi) ((fi) << 2)
  757. #define GRAPHIC_FIFO_MASK 0x0000000c
  758. /* read-only */
  759. #define DMA_FRAME_IRQ0_LEVEL_MASK 0x00008000
  760. #define DMA_FRAME_IRQ1_LEVEL_MASK 0x00004000
  761. #define DMA_FRAME_CNT_ISR_MASK 0x00003000
  762. #define GRA_FRAME_IRQ0_LEVEL_MASK 0x00000800
  763. #define GRA_FRAME_IRQ1_LEVEL_MASK 0x00000400
  764. #define GRA_FRAME_CNT_ISR_MASK 0x00000300
  765. #define VSYNC_IRQ_LEVEL_MASK 0x00000080
  766. #define DUMB_FRAMEDONE_LEVEL_MASK 0x00000040
  767. #define TWC_FRAMEDONE_LEVEL_MASK 0x00000020
  768. #define HWC_FRAMEDONE_LEVEL_MASK 0x00000010
  769. #define SLV_FF_EMPTY_MASK 0x00000008
  770. #define DMA_FF_ALLEMPTY_MASK 0x00000004
  771. #define GRA_FF_ALLEMPTY_MASK 0x00000002
  772. #define PWRDN_IRQ_LEVEL_MASK 0x00000001
  773. /* 32 bit LCD Interrupt Reset Status*/
  774. #define SPU_IRQ_RSR (0x01C8)
  775. /* 32 bit Panel Path Graphic Partial Display Horizontal Control Register*/
  776. #define LCD_GRA_CUTHPXL (0x01CC)
  777. /* 32 bit Panel Path Graphic Partial Display Vertical Control Register*/
  778. #define LCD_GRA_CUTVLN (0x01D0)
  779. /* 32 bit TV Path Graphic Partial Display Horizontal Control Register*/
  780. #define LCD_TVG_CUTHPXL (0x01D4)
  781. /* 32 bit TV Path Graphic Partial Display Vertical Control Register*/
  782. #define LCD_TVG_CUTVLN (0x01D8)
  783. /* 32 bit LCD Global Control Register*/
  784. #define LCD_TOP_CTRL (0x01DC)
  785. /* 32 bit LCD SQU Line Buffer Control Register 1*/
  786. #define LCD_SQULN1_CTRL (0x01E0)
  787. /* 32 bit LCD SQU Line Buffer Control Register 2*/
  788. #define LCD_SQULN2_CTRL (0x01E4)
  789. #define squln_ctrl(id) ((id) ? (((id) & 1) ? LCD_SQULN2_CTRL : \
  790. LCD_PN2_SQULN1_CTRL) : LCD_SQULN1_CTRL)
  791. /* 32 bit LCD Mixed Overlay Control Register */
  792. #define LCD_AFA_ALL2ONE (0x01E8)
  793. #define LCD_PN2_SCLK_DIV (0x01EC)
  794. #define LCD_PN2_TCLK_DIV (0x01F0)
  795. #define LCD_LVDS_SCLK_DIV_WR (0x01F4)
  796. #define LCD_LVDS_SCLK_DIV_RD (0x01FC)
  797. #define PN2_LCD_DMA_START_ADDR_Y0 (0x0200)
  798. #define PN2_LCD_DMA_START_ADDR_U0 (0x0204)
  799. #define PN2_LCD_DMA_START_ADDR_V0 (0x0208)
  800. #define PN2_LCD_DMA_START_ADDR_C0 (0x020C)
  801. #define PN2_LCD_DMA_START_ADDR_Y1 (0x0210)
  802. #define PN2_LCD_DMA_START_ADDR_U1 (0x0214)
  803. #define PN2_LCD_DMA_START_ADDR_V1 (0x0218)
  804. #define PN2_LCD_DMA_START_ADDR_C1 (0x021C)
  805. #define PN2_LCD_DMA_PITCH_YC (0x0220)
  806. #define PN2_LCD_DMA_PITCH_UV (0x0224)
  807. #define PN2_LCD_DMA_OVSA_HPXL_VLN (0x0228)
  808. #define PN2_LCD_DMA_HPXL_VLN (0x022C)
  809. #define PN2_LCD_DMAZM_HPXL_VLN (0x0230)
  810. #define PN2_LCD_GRA_START_ADDR0 (0x0234)
  811. #define PN2_LCD_GRA_START_ADDR1 (0x0238)
  812. #define PN2_LCD_GRA_PITCH (0x023C)
  813. #define PN2_LCD_GRA_OVSA_HPXL_VLN (0x0240)
  814. #define PN2_LCD_GRA_HPXL_VLN (0x0244)
  815. #define PN2_LCD_GRAZM_HPXL_VLN (0x0248)
  816. #define PN2_LCD_HWC_OVSA_HPXL_VLN (0x024C)
  817. #define PN2_LCD_HWC_HPXL_VLN (0x0250)
  818. #define LCD_PN2_V_H_TOTAL (0x0254)
  819. #define LCD_PN2_V_H_ACTIVE (0x0258)
  820. #define LCD_PN2_H_PORCH (0x025C)
  821. #define LCD_PN2_V_PORCH (0x0260)
  822. #define LCD_PN2_BLANKCOLOR (0x0264)
  823. #define LCD_PN2_ALPHA_COLOR1 (0x0268)
  824. #define LCD_PN2_ALPHA_COLOR2 (0x026C)
  825. #define LCD_PN2_COLORKEY_Y (0x0270)
  826. #define LCD_PN2_COLORKEY_U (0x0274)
  827. #define LCD_PN2_COLORKEY_V (0x0278)
  828. #define LCD_PN2_SEPXLCNT (0x027C)
  829. #define LCD_TV_V_H_TOTAL_FLD (0x0280)
  830. #define LCD_TV_V_PORCH_FLD (0x0284)
  831. #define LCD_TV_SEPXLCNT_FLD (0x0288)
  832. #define LCD_2ND_ALPHA (0x0294)
  833. #define LCD_PN2_CONTRAST (0x0298)
  834. #define LCD_PN2_SATURATION (0x029c)
  835. #define LCD_PN2_CBSH_HUE (0x02a0)
  836. #define LCD_TIMING_EXT (0x02C0)
  837. #define LCD_PN2_LAYER_ALPHA_SEL1 (0x02c4)
  838. #define LCD_PN2_CTRL0 (0x02C8)
  839. #define TV_LAYER_ALPHA_SEL1 (0x02cc)
  840. #define LCD_SMPN2_CTRL (0x02D0)
  841. #define LCD_IO_OVERL_MAP_CTRL (0x02D4)
  842. #define LCD_DUMB2_CTRL (0x02d8)
  843. #define LCD_PN2_CTRL1 (0x02DC)
  844. #define PN2_IOPAD_CONTROL (0x02E0)
  845. #define LCD_PN2_SQULN1_CTRL (0x02E4)
  846. #define PN2_LCD_GRA_CUTHPXL (0x02e8)
  847. #define PN2_LCD_GRA_CUTVLN (0x02ec)
  848. #define LCD_PN2_SQULN2_CTRL (0x02F0)
  849. #define ALL_LAYER_ALPHA_SEL (0x02F4)
  850. /* pxa988 has different MASTER_CTRL from MMP3/MMP2 */
  851. #ifdef CONFIG_CPU_PXA988
  852. #define TIMING_MASTER_CONTROL (0x01F4)
  853. #define MASTER_ENH(id) (1 << ((id) + 5))
  854. #define MASTER_ENV(id) (1 << ((id) + 6))
  855. #else
  856. #define TIMING_MASTER_CONTROL (0x02F8)
  857. #define MASTER_ENH(id) (1 << (id))
  858. #define MASTER_ENV(id) (1 << ((id) + 4))
  859. #endif
  860. #define DSI_START_SEL_SHIFT(id) (((id) << 1) + 8)
  861. #define timing_master_config(path, dsi_id, lcd_id) \
  862. (MASTER_ENH(path) | MASTER_ENV(path) | \
  863. (((lcd_id) + ((dsi_id) << 1)) << DSI_START_SEL_SHIFT(path)))
  864. #define LCD_2ND_BLD_CTL (0x02Fc)
  865. #define LVDS_SRC_MASK (3 << 30)
  866. #define LVDS_SRC_SHIFT (30)
  867. #define LVDS_FMT_MASK (1 << 28)
  868. #define LVDS_FMT_SHIFT (28)
  869. #define CLK_SCLK (1 << 0)
  870. #define CLK_LVDS_RD (1 << 1)
  871. #define CLK_LVDS_WR (1 << 2)
  872. #define gra_partdisp_ctrl_hor(id) ((id) ? (((id) & 1) ? \
  873. LCD_TVG_CUTHPXL : PN2_LCD_GRA_CUTHPXL) : LCD_GRA_CUTHPXL)
  874. #define gra_partdisp_ctrl_ver(id) ((id) ? (((id) & 1) ? \
  875. LCD_TVG_CUTVLN : PN2_LCD_GRA_CUTVLN) : LCD_GRA_CUTVLN)
  876. /*
  877. * defined Video Memory Color format for DMA control 0 register
  878. * DMA0 bit[23:20]
  879. */
  880. #define VMODE_RGB565 0x0
  881. #define VMODE_RGB1555 0x1
  882. #define VMODE_RGB888PACKED 0x2
  883. #define VMODE_RGB888UNPACKED 0x3
  884. #define VMODE_RGBA888 0x4
  885. #define VMODE_YUV422PACKED 0x5
  886. #define VMODE_YUV422PLANAR 0x6
  887. #define VMODE_YUV420PLANAR 0x7
  888. #define VMODE_SMPNCMD 0x8
  889. #define VMODE_PALETTE4BIT 0x9
  890. #define VMODE_PALETTE8BIT 0xa
  891. #define VMODE_RESERVED 0xb
  892. /*
  893. * defined Graphic Memory Color format for DMA control 0 register
  894. * DMA0 bit[19:16]
  895. */
  896. #define GMODE_RGB565 0x0
  897. #define GMODE_RGB1555 0x1
  898. #define GMODE_RGB888PACKED 0x2
  899. #define GMODE_RGB888UNPACKED 0x3
  900. #define GMODE_RGBA888 0x4
  901. #define GMODE_YUV422PACKED 0x5
  902. #define GMODE_YUV422PLANAR 0x6
  903. #define GMODE_YUV420PLANAR 0x7
  904. #define GMODE_SMPNCMD 0x8
  905. #define GMODE_PALETTE4BIT 0x9
  906. #define GMODE_PALETTE8BIT 0xa
  907. #define GMODE_RESERVED 0xb
  908. /*
  909. * define for DMA control 1 register
  910. */
  911. #define DMA1_FRAME_TRIG 31 /* bit location */
  912. #define DMA1_VSYNC_MODE 28
  913. #define DMA1_VSYNC_INV 27
  914. #define DMA1_CKEY 24
  915. #define DMA1_CARRY 23
  916. #define DMA1_LNBUF_ENA 22
  917. #define DMA1_GATED_ENA 21
  918. #define DMA1_PWRDN_ENA 20
  919. #define DMA1_DSCALE 18
  920. #define DMA1_ALPHA_MODE 16
  921. #define DMA1_ALPHA 08
  922. #define DMA1_PXLCMD 00
  923. /*
  924. * defined for Configure Dumb Mode
  925. * DUMB LCD Panel bit[31:28]
  926. */
  927. #define DUMB16_RGB565_0 0x0
  928. #define DUMB16_RGB565_1 0x1
  929. #define DUMB18_RGB666_0 0x2
  930. #define DUMB18_RGB666_1 0x3
  931. #define DUMB12_RGB444_0 0x4
  932. #define DUMB12_RGB444_1 0x5
  933. #define DUMB24_RGB888_0 0x6
  934. #define DUMB_BLANK 0x7
  935. /*
  936. * defined for Configure I/O Pin Allocation Mode
  937. * LCD LCD I/O Pads control register bit[3:0]
  938. */
  939. #define IOPAD_DUMB24 0x0
  940. #define IOPAD_DUMB18SPI 0x1
  941. #define IOPAD_DUMB18GPIO 0x2
  942. #define IOPAD_DUMB16SPI 0x3
  943. #define IOPAD_DUMB16GPIO 0x4
  944. #define IOPAD_DUMB12 0x5
  945. #define IOPAD_SMART18SPI 0x6
  946. #define IOPAD_SMART16SPI 0x7
  947. #define IOPAD_SMART8BOTH 0x8
  948. #define IOPAD_DUMB18_SMART8 0x9
  949. #define IOPAD_DUMB16_SMART8SPI 0xa
  950. #define IOPAD_DUMB16_SMART8GPIO 0xb
  951. #define IOPAD_DUMB16_DUMB16 0xc
  952. #define IOPAD_SMART8_SMART8 0xc
  953. /*
  954. *defined for indicating boundary and cycle burst length
  955. */
  956. #define CFG_BOUNDARY_1KB (1<<5)
  957. #define CFG_BOUNDARY_4KB (0<<5)
  958. #define CFG_CYC_BURST_LEN16 (1<<4)
  959. #define CFG_CYC_BURST_LEN8 (0<<4)
  960. /*
  961. * defined Dumb Panel Clock Divider register
  962. * SCLK_Source bit[31]
  963. */
  964. /* 0: PLL clock select*/
  965. #define AXI_BUS_SEL 0x80000000
  966. #define CCD_CLK_SEL 0x40000000
  967. #define DCON_CLK_SEL 0x20000000
  968. #define ENA_CLK_INT_DIV CONFIG_FB_DOVE_CLCD_SCLK_DIV
  969. #define IDLE_CLK_INT_DIV 0x1 /* idle Integer Divider */
  970. #define DIS_CLK_INT_DIV 0x0 /* Disable Integer Divider */
  971. /* SRAM ID */
  972. #define SRAMID_GAMMA_YR 0x0
  973. #define SRAMID_GAMMA_UG 0x1
  974. #define SRAMID_GAMMA_VB 0x2
  975. #define SRAMID_PALATTE 0x3
  976. #define SRAMID_HWC 0xf
  977. /* SRAM INIT Read/Write */
  978. #define SRAMID_INIT_READ 0x0
  979. #define SRAMID_INIT_WRITE 0x2
  980. #define SRAMID_INIT_DEFAULT 0x3
  981. /*
  982. * defined VSYNC selection mode for DMA control 1 register
  983. * DMA1 bit[30:28]
  984. */
  985. #define VMODE_SMPN 0x0
  986. #define VMODE_SMPNIRQ 0x1
  987. #define VMODE_DUMB 0x2
  988. #define VMODE_IPE 0x3
  989. #define VMODE_IRE 0x4
  990. /*
  991. * defined Configure Alpha and Alpha mode for DMA control 1 register
  992. * DMA1 bit[15:08](alpha) / bit[17:16](alpha mode)
  993. */
  994. /* ALPHA mode */
  995. #define MODE_ALPHA_DMA 0x0
  996. #define MODE_ALPHA_GRA 0x1
  997. #define MODE_ALPHA_CFG 0x2
  998. /* alpha value */
  999. #define ALPHA_NOGRAPHIC 0xFF /* all video, no graphic */
  1000. #define ALPHA_NOVIDEO 0x00 /* all graphic, no video */
  1001. #define ALPHA_GRAPHNVIDEO 0x0F /* Selects graphic & video */
  1002. /*
  1003. * defined Pixel Command for DMA control 1 register
  1004. * DMA1 bit[07:00]
  1005. */
  1006. #define PIXEL_CMD 0x81
  1007. /* DSI */
  1008. /* DSI1 - 4 Lane Controller base */
  1009. #define DSI1_REGS_PHYSICAL_BASE 0xD420B800
  1010. /* DSI2 - 3 Lane Controller base */
  1011. #define DSI2_REGS_PHYSICAL_BASE 0xD420BA00
  1012. /* DSI Controller Registers */
  1013. struct dsi_lcd_regs {
  1014. #define DSI_LCD1_CTRL_0 0x100 /* DSI Active Panel 1 Control register 0 */
  1015. #define DSI_LCD1_CTRL_1 0x104 /* DSI Active Panel 1 Control register 1 */
  1016. u32 ctrl0;
  1017. u32 ctrl1;
  1018. u32 reserved1[2];
  1019. #define DSI_LCD1_TIMING_0 0x110 /* Timing register 0 */
  1020. #define DSI_LCD1_TIMING_1 0x114 /* Timing register 1 */
  1021. #define DSI_LCD1_TIMING_2 0x118 /* Timing register 2 */
  1022. #define DSI_LCD1_TIMING_3 0x11C /* Timing register 3 */
  1023. #define DSI_LCD1_WC_0 0x120 /* Word Count register 0 */
  1024. #define DSI_LCD1_WC_1 0x124 /* Word Count register 1 */
  1025. #define DSI_LCD1_WC_2 0x128 /* Word Count register 2 */
  1026. u32 timing0;
  1027. u32 timing1;
  1028. u32 timing2;
  1029. u32 timing3;
  1030. u32 wc0;
  1031. u32 wc1;
  1032. u32 wc2;
  1033. u32 reserved2[1];
  1034. u32 slot_cnt0;
  1035. u32 slot_cnt1;
  1036. u32 reserved3[2];
  1037. u32 status_0;
  1038. u32 status_1;
  1039. u32 status_2;
  1040. u32 status_3;
  1041. u32 status_4;
  1042. };
  1043. struct dsi_regs {
  1044. #define DSI_CTRL_0 0x000 /* DSI control register 0 */
  1045. #define DSI_CTRL_1 0x004 /* DSI control register 1 */
  1046. u32 ctrl0;
  1047. u32 ctrl1;
  1048. u32 reserved1[2];
  1049. u32 irq_status;
  1050. u32 irq_mask;
  1051. u32 reserved2[2];
  1052. #define DSI_CPU_CMD_0 0x020 /* DSI CPU packet command register 0 */
  1053. #define DSI_CPU_CMD_1 0x024 /* DSU CPU Packet Command Register 1 */
  1054. #define DSI_CPU_CMD_3 0x02C /* DSU CPU Packet Command Register 3 */
  1055. #define DSI_CPU_WDAT_0 0x030 /* DSI CUP */
  1056. u32 cmd0;
  1057. u32 cmd1;
  1058. u32 cmd2;
  1059. u32 cmd3;
  1060. u32 dat0;
  1061. u32 status0;
  1062. u32 status1;
  1063. u32 status2;
  1064. u32 status3;
  1065. u32 status4;
  1066. u32 reserved3[2];
  1067. u32 smt_cmd;
  1068. u32 smt_ctrl0;
  1069. u32 smt_ctrl1;
  1070. u32 reserved4[1];
  1071. u32 rx0_status;
  1072. /* Rx Packet Header - data from slave device */
  1073. #define DSI_RX_PKT_HDR_0 0x064
  1074. u32 rx0_header;
  1075. u32 rx1_status;
  1076. u32 rx1_header;
  1077. u32 rx_ctrl;
  1078. u32 rx_ctrl1;
  1079. u32 rx2_status;
  1080. u32 rx2_header;
  1081. u32 reserved5[1];
  1082. u32 phy_ctrl1;
  1083. #define DSI_PHY_CTRL_2 0x088 /* DSI DPHI Control Register 2 */
  1084. #define DSI_PHY_CTRL_3 0x08C /* DPHY Control Register 3 */
  1085. u32 phy_ctrl2;
  1086. u32 phy_ctrl3;
  1087. u32 phy_status0;
  1088. u32 phy_status1;
  1089. u32 reserved6[5];
  1090. u32 phy_status2;
  1091. #define DSI_PHY_RCOMP_0 0x0B0 /* DPHY Rcomp Control Register */
  1092. u32 phy_rcomp0;
  1093. u32 reserved7[3];
  1094. #define DSI_PHY_TIME_0 0x0C0 /* DPHY Timing Control Register 0 */
  1095. #define DSI_PHY_TIME_1 0x0C4 /* DPHY Timing Control Register 1 */
  1096. #define DSI_PHY_TIME_2 0x0C8 /* DPHY Timing Control Register 2 */
  1097. #define DSI_PHY_TIME_3 0x0CC /* DPHY Timing Control Register 3 */
  1098. #define DSI_PHY_TIME_4 0x0D0 /* DPHY Timing Control Register 4 */
  1099. #define DSI_PHY_TIME_5 0x0D4 /* DPHY Timing Control Register 5 */
  1100. u32 phy_timing0;
  1101. u32 phy_timing1;
  1102. u32 phy_timing2;
  1103. u32 phy_timing3;
  1104. u32 phy_code_0;
  1105. u32 phy_code_1;
  1106. u32 reserved8[2];
  1107. u32 mem_ctrl;
  1108. u32 tx_timer;
  1109. u32 rx_timer;
  1110. u32 turn_timer;
  1111. u32 reserved9[4];
  1112. #define DSI_LCD1_CTRL_0 0x100 /* DSI Active Panel 1 Control register 0 */
  1113. #define DSI_LCD1_CTRL_1 0x104 /* DSI Active Panel 1 Control register 1 */
  1114. #define DSI_LCD1_TIMING_0 0x110 /* Timing register 0 */
  1115. #define DSI_LCD1_TIMING_1 0x114 /* Timing register 1 */
  1116. #define DSI_LCD1_TIMING_2 0x118 /* Timing register 2 */
  1117. #define DSI_LCD1_TIMING_3 0x11C /* Timing register 3 */
  1118. #define DSI_LCD1_WC_0 0x120 /* Word Count register 0 */
  1119. #define DSI_LCD1_WC_1 0x124 /* Word Count register 1 */
  1120. #define DSI_LCD1_WC_2 0x128 /* Word Count register 2 */
  1121. struct dsi_lcd_regs lcd1;
  1122. u32 reserved10[11];
  1123. struct dsi_lcd_regs lcd2;
  1124. };
  1125. #define DSI_LCD2_CTRL_0 0x180 /* DSI Active Panel 2 Control register 0 */
  1126. #define DSI_LCD2_CTRL_1 0x184 /* DSI Active Panel 2 Control register 1 */
  1127. #define DSI_LCD2_TIMING_0 0x190 /* Timing register 0 */
  1128. #define DSI_LCD2_TIMING_1 0x194 /* Timing register 1 */
  1129. #define DSI_LCD2_TIMING_2 0x198 /* Timing register 2 */
  1130. #define DSI_LCD2_TIMING_3 0x19C /* Timing register 3 */
  1131. #define DSI_LCD2_WC_0 0x1A0 /* Word Count register 0 */
  1132. #define DSI_LCD2_WC_1 0x1A4 /* Word Count register 1 */
  1133. #define DSI_LCD2_WC_2 0x1A8 /* Word Count register 2 */
  1134. /* DSI_CTRL_0 0x0000 DSI Control Register 0 */
  1135. #define DSI_CTRL_0_CFG_SOFT_RST (1<<31)
  1136. #define DSI_CTRL_0_CFG_SOFT_RST_REG (1<<30)
  1137. #define DSI_CTRL_0_CFG_LCD1_TX_EN (1<<8)
  1138. #define DSI_CTRL_0_CFG_LCD1_SLV (1<<4)
  1139. #define DSI_CTRL_0_CFG_LCD1_EN (1<<0)
  1140. /* DSI_CTRL_1 0x0004 DSI Control Register 1 */
  1141. #define DSI_CTRL_1_CFG_EOTP (1<<8)
  1142. #define DSI_CTRL_1_CFG_RSVD (2<<4)
  1143. #define DSI_CTRL_1_CFG_LCD2_VCH_NO_MASK (3<<2)
  1144. #define DSI_CTRL_1_CFG_LCD2_VCH_NO_SHIFT 2
  1145. #define DSI_CTRL_1_CFG_LCD1_VCH_NO_MASK (3<<0)
  1146. #define DSI_CTRL_1_CFG_LCD1_VCH_NO_SHIFT 0
  1147. /* DSI_LCD1_CTRL_1 0x0104 DSI Active Panel 1 Control Register 1 */
  1148. /* LCD 1 Vsync Reset Enable */
  1149. #define DSI_LCD1_CTRL_1_CFG_L1_VSYNC_RST_EN (1<<31)
  1150. /* LCD 1 2K Pixel Buffer Mode Enable */
  1151. #define DSI_LCD1_CTRL_1_CFG_L1_M2K_EN (1<<30)
  1152. /* Bit(s) DSI_LCD1_CTRL_1_RSRV_29_23 reserved */
  1153. /* Long Blanking Packet Enable */
  1154. #define DSI_LCD1_CTRL_1_CFG_L1_HLP_PKT_EN (1<<22)
  1155. /* Extra Long Blanking Packet Enable */
  1156. #define DSI_LCD1_CTRL_1_CFG_L1_HEX_PKT_EN (1<<21)
  1157. /* Front Porch Packet Enable */
  1158. #define DSI_LCD1_CTRL_1_CFG_L1_HFP_PKT_EN (1<<20)
  1159. /* hact Packet Enable */
  1160. #define DSI_LCD1_CTRL_1_CFG_L1_HACT_PKT_EN (1<<19)
  1161. /* Back Porch Packet Enable */
  1162. #define DSI_LCD1_CTRL_1_CFG_L1_HBP_PKT_EN (1<<18)
  1163. /* hse Packet Enable */
  1164. #define DSI_LCD1_CTRL_1_CFG_L1_HSE_PKT_EN (1<<17)
  1165. /* hsa Packet Enable */
  1166. #define DSI_LCD1_CTRL_1_CFG_L1_HSA_PKT_EN (1<<16)
  1167. /* All Item Enable after Pixel Data */
  1168. #define DSI_LCD1_CTRL_1_CFG_L1_ALL_SLOT_EN (1<<15)
  1169. /* Extra Long Packet Enable after Pixel Data */
  1170. #define DSI_LCD1_CTRL_1_CFG_L1_HEX_SLOT_EN (1<<14)
  1171. /* Bit(s) DSI_LCD1_CTRL_1_RSRV_13_11 reserved */
  1172. /* Turn Around Bus at Last h Line */
  1173. #define DSI_LCD1_CTRL_1_CFG_L1_LAST_LINE_TURN (1<<10)
  1174. /* Go to Low Power Every Frame */
  1175. #define DSI_LCD1_CTRL_1_CFG_L1_LPM_FRAME_EN (1<<9)
  1176. /* Go to Low Power Every Line */
  1177. #define DSI_LCD1_CTRL_1_CFG_L1_LPM_LINE_EN (1<<8)
  1178. /* Bit(s) DSI_LCD1_CTRL_1_RSRV_7_4 reserved */
  1179. /* DSI Transmission Mode for LCD 1 */
  1180. #define DSI_LCD1_CTRL_1_CFG_L1_BURST_MODE_SHIFT 2
  1181. #define DSI_LCD1_CTRL_1_CFG_L1_BURST_MODE_MASK (3<<2)
  1182. /* LCD 1 Input Data RGB Mode for LCD 1 */
  1183. #define DSI_LCD2_CTRL_1_CFG_L1_RGB_TYPE_SHIFT 0
  1184. #define DSI_LCD2_CTRL_1_CFG_L1_RGB_TYPE_MASK (3<<2)
  1185. /* DSI_PHY_CTRL_2 0x0088 DPHY Control Register 2 */
  1186. /* Bit(s) DSI_PHY_CTRL_2_RSRV_31_12 reserved */
  1187. /* DPHY LP Receiver Enable */
  1188. #define DSI_PHY_CTRL_2_CFG_CSR_LANE_RESC_EN_MASK (0xf<<8)
  1189. #define DSI_PHY_CTRL_2_CFG_CSR_LANE_RESC_EN_SHIFT 8
  1190. /* DPHY Data Lane Enable */
  1191. #define DSI_PHY_CTRL_2_CFG_CSR_LANE_EN_MASK (0xf<<4)
  1192. #define DSI_PHY_CTRL_2_CFG_CSR_LANE_EN_SHIFT 4
  1193. /* DPHY Bus Turn Around */
  1194. #define DSI_PHY_CTRL_2_CFG_CSR_LANE_TURN_MASK (0xf)
  1195. #define DSI_PHY_CTRL_2_CFG_CSR_LANE_TURN_SHIFT 0
  1196. /* DSI_CPU_CMD_1 0x0024 DSI CPU Packet Command Register 1 */
  1197. /* Bit(s) DSI_CPU_CMD_1_RSRV_31_24 reserved */
  1198. /* LPDT TX Enable */
  1199. #define DSI_CPU_CMD_1_CFG_TXLP_LPDT_MASK (0xf<<20)
  1200. #define DSI_CPU_CMD_1_CFG_TXLP_LPDT_SHIFT 20
  1201. /* ULPS TX Enable */
  1202. #define DSI_CPU_CMD_1_CFG_TXLP_ULPS_MASK (0xf<<16)
  1203. #define DSI_CPU_CMD_1_CFG_TXLP_ULPS_SHIFT 16
  1204. /* Low Power TX Trigger Code */
  1205. #define DSI_CPU_CMD_1_CFG_TXLP_TRIGGER_CODE_MASK (0xffff)
  1206. #define DSI_CPU_CMD_1_CFG_TXLP_TRIGGER_CODE_SHIFT 0
  1207. /* DSI_PHY_TIME_0 0x00c0 DPHY Timing Control Register 0 */
  1208. /* Length of HS Exit Period in tx_clk_esc Cycles */
  1209. #define DSI_PHY_TIME_0_CFG_CSR_TIME_HS_EXIT_MASK (0xff<<24)
  1210. #define DSI_PHY_TIME_0_CFG_CSR_TIME_HS_EXIT_SHIFT 24
  1211. /* DPHY HS Trail Period Length */
  1212. #define DSI_PHY_TIME_0_CFG_CSR_TIME_HS_TRAIL_MASK (0xff<<16)
  1213. #define DSI_PHY_TIME_0_CFG_CSR_TIME_HS_TRAIL_SHIFT 16
  1214. /* DPHY HS Zero State Length */
  1215. #define DSI_PHY_TIME_0_CDG_CSR_TIME_HS_ZERO_MASK (0xff<<8)
  1216. #define DSI_PHY_TIME_0_CDG_CSR_TIME_HS_ZERO_SHIFT 8
  1217. /* DPHY HS Prepare State Length */
  1218. #define DSI_PHY_TIME_0_CFG_CSR_TIME_HS_PREP_MASK (0xff)
  1219. #define DSI_PHY_TIME_0_CFG_CSR_TIME_HS_PREP_SHIFT 0
  1220. /* DSI_PHY_TIME_1 0x00c4 DPHY Timing Control Register 1 */
  1221. /* Time to Drive LP-00 by New Transmitter */
  1222. #define DSI_PHY_TIME_1_CFG_CSR_TIME_TA_GET_MASK (0xff<<24)
  1223. #define DSI_PHY_TIME_1_CFG_CSR_TIME_TA_GET_SHIFT 24
  1224. /* Time to Drive LP-00 after Turn Request */
  1225. #define DSI_PHY_TIME_1_CFG_CSR_TIME_TA_GO_MASK (0xff<<16)
  1226. #define DSI_PHY_TIME_1_CFG_CSR_TIME_TA_GO_SHIFT 16
  1227. /* DPHY HS Wakeup Period Length */
  1228. #define DSI_PHY_TIME_1_CFG_CSR_TIME_WAKEUP_MASK (0xffff)
  1229. #define DSI_PHY_TIME_1_CFG_CSR_TIME_WAKEUP_SHIFT 0
  1230. /* DSI_PHY_TIME_2 0x00c8 DPHY Timing Control Register 2 */
  1231. /* DPHY CLK Exit Period Length */
  1232. #define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_EXIT_MASK (0xff<<24)
  1233. #define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_EXIT_SHIFT 24
  1234. /* DPHY CLK Trail Period Length */
  1235. #define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_TRAIL_MASK (0xff<<16)
  1236. #define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_TRAIL_SHIFT 16
  1237. /* DPHY CLK Zero State Length */
  1238. #define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_ZERO_MASK (0xff<<8)
  1239. #define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_ZERO_SHIFT 8
  1240. /* DPHY CLK LP Length */
  1241. #define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_LPX_MASK (0xff)
  1242. #define DSI_PHY_TIME_2_CFG_CSR_TIME_CK_LPX_SHIFT 0
  1243. /* DSI_PHY_TIME_3 0x00cc DPHY Timing Control Register 3 */
  1244. /* Bit(s) DSI_PHY_TIME_3_RSRV_31_16 reserved */
  1245. /* DPHY LP Length */
  1246. #define DSI_PHY_TIME_3_CFG_CSR_TIME_LPX_MASK (0xff<<8)
  1247. #define DSI_PHY_TIME_3_CFG_CSR_TIME_LPX_SHIFT 8
  1248. /* DPHY HS req to rdy Length */
  1249. #define DSI_PHY_TIME_3_CFG_CSR_TIME_REQRDY_MASK (0xff)
  1250. #define DSI_PHY_TIME_3_CFG_CSR_TIME_REQRDY_SHIFT 0
  1251. /*
  1252. * DSI timings
  1253. * PXA988 has diffrent ESC CLK with MMP2/MMP3
  1254. * it will be used in dsi_set_dphy() in pxa688_phy.c
  1255. * as low power mode clock.
  1256. */
  1257. #ifdef CONFIG_CPU_PXA988
  1258. #define DSI_ESC_CLK 52 /* Unit: Mhz */
  1259. #define DSI_ESC_CLK_T 19 /* Unit: ns */
  1260. #else
  1261. #define DSI_ESC_CLK 66 /* Unit: Mhz */
  1262. #define DSI_ESC_CLK_T 15 /* Unit: ns */
  1263. #endif
  1264. /* LVDS */
  1265. /* LVDS_PHY_CTRL */
  1266. #define LVDS_PHY_CTL 0x2A4
  1267. #define LVDS_PLL_LOCK (1 << 31)
  1268. #define LVDS_PHY_EXT_MASK (7 << 28)
  1269. #define LVDS_PHY_EXT_SHIFT (28)
  1270. #define LVDS_CLK_PHASE_MASK (0x7f << 16)
  1271. #define LVDS_CLK_PHASE_SHIFT (16)
  1272. #define LVDS_SSC_RESET_EXT (1 << 13)
  1273. #define LVDS_SSC_MODE_DOWN_SPREAD (1 << 12)
  1274. #define LVDS_SSC_EN (1 << 11)
  1275. #define LVDS_PU_PLL (1 << 10)
  1276. #define LVDS_PU_TX (1 << 9)
  1277. #define LVDS_PU_IVREF (1 << 8)
  1278. #define LVDS_CLK_SEL (1 << 7)
  1279. #define LVDS_CLK_SEL_LVDS_PCLK (1 << 7)
  1280. #define LVDS_PD_CH_MASK (0x3f << 1)
  1281. #define LVDS_PD_CH(ch) ((ch) << 1)
  1282. #define LVDS_RST (1 << 0)
  1283. #define LVDS_PHY_CTL_EXT 0x2A8
  1284. /* LVDS_PHY_CTRL_EXT1 */
  1285. #define LVDS_SSC_RNGE_MASK (0x7ff << 16)
  1286. #define LVDS_SSC_RNGE_SHIFT (16)
  1287. #define LVDS_RESERVE_IN_MASK (0xf << 12)
  1288. #define LVDS_RESERVE_IN_SHIFT (12)
  1289. #define LVDS_TEST_MON_MASK (0x7 << 8)
  1290. #define LVDS_TEST_MON_SHIFT (8)
  1291. #define LVDS_POL_SWAP_MASK (0x3f << 0)
  1292. #define LVDS_POL_SWAP_SHIFT (0)
  1293. /* LVDS_PHY_CTRL_EXT2 */
  1294. #define LVDS_TX_DIF_AMP_MASK (0xf << 24)
  1295. #define LVDS_TX_DIF_AMP_SHIFT (24)
  1296. #define LVDS_TX_DIF_CM_MASK (0x3 << 22)
  1297. #define LVDS_TX_DIF_CM_SHIFT (22)
  1298. #define LVDS_SELLV_TXCLK_MASK (0x1f << 16)
  1299. #define LVDS_SELLV_TXCLK_SHIFT (16)
  1300. #define LVDS_TX_CMFB_EN (0x1 << 15)
  1301. #define LVDS_TX_TERM_EN (0x1 << 14)
  1302. #define LVDS_SELLV_TXDATA_MASK (0x1f << 8)
  1303. #define LVDS_SELLV_TXDATA_SHIFT (8)
  1304. #define LVDS_SELLV_OP7_MASK (0x3 << 6)
  1305. #define LVDS_SELLV_OP7_SHIFT (6)
  1306. #define LVDS_SELLV_OP6_MASK (0x3 << 4)
  1307. #define LVDS_SELLV_OP6_SHIFT (4)
  1308. #define LVDS_SELLV_OP9_MASK (0x3 << 2)
  1309. #define LVDS_SELLV_OP9_SHIFT (2)
  1310. #define LVDS_STRESSTST_EN (0x1 << 0)
  1311. /* LVDS_PHY_CTRL_EXT3 */
  1312. #define LVDS_KVCO_MASK (0xf << 28)
  1313. #define LVDS_KVCO_SHIFT (28)
  1314. #define LVDS_CTUNE_MASK (0x3 << 26)
  1315. #define LVDS_CTUNE_SHIFT (26)
  1316. #define LVDS_VREG_IVREF_MASK (0x3 << 24)
  1317. #define LVDS_VREG_IVREF_SHIFT (24)
  1318. #define LVDS_VDDL_MASK (0xf << 20)
  1319. #define LVDS_VDDL_SHIFT (20)
  1320. #define LVDS_VDDM_MASK (0x3 << 18)
  1321. #define LVDS_VDDM_SHIFT (18)
  1322. #define LVDS_FBDIV_MASK (0xf << 8)
  1323. #define LVDS_FBDIV_SHIFT (8)
  1324. #define LVDS_REFDIV_MASK (0x7f << 0)
  1325. #define LVDS_REFDIV_SHIFT (0)
  1326. /* LVDS_PHY_CTRL_EXT4 */
  1327. #define LVDS_SSC_FREQ_DIV_MASK (0xffff << 16)
  1328. #define LVDS_SSC_FREQ_DIV_SHIFT (16)
  1329. #define LVDS_INTPI_MASK (0xf << 12)
  1330. #define LVDS_INTPI_SHIFT (12)
  1331. #define LVDS_VCODIV_SEL_SE_MASK (0xf << 8)
  1332. #define LVDS_VCODIV_SEL_SE_SHIFT (8)
  1333. #define LVDS_RESET_INTP_EXT (0x1 << 7)
  1334. #define LVDS_VCO_VRNG_MASK (0x7 << 4)
  1335. #define LVDS_VCO_VRNG_SHIFT (4)
  1336. #define LVDS_PI_EN (0x1 << 3)
  1337. #define LVDS_ICP_MASK (0x7 << 0)
  1338. #define LVDS_ICP_SHIFT (0)
  1339. /* LVDS_PHY_CTRL_EXT5 */
  1340. #define LVDS_FREQ_OFFSET_MASK (0x1ffff << 15)
  1341. #define LVDS_FREQ_OFFSET_SHIFT (15)
  1342. #define LVDS_FREQ_OFFSET_VALID (0x1 << 2)
  1343. #define LVDS_FREQ_OFFSET_MODE_CK_DIV4_OUT (0x1 << 1)
  1344. #define LVDS_FREQ_OFFSET_MODE_EN (0x1 << 0)
  1345. /* VDMA */
  1346. struct vdma_ch_regs {
  1347. #define VDMA_DC_SADDR_1 0x320
  1348. #define VDMA_DC_SADDR_2 0x3A0
  1349. #define VDMA_DC_SZ_1 0x324
  1350. #define VDMA_DC_SZ_2 0x3A4
  1351. #define VDMA_CTRL_1 0x328
  1352. #define VDMA_CTRL_2 0x3A8
  1353. #define VDMA_SRC_SZ_1 0x32C
  1354. #define VDMA_SRC_SZ_2 0x3AC
  1355. #define VDMA_SA_1 0x330
  1356. #define VDMA_SA_2 0x3B0
  1357. #define VDMA_DA_1 0x334
  1358. #define VDMA_DA_2 0x3B4
  1359. #define VDMA_SZ_1 0x338
  1360. #define VDMA_SZ_2 0x3B8
  1361. u32 dc_saddr;
  1362. u32 dc_size;
  1363. u32 ctrl;
  1364. u32 src_size;
  1365. u32 src_addr;
  1366. u32 dst_addr;
  1367. u32 dst_size;
  1368. #define VDMA_PITCH_1 0x33C
  1369. #define VDMA_PITCH_2 0x3BC
  1370. #define VDMA_ROT_CTRL_1 0x340
  1371. #define VDMA_ROT_CTRL_2 0x3C0
  1372. #define VDMA_RAM_CTRL0_1 0x344
  1373. #define VDMA_RAM_CTRL0_2 0x3C4
  1374. #define VDMA_RAM_CTRL1_1 0x348
  1375. #define VDMA_RAM_CTRL1_2 0x3C8
  1376. u32 pitch;
  1377. u32 rot_ctrl;
  1378. u32 ram_ctrl0;
  1379. u32 ram_ctrl1;
  1380. };
  1381. struct vdma_regs {
  1382. #define VDMA_ARBR_CTRL 0x300
  1383. #define VDMA_IRQR 0x304
  1384. #define VDMA_IRQM 0x308
  1385. #define VDMA_IRQS 0x30C
  1386. #define VDMA_MDMA_ARBR_CTRL 0x310
  1387. u32 arbr_ctr;
  1388. u32 irq_raw;
  1389. u32 irq_mask;
  1390. u32 irq_status;
  1391. u32 mdma_arbr_ctrl;
  1392. u32 reserved[3];
  1393. struct vdma_ch_regs ch1;
  1394. u32 reserved2[21];
  1395. struct vdma_ch_regs ch2;
  1396. };
  1397. /* CMU */
  1398. #define CMU_PIP_DE_H_CFG 0x0008
  1399. #define CMU_PRI1_H_CFG 0x000C
  1400. #define CMU_PRI2_H_CFG 0x0010
  1401. #define CMU_ACE_MAIN_DE1_H_CFG 0x0014
  1402. #define CMU_ACE_MAIN_DE2_H_CFG 0x0018
  1403. #define CMU_ACE_PIP_DE1_H_CFG 0x001C
  1404. #define CMU_ACE_PIP_DE2_H_CFG 0x0020
  1405. #define CMU_PIP_DE_V_CFG 0x0024
  1406. #define CMU_PRI_V_CFG 0x0028
  1407. #define CMU_ACE_MAIN_DE_V_CFG 0x002C
  1408. #define CMU_ACE_PIP_DE_V_CFG 0x0030
  1409. #define CMU_BAR_0_CFG 0x0034
  1410. #define CMU_BAR_1_CFG 0x0038
  1411. #define CMU_BAR_2_CFG 0x003C
  1412. #define CMU_BAR_3_CFG 0x0040
  1413. #define CMU_BAR_4_CFG 0x0044
  1414. #define CMU_BAR_5_CFG 0x0048
  1415. #define CMU_BAR_6_CFG 0x004C
  1416. #define CMU_BAR_7_CFG 0x0050
  1417. #define CMU_BAR_8_CFG 0x0054
  1418. #define CMU_BAR_9_CFG 0x0058
  1419. #define CMU_BAR_10_CFG 0x005C
  1420. #define CMU_BAR_11_CFG 0x0060
  1421. #define CMU_BAR_12_CFG 0x0064
  1422. #define CMU_BAR_13_CFG 0x0068
  1423. #define CMU_BAR_14_CFG 0x006C
  1424. #define CMU_BAR_15_CFG 0x0070
  1425. #define CMU_BAR_CTRL 0x0074
  1426. #define PATTERN_TOTAL 0x0078
  1427. #define PATTERN_ACTIVE 0x007C
  1428. #define PATTERN_FRONT_PORCH 0x0080
  1429. #define PATTERN_BACK_PORCH 0x0084
  1430. #define CMU_CLK_CTRL 0x0088
  1431. #define CMU_ICSC_M_C0_L 0x0900
  1432. #define CMU_ICSC_M_C0_H 0x0901
  1433. #define CMU_ICSC_M_C1_L 0x0902
  1434. #define CMU_ICSC_M_C1_H 0x0903
  1435. #define CMU_ICSC_M_C2_L 0x0904
  1436. #define CMU_ICSC_M_C2_H 0x0905
  1437. #define CMU_ICSC_M_C3_L 0x0906
  1438. #define CMU_ICSC_M_C3_H 0x0907
  1439. #define CMU_ICSC_M_C4_L 0x0908
  1440. #define CMU_ICSC_M_C4_H 0x0909
  1441. #define CMU_ICSC_M_C5_L 0x090A
  1442. #define CMU_ICSC_M_C5_H 0x090B
  1443. #define CMU_ICSC_M_C6_L 0x090C
  1444. #define CMU_ICSC_M_C6_H 0x090D
  1445. #define CMU_ICSC_M_C7_L 0x090E
  1446. #define CMU_ICSC_M_C7_H 0x090F
  1447. #define CMU_ICSC_M_C8_L 0x0910
  1448. #define CMU_ICSC_M_C8_H 0x0911
  1449. #define CMU_ICSC_M_O1_0 0x0914
  1450. #define CMU_ICSC_M_O1_1 0x0915
  1451. #define CMU_ICSC_M_O1_2 0x0916
  1452. #define CMU_ICSC_M_O2_0 0x0918
  1453. #define CMU_ICSC_M_O2_1 0x0919
  1454. #define CMU_ICSC_M_O2_2 0x091A
  1455. #define CMU_ICSC_M_O3_0 0x091C
  1456. #define CMU_ICSC_M_O3_1 0x091D
  1457. #define CMU_ICSC_M_O3_2 0x091E
  1458. #define CMU_ICSC_P_C0_L 0x0920
  1459. #define CMU_ICSC_P_C0_H 0x0921
  1460. #define CMU_ICSC_P_C1_L 0x0922
  1461. #define CMU_ICSC_P_C1_H 0x0923
  1462. #define CMU_ICSC_P_C2_L 0x0924
  1463. #define CMU_ICSC_P_C2_H 0x0925
  1464. #define CMU_ICSC_P_C3_L 0x0926
  1465. #define CMU_ICSC_P_C3_H 0x0927
  1466. #define CMU_ICSC_P_C4_L 0x0928
  1467. #define CMU_ICSC_P_C4_H 0x0929
  1468. #define CMU_ICSC_P_C5_L 0x092A
  1469. #define CMU_ICSC_P_C5_H 0x092B
  1470. #define CMU_ICSC_P_C6_L 0x092C
  1471. #define CMU_ICSC_P_C6_H 0x092D
  1472. #define CMU_ICSC_P_C7_L 0x092E
  1473. #define CMU_ICSC_P_C7_H 0x092F
  1474. #define CMU_ICSC_P_C8_L 0x0930
  1475. #define CMU_ICSC_P_C8_H 0x0931
  1476. #define CMU_ICSC_P_O1_0 0x0934
  1477. #define CMU_ICSC_P_O1_1 0x0935
  1478. #define CMU_ICSC_P_O1_2 0x0936
  1479. #define CMU_ICSC_P_O2_0 0x0938
  1480. #define CMU_ICSC_P_O2_1 0x0939
  1481. #define CMU_ICSC_P_O2_2 0x093A
  1482. #define CMU_ICSC_P_O3_0 0x093C
  1483. #define CMU_ICSC_P_O3_1 0x093D
  1484. #define CMU_ICSC_P_O3_2 0x093E
  1485. #define CMU_BR_M_EN 0x0940
  1486. #define CMU_BR_M_TH1_L 0x0942
  1487. #define CMU_BR_M_TH1_H 0x0943
  1488. #define CMU_BR_M_TH2_L 0x0944
  1489. #define CMU_BR_M_TH2_H 0x0945
  1490. #define CMU_ACE_M_EN 0x0950
  1491. #define CMU_ACE_M_WFG1 0x0951
  1492. #define CMU_ACE_M_WFG2 0x0952
  1493. #define CMU_ACE_M_WFG3 0x0953
  1494. #define CMU_ACE_M_TH0 0x0954
  1495. #define CMU_ACE_M_TH1 0x0955
  1496. #define CMU_ACE_M_TH2 0x0956
  1497. #define CMU_ACE_M_TH3 0x0957
  1498. #define CMU_ACE_M_TH4 0x0958
  1499. #define CMU_ACE_M_TH5 0x0959
  1500. #define CMU_ACE_M_OP0_L 0x095A
  1501. #define CMU_ACE_M_OP0_H 0x095B
  1502. #define CMU_ACE_M_OP5_L 0x095C
  1503. #define CMU_ACE_M_OP5_H 0x095D
  1504. #define CMU_ACE_M_GB2 0x095E
  1505. #define CMU_ACE_M_GB3 0x095F
  1506. #define CMU_ACE_M_MS1 0x0960
  1507. #define CMU_ACE_M_MS2 0x0961
  1508. #define CMU_ACE_M_MS3 0x0962
  1509. #define CMU_BR_P_EN 0x0970
  1510. #define CMU_BR_P_TH1_L 0x0972
  1511. #define CMU_BR_P_TH1_H 0x0973
  1512. #define CMU_BR_P_TH2_L 0x0974
  1513. #define CMU_BR_P_TH2_H 0x0975
  1514. #define CMU_ACE_P_EN 0x0980
  1515. #define CMU_ACE_P_WFG1 0x0981
  1516. #define CMU_ACE_P_WFG2 0x0982
  1517. #define CMU_ACE_P_WFG3 0x0983
  1518. #define CMU_ACE_P_TH0 0x0984
  1519. #define CMU_ACE_P_TH1 0x0985
  1520. #define CMU_ACE_P_TH2 0x0986
  1521. #define CMU_ACE_P_TH3 0x0987
  1522. #define CMU_ACE_P_TH4 0x0988
  1523. #define CMU_ACE_P_TH5 0x0989
  1524. #define CMU_ACE_P_OP0_L 0x098A
  1525. #define CMU_ACE_P_OP0_H 0x098B
  1526. #define CMU_ACE_P_OP5_L 0x098C
  1527. #define CMU_ACE_P_OP5_H 0x098D
  1528. #define CMU_ACE_P_GB2 0x098E
  1529. #define CMU_ACE_P_GB3 0x098F
  1530. #define CMU_ACE_P_MS1 0x0990
  1531. #define CMU_ACE_P_MS2 0x0991
  1532. #define CMU_ACE_P_MS3 0x0992
  1533. #define CMU_FTDC_M_EN 0x09A0
  1534. #define CMU_FTDC_P_EN 0x09A1
  1535. #define CMU_FTDC_INLOW_L 0x09A2
  1536. #define CMU_FTDC_INLOW_H 0x09A3
  1537. #define CMU_FTDC_INHIGH_L 0x09A4
  1538. #define CMU_FTDC_INHIGH_H 0x09A5
  1539. #define CMU_FTDC_OUTLOW_L 0x09A6
  1540. #define CMU_FTDC_OUTLOW_H 0x09A7
  1541. #define CMU_FTDC_OUTHIGH_L 0x09A8
  1542. #define CMU_FTDC_OUTHIGH_H 0x09A9
  1543. #define CMU_FTDC_YLOW 0x09AA
  1544. #define CMU_FTDC_YHIGH 0x09AB
  1545. #define CMU_FTDC_CH1 0x09AC
  1546. #define CMU_FTDC_CH2_L 0x09AE
  1547. #define CMU_FTDC_CH2_H 0x09AF
  1548. #define CMU_FTDC_CH3_L 0x09B0
  1549. #define CMU_FTDC_CH3_H 0x09B1
  1550. #define CMU_FTDC_1_C00_6 0x09B2
  1551. #define CMU_FTDC_1_C01_6 0x09B8
  1552. #define CMU_FTDC_1_C11_6 0x09BE
  1553. #define CMU_FTDC_1_C10_6 0x09C4
  1554. #define CMU_FTDC_1_OFF00_6 0x09CA
  1555. #define CMU_FTDC_1_OFF10_6 0x09D0
  1556. #define CMU_HS_M_EN 0x0A00
  1557. #define CMU_HS_M_AX1_L 0x0A02
  1558. #define CMU_HS_M_AX1_H 0x0A03
  1559. #define CMU_HS_M_AX2_L 0x0A04
  1560. #define CMU_HS_M_AX2_H 0x0A05
  1561. #define CMU_HS_M_AX3_L 0x0A06
  1562. #define CMU_HS_M_AX3_H 0x0A07
  1563. #define CMU_HS_M_AX4_L 0x0A08
  1564. #define CMU_HS_M_AX4_H 0x0A09
  1565. #define CMU_HS_M_AX5_L 0x0A0A
  1566. #define CMU_HS_M_AX5_H 0x0A0B
  1567. #define CMU_HS_M_AX6_L 0x0A0C
  1568. #define CMU_HS_M_AX6_H 0x0A0D
  1569. #define CMU_HS_M_AX7_L 0x0A0E
  1570. #define CMU_HS_M_AX7_H 0x0A0F
  1571. #define CMU_HS_M_AX8_L 0x0A10
  1572. #define CMU_HS_M_AX8_H 0x0A11
  1573. #define CMU_HS_M_AX9_L 0x0A12
  1574. #define CMU_HS_M_AX9_H 0x0A13
  1575. #define CMU_HS_M_AX10_L 0x0A14
  1576. #define CMU_HS_M_AX10_H 0x0A15
  1577. #define CMU_HS_M_AX11_L 0x0A16
  1578. #define CMU_HS_M_AX11_H 0x0A17
  1579. #define CMU_HS_M_AX12_L 0x0A18
  1580. #define CMU_HS_M_AX12_H 0x0A19
  1581. #define CMU_HS_M_AX13_L 0x0A1A
  1582. #define CMU_HS_M_AX13_H 0x0A1B
  1583. #define CMU_HS_M_AX14_L 0x0A1C
  1584. #define CMU_HS_M_AX14_H 0x0A1D
  1585. #define CMU_HS_M_H1_H14 0x0A1E
  1586. #define CMU_HS_M_S1_S14 0x0A2C
  1587. #define CMU_HS_M_GL 0x0A3A
  1588. #define CMU_HS_M_MAXSAT_RGB_Y_L 0x0A3C
  1589. #define CMU_HS_M_MAXSAT_RGB_Y_H 0x0A3D
  1590. #define CMU_HS_M_MAXSAT_RCR_L 0x0A3E
  1591. #define CMU_HS_M_MAXSAT_RCR_H 0x0A3F
  1592. #define CMU_HS_M_MAXSAT_RCB_L 0x0A40
  1593. #define CMU_HS_M_MAXSAT_RCB_H 0x0A41
  1594. #define CMU_HS_M_MAXSAT_GCR_L 0x0A42
  1595. #define CMU_HS_M_MAXSAT_GCR_H 0x0A43
  1596. #define CMU_HS_M_MAXSAT_GCB_L 0x0A44
  1597. #define CMU_HS_M_MAXSAT_GCB_H 0x0A45
  1598. #define CMU_HS_M_MAXSAT_BCR_L 0x0A46
  1599. #define CMU_HS_M_MAXSAT_BCR_H 0x0A47
  1600. #define CMU_HS_M_MAXSAT_BCB_L 0x0A48
  1601. #define CMU_HS_M_MAXSAT_BCB_H 0x0A49
  1602. #define CMU_HS_M_ROFF_L 0x0A4A
  1603. #define CMU_HS_M_ROFF_H 0x0A4B
  1604. #define CMU_HS_M_GOFF_L 0x0A4C
  1605. #define CMU_HS_M_GOFF_H 0x0A4D
  1606. #define CMU_HS_M_BOFF_L 0x0A4E
  1607. #define CMU_HS_M_BOFF_H 0x0A4F
  1608. #define CMU_HS_P_EN 0x0A50
  1609. #define CMU_HS_P_AX1_L 0x0A52
  1610. #define CMU_HS_P_AX1_H 0x0A53
  1611. #define CMU_HS_P_AX2_L 0x0A54
  1612. #define CMU_HS_P_AX2_H 0x0A55
  1613. #define CMU_HS_P_AX3_L 0x0A56
  1614. #define CMU_HS_P_AX3_H 0x0A57
  1615. #define CMU_HS_P_AX4_L 0x0A58
  1616. #define CMU_HS_P_AX4_H 0x0A59
  1617. #define CMU_HS_P_AX5_L 0x0A5A
  1618. #define CMU_HS_P_AX5_H 0x0A5B
  1619. #define CMU_HS_P_AX6_L 0x0A5C
  1620. #define CMU_HS_P_AX6_H 0x0A5D
  1621. #define CMU_HS_P_AX7_L 0x0A5E
  1622. #define CMU_HS_P_AX7_H 0x0A5F
  1623. #define CMU_HS_P_AX8_L 0x0A60
  1624. #define CMU_HS_P_AX8_H 0x0A61
  1625. #define CMU_HS_P_AX9_L 0x0A62
  1626. #define CMU_HS_P_AX9_H 0x0A63
  1627. #define CMU_HS_P_AX10_L 0x0A64
  1628. #define CMU_HS_P_AX10_H 0x0A65
  1629. #define CMU_HS_P_AX11_L 0x0A66
  1630. #define CMU_HS_P_AX11_H 0x0A67
  1631. #define CMU_HS_P_AX12_L 0x0A68
  1632. #define CMU_HS_P_AX12_H 0x0A69
  1633. #define CMU_HS_P_AX13_L 0x0A6A
  1634. #define CMU_HS_P_AX13_H 0x0A6B
  1635. #define CMU_HS_P_AX14_L 0x0A6C
  1636. #define CMU_HS_P_AX14_H 0x0A6D
  1637. #define CMU_HS_P_H1_H14 0x0A6E
  1638. #define CMU_HS_P_S1_S14 0x0A7C
  1639. #define CMU_HS_P_GL 0x0A8A
  1640. #define CMU_HS_P_MAXSAT_RGB_Y_L 0x0A8C
  1641. #define CMU_HS_P_MAXSAT_RGB_Y_H 0x0A8D
  1642. #define CMU_HS_P_MAXSAT_RCR_L 0x0A8E
  1643. #define CMU_HS_P_MAXSAT_RCR_H 0x0A8F
  1644. #define CMU_HS_P_MAXSAT_RCB_L 0x0A90
  1645. #define CMU_HS_P_MAXSAT_RCB_H 0x0A91
  1646. #define CMU_HS_P_MAXSAT_GCR_L 0x0A92
  1647. #define CMU_HS_P_MAXSAT_GCR_H 0x0A93
  1648. #define CMU_HS_P_MAXSAT_GCB_L 0x0A94
  1649. #define CMU_HS_P_MAXSAT_GCB_H 0x0A95
  1650. #define CMU_HS_P_MAXSAT_BCR_L 0x0A96
  1651. #define CMU_HS_P_MAXSAT_BCR_H 0x0A97
  1652. #define CMU_HS_P_MAXSAT_BCB_L 0x0A98
  1653. #define CMU_HS_P_MAXSAT_BCB_H 0x0A99
  1654. #define CMU_HS_P_ROFF_L 0x0A9A
  1655. #define CMU_HS_P_ROFF_H 0x0A9B
  1656. #define CMU_HS_P_GOFF_L 0x0A9C
  1657. #define CMU_HS_P_GOFF_H 0x0A9D
  1658. #define CMU_HS_P_BOFF_L 0x0A9E
  1659. #define CMU_HS_P_BOFF_H 0x0A9F
  1660. #define CMU_GLCSC_M_C0_L 0x0AA0
  1661. #define CMU_GLCSC_M_C0_H 0x0AA1
  1662. #define CMU_GLCSC_M_C1_L 0x0AA2
  1663. #define CMU_GLCSC_M_C1_H 0x0AA3
  1664. #define CMU_GLCSC_M_C2_L 0x0AA4
  1665. #define CMU_GLCSC_M_C2_H 0x0AA5
  1666. #define CMU_GLCSC_M_C3_L 0x0AA6
  1667. #define CMU_GLCSC_M_C3_H 0x0AA7
  1668. #define CMU_GLCSC_M_C4_L 0x0AA8
  1669. #define CMU_GLCSC_M_C4_H 0x0AA9
  1670. #define CMU_GLCSC_M_C5_L 0x0AAA
  1671. #define CMU_GLCSC_M_C5_H 0x0AAB
  1672. #define CMU_GLCSC_M_C6_L 0x0AAC
  1673. #define CMU_GLCSC_M_C6_H 0x0AAD
  1674. #define CMU_GLCSC_M_C7_L 0x0AAE
  1675. #define CMU_GLCSC_M_C7_H 0x0AAF
  1676. #define CMU_GLCSC_M_C8_L 0x0AB0
  1677. #define CMU_GLCSC_M_C8_H 0x0AB1
  1678. #define CMU_GLCSC_M_O1_1 0x0AB4
  1679. #define CMU_GLCSC_M_O1_2 0x0AB5
  1680. #define CMU_GLCSC_M_O1_3 0x0AB6
  1681. #define CMU_GLCSC_M_O2_1 0x0AB8
  1682. #define CMU_GLCSC_M_O2_2 0x0AB9
  1683. #define CMU_GLCSC_M_O2_3 0x0ABA
  1684. #define CMU_GLCSC_M_O3_1 0x0ABC
  1685. #define CMU_GLCSC_M_O3_2 0x0ABD
  1686. #define CMU_GLCSC_M_O3_3 0x0ABE
  1687. #define CMU_GLCSC_P_C0_L 0x0AC0
  1688. #define CMU_GLCSC_P_C0_H 0x0AC1
  1689. #define CMU_GLCSC_P_C1_L 0x0AC2
  1690. #define CMU_GLCSC_P_C1_H 0x0AC3
  1691. #define CMU_GLCSC_P_C2_L 0x0AC4
  1692. #define CMU_GLCSC_P_C2_H 0x0AC5
  1693. #define CMU_GLCSC_P_C3_L 0x0AC6
  1694. #define CMU_GLCSC_P_C3_H 0x0AC7
  1695. #define CMU_GLCSC_P_C4_L 0x0AC8
  1696. #define CMU_GLCSC_P_C4_H 0x0AC9
  1697. #define CMU_GLCSC_P_C5_L 0x0ACA
  1698. #define CMU_GLCSC_P_C5_H 0x0ACB
  1699. #define CMU_GLCSC_P_C6_L 0x0ACC
  1700. #define CMU_GLCSC_P_C6_H 0x0ACD
  1701. #define CMU_GLCSC_P_C7_L 0x0ACE
  1702. #define CMU_GLCSC_P_C7_H 0x0ACF
  1703. #define CMU_GLCSC_P_C8_L 0x0AD0
  1704. #define CMU_GLCSC_P_C8_H 0x0AD1
  1705. #define CMU_GLCSC_P_O1_1 0x0AD4
  1706. #define CMU_GLCSC_P_O1_2 0x0AD5
  1707. #define CMU_GLCSC_P_O1_3 0x0AD6
  1708. #define CMU_GLCSC_P_O2_1 0x0AD8
  1709. #define CMU_GLCSC_P_O2_2 0x0AD9
  1710. #define CMU_GLCSC_P_O2_3 0x0ADA
  1711. #define CMU_GLCSC_P_O3_1 0x0ADC
  1712. #define CMU_GLCSC_P_O3_2 0x0ADD
  1713. #define CMU_GLCSC_P_O3_3 0x0ADE
  1714. #define CMU_PIXVAL_M_EN 0x0AE0
  1715. #define CMU_PIXVAL_P_EN 0x0AE1
  1716. #define CMU_CLK_CTRL_TCLK 0x0
  1717. #define CMU_CLK_CTRL_SCLK 0x2
  1718. #define CMU_CLK_CTRL_MSK 0x2
  1719. #define CMU_CLK_CTRL_ENABLE 0x1
  1720. #define LCD_TOP_CTRL_TV 0x2
  1721. #define LCD_TOP_CTRL_PN 0x0
  1722. #define LCD_TOP_CTRL_SEL_MSK 0x2
  1723. #define LCD_IO_CMU_IN_SEL_MSK (0x3 << 20)
  1724. #define LCD_IO_CMU_IN_SEL_TV 0
  1725. #define LCD_IO_CMU_IN_SEL_PN 1
  1726. #define LCD_IO_CMU_IN_SEL_PN2 2
  1727. #define LCD_IO_TV_OUT_SEL_MSK (0x3 << 26)
  1728. #define LCD_IO_PN_OUT_SEL_MSK (0x3 << 24)
  1729. #define LCD_IO_PN2_OUT_SEL_MSK (0x3 << 28)
  1730. #define LCD_IO_TV_OUT_SEL_NON 3
  1731. #define LCD_IO_PN_OUT_SEL_NON 3
  1732. #define LCD_IO_PN2_OUT_SEL_NON 3
  1733. #define LCD_TOP_CTRL_CMU_ENABLE 0x1
  1734. #define LCD_IO_OVERL_MSK 0xC00000
  1735. #define LCD_IO_OVERL_TV 0x0
  1736. #define LCD_IO_OVERL_LCD1 0x400000
  1737. #define LCD_IO_OVERL_LCD2 0xC00000
  1738. #define HINVERT_MSK 0x4
  1739. #define VINVERT_MSK 0x8
  1740. #define HINVERT_LEN 0x2
  1741. #define VINVERT_LEN 0x3
  1742. #define CMU_CTRL 0x88
  1743. #define CMU_CTRL_A0_MSK 0x6
  1744. #define CMU_CTRL_A0_TV 0x0
  1745. #define CMU_CTRL_A0_LCD1 0x1
  1746. #define CMU_CTRL_A0_LCD2 0x2
  1747. #define CMU_CTRL_A0_HDMI 0x3
  1748. #define ICR_DRV_ROUTE_OFF 0x0
  1749. #define ICR_DRV_ROUTE_TV 0x1
  1750. #define ICR_DRV_ROUTE_LCD1 0x2
  1751. #define ICR_DRV_ROUTE_LCD2 0x3
  1752. enum {
  1753. PATH_PN = 0,
  1754. PATH_TV,
  1755. PATH_P2,
  1756. };
  1757. /*
  1758. * mmp path describes part of mmp path related info:
  1759. * which is hiden in display driver and not exported to buffer driver
  1760. */
  1761. struct mmphw_ctrl;
  1762. struct mmphw_path_plat {
  1763. int id;
  1764. struct mmphw_ctrl *ctrl;
  1765. struct mmp_path *path;
  1766. u32 path_config;
  1767. u32 link_config;
  1768. };
  1769. /* mmp ctrl describes mmp controller related info */
  1770. struct mmphw_ctrl {
  1771. /* platform related, get from config */
  1772. const char *name;
  1773. int irq;
  1774. void *reg_base;
  1775. struct clk *clk;
  1776. /* sys info */
  1777. struct device *dev;
  1778. /* state */
  1779. int open_count;
  1780. int status;
  1781. struct mutex access_ok;
  1782. /*pathes*/
  1783. int path_num;
  1784. struct mmphw_path_plat path_plats[0];
  1785. };
  1786. static inline int overlay_is_vid(struct mmp_overlay *overlay)
  1787. {
  1788. return overlay->dmafetch_id & 1;
  1789. }
  1790. static inline struct mmphw_path_plat *path_to_path_plat(struct mmp_path *path)
  1791. {
  1792. return (struct mmphw_path_plat *)path->plat_data;
  1793. }
  1794. static inline struct mmphw_ctrl *path_to_ctrl(struct mmp_path *path)
  1795. {
  1796. return path_to_path_plat(path)->ctrl;
  1797. }
  1798. static inline struct mmphw_ctrl *overlay_to_ctrl(struct mmp_overlay *overlay)
  1799. {
  1800. return path_to_ctrl(overlay->path);
  1801. }
  1802. static inline void *ctrl_regs(struct mmp_path *path)
  1803. {
  1804. return path_to_ctrl(path)->reg_base;
  1805. }
  1806. /* path regs, for regs symmetrical for both pathes */
  1807. static inline struct lcd_regs *path_regs(struct mmp_path *path)
  1808. {
  1809. if (path->id == PATH_PN)
  1810. return (struct lcd_regs *)(ctrl_regs(path) + 0xc0);
  1811. else if (path->id == PATH_TV)
  1812. return (struct lcd_regs *)ctrl_regs(path);
  1813. else if (path->id == PATH_P2)
  1814. return (struct lcd_regs *)(ctrl_regs(path) + 0x200);
  1815. else {
  1816. dev_err(path->dev, "path id %d invalid\n", path->id);
  1817. BUG_ON(1);
  1818. return NULL;
  1819. }
  1820. }
  1821. #ifdef CONFIG_MMP_DISP_SPI
  1822. extern int lcd_spi_register(struct mmphw_ctrl *ctrl);
  1823. #endif
  1824. #endif /* _MMP_CTRL_H_ */