mt1389.h
上传用户:diaokj
上传日期:2019-12-22
资源大小:17k
文件大小:100k
源码类别:

DVD

开发平台:

C++ Builder

  1. /***************    MTK CONFIDENTIAL & COPYRIGHTED     ****************/
  2. /***************                                       ****************/
  3. /***************  $Modtime:: 07/04/09 11:49a   $       ****************/
  4. /***************  $Revision:: 7                $       ****************/
  5. /***************                                       ****************/
  6. /*************** Description : MT1389 register         ****************/
  7. /***************               definition              ****************/
  8. /***************                                       ****************/
  9. /***************     Company : MediaTek Inc.           ****************/
  10. /***************  Programmer : Joseph Lin              ****************/
  11. /**********************************************************************/
  12. #ifndef _H_MT1389_
  13. #define _H_MT1389_
  14. #define DEC_REG_START     0xF900    // Decoder register access
  15. #define BIM_REG_START     0xF800    // BUS INTERFACE MANAGER
  16. #define SRV_REG_START     0xFA00
  17. #define RW_BSTEST         0x0
  18. #define BSDEN             (0x1 << 7)
  19. #define RW_PRITRL         0x3E          // E6 only
  20. #define RW_FIFOCR         0x3F          // E6 only
  21. #define RAMCC             (1 << 5)
  22. #define RW_CMDQ           0x40          // Command Queue Control Register
  23. #define QSEL_2            (0 << 5)      // Command queue depth 2
  24. #define QSEL_3            (1 << 5)      // Command queue depth 3
  25. #define QSEL_4            (2 << 5)      // Command queue depth 4
  26. #define QSEL_5            (3 << 5)      // Command queue depth 5
  27. #define QSEL_6            (4 << 5)      // Command queue depth 6
  28. #define QSEL_7            (5 << 5)      // Command queue depth 7
  29. #define QSEL_8            (6 << 5)      // Command queue depth 8
  30. #define QSEL_9            (7 << 5)      // Command queue depth 9
  31. #define MBEN              (1 << 4)      // Burst mode enable
  32. #define CMDQ_EN           (1 << 3)      // Command queue enable
  33. #define TWR_0T            (0 << 1)      // Write recovery time 0 T
  34. #define TWR_1T            (1 << 1)      // Write recovery time 1 T
  35. #define TWR_2T            (2 << 1)      // Write recovery time 2 T
  36. #define TWR_3T            (3 << 1)      // Write recovery time 3 T
  37. #define RTW_0T            (0 << 0)      // No additional latency
  38. #define RTW_1T            (1 << 0)      // Additional 1T latency
  39. #define RW_RBCR0          0x41          // RAM buffer control 0
  40. #define TRAS_6T           (0 << 6)
  41. #define TRAS_7T           (1 << 6)
  42. #define TRAS_8T           (2 << 6)
  43. #define TRAS_9T           (3 << 6)
  44. #define TRP_1T            (0 << 4)
  45. #define TRP_2T            (1 << 4)
  46. #define TRP_3T            (2 << 4)
  47. #define TRP_4T            (3 << 4)
  48. #define TRCD_5T           (0 << 2)
  49. #define TRCD_2T           (1 << 2)
  50. #define TRCD_3T           (2 << 2)
  51. #define TRCD_4T           (3 << 2)
  52. #define MCASLT_1T         (1 << 0)      // CAS latancy 1T
  53. #define MCASLT_2T         (2 << 0)      // CAS latancy 2T
  54. #define MCASLT_3T         (3 << 0)      // CAS latancy 3T
  55. #define RW_RBCR1          0x42          // RAM buffer control 1
  56. #define DAW_4BK           (1 << 7)      // SDRAM 4 banks
  57. #define BWSEL_32          (1 << 6)      // The external SDRAM bus width is 32-bits
  58. #define CBSEL_9           (1 << 5)      // The external SDRAM column width is 9-bits (A0-A8)
  59. #define BREFEN            (1 << 4)      // Burst refresh before and after self refresh enable
  60. #define MBL_0             (0 << 1)      // Minimum burst length 0
  61. #define MBL_1             (1 << 1)      // Minimum burst length 1
  62. #define MBL_2             (2 << 1)      // Minimum burst length 2
  63. #define MBL_3             (3 << 1)      // Minimum burst length 3
  64. #define MBL_4             (4 << 1)      // Minimum burst length 4
  65. #define MBL_5             (5 << 1)      // Minimum burst length 5
  66. #define MBL_6             (6 << 1)      // Minimum burst length 6
  67. #define MBL_7             (7 << 1)      // Minimum burst length 7
  68. #define INITRG            (1 << 0)      // SDRAM initial trigger
  69. #define RW_RBCR2          0x43          // RAM buffer control 2
  70. #define MPDM              (1 << 7)      // SDRAM CKE power down mode
  71. #define MPDM_ON           (0 << 7)
  72. #define MPDM_OFF          (1 << 7)
  73. #define CLKDRV1_2         (0 << 3)      // Driving strength of SDRAM clock
  74. #define CLKDRV1_4         (1 << 3)
  75. #define CLKDRV1_6         (2 << 3)
  76. #define CLKDRV1_8         (3 << 3)
  77. #define CLKDRV1_10        (4 << 3)
  78. #define CLKDRV1_12        (5 << 3)
  79. #define CLKDRV1_14        (6 << 3)
  80. #define CLKDRV1_16        (7 << 3)
  81. #define CLKDRV2_10        (8 << 3)
  82. #define CLKDRV2_12        (9 << 3)
  83. #define CLKDRV2_14        (10 << 3)
  84. #define CLKDRV2_16        (11 << 3)
  85. #define CLKDRV2_18        (12 << 3)
  86. #define CLKDRV2_20        (13 << 3)
  87. #define CLKDRV2_22        (14 << 3)
  88. #define CLKDRV2_24        (15 << 3)
  89. #define CCKDLY_00         (0 << 0)      // The clock delay output 0.0ns
  90. #define CCKDLY_05         (1 << 0)      // The clock delay output 0.5ns
  91. #define CCKDLY_10         (2 << 0)      // The clock delay output 1.0ns
  92. #define CCKDLY_15         (3 << 0)      // The clock delay output 1.5ns
  93. #define CCKDLY_20         (4 << 0)      // The clock delay output 2.0ns
  94. #define CCKDLY_25         (5 << 0)      // The clock delay output 2.5ns
  95. #define CCKDLY_30         (6 << 0)      // The clock delay output 3.0ns
  96. #define CCKDLY_35         (7 << 0)      // The clock delay output 3.5ns
  97. #define RW_REFC           0x44          // Refresh Period Counter
  98. #define REFC_MASK         0xFC
  99. #define REFT_1            (0 << 0)      // Refresh once per Tref
  100. #define REFT_2            (1 << 0)      // Refresh twice per Tref
  101. #define REFT_3            (2 << 0)      // Refresh triple per Tref
  102. #define REFT_4            (3 << 0)      //
  103. #define RW_MCTRL          0x45          // Main Channel Interface Control
  104. #define BSYEN             (1 << 7)      // CD buffering FIFO busy enable (to avoid overflow)
  105. #define C2EN              (1 << 5)      // CD-ROM C2PO data write enable
  106. #define DSPEN             (1 << 4)      // Auto enable CIRC decoding in CDDA
  107. #define SYDEN             (1 << 3)      // SYNC DECECTION ENABLE
  108. #define SYIEN             (1 << 2)      // SYNC INSERTION ENABLE
  109. #define DSCEN             (1 << 1)      // DISCRAMBLER ENABLE
  110. #define WRRQ              (1 << 0)      // DSP DATA WRITE REQUEST
  111. #define RW_MCIER          0x46          // Main Channel Interface INT Enable
  112. #define FIFOTH            (1 << 7)      // CD buffering FIFO request threshold
  113. #define SMTBIE            (1 << 6)      // 1:SMART TARGET FIND BLANK SECTOR ENABLE
  114. #define IDNMIEN           (1 << 5)      // 1:ID/PID AND TARGET COMPARE ENABLE
  115. #define DTSEN             (1 << 4)      // 1:Enable DTS CD detection
  116. #define NOEFMEN           (1 << 3)      // 1:NO EFM SIGINAL FOR ONE PERIOD
  117. #define IHCEN             (1 << 2)      // 1:ILLEGAL CDROM HEADER CHK ENABLE
  118. #define TNFIEN            (1 << 1)      // 1:TARGET NOT FOUND INT ENABLE
  119. #define TFIEN             (1 << 0)      // 1:TARGET FOUND INT ENABLE
  120. #define RD_MCSTA          0x47          // Main Channel Interface Status
  121. #define SMTBNK            (1 << 7)      // 1:BLANK SECTOR FOUND BY SMART TARGET
  122. #define IDNM              (1 << 6)      // 1:ID/PID NOT MATCH TARGET
  123. #define DTS16             (1 << 6)      // 1: DTS CD 16 bit
  124. #define DTS14             (1 << 5)      // 1: DTS CD 14 bit
  125. #define BCAEND            (1 << 5)      // BCA DECODE COMPLETE
  126. #define NOEFM             (1 << 4)      // 1:NO EFM SIGINAL
  127. #define OVERRUN           (1 << 3)      // 1:TARGET OVERRUN
  128. #define NOSYNC            (1 << 2)      // 1:SYNC NOT FOUND
  129. #define TNFI              (1 << 1)      // 1:TARGET NOT FOUND
  130. #define TFI               (1 << 0)      // 1:TARGET FOUND
  131. #define RW_SCTRL          0x48          // Subcode Control
  132. #define C2LAST            (1 << 6)      // C2PO request last enable
  133. #define CTEXT             (1 << 5)      // 1: CD TEXT ENABLE
  134. #define LMT64             (1 << 3)      // 1: LIMIT 64
  135. #define SCWEN             (1 << 2)      // 1:SUBCODE WRITE ENABLE
  136. #define NOPQ              (1 << 1)      // 1:NO SUBCODE P AND Q
  137. #define SCEN              (1 << 0)      // 1:ENABL SUBCODE LOGIC
  138. #define RW_SCIER          0x49          // Subcode Interrupt Enable
  139. #define SBOKEN            (1 << 4)      // 1:SBOK INTERRUPT ENABLE
  140. #define QCLEAN            (1 << 3)      // 1:CLEAN SUB-Q CODE TARGET SEARCH
  141. #define MISSYEN           (1 << 2)      // Missing Q subchannel SYNC interrupt enable
  142. #define SBKEN             (1 << 1)      // Normal end of subcode block interrupt enable
  143. #define SILSYEN           (1 << 0)      // Illegal Q subchannel SYNC interrupt enable
  144. #define RD_SCSTA          0x4A          // Subcode Status
  145. #define SBOK              (1 << 3)      // 1:SUB-Q CODE CRC STATUS OK
  146. #define MISSY             (1 << 2)      // 1:MISS SUBCODE SYNC
  147. #define SBKEND            (1 << 1)      // 1:NORMAL SUBCODE END
  148. #define SILSY             (1 << 0)      // 1:ILLEGAL SUBCODE SYNC
  149. #define RW_SEEKLMT        0x4B          // CD Seek Limit
  150. #define RD_CDSC           0x4C          // Seek Counter
  151. #define RW_RAMPC          0x4D          // DRAM Pin Control Register 1
  152. #define CCKINV            (1 << 7)      // SDRAM clock inverting
  153. #define RAMDRV_2          (0 << 2)      // DRAM interface pin driving strength
  154. #define RAMDRV_4          (1 << 2)
  155. #define RAMDRV_6          (2 << 2)
  156. #define RAMDRV_8          (3 << 2)
  157. #define RAMDRV_10         (6 << 2)
  158. #define RAMDRV_12         (7 << 2)
  159. #define RCPT              (1 << 0)
  160. #define RW_RBCR3          0x4E          // Buffer Memory Control Register 3
  161. #define DM_SREFEN         (1 << 7)      // DRAM Self Refresh
  162. #define APSEL_A10         (0 << 5)      // SDRAM AP(auto precharge) pin select
  163. #define APSEL_A8          (1 << 5)
  164. #define APSEL_A9          (2 << 5)
  165. #define RW_RBCR4          0x4F          // Buffer Memory Control Register 4
  166. #define DCKDLY_00         (0 << 5)      // Data latch clock delay 0.0ns
  167. #define DCKDLY_05         (1 << 5)      // Data latch clock delay 0.5ns
  168. #define DCKDLY_10         (2 << 5)      // Data latch clock delay 1.0ns
  169. #define DCKDLY_15         (3 << 5)      // Data latch clock delay 1.5ns
  170. #define DCKDLY_20         (4 << 5)      // Data latch clock delay 2.0ns
  171. #define DCKDLY_25         (5 << 5)      // Data latch clock delay 2.5ns
  172. #define DCKDLY_30         (6 << 5)      // Data latch clock delay 3.0ns
  173. #define DCKDLY_35         (7 << 5)      // Data latch clock delay 3.5ns
  174. #define DCKINV            (1 << 4)      // Data latch clock invert
  175. #define CCASLT_4T         (0 << 2)
  176. #define CCASLT_1T         (1 << 2)
  177. #define CCASLT_2T         (2 << 2)
  178. #define CCASLT_3T         (3 << 2)
  179. #define DATR              (1 << 1)      // SDRAM Auto-tune trigger
  180. #define DSTS              (1 << 0)      // Status bit for SDRAM auto-tuning
  181. #define RD_QDATA0         0x50          // SUB-Q CODE BYTE 0 REGISTER
  182. #define RD_QDATA1         0x51          // SUB-Q CODE BYTE 1 REGISTER
  183. #define RD_QDATA2         0x52          // SUB-Q CODE BYTE 2 REGISTER
  184. #define RD_QDATA3         0x53          // SUB-Q CODE BYTE 3 REGISTER
  185. #define RD_QDATA4         0x54          // SUB-Q CODE BYTE 4 REGISTER
  186. #define RD_QDATA5         0x55          // SUB-Q CODE BYTE 5 REGISTER
  187. #define RD_QDATA6         0x56          // SUB-Q CODE BYTE 6 REGISTER
  188. #define RD_QDATA7         0x57          // SUB-Q CODE BYTE 7 REGISTER
  189. #define RD_QDATA8         0x58          // SUB-Q CODE BYTE 8 REGISTER
  190. #define RD_QDATA9         0x59          // SUB-Q CODE BYTE 9 REGISTER
  191. #define RW_NBLK           0x5A          // Number of blocks in buffer
  192. #define RW_NBLKH          0x5A          // Number of blocks in buffer High
  193. #define RW_NBLKL          0x5B          // Number of blocks in buffer Low
  194. #define RW_BBLK           0x5C          // Buffering Block Index
  195. #define RW_BBLKH          0x5C          // Buffering Block Index High
  196. #define RW_BBLKL          0x5D          // Buffering Block Index Low
  197. #define RW_SBLK           0x5E          // Subcode block Index
  198. #define RW_SBLKH          0x5E          // Subcode block Index High
  199. #define RW_SBLKL          0x5F          // Subcode block Index Low
  200. #define RW_TAR            0x60          // Target Sector
  201. #define RW_TARR           0x60          // Target Sector Reserved
  202. #define RW_TARH           0x61          // Target Sector High (Minute)
  203. #define RW_TARM           0x62          // Target Sector Medium (Second)
  204. #define RW_TARL           0x63          // Target Sector Low (Frame)
  205. #define RW_DBLK           0x64          // Decoding Block Index
  206. #define RW_DBLKH          0x64          // Decoding Block Index High
  207. #define RW_DBLKL          0x65          // Decoding Block Index Low
  208. #define RW_DCTRL0         0x66          // Decode Control Register 0
  209. #define ECCEN             (1 << 7)      // 1:ECC/EDC enable
  210. #define ACCEN             (1 << 6)      // 1:ECC acceleration enable
  211. #define DSECC             (1 << 5)      // 1:DVD Smart ECC
  212. #define QEN               (1 << 5)      // 1:CDROM Q error correction enable
  213. #define PEN               (1 << 4)      // 1:CDROM P error correction enable
  214. #define DBEDC             (1 << 4)      // 1:DVD Increase DBLK in ALL EDC O.K.
  215. #define MMASK             (1 << 3)      // 1:CDROM Mask Mode bits 7-5
  216. #define MF_MODE1          0x00          // 000 : MODE 1
  217. #define MF_XAFORM1        0x01          // 001 : MODE 2 FORM 1
  218. #define MF_XAFORM2        0x02          // 010 : MODE 2 FORM 2
  219. #define MF_MODE2          0x03          // 011 : MODE 2 AUTO FORM
  220. #define MF_AUTO           0x04          // 100 : AUTO MODE AUTO FORM
  221. #define MF_FMODEFORM      0x05          // 101 : FIXED MODE1 or MODE2 Form1
  222. #define MF_FMODEAFORM     0x06          // 110 : FIXED MODE, AUTO FORM
  223. #define RW_DCTRL1         0x67          // Decode Control Register 1
  224. #define RASEN            (1 << 7)       // auto stop buffering ctrl
  225. #define RAS              (1 << 6)       // auto stop buffering status
  226. #define LINK             (1 << 5)       // 1:Enable Auto Link
  227. #define METHOD1          (0 << 4)       // Method 1
  228. #define METHOD2          (1 << 4)       // Method 2
  229. #define DSKID            (1 << 3)       // 1:Skip DVD Sector ID check
  230. #define LKMODECLEAN      (1 << 3)       // 1:Enable Link Mode clean check
  231. #define RLIMIT01         (0x01)         // RLIMIT = 1
  232. #define RLIMIT02         (0x02)         // RLIMIT = 2
  233. #define RLIMIT03         (0x03)         // RLIMIT = 3
  234. #define RLIMIT04         (0x04)         // RLIMIT = 4
  235. #define RLIMIT05         (0x05)         // RLIMIT = 5
  236. #define RLIMIT06         (0x06)         // RLIMIT = 6
  237. #define RLIMIT07         (0x07)         // RLIMIT = 7
  238. #define RLIMIT08         (0x08)         // RLIMIT = 8
  239. #define RD_HDR0           0x68          // HEADER MINUTES (BCD)
  240. #define RD_HDR1           0x69          // HEADER SECOND (BCD)
  241. #define RD_HDR2           0x6A          // HEADER FRAME (BCD)
  242. #define RD_HDR3           0x6B          // HEADER MODE (BCD)
  243. #define RD_SHDR0          0x6C          // SUBHEADER FILE NUMBER
  244. #define RD_SHDR1          0x6D          // SUBHEADER CHANNEL NUMBER
  245. #define RD_SHDR2          0x6E          // SUBHEADER SUBMODE NUMBER
  246. #define RD_SHDR3          0x6F          // SUBHEADER CODING INFO
  247. #define RD_HDER           0x70          // CD Header/Subheader Error Flags
  248. #define RW_NSEC           0x71          // Number of Sectors to Decode
  249. #define RW_SRII           0x72          // Sector Ready Interrupt Interval
  250. #define RD_RSC            0x73          // Ready Sector Count
  251. #define RW_C2POL          0x74          // CD C2 Pointer Limit
  252. #define RD_C2POC          0x75          // CD C2 Pointer Count
  253. #define RW_DENEN          0x76          // Decode Error Notification Enable
  254. #define ILSYEN            (1 << 7)      // ILLSYNC OR SHORT BLK ERROR INT EN
  255. #define NOSYEN            (1 << 6)      // NO SYNC OR LONG BLK ERROR INT EN
  256. #define ADDREN            (1 << 5)      // CD Sector ADDRess MISMATCH INT ENable
  257. #define SNEN              (1 << 5)      // DVD SECTOR ID MISMATCH INT ENable
  258. #define MODEEN            (1 << 4)      // CD MODE ERROR INT ENable
  259. #define SIEN              (1 << 4)      // DVD SECTOR Information ERROR INT ENable
  260. #define FORMEN            (1 << 3)      // CD FORM ERRor INT ENable
  261. #define CPREN             (1 << 3)      // DVD CSS ERRor INT ENable
  262. #define EDCEN             (1 << 2)      // ECC FAILURE INT EN
  263. #define HDREN             (1 << 1)      // ERROR IN HEADER/SUBHEADER INT EN
  264. #define C2POEN            (1 << 0)      // C2PO COUNT EXCEEDS LIMIT INT EN
  265. #define UIDMEN            (1 << 0)      // User Expected ID Match
  266. #define RD_DESTA          0x77          // Decode Error Status
  267. #define ILSYER            (1 << 7)      // CD ILLSYNC OR SHORT BLK ERROR INT
  268. #define BLANKECC          (1 << 7)      // DVD-RAM BLANK ECC  HAPPENING
  269. #define NOSYER            (1 << 6)      // CD NO SYNC OR LONG BLK ERROR INT
  270. #define BLANKSECTOR       (1 << 6)      // DVD-RAM BLANK SECTOR HAPPENING
  271. #define ADDRER            (1 << 5)      // CD Sector ADDRess MISMATCH
  272. #define SNER              (1 << 5)      // DVD SECTOR ID MISMATCH
  273. #define MODEER            (1 << 4)      // CD MODE ERROR
  274. #define SIER              (1 << 4)      // DVD SECTOR Information ERROR
  275. #define FORMER            (1 << 3)      // CD FORM ERRor
  276. #define CPRER             (1 << 3)      // DVD CSS ERRor
  277. #define EDCER             (1 << 2)      // ECC FAILURE INT
  278. #define HDRER             (1 << 1)      // CD HEADER/SUBHEADER Error
  279. #define DSEC              (1 << 1)      // DVD-RAM IRREPLACEMENT DEFECT LIST
  280. #define C2POER            (1 << 0)      // CD C2PO COUNT EXCEEDS LIMIT INT
  281. #define UIDM              (1 << 0)      // DVD USER EXPECTED ID MATCHED
  282. #define RW_DIEN           0x78          // Decode Interrupt Enable Register
  283. #define EMPIEN            (1 << 7)      // BC3 EMPTY INT ENABLE
  284. #define DCIEN             (1 << 6)      // DECODER OP COMPLETE INT ENABLE
  285. #define DEIEN             (1 << 5)      // DECODER ERROR INT ENABLE
  286. #define MCIEN             (1 << 4)      // MAIN CHANNEL INTERFACE INT ENABLE
  287. #define SCIEN             (1 << 3)      // SUBCODE INTERFACE INT ENABLE
  288. #define RISCIEN           (1 << 2)      // RISC INT ENABLE
  289. #define BUFIEN            (1 << 1)      // BUFFERING COUNTER INT ENABLE
  290. #define DMIEN             (1 << 0)      // DEFECT MANAGEMENT INT ENABLE
  291. #define RC_DISTA          0x79          // Decode Interrupt Status Register
  292. #define EMPI              (1 << 7)      // BC3 EMPTY INT
  293. #define DCI               (1 << 6)      // DECODER OP COMPLETE INT
  294. #define DEI               (1 << 5)      // DECODER ERROR INT
  295. #define MCI               (1 << 4)      // MAIN CHANNEL INTERFACE INT
  296. #define SCI               (1 << 3)      // SUBCODE INTERFACE INT
  297. #define RISCI             (1 << 2)      // RISC INT
  298. #define BUFI              (1 << 1)      // BUFFERING COUNTER INT
  299. #define DMI               (1 << 0)      // DEFECT MANAGEMENT INT
  300. #define RW_BC1            0x7A          // Buffer Counter 1
  301. #define RW_BC1H           0x7A          // Buffer Counter 1 High
  302. #define RW_BC1L           0x7B          // Buffer Counter 1 Low
  303. #define RW_BC2            0x7C          // Buffer Counter 2
  304. #define RW_BC2H           0x7C          // Buffer Counter 2 High
  305. #define RW_BC2L           0x7D          // Buffer Counter 2 Low
  306. #define RW_BCS            0x7E          // Buffer Counter 1/2 Setting
  307. #define RW_BC1S           0x7E          // Buffer Counter 1 Setting
  308. #define RW_BC2S           0x7F          // Buffer Counter 2 Setting
  309. #define BC_DISABLE        (1 << 7)      // DISABLE BUFFERING COUNT
  310. #define BC_SUSPEND        (1 << 6)      // SUSPEND BUFFERING COUNT
  311. #define BC_NOINC          0x00          // 000:NO INCREMENT ON ANY EVENTS
  312. #define BC_BBLKINC        0x08          // 001:INCREMENT ON BBLK EVENTS
  313. #define BC_SBLKINC        0x10          // 010:INCREMENT ON SBLK EVENTS
  314. #define BC_DBLKINC        0x18          // 011:INCREMENT ON DBLK EVENTS
  315. #define BC_TBLKINC        0x20          // 100:INCREMENT ON TBLK EVENTS
  316. #define BC_ABLKINC        0x28          // 101:INCREMENT ON ABLK
  317. #define BC_NODEC          0x00          // 000:NO DECREMENT ON ANY EVENTS
  318. #define BC_BBLKDEC        0x01          // 001:DECREMENT ON BBLK EVENTS
  319. #define BC_SBLKDEC        0x02          // 010:DECREMENT ON SBLK EVENTS
  320. #define BC_DBLKDEC        0x03          // 011:DECREMENT ON DBLK EVENTS
  321. #define BC_TBLKDEC        0x04          // 100:DECREMENT ON TBLK EVENTS
  322. #define BC_ABLKDEC        0x05          // 101:DECREMENT ON ABLK
  323. #define RW_BCL            0x80          // Buffer Counter 1 Limit
  324. #define RW_BCLH           0x80          // Buffer Counter 1 Limit High
  325. #define RW_BCLL           0x81          // Buffer Counter 1 Limit Low
  326. #define RW_BCA            0x82          // Buffer Counter Adjustment
  327. #define RW_BCAH           0x82          // Buffer Counter Adjustment High
  328. #define RW_BCAL           0x83          // Buffer Counter Adjustment Low
  329. #define RW_TRIG           0x84          // Decoder Trigger Register
  330. #define READTRG           (1 << 7)      // READ OPERATION TRIG
  331. #define TARGETTRG         (1 << 6)      // READ IS TARGETED
  332. #define CLEANTRG          (1 << 5)      // CLEAN TARGET CHECK
  333. #define CDDATRG           (1 << 4)      // READ CDDA DATA
  334. #define REREADTRG         (1 << 5)      // REREAD DVD DATA
  335. #define REDECTRG          (1 << 4)      // REDECODE DVD DATA
  336. #define STOPRTRG          (1 << 3)      // STOP READ OPERATION TRIG
  337. #define DECTRG            (1 << 2)      // START DECODE OPERATION TRIG
  338. #define RESUMETRG         (1 << 1)      // RESUME DECODE OPERATION TRIG
  339. #define STOPDTRG          (1 << 0)      // STOP DECODE OPERATION TRIG
  340. #define RW_BMT            0x85
  341. #define CPBC              (1 << 0)      // Copy BC2 into BC1
  342. #define CPDBLK            (1 << 1)      // Copy DBLK into BBLK, SBLK
  343. #define RW_EID0           0x88          // Expected Decoded DVD SecID 0
  344. #define RW_EID1           0x89          // Expected Decoded DVD SecID 1
  345. #define RW_EID2           0x8A          // Expected Decoded DVD SecID 2
  346. #define RW_EID3           0x8B          // Expected Decoded DVD SecID 3
  347. #define AREA_DATA         0x00          // 00 Data area
  348. #define AREA_LEADIN       0x04          // 01 Lead-in area
  349. #define AREA_LEADOUT      0x08          // 10 Lead-out area
  350. #define AREA_MIDDLE       0x0C          // 11 Middle area
  351. #define LAYER_0           0x00          // Layer 0
  352. #define LAYER_1           0x01          // Layer 1
  353. #define RW_EBLK           0x8C          // DVD ECC Block Index
  354. #define RW_EBLKH          0x8C          // DVD ECC Block Index High
  355. #define RW_EBLKL          0x8D          // DVD ECC Block Index Low
  356. #define RW_SICE           0x8E          // DVD Sector Info Check Enable
  357. #define FOREN             (1 << 5)      // 1:Sector format type check enable
  358. #define TRKEN             (1 << 4)      // 1:Tracking method check enable
  359. #define REFEN             (1 << 3)      // 1:Reflectivity check enable
  360. #define AREAEN            (1 << 2)      // 1:Area type check enable
  361. #define DATAEN            (1 << 1)      // 1:Data type check enable
  362. #define LAYEN             (1 << 0)      // 1:Layer number check enable
  363. #define RD_SICR           0x8F          // DVD Sector Info Check Result
  364. #define FORR              (1 << 5)      // 1:Sector format type check result
  365. #define TRKR              (1 << 4)      // 1:Tracking method check result
  366. #define REFR              (1 << 3)      // 1:Reflectivity check result
  367. #define AREAR             (1 << 2)      // 1:Area type check result
  368. #define DATAR             (1 << 1)      // 1:Data type check result
  369. #define LAYR              (1 << 0)      // 1:Layer number check result
  370. #define RW_IDECC          0x90          // DVD Sector ID Err Correction Mode
  371. #define PIDUSEL           (1 << 5)      // PID Update Select
  372. #define SMTAR             (1 << 4)      // DVD Smart Target
  373. #define POPEN             (1 << 3)      // Enable PI's PO decoding
  374. #define IDCCHK            (1 << 2)      // DVD Sector ID Clean Check Enable
  375. #define IDECCON           (1 << 1)
  376. #define IDERAON           (1 << 0)
  377. #define RD_ECPR0          0x92          // Expected Decoded DVD Secotr CPR 0
  378. #define RD_ECPR1          0x93          // Expected Decoded DVD Secotr CPR 1
  379. #define RD_ECPR2          0x94          // Expected Decoded DVD Secotr CPR 2
  380. #define RD_ECPR3          0x95          // Expected Decoded DVD Secotr CPR 3
  381. #define RD_ECPR4          0x96          // Expected Decoded DVD Secotr CPR 4
  382. #define RD_ECPR5          0x97          // Expected Decoded DVD Secotr CPR 5
  383. #define RD_DID0           0x98          // Decoded DVD Sector ID 0
  384. #define RD_DID1           0x99          // Decoded DVD Sector ID 1
  385. #define RD_DID2           0x9A          // Decoded DVD Sector ID 2
  386. #define RD_DID3           0x9B          // Decoded DVD Sector ID 3
  387. #define RD_IID0           0x9C          // Incoming DVD Sector ID 0
  388. #define RD_IID1           0x9D          // Incoming DVD Sector ID 1
  389. #define RD_IID2           0x9E          // Incoming DVD Sector ID 2
  390. #define RD_IID3           0x9F          // Incoming DVD Sector ID 3
  391. #define RW_BC3            0xA8          // Buffer Counter 3
  392. #define RW_BC3R           0xA8          // Buffer Counter 3 Reserved
  393. #define RW_BC3H           0xA9          // Buffer Counter 3 High
  394. #define RW_BC3M           0xAA          // Buffer Counter 3 Middle
  395. #define RW_BC3L           0xAB          // Buffer Counter 3 Low
  396. #define RW_BC3S           0xAC          // Buffer Counter 3 Setting
  397. #define RW_BPC            0xC2
  398. #define RUN               (1 << 0)      // 1: Run Batch Register Programming
  399. #define RW_BPAR           0xC4          // Batch Program Reserved Address
  400. #define RW_BPAH           0xC5          // Batch Program High Address
  401. #define RW_BPAM           0xC6          // Batch Program Middle Address
  402. #define RW_BPAL           0xC7          // Batch Program Low Address
  403. #define RW_RXD            0xD6          // RS232 RECEIVE PORT
  404. #define RW_TXD            0xD6          // RS232 TRANSMIT PORT
  405. #define RD_RSFLG          0xD7          // RS232 FLAG REGISTER
  406. #define RSCEE             (1 << 7)      // Check End Error
  407. #define RSRO              (1 << 6)      // RECEIVE OVERFLOW
  408. #define RSTO              (1 << 5)      // TRANSMIT OVERFLOW
  409. #define RSRBF             (1 << 4)      // RECEIVE BUF FULL
  410. #define RSTBF             (1 << 3)      // TRANSMIT BUF FULL
  411. #define RW_DITA           0xE0          // Defect Info Table Address
  412. #define RW_TLSN           0xE1          // Target Logic Sector Number
  413. #define RW_ULSN           0xE2          // User-Specific Logic Sector Number
  414. #define RW_ZBLSN          0xE3          // Zone Boundary LSN
  415. #define RW_DMO            0xE4          // Defect Manager Operation Register
  416. #define DMO_DMBSY         (1 << 7)      // Defect Manager Busy
  417. #define DMO_RSDL          (1 << 6)      // Replacement SDL
  418. #define DMO_IRSDL         (1 << 5)      // Irreplacement SDL
  419. #define DMO_PDL           (1 << 4)      // PDL Defect
  420. #define RSTRWP            (1 << 2)      // Reset DM register pointers
  421. #define TRANS             (1 << 1)      // Translates TLSN to PSN in Target
  422. #define INITDIT           (1 << 0)      // Initialize Zone PDL pointer in DIT
  423. #define RW_DMC            0xE5          // Defect Manager Control Register
  424. #define SEC_STM_EN        (1 << 5)      // Sector Streaming Enable
  425. #define DMUPDN            (1 << 4)      // Defect Manager Power Down
  426. #define ZBAS              (1 << 3)      // Auto Stop at Zone Boundary
  427. #define STREAM            (1 << 2)      // Streaming Mode
  428. #define AUTOLR            (1 << 1)      // Auto Linear Replacement
  429. #define AUTOSLP           (1 << 0)      // Auto Slipping
  430. #define RW_DMIER          0xE6          // Defect Manager Interrupt Enable
  431. #define ULSNREN           (1 << 6)      // User-Specific LSN Reach
  432. #define ZBREN             (1 << 5)      // Zone Boundary Reach
  433. #define RSDLDEN           (1 << 4)      // Replacement SDL
  434. #define RBEEN             (1 << 3)      // Replacement Block End
  435. #define IRSDLDEN          (1 << 2)      // Irreplacement SDL
  436. #define IRSDLEEN          (1 << 1)      // Irreplacement SDL Block End
  437. #define PDLDEN            (1 << 0)      //  PDL Reach
  438. #define RC_DMSTA          0xE7          // Defect Manager Interrupt Status
  439. #define ULSNR             (1 << 6)      // User-Specific LSN Reach
  440. #define ZBR               (1 << 5)      // Zone Boundary Reach
  441. #define RSDLD             (1 << 4)      // Replacement SDL
  442. #define RBE               (1 << 3)      // Replacement Block End
  443. #define IRSDLD            (1 << 2)      // Irreplacement SDL
  444. #define IRSDLE            (1 << 1)      // Irreplacement SDL Block End
  445. #define PDLD              (1 << 0)      //  PDL Reach
  446. #define RW_HIM            0xE8
  447. #define IMODE_IDE         0x00          // IDE INTERFACE
  448. #define IMODE_PARAL       0x01          // Parallel AV
  449. #define IMODE_SER1        0x02          // Serial Port 1
  450. #define IMODE_SER2        0x03          // Serail Port 2
  451. #define IMODE_DUAL        0x04          // Dual Port
  452. #define RW_BPX            0xEA          // Batch Program Parameter X
  453. #define RW_BPY            0xEB          // Batch Program Parameter Y
  454. #define RD_PIDSTA         0xF0          // PID Status Register
  455. #define PID34OK           0x20          // PID34 O.K.
  456. #define PID34CLN          0x10          // PID34 Clean Flag
  457. #define PID12OK           0x02          // PID12 O.K.
  458. #define PID12CLN          0x01          // PID12 Clean Flag
  459. #define RW_C1C2R          0xF0          // CIRC/RSPC Error Flag
  460. #define RW_TXCTRL         0xF1          // DVD_RAM Sector Transfer Control
  461. #define STMINTREN         (1 << 7)      // Decoding Error Int in Stream Mode
  462. #define BESSITEN          (1 << 6)      // Blank ECC decoding error interrupt
  463. #define BNKINTREN         (1 << 5)      // Decoding error int if blank is detected
  464. #define DFTINTREN         (1 << 4)      // Decoding error int in inreplaceable SDL defect
  465. #define BNKLEV            (1 << 3)      // Blank level for a sector
  466. #define BECCTXSEL         (1 << 2)      // Blank ECC transfer mode select
  467. #define BNKTXSEL          (1 << 1)      // Blank Sector Transfer Mode
  468. #define DFTTXSEL          (1 << 0)      // Defect Sector Transfer Mode Select
  469. #define RW_BCARC          0xF2          // BCA Rebuffer Control Register
  470. #define BCASEL            (1 << 4)      // BCA Select
  471. #define BCARTIME1         0x02          // BCA Rebuffer Count
  472. #define BCARTIME2         0x04          // BCA Rebuffer Count
  473. #define BCARTIME3         0x06          // BCA Rebuffer Count
  474. #define BCARTIME4         0x08          // BCA Rebuffer Count
  475. #define BCARTIME5         0x0A          // BCA Rebuffer Count
  476. #define BCARTIME6         0x0C          // BCA Rebuffer Count
  477. #define BCARTIME7         0x0E          // BCA Rebuffer Count
  478. #define BCARTIME8         0x00          // BCA Rebuffer Count
  479. #define BCAREB            0x01          // BCA Rebuufer Enable
  480. #define RD_BCASTA         0xF3          // BCA Status Register
  481. #define BCAOK             (1 << 4)      // BCA OK Status
  482. #define BCAN              0x0F          // BCA N rows value
  483. #define RW_CIRCCTL        0xF4          // CIRC Control Register
  484. #define PIECCALIGN        (1 << 7)      // PI Error Count Aligned ECC
  485. #define CDERRCNT_01       (0 << 6)      // 1 Sector Error Cal Interval
  486. #define CDERRCNT_75       (1 << 6)      // 75 Sector Error Cal Interval
  487. #define DVDERRCNT_01      (0 << 6)      // 1 ECC  Error Cal Interval
  488. #define DVDERRCNT_42      (1 << 6)      // 42 Sector Error Cal Interval
  489. #define PI_FRMERR         (0 << 5)      // PI frame error number
  490. #define PI_ERROR          (1 << 5)      // PI error number
  491. #define C1C2_NOSFRMERR    (0 << 5)      // C1/C2 no solution frame
  492. #define C1C2_FRMERR       (1 << 5)      // C1/C2 frame error number
  493. #define CDROMCIRC1        (0x10)        // CDROM Strategy 1
  494. #define CDROMCIRC2        (0x14)        // CDROM Strategy 2
  495. #define CDDACIRC1         (0x18)        // CDDA Strategy 1
  496. #define CDDACIRC2         (0x1C)        // CDDA Strategy 2
  497. #define CDDANEWCIRC2      (0x08)        // CDDA new Strategy 2
  498. #define DISC2             (1 << 1)      // Disable C2 correction
  499. #define DISC1             (1 << 0)      // Disable C1 correction
  500. #define RW_REGCTRL        0xF5          // Monitor Control Register
  501. #define UEIDRWLOW         0x00          // Write/Read Low Byte
  502. #define UEIDRWMID         0x10          // Write/Read Middle Byte
  503. #define UEIDRWHIGH        0x20          // Write/Read High Byte
  504. #define CD_C1C2           0x00          // CD C1/C2 Error
  505. #define DVD_PIPO          0x01          // DVD PI/PO Error
  506. #define DVD_PIPO_FRM      0x02          // DVD PI/PO Frame Error
  507. #define RW_UEID           0xF6          // User Expected Decoded ID
  508. #define RD_DECMONSTA0     0xF7          // Decoder Monitor Status Reg
  509. #define RD_DECMONSTA1     0xF8          // Decoder Monitor Status Reg
  510. #define RD_DECMONSTA2     0xF9          // Decoder Monitor Status Reg
  511. #define RD_DECMONSTA3     0xFA          // Decoder Monitor Status Reg
  512. #define RW_RBFSEC         0xFB          // DVD-RAM rebuffer sector index register
  513. #define RW_ILSYNC         0xFC          // illegal SYNC detection status
  514. #define ILSYNC            (1 << 3)      // illegal SYNC detected
  515. #define RW_ISMASK         0xFD          // illegal SYNC interrupt mask
  516. #define ISMASK            (1 << 7)      // illegal SYNC interrupt mask
  517. #define RW_REGCTRL1       0xFE          // Register monitor control register
  518. #define NCSOP_6           (0 << 6)      // Continuously no-solution number is 6
  519. #define NCSOP_8           (1 << 6)      // Continuously no-solution number is 8
  520. #define NCSOP_10          (2 << 6)      // Continuously no-solution number is 10
  521. #define NCSOP_12          (3 << 6)      // Continuously no-solution number is 12
  522. #define NANOP_1           (0 << 4)      // The postponed number is 1
  523. #define NANOP_2           (1 << 4)      // The postponed number is 2
  524. #define NANOP_3           (2 << 4)      // The postponed number is 3
  525. #define NANOP_4           (3 << 4)      // The postponed number is 4
  526. #define NEWECCOP          (1 << 3)      // ehold will be set
  527. #define RSPOWER           (1 << 2)      // rs_engine is always on
  528. #define DECMCLK           (1 << 1)      // DRAM clock is on
  529. #define DSPMCLK           (1 << 0)      // DRAM clcck is on
  530. #define RW_REGCTRL2       0xFF          // Register monitor control register
  531. #define C1ESETEN          (1 << 7)      // Enable C1 automatically set erasure
  532. #define NOSOLADD          (1 << 6)      // Enable postponing C1 no-solution length
  533. //////////////////////////////////////////////////////
  534. // definition of decoder Register
  535. #define CDROM_AUTO_CIRC   CDROMCIRC1
  536. #define CDROMXA_AUTO_CIRC CDROMCIRC1
  537. #define CDDA_AUTO_CIRC    CDDANEWCIRC2
  538. // definition of servo Register
  539. #ifdef MT1389LK_DIGITAL_SERVO
  540. // For 1389L/K, DPUCmd 35[7:6] = 11, by Jethro
  541.   #define CDROM_ENA_CIRC    0xEA
  542.   #define CDDA_ENA_CIRC     0xDA
  543.   #define CDDA_DIS_CIRC     0xC8
  544. #else
  545.   #define CDROM_ENA_CIRC    0x2A
  546.   #define CDDA_ENA_CIRC     0x1A
  547.   #define CDDA_DIS_CIRC     0x08
  548. #endif
  549. #define DVD_AUTO_RSPC     0x22
  550. #define DVDRAM_AUTO_RSPC  0xE6
  551. // the Despike register for MT1379 was moved to 0x48,
  552. // and will be initialed by SERVO
  553. // SDATA data interpolation control
  554. #define ITMD_1_C2PO       0x00
  555. #define ITMD_3_C2PO       0x10
  556. // Interpolation
  557. #define ENA_INPT          (0 << 3)
  558. #define DIS_INPT          (1 << 3)
  559. // Path Select
  560. #define CDROM_MODE        (1 << 2)
  561. #define CDDA_MODE         (0 << 2)
  562. // Avoid Left/Right Channel Shift
  563. #define ITSEL             (1 << 1)
  564. #define CDROM_PATH        (CDROM_MODE)
  565. #define CDDA_DIS_INTP     (CDDA_MODE + DIS_INPT)
  566. #define CDDA_ENA_INTP     (CDDA_MODE + ENA_INPT + ITSEL)
  567. //////////////////////////////////////////////////////
  568. // BIM registers definition
  569. #define BIM_RISCSSH       0x40
  570. #define BIM_RISCSSL       0x41
  571. #define BIM_RISCS3        0x42
  572. #define BIM_RISCS2        0x43
  573. #define BIM_RISCS1        0x44
  574. #define BIM_RISCS0        0x45
  575. #define BIM_DBGC          0x48
  576. #define RSTOP             (1 << 0)          // RISC stop
  577. #define BIM_DBGS          0x49
  578. #define BIM_CHK1H         0x4A
  579. #define BIM_CHK1L         0x4B
  580. #define BIM_CHK2H         0x4C
  581. #define BIM_CHK2L         0x4D
  582. #define BIM_CHK1A         0x4E
  583. #define BIM_CHK2A         0x4F
  584. #define BIM_SIFSel         0x50
  585. #define Device_Addr        0x00
  586. #define Word_Addr          0x01
  587. #define W_Data             0x02
  588. #define R_Data             0x03
  589. #ifndef MT1389_REV_P
  590. #define SIFCfg             0x10
  591. #else
  592. #define SIFCFG             0x15
  593. #define SIFCLK_CNT      0x18
  594. #define SIFCTRL        0x19
  595. #define SIFACK             0x1A
  596. #endif
  597. #define BIM_SIFData        0x51
  598. #define SIFAACK           (1 << 2)
  599. #define SIFCKSEL_30K      0x00
  600. #define SIFCKSEL_120K     0x01
  601. #define SIFCKSEL_480K     0x02
  602. #define BIM_SCTRL         0x52
  603. #define SIFEN             (1 << 0)
  604. #define SIFBIDA           (1 << 1)
  605. #define SIFTRI            (1 << 2)
  606. #define SIFWR             (1 << 3)
  607. #if (defined(MT1389_REV_K))
  608. #define SIFCURAR          (1 << 4)
  609. #define SIFHD1T           (1 << 5)
  610. #define BIM_SIFIC         0x53
  611. #define SACDCLR           (1 << 6)
  612. #define BIM_SIFINT        0x54
  613. #define SIFMI             (1 << 0)
  614. #define VFDI              (1 << 1)
  615. #define SIFS0I            (1 << 2)
  616. #define SIFS1I            (1 << 3)
  617. #define EXTI              (1 << 4)
  618. #define SDHOS             (1 << 5)
  619. #define PSPDET            (1 << 6)  //G.T??
  620. #endif
  621. #define BIM_STAT          0x60
  622. #define ICEM              (1 << 7)          // ICE MODE
  623. #define E373              (1 << 6)          // 1 external, 0 internal
  624. #define MBSY              (1 << 5)          // DRAM busy
  625. #define HPIN              (1 << 4)          // 1: 256 pins package
  626. #define EMU               (1 << 1)          // 1: emulation SRAM avaiable
  627. #define RICE              (1 << 0)          // RICE in ICE mode
  628. #define BIM_MARH          0x61              // DRAM write port address High
  629. #define BIM_MARM          0x62              // DRAM write port address Mid
  630. #define BIM_MARL          0x63              // DRAM write port address Low
  631. #define BIM_MDAT          0x64              // DRAM write Data port
  632. #define BIM_FRST          0x65              // Firmware Reset
  633. #define CTRST             (1 << 3)          // Counter reset
  634. #define RPOR              (1 << 2)          // RISC power-on reset
  635. #define RRST              (1 << 1)          // RISC firmware reset
  636. #define FRST              (1 << 0)          // 8032 firmware reset
  637. #define BIM_PCTL1         0x66              // Pin Control 1 Register
  638. #if (!defined(MT1389_REV_P) && !defined(MT1389_REV_K))
  639. #define OSCEN             (1 << 7)          // Oscillator Enable
  640. #else
  641. #define A22EN             (1 << 7)          // A22 Enable
  642. #endif
  643. #define A21EN             (1 << 6)          // A20 Enable
  644. #define A20EN             (1 << 5)          // A20 Enable
  645. #if defined(MT1389_REV_K) //G.T1225:BIM Rechecking: Here is different from 89L porting.
  646. #define IOFLG             (1 << 4)          // Servo Flag Mode
  647. #define A19LOCK           (1 << 3)
  648. #define A18LOCK           (1 << 2)
  649. #define A17LOCK           (1 << 1)
  650. #define A16LOCK           (1 << 0)
  651. #else
  652. #define A19EN             (1 << 4)          // A19 Enable
  653. #define IOFLG             (1 << 3)          // Servo Flag Mode
  654. #define A18LOCK           (1 << 2)
  655. #define A17LOCK           (1 << 1)
  656. #define A16LOCK           (1 << 0)
  657. #endif
  658. #ifdef BANK_NO
  659.   #if (BANK_NO > 4) // use 8 banks
  660.     #define ADDR_LOCK       (A16LOCK | A17LOCK | A18LOCK)
  661.   #else
  662.     #define ADDR_LOCK       (A16LOCK | A17LOCK)
  663.   #endif
  664. #endif
  665. #define BIM_PCTL2         0x67              // Pin Control 2 Register
  666. #define EXTCS             (1 << 7)          // External Chip-Select Enable
  667. #define F4MX2             (1 << 6)          // Use two 4M Flash
  668. #define XL54M             (1 << 5)          // Use external 54M clock
  669. #define LEDEN             (1 << 4)          // LED Enable
  670. #define CS_EN             (1 << 3)          // Flash CS Enable
  671. #if (defined(MT1389_REV_L) || defined(MT1389_REV_K))
  672. #define RS232P2         (1 << 2)
  673. #define CKM               (1 << 1)          // Clock Monitor Enable
  674. #define DSPT              (1 << 0)          //
  675. #else
  676. #define CKM               (1 << 2)          // Clock Monitor Enable
  677. #define DSPT              (1 << 1)          //
  678. #define W_EN              (1 << 0)          // Flash WR Enable
  679. #endif
  680. #define BIM_IOENH         0x68
  681. #define BIM_IOENM         0x69
  682. #define BIM_IOENL         0x6A
  683. #define BIM_IODRH         0x68
  684. #define BIM_IODRM         0x69
  685. #define BIM_IODRL         0x6A
  686. #define BIM_IODOH         0x6B
  687. #define BIM_IODOM         0x6C
  688. #define BIM_IODOL         0x6D
  689. #define BIM_IODIH         0x6E
  690. #define BIM_IODIM         0x6F
  691. #define BIM_IODIL         0x70
  692. // BIM_IOENH,BIM_IODOH,BIM_IODIH
  693. #define IOH_VSYN          (1 << 0)
  694. #define IOH_YUV7          (1 << 3)
  695. #define IOH_SPBCK         (1 << 4)
  696. #define IOH_SPLRCK        (1 << 5)
  697. #define IOH_SPDATA        (1 << 6)
  698. #define IOH_SPMCLK        (1 << 7)
  699. // BIM_IOENM,BIM_IODOM,BIM_IODIM
  700. #define IOM_A16           (1 << 0)
  701. #define IOM_A17           (1 << 1)
  702. #define IOM_A18           (1 << 2)
  703. #define IOM_A19           (1 << 3)
  704. #define IOM_A20           (1 << 4)
  705. #define IOM_A21           (1 << 5)
  706. #define IOM_BLANK         (1 << 6)
  707. #define IOM_HSYN          (1 << 7)
  708. // BIM_IOENL,BIM_IODOL,BIM_IODIL
  709. #ifdef FLASH_SZ
  710.   #if (FLASH_SZ == 4)
  711.     #define IOM_BMASK         (IOM_A16 | IOM_A17 | IOM_A18 | IOM_A19 | IOM_A20 | IOM_A21)
  712.   #elif (FLASH_SZ == 2)
  713.     #define IOM_BMASK         (IOM_A16 | IOM_A17 | IOM_A18 | IOM_A19 | IOM_A20)
  714.   #else /* 1M byte flash */
  715.     #define IOM_BMASK         (IOM_A16 | IOM_A17 | IOM_A18 | IOM_A19)
  716.   #endif
  717. #endif
  718. #define IOH_VSYN          (1 << 0)
  719. #define IOH_IOWR          (1 << 1)
  720. #define IOH_IOCS          (1 << 2)
  721. #define IOH_XTALI         (1 << 3)
  722. #define IOH_SPBCK         (1 << 4)
  723. #define IOH_SPLRCK        (1 << 5)
  724. #define IOH_SPDATA        (1 << 6)
  725. #define IOH_SPMCLK        (1 << 7)
  726. #define BIM_MAP           0x71              // Map rom in ICE mode
  727. #define VRAM2             (2 << 1)          // enable virtual SRAM 2
  728. #define VRAM              (1 << 1)          // enable virtual SRAM
  729. #define MAPROM            (1 << 0)
  730. #if defined(MT1389_REV_K)
  731. #define HI_GPR_SEL     (1 << 3)  //Enable acess to additional 128 bytes GPR.
  732. #define GPRCK              (1 << 2)  //General purpose ram clock select
  733. #endif
  734. #define BIM_DUAL          0x72
  735. #define CPU_HALF_EN       (1 << 3)
  736. #define IN2K              (1 << 2)
  737. #define DUALEN            (1 << 0)
  738. #define BIM_CFLA          0x73
  739. #define CFLA              (1 << 0)
  740. #define BIM_ADDREN        0x74
  741. #define ROMEN             (1 << 7)
  742. #define FAEN              (1 << 6)
  743. #define FNEN              (1 << 5)
  744. #define DACEN             (1 << 4)
  745. #define DANEN             (1 << 3)
  746. #define DBCEN             (1 << 2)
  747. #define DBNEN             (1 << 1)
  748. #define IOEN              (1 << 0)
  749. #define BIM_FCBA          0x75              // Flash Cache Addr
  750. #define BIM_FNBA          0x76              // Flash Non-Cache Addr
  751. #define BIM_ACBA          0x77              // DRAM A Cache Addr
  752. #define BIM_ANBA          0x78              // DRAM A Non-Cache Addr
  753. #define BIM_BCBA          0x79              // DRAM B Cache Addr
  754. #define BIM_BNBA          0x7A              // DRAM B Non-Cache Addr
  755. #define BIM_IOBA          0x7B              // IO Addr
  756. #define BIM_DPAH          0x7C              // DRAM Partition Register
  757. #define BIM_DPAM          0x7D
  758. #define BIM_DPAL          0x7E
  759. #define BIM_CFG           0x7F              // Configuration Register
  760. #define BCDEN             (1 << 7)          // Binary to BCD enable
  761. #define FASTM             (1 << 6)          // 8032 Fast mode
  762. #define DVDPRW            (1 << 4)          // DVD+RW 4.7G mode
  763. #define DVDRAMVER2        (1 << 3)          // DVD-RAM version 2 mode
  764. #define DVDRAMVER1        (0 << 3)          // DVD-RAM version 1 mode
  765. #define DVDRAM            0x06              // DVD-RAM mode
  766. #define DVDMODE           (1 << 1)          // DVD mode
  767. #define CDMODE            (1 << 0)          // CD mode
  768. #ifdef IR_USE_HW
  769.   #define BIM_IR_CNT      0x80              // IR bit count
  770.   #define BIM_IR_VAL      0x81              // IR 1st/2nd/decoded value
  771. #else
  772.   #define BIM_IRL         0x81              // IR counter low
  773.   #define BIM_IRH         0x80              // IR counter high
  774. #endif
  775. #define BIM_IR_CFGH       0x82              // IR configuration high register
  776. #define IR_END_7          0x00              // If sampling counter 7, delcare IR end pattern
  777. #define IR_END_15         0x40              // If sampling counter 15, delcare IR end pattern
  778. #define IR_END_23         0x80              // If sampling counter 23, delcare IR end pattern
  779. #define IR_END_31         0xC0              // If sampling counter 31, delcare IR end pattern
  780. #define IR_IGSYN          (1 << 5)          // Ignore IR first synchronization bit
  781. #define IR_ORDI           (1 << 4)          // The decoded IR pulse is bit reversed
  782. #define IR_RC5            (1 << 2)          // IR RC5 format is used
  783. #define IR_INV            (1 << 1)          // IR pulse inverse before decode
  784. #define IR_HW             (1 << 0)          // IR H/W sampling counter
  785. #define BIM_IR_CFGL       0x83              // IR configuration low register
  786. #define BIM_RISCIEN       0x84              // RISC Interrupt enable register
  787. #define IRIEN             (1 << 7)          // IR interrupt enable
  788. #define EEVTIEN           (1 << 6)          // RISC event interrupt enable
  789. #define SIFIE             (1 << 5)          // Serial interface interrupt enable
  790. #define RSIEN             (1 << 4)          // RS232 interrupt enable
  791. #define HZIEN             (1 << 3)          // HTL Zero zero interrupt enable
  792. #define POKIEN            (1 << 2)          // Parser OK interrupt enable
  793. #define SMBIEN            (1 << 1)          // Share Memory B interrupt enable
  794. #define CMDIEN            (1 << 0)          // Command interrupt enable
  795. #define BIM_RISCI         0x85              // RISC Interrupt status register
  796. #define IRI               (1 << 7)          // IR interrupt
  797. #define EEVTI             (1 << 6)          // RISC event interrupt
  798. #define SIFI              (1 << 5)          // Serial interface interrupt
  799. #define RSI               (1 << 4)          // RS232 interrupt
  800. #define HZI               (1 << 3)          // HTL Zero zero interrupt
  801. #define POKI              (1 << 2)          // Parser OK interrupt
  802. #define SMBI              (1 << 1)          // Share Memory B interrupt
  803. #define CMDI              (1 << 0)          // Command interrupt
  804. #define BIM_ASSI          0x86              // Assert RISC Interrupt Register
  805. #define AOSD              (1 << 3)          // Assert OSD to RISC
  806. #define ASTA              (1 << 2)          // Assert Status to RISC
  807. #define ASA               (1 << 1)          // Assert Share Memory A to RISC
  808. #define AIRC              (1 << 0)          // Assert IR Command to RISC
  809. #define BIM_TRB0          0x87              // TASK Register B
  810. #define BIM_TRB1          0x88
  811. #define BIM_TRB2          0x89
  812. #define BIM_TRB3          0x8A
  813. #define BIM_TRB4          0x8B
  814. #define BIM_TRB5          0x8C
  815. #define BIM_TRB6          0x8D
  816. #define BIM_TRB7          0x8E
  817. #define BIM_TRB8          0x8F
  818. #define BIM_TRB9          0x90
  819. #define BIM_TRB10         0x91
  820. #define BIM_TRB11         0x92
  821. #define BIM_TRB12         0x93
  822. #define BIM_TRB13         0x94
  823. #define BIM_TRB14         0x95
  824. #define BIM_TRB15         0x96
  825. #define BIM_TRA0          0x97              // Task Register A
  826. #define BIM_TRA1          0x98
  827. #define BIM_TRA2          0x99
  828. #define BIM_TRA3          0x9A
  829. #define BIM_TRA4          0x9B
  830. #define BIM_TRA5          0x9C
  831. #define BIM_TRA6          0x9D
  832. #define BIM_TRA7          0x9E
  833. #define BIM_TRA8          0x9F
  834. #define BIM_TRA9          0xA0
  835. #define BIM_TRA10         0xA1
  836. #define BIM_TRA11         0xA2
  837. #define BIM_RISCBF        0xA3              // RISC Bus Clock Control Register
  838. #define BF_CLK_MASK       0x1F
  839. #define BF_27M            0x18              // Use 27MHz as bus clock
  840. #define BF_D2             0x00              // RISC clock divided by 2
  841. #define BF_D4             0x01              // RISC clock divided by 4
  842. #define BF_D6             0x02              // RISC clock divided by 6
  843. #define BF_D8             0x03              // RISC clock divided by 8
  844. #define BF_D10            0x04              // RISC clock divided by 10
  845. #define BF_D12            0x05              // RISC clock divided by 12
  846. #define BF_D14            0x06              // RISC clock divided by 14
  847. #define BF_D16            0x07              // RISC clock divided by 16
  848. #define RISCCD4           0x01              // RISC clock divided by 2
  849. #define BIM_CRBSY         0xA4              // Clear Busy Register
  850. #define CRCB              (1 << 0)          // clear command busy
  851. #define CRSMB             (1 << 1)          // clear share memory busy
  852. #define CRIR              (1 << 2)          // clear IR
  853. #define CREVT             (1 << 3)          // clear error event
  854. #define BIM_FLCTL         0xA5              // Flow Control Register
  855. #define PSTART            (1 << 0)          // start transfer
  856. #define BIM_TBLK          0xA6              // Transfer Block Register
  857. #define BIM_TBLKH         0xA6
  858. #define BIM_TBLKL         0xA7
  859. #define BIM_TLBAR         0xA8          // Transfer LBA Register
  860. #define BIM_TLBAH         0xA8
  861. #define BIM_TLBAM         0xA9
  862. #define BIM_TLBAL         0xAA
  863. #define BIM_HTL           0xAB          // Transfer Length Register
  864. #define BIM_HTLH          0xAB
  865. #define BIM_HTLM          0xAC
  866. #define BIM_HTLL          0xAD
  867. #define BIM_WKUP          0xAE          // Wakeup Control Register
  868. #define WKCNT_200US       0x00          // pulse width 200us
  869. #define WKCNT_1600US      0x01          // pulse width 1.6ms
  870. #define WKCNT_13MS        0x02          // pulse width 13ms
  871. #define WKCNT_26MS        0x03          // pulse width 26ms
  872. #define WINTE             (1 << 2)      // Wakeup by Interrupt
  873. #define WIRE              (1 << 3)      // Wakeup by IR
  874. #define WITST             (1 << 6)      // Interrupt Wakeup Status
  875. #define WIRST             (1 << 7)      // IR Wakeup Status
  876. #define BIM_DRVC          0xAF          // Drive Control Register
  877. #define CYDRV             (1 << 6)      // Crystal Pad Driving Strength
  878. #define FDRV_2MA          0x00          // 8032 fast signal driving 2mA
  879. #define FDRV_4MA          0x08          // 8032 fast signal driving 4mA
  880. #define FDRV_6MA          0x10          // 8032 fast signal driving 6mA
  881. #define FDRV_8MA          0x18          // 8032 fast signal driving 8mA
  882. #define FDRV_10MA         0x20          // 8032 fast signal driving 10mA
  883. #define FDRV_12MA         0x28          // 8032 fast signal driving 12mA
  884. #define FDRV_14MA         0x30          // 8032 fast signal driving 14mA
  885. #define FDRV_16MA         0x38          // 8032 fast signal driving 16mA
  886. #define SDRV_2MA          0x00          // 8032 slow signal driving 2mA
  887. #define SDRV_4MA          0x01          // 8032 slow signal driving 4mA
  888. #define SDRV_6MA          0x02          // 8032 slow signal driving 6mA
  889. #define SDRV_8MA          0x03          // 8032 slow signal driving 8mA
  890. #define SDRV_10MA         0x04          // 8032 slow signal driving 10mA
  891. #define SDRV_12MA         0x05          // 8032 slow signal driving 12mA
  892. #define SDRV_14MA         0x06          // 8032 slow signal driving 14mA
  893. #define SDRV_16MA         0x07          // 8032 slow signal driving 16mA
  894. #if defined(MT1389_REV_P) || defined(MT1389_REV_L) || defined(MT1389_REV_K)
  895. #define BIM_CAL           0xB0          // APLL Control 0 Register
  896. #define APLL_PD           (1 << 0)      // APLL Power Down
  897. #define APLL_PM_SEL       (1<<  1)
  898. #define APLL_CALE         (1 << 2)      // APLL calibration enable
  899. #define APLL_BD_MASK      0xF8
  900. #define BIM_APLLC1        0xB1          // APLL Control 1 Register
  901. #define APLL_IACGB        (2<<4)        //IACGB set 2
  902. #define DAC_MUTE_DIV      (3<<6)
  903. #define BIM_APLLC2        0xB2          // APLL Control 2 Register
  904. #define APLL_DAC_RST      (1<<4)
  905. #define APLL_MUTE_RST     (1<<5)
  906. #define APLL_A2K2_RST     (1<<6)
  907. #define APLL_AMAN_RST     (1<<7)
  908. #define APLL_POR_B   (1<<3) //when Calibration set it to be 0
  909. #define APLL_IPDO         (3<<0)
  910. #define BIM_ADAC_LPF_DIV   0xB3          //Internal Audio DAC clock divider
  911. #define BIM_ADAC_MOD_DIV      0xB4          //Internal Audio DAC clock divider
  912. #define BIM_AN_L         0xB5          // APLL Divide-N[0:7]  Register
  913. #else
  914. #define BIM_APLLC1        0xB0          // APLL Control 1 Register
  915. #define APLL_PD           (1 << 0)      // APLL Power Down
  916. #define APLL_BD_MASK      0x3E
  917. #define BIM_APLLC2        0xB1          // APLL Control 2 Register
  918. #define BIM_APLLC3        0xB2          // APLL Control 3 Register
  919. #define APLLC3_SETTING    (0x01)
  920. #define BIM_CAL           0xB3          // APLL Calibration Register
  921. #define APLL_CALT         (1 << 1)      // APLL calibration trigger
  922. #define APLL_CALE         (1 << 0)      // APLL calibration enable
  923. #define BIM_CCNT          0xB4          // Calibration Counter Registers
  924. #define BIM_CCNTH         0xB4
  925. #define BIM_CCNTL         0xB5
  926. #endif
  927. #define BIM_FOFFH         0xB6          // Flash Offset Register
  928. #define BIM_FOFFL         0xB7
  929. #if (defined(MT1389_REV_HD) || defined(MT1389_REV_E) || defined(MT1389_REV_P) || defined(MT1389_REV_L) || defined(MT1389_REV_K))
  930.   #define BIM_PLLS        0xB8
  931. #if (defined(MT1389_REV_L) || defined(MT1389_REV_K))
  932.   #define PS_DMPLL_1         0x00
  933.   #define PS_DMPLL_2         0x01
  934.   // 0x03 reserved
  935.   // 0x04 reserved
  936.   #define PS_VPLL_1           0x04
  937.   #define PS_VPLL_2           0x05
  938.   #define PS_VPLL_3           0x06
  939.   #define PS_VPLL_4           0x07
  940.   #define PS_VPLL_5           0x08
  941.   #define PS_VPLL_6           0x09
  942.   #define PS_VPLL_7           0x0A
  943.   #define PS_VPLL_8           0x0B
  944.     #define DEN_VPLL          (1<<7)
  945.   #define PS_VPLL_9           0x0C
  946.   #define PS_MISC_CTRL        0x18
  947.   #define PS_DPL_DELAY        0x19
  948.   #define PS_DPL_DUTY         0x1A
  949.   #define PS_DRAM_CLK_1       0x1B
  950.   #define PS_DRAM_CLK_2       0x1C
  951.   #define PS_NEW_IO1_EN       0x1D
  952.   #define PS_NEW_IO2_EN       0x1E
  953.   #define PS_NEW_IO1_OUT      0x1F
  954.   #define PS_NEW_IO2_OUT      0x20
  955.   #define PS_NEW_IO1_IN       0x21
  956.   #define PS_NEW_IO2_IN       0x22
  957.   #define PS_8032_CLK         0x23
  958.   #define PS_SM_CLK       0x24
  959.   #define PS_MS_CLK       0x25
  960.   #define PS_SD_CLK       0x26
  961.   #define PS_SFI_CLK          0x29
  962.     #define ACLK_PIN_SEL1    (1 << 0)
  963.     #define ACLK_PIN_SEL2    (1 << 1)
  964.   #define PS_FPD_VDOUT_CLK    0x2C
  965.   #define PS_PIN_CTRL5        0x30
  966.     #define SDATA0_PIN_SEL1  (1<<0)
  967. #define SDATA0_PIN_SEL2  (1<<1)
  968.   #define MP_ADC_INTERFAACE_CONF0  0x31
  969.   #define PS_ANALOG_PIN_CTRL1 0x31
  970.     #define SPDIF_GPIO12_EN    (1<<7)
  971.     #define GPIO3_EN             (1<<6)
  972.     #define LR_GPIO10_EN           (1<<5)
  973.     #define UD_GPIO9_EN            (1<<4)
  974.     #define AKIN1_GPIO_EN    (1<<3)
  975.     #define ADVCM_GPIO_EN    (1<<2)
  976.     #define AKIN2_GPIO_EN    (1<<1)
  977.     #define FG_GPIO2_EN    (1<<0)
  978.   #define PS_ANALOG_PIN_CTRL2 0x32
  979.   #define PS_MMU_CTRL_1       0x35        // New H/W common bank register
  980.   #define PS_MMU_CTRL_2       0x36
  981.   #define PS_MMU_CTRL_3       0x37
  982.   #define PS_ROM_NC_ADDR    0x3C
  983.   #define PS_ROM_C_ADDR     0x3D
  984.   #define PS_ROM_DELAY_SEL  0x3E
  985.   #define PS_ROM_CTRL       0x3F
  986. #elif defined (MT1389_REV_P)
  987.   #define PS_DMPLL_1         0x00
  988.   #define PS_DMPLL_2         0x01
  989.   #define PS_DMPLL_3         0x02
  990.   #define PS_DMPLL_4         0x03
  991.   #define PS_DMPLL_5         0x04
  992.   #define PS_DMPLL_6         0x05
  993. // 0x06 reserved
  994. // 0x07 reserved
  995. // 0x08 reserved
  996. // 0x09 reserved
  997. // 0x0A reserved
  998. // 0x0B reserved
  999. // 0x0C reserved
  1000. // 0x0D reserved
  1001. // 0x0E reserved
  1002. #define PS_VPLL_1           0x0F
  1003. #define PS_VPLL_2           0x10
  1004. #define PS_VPLL_3           0x11
  1005. #define PS_VPLL_4           0x12
  1006. #define PS_VPLL_5           0x13
  1007. #define PS_VPLL_6           0x14
  1008. #define PS_VPLL_7           0x15
  1009. #define PS_VPLL_8           0x16
  1010. // 0x17 reserved
  1011. #define PS_MISC_CTRL        0x18
  1012. #define PS_DPL_DELAY        0x19
  1013. #define PS_DPL_DUTY         0x1A
  1014. #define PS_DRAM_CLK_1       0x1B
  1015. #define PS_DRAM_CLK_2       0x1C
  1016. #define PS_NEW_IO1_EN       0x1D
  1017. #define PS_NEW_IO2_EN       0x1E
  1018. #define PS_NEW_IO1_OUT      0x1F
  1019. #define PS_NEW_IO2_OUT      0x20
  1020. #define PS_NEW_IO1_IN       0x21
  1021. #define PS_NEW_IO2_IN       0x22
  1022. #define PS_8032_CLK         0x23
  1023. //PS_FCI_CLK => SM/MS/SD
  1024. #define PS_SM_CLK          0x24
  1025. #define PS_MS_CLK          0x25
  1026. #define PS_SD_CLK          0x26
  1027. #define PS_TS_DEMUX_CLK     0x27
  1028. #define PS_ATA_CLK          0x28
  1029. #define PS_SFI_CLK          0x29
  1030. #define PS_TVD_CLK          0x2A
  1031. #define PS_VDOIN_CLK        0x2B
  1032. #define PS_FPD_VDOUT_CLK    0x2C
  1033. #define PS_SC_CLK           0x2D
  1034. #define PS_SRV_RF_CTRL1     0x2E
  1035. #define PS_SRV_RF_CTRL2     0x2F
  1036. #define PS_PIN_CTRL5        0x30
  1037. #define PS_ANALOG_PIN_CTRL1 0x31
  1038. #define PS_ANALOG_PIN_CTRL2 0x32
  1039. // 0x33 reserved
  1040.         #define PS_TS_DEMUX_CTRL    0x34
  1041. //below is the definition that I dont know where to place it.
  1042. //#define PS_PLL74_1      0x06
  1043. //#define PS_PLL74_2      0x07
  1044. //#define PS_PLL74_3      0x08
  1045. //#define PS_PLL74_4      0x09
  1046. //#define PS_PLL74_R      0x0A
  1047. //#define PS_PLL74_K1     0x18
  1048. //#define PS_pll74_K2     0x19
  1049.   #else
  1050.     #define PS_DMPLL_1      0x00
  1051.     #define PS_DMPLL_2      0x01
  1052.     #define PS_DMPLL_3      0x02
  1053.     #define PS_DMPLL_4      0x03
  1054.     #define PS_DMPLL_5      0x04
  1055.     #define PS_DMPLL_6      0x05
  1056.     #define PS_PLL74_1      0x06
  1057.     #define PS_PLL74_2      0x07
  1058.     #define PS_PLL74_3      0x08
  1059.     #define PS_PLL74_4      0x09
  1060.     #define PS_PLL74_R      0x0A
  1061.     #define PS_MISC_CTRL    0x0B
  1062.     #define PS_NEW_IO1_EN   0x0C
  1063.     #define PS_NEW_IO2_EN   0x0D
  1064.     #define PS_NEW_IO1_OUT  0x0E
  1065.     #define PS_NEW_IO2_OUT  0x0F
  1066.     #define PS_NEW_IO1_IN   0x10
  1067.     #define PS_NEW_IO2_IN   0x11
  1068.     #define PS_FCI_CLK      0x12
  1069.     #define PS_8032_CLK     0x13
  1070.     #define PS_DPL_DELAY    0x14
  1071.     #define PS_DPL_DUTY     0x15
  1072.     #define PS_DRAM_CLK_1   0x16
  1073.     #define PS_DRAM_CLK_2   0x17
  1074.     #define PS_PLL74_K1     0x18
  1075.     #define PS_pll74_K2     0x19
  1076.   #endif
  1077.   #define BIM_PLLD        0xB9
  1078.     #define PD_1_PD         (0x01 << 7)
  1079.     #define PD_1_RST        (0x01 << 6)
  1080.     #define PD_1_TET_1      (0x01 << 6)
  1081.     #define PD_4_DIV_1      0x00
  1082.     #define PD_4_DIV_2      0x01
  1083.     #define PD_5_K_TRIG     (0x01 << 7)
  1084.     #define PD_5_DMPLL      (0x00 << 5)
  1085.     #define PD_5_DMPLL_2    (0x01 << 5)
  1086.     #define PD_5_DMPLL_4    (0x10 << 5)
  1087.     #define PD_5_DMPLL_8    (0x11 << 5)
  1088.     #define PD_5_K_RDY      (0x01 << 4)
  1089. #else  // MT1389_REV_HD || MT1389_REV_E
  1090.   #define BIM_DMPLLC        0xB8        // DMPLL Control Register
  1091.   #define DMPLL_PD          (1 << 0)    // DMPLL Power Down
  1092.   #define DMPLL_BD          (1 << 1)    // DMPLL band select
  1093.   #define DMPLL_TST         (1 << 2)    // DMPLL test mode
  1094.   #define BIM_DMPLLO        0xB9        // DMPLL Coefficient Register
  1095. #endif  // MT1389_REV_HD || MT1389_REV_E
  1096. #ifdef MT1389_REV_E
  1097.   // BIM_PLLS
  1098.   #undef PS_PLL74_1
  1099.   #undef PS_PLL74_2
  1100.   #undef PS_PLL74_3
  1101.   #undef PS_PLL74_4
  1102.   #undef PS_PLL74_R
  1103.   #undef PS_NEW_IO2_EN
  1104.   #undef PS_NEW_IO2_OUT
  1105.   #undef PS_NEW_IO2_IN
  1106.   #undef PS_FCI_CLK
  1107.   #undef PS_PLL74_K1
  1108.   #undef PS_pll74_K2
  1109.   #define PS_CMN_CODE_CTRL  0x20
  1110.   #define PS_CMN_CODE_SZ    0x21
  1111.   #define PS_BANK1_ADDR_HI  0x22
  1112.   #define PS_BANK1_ADDR_LO  0x23
  1113.   #define PS_BANK2_ADDR_HI  0x24
  1114.   #define PS_BANK2_ADDR_LO  0x25
  1115.   #define PS_BANK3_ADDR_HI  0x26
  1116.   #define PS_BANK3_ADDR_LO  0x27
  1117.   #define PS_BANK4_ADDR_HI  0x28
  1118.   #define PS_BANK4_ADDR_LO  0x29
  1119.   #define PS_BANK5_ADDR_HI  0x2A
  1120.   #define PS_BANK5_ADDR_LO  0x2B
  1121.   #define PS_BANK6_ADDR_HI  0x2C
  1122.   #define PS_BANK6_ADDR_LO  0x2D
  1123.   #define PS_BANK7_ADDR_HI  0x2E
  1124.   #define PS_BANK7_ADDR_LO  0x2F
  1125.   #define PS_TRAP0_ADDR_EN  0x30
  1126.   #define PS_TRAP1_ADDR_EN  0x31
  1127.   #define PS_TRAP2_ADDR_EN  0x32
  1128.   #define PS_TRAP3_ADDR_EN  0x33
  1129.   #define PS_TRAP4_ADDR_EN  0x34
  1130.   #define PS_TRAP5_ADDR_EN  0x35
  1131.   #define PS_TRAP6_ADDR_EN  0x36
  1132.   #define PS_TRAP7_ADDR_EN  0x37
  1133.   #define PS_TRAP8_ADDR_EN  0x38
  1134.   #define PS_TRAP9_ADDR_EN  0x39
  1135.   #define PS_TRAPA_ADDR_EN  0x3A
  1136.   #define PS_TRAPB_ADDR_EN  0x3B
  1137.   #define PS_TRAPC_ADDR_EN  0x3C
  1138.   #define PS_TRAPD_ADDR_EN  0x3D
  1139.   #define PS_TRAPE_ADDR_EN  0x3E
  1140.   #define PS_TRAPF_ADDR_EN  0x3F
  1141.   #define PS_ROM_NC_ADDR    0xF0
  1142.   #define PS_ROM_C_ADDR     0xF1
  1143.   #define PS_ROM_DELAY_SEL  0xF2
  1144.   #define PS_ROM_CTRL       0xF3
  1145.   // BIM_PLLD
  1146. #endif  // MT1389_REV_E
  1147. #ifdef MT1389_REV_L   // AceBest_Lin 89LRomCode
  1148.   #define PS_CMN_CODE_CTRL  0x20
  1149.   #define PS_CMN_CODE_SZ    0x21
  1150.   #define PS_BANK1_ADDR_HI  0x22
  1151.   #define PS_BANK1_ADDR_LO  0x23
  1152.   #define PS_BANK2_ADDR_HI  0x24
  1153.   #define PS_BANK2_ADDR_LO  0x25
  1154.   #define PS_BANK3_ADDR_HI  0x26
  1155.   #define PS_BANK3_ADDR_LO  0x27
  1156.   #define PS_BANK4_ADDR_HI  0x28
  1157.   #define PS_BANK4_ADDR_LO  0x29
  1158.   #define PS_BANK5_ADDR_HI  0x2A
  1159.   #define PS_BANK5_ADDR_LO  0x2B
  1160.   #define PS_BANK6_ADDR_HI  0x2C
  1161.   #define PS_BANK6_ADDR_LO  0x2D
  1162.   #define PS_BANK7_ADDR_HI  0x2E
  1163.   #define PS_BANK7_ADDR_LO  0x2F
  1164.   #define PS_TRAP0_ADDR_EN  0x40
  1165.   #define PS_TRAP1_ADDR_EN  0x41
  1166.   #define PS_TRAP2_ADDR_EN  0x42
  1167.   #define PS_TRAP3_ADDR_EN  0x43
  1168.   #define PS_TRAP4_ADDR_EN  0x44
  1169.   #define PS_TRAP5_ADDR_EN  0x45
  1170.   #define PS_TRAP6_ADDR_EN  0x46
  1171.   #define PS_TRAP7_ADDR_EN  0x47
  1172.   #define PS_TRAP0_ADDR_LO  0x48   //  8 : 1
  1173.   #define PS_TRAP0_ADDR_MI  0x49   // 16 : 9
  1174.   #define PS_TRAP0_ADDR_HI  0x4A   // 24 :17
  1175.   #define PS_TRAP1_ADDR_LO  0x50
  1176.   #define PS_TRAP1_ADDR_MI  0x51
  1177.   #define PS_TRAP1_ADDR_HI  0x52
  1178.   #define PS_TRAP2_ADDR_LO  0x53
  1179.   #define PS_TRAP2_ADDR_MI  0x54
  1180.   #define PS_TRAP2_ADDR_HI  0x55
  1181.   #define PS_TRAP3_ADDR_LO  0x56
  1182.   #define PS_TRAP3_ADDR_MI  0x57
  1183.   #define PS_TRAP3_ADDR_HI  0x58
  1184.   #define PS_PATCH0_ADDR_LO   0x60
  1185.   #define PS_PATCH0_ADDR_MID  0x61
  1186.   #define PS_PATCH0_ADDR_HI   0x62
  1187.   #define PS_PATCH1_ADDR_LO   0x63
  1188.   #define PS_PATCH1_ADDR_MID  0x64
  1189.   #define PS_PATCH1_ADDR_HI   0x65
  1190.   #define PS_PATCH2_ADDR_LO   0x66
  1191.   #define PS_PATCH2_ADDR_MID  0x67
  1192.   #define PS_PATCH2_ADDR_HI   0x68
  1193.   #define PS_PATCH3_ADDR_LO   0x69
  1194.   #define PS_PATCH3_ADDR_MID  0x6a
  1195.   #define PS_PATCH3_ADDR_HI   0x6b
  1196. #endif  // MT1389_REV_L
  1197. #if defined(MT1389_REV_P) || defined(MT1389_REV_L) || defined(MT1389_REV_K)
  1198. #define BIM_AN_H              0xBA          // APLL Divide-N[8:15]  Register
  1199. #define BIM_AML               0xBB          // APLL Divide-M Register
  1200. #define BIM_AMH               0xBC
  1201. #define BIM_AK                0xBD          //APLL Divider AK
  1202. #define BIM_APLL_CAL_CNTH     0xBE          ////APLL calibration[8:11]
  1203. #else
  1204. #define BIM_AMH           0xBA          // APLL Divide-M Register
  1205. #define BIM_AML           0xBB
  1206. #define BIM_AN1           0xBC          // APLL Divide-N1 Register
  1207. #define AN1_D8            0x00          // Divide 8
  1208. #define AN1_D9            0x01          // Divide 9
  1209. #define AN1_D10           0x02          // Divide 10
  1210. #define AN1_D11           0x03          // Divide 11
  1211. #define AN1_D12           0x04          // Divide 12
  1212. #define BIM_AN2H          0xBD          // APLL Divide-N2 Register
  1213. #define BIM_AN2L          0xBE
  1214. #endif
  1215. #if defined(MT1389_REV_E) || defined(MT1389_REV_HD) || defined(MT1389_REV_P)|| defined(MT1389_REV_L) || defined(MT1389_REV_K)
  1216. #define CLK_NO_APPLY 0x0 // Which means won't work if you set here. by Alfonso.
  1217. #define BIM_RCLKC         0xBF          // RISC Clock Control Register
  1218. #if defined(MT1389_REV_L) || defined(MT1389_REV_K)
  1219. #define RC_27M            0x00          // 27MHz
  1220. #define RC_DPLD2_0D       0x01          // DMPLL clock divided by 2 with 0 degree phrase
  1221. #define RC_DLL_108M       0x02          // DLL 108M
  1222. #define RC_DPLD2          0x05          // DMPLL clock divided by 2
  1223. #define RC_DPLD3          0x06          // DMPLL clock divided by 3
  1224. #define RC_DPLD4          0x07          // DMPLL clock divided by 4
  1225. #define RC_CLK_MASK       0x07
  1226. #define RCLK_PD           (1 << 7)      // RISC Clock Power Down
  1227. #else
  1228. #define RC_27M            0x00          // 27MHz
  1229. #define RC_APLD2          0x01          // APLL clock divided by 2
  1230. #define RC_DPLD2_0D       0x02          // DMPLL clock divided by 2 with 0 degree phrase
  1231. #ifdef MT1389_REV_P
  1232. #define RC_162M   0x03          // 324M divided by 2
  1233. #define RC_130M        0x04          // 324M divided by 2.5
  1234. #else  /*! MT1389_REV_P*/
  1235. #define RC_DPLD2_90D      0x03          // DMPLL clock divided by 2 with 90 degree phrase
  1236. #define RC_DPLD2_270D     0x04          // DMPLL clock divided by 2 with 270 degree phrase
  1237. #endif
  1238. #define RC_DPLD2          0x05          // DMPLL clock divided by 2
  1239. #define RC_DPLD3          0x06          // DMPLL clock divided by 3
  1240. #define RC_DPLD4          0x07          // DMPLL clock divided by 4
  1241. #define RC_CLK_MASK       0x07
  1242. #define RCLK_PD           (1 << 7)      // RISC Clock Power Down
  1243. #endif
  1244. #define BIM_ACLKC         0xC0          // Audio DSP Clock Control Register
  1245. #if defined(MT1389_REV_L) || defined(MT1389_REV_K)
  1246. #define AC_27M            0x00          // 27MHz
  1247. #define AC_APLD2          0x01          // APLL clock divided by 2
  1248. #define AC_DPLD2_0D       0x02          // DMPLL clock divided by 2 with 0 degree phrase
  1249. #define AC_DPLD2          0x05          // DMPLL clock divided by 2
  1250. #define AC_DPLD3          0x06          // DMPLL clock divided by 3
  1251. #define AC_DPLD4          0x07          // DMPLL clock divided by 4
  1252. #define AC_CLK_MASK       0x07
  1253. #define ACLK_PD           (1 << 7)      // Audio DSP Clock Power Down
  1254. #else
  1255. #define AC_27M            0x00          // 27MHz
  1256. #define AC_APLD2          0x01          // APLL clock divided by 2
  1257. #define AC_DPLD2_0D       0x02          // DMPLL clock divided by 2 with 0 degree phrase
  1258. #ifdef MT1389_REV_P
  1259. #define RC_162M   0x03          // 324M divided by 2
  1260. #define RC_130M        0x04          // 324M divided by 2.5
  1261. #else  /*! MT1389_REV_P*/
  1262. #define AC_DPLD2_90D      0x03          // DMPLL clock divided by 2 with 90 degree phrase
  1263. #define AC_DPLD2_270D     0x04          // DMPLL clock divided by 2 with 270 degree phrase
  1264. #endif
  1265. #define AC_DPLD2          0x05          // DMPLL clock divided by 2
  1266. #define AC_DPLD3          0x06          // DMPLL clock divided by 3
  1267. #define AC_DPLD4          0x07          // DMPLL clock divided by 4
  1268. #define AC_CLK_MASK       0x07
  1269. #define ACLK_PD           (1 << 7)      // Audio DSP Clock Power Down
  1270. #endif
  1271. #define BIM_PCLKC         0xC1          // uP Clock Control Register
  1272. #if defined(MT1389_REV_L) || defined(MT1389_REV_K)
  1273. #define PC_7M             0x00          // 27M/4 clock
  1274. #define PC_13M            0x01          // 27M/2 clock
  1275. #define PC_27M            0x02          // 27M clock
  1276. #define PC_DLL_108M2      0x03          // DLL 108M/2
  1277. #define PC_DPLD8          0x04          // DMPLL /8
  1278. #define PC_DPL_CNTR       0x05          // DMPLL divided by the value of 8032 Counter (0xF8B8=0x23)
  1279. #define PC_SDCD5          0x06          // Source decode clock divided 5
  1280. #define PC_SDCD6          0x07          // Source decode clock divided 6
  1281. #else
  1282. #define PC_7M             0x00          // 27M/4 clock
  1283. #define PC_13M            0x01          // 27M/2 clock
  1284. #define PC_27M            0x02          // 27M clock
  1285. #define PC_LOCAL_OSC      0x03
  1286. #define PC_DPLD16         0x04
  1287. #define PC_DPL_CNTR       0x05          // MT1389HD
  1288. #define PC_SDCD5          0x06
  1289. #define PC_SDCD6          0x07
  1290. #endif
  1291. // The value apply on 0xF8C2[2:0] won't work for DRAM setting.
  1292. #define BIM_DCLKC         0xC2          // DRAM Clock Control Register
  1293. #define DC_27M            0x00          // 27MHz
  1294. #define DC_DLL_108M       0x01          // DLL 108M
  1295. #define DC_DPLD2_0D       0x02          // DMPLL clock divided by 2 with 0 degree phrase
  1296. #define DC_DPLD2_90D      0x03          // DMPLL clock divided by 2 with 90 degree phrase
  1297. #define DC_DPLD2_270D     0x04          // DMPLL clock divided by 2 with 270 degree phrase
  1298. #define DC_DPLD2          0x05          // DMPLL clock divided by 2
  1299. #define DC_DPLD3          0x06          // DMPLL clock divided by 3
  1300. #define DC_DPLD4          0x07          // DMPLL clock divided by 4
  1301. #define DC_CLK_MASK       0x07
  1302. #define DCLK_SB           (1 << 6)      // DRAM clock standby
  1303. #define DCLK_PD           (1 << 7)      // DRAM clock Power Down
  1304. #if defined(MT1389_REV_L) || defined(MT1389_REV_K)
  1305. #else
  1306. #define DC_27M            0x00          // 27MHz
  1307. #define DC_APLD2          0x01          // APLL clock divided by 2
  1308. #define DC_DPLD2_0D       0x02          // DMPLL clock divided by 2 with 0 degree phrase
  1309. #define DC_DPLD2_90D      0x03          // DMPLL clock divided by 2 with 90 degree phrase
  1310. #define DC_DPLD2_270D     0x04          // DMPLL clock divided by 2 with 270 degree phrase
  1311. #define DC_DPLD2          0x05          // DMPLL clock divided by 2
  1312. #define DC_DPLD3          0x06          // DMPLL clock divided by 3
  1313. #define DC_DPLD4          0x07          // DMPLL clock divided by 4
  1314. #define DC_CLK_MASK       0x07
  1315. #define DCLK_SB           (1 << 6)      // DRAM clock standby
  1316. #define DCLK_PD           (1 << 7)      // DRAM clock Power Down
  1317. #endif
  1318. #define BIM_SDCLKC        0xC3          // Source Decode Clock Control Register
  1319. #if defined(MT1389_REV_L) || defined(MT1389_REV_K)
  1320. #define SDC_27M           0x00          // 27MHz
  1321. #define SDC_DLL_108M      0x04          // DLL 108M
  1322. #define SDC_DPLD2         0x05          // DMPLL clock divided by 2
  1323. #define SDC_DPLD3         0x06          // DMPLL clock divided by 3
  1324. #define SDC_DPLD4         0x07          // DMPLL clock divided by 4
  1325. #define SDC_CLK_MASK      0x07
  1326. #define SDCLK_PD          (1 << 7)      // Source Decode Clock Power Down
  1327. #else
  1328. #define SDC_27M           0x00          // 27MHz
  1329. #ifdef MT1389_REV_P
  1330. #define SDC_APLD2         0x01          // APLL clock divided by 2
  1331. #define SDC_162M          0x02          // 324M divided by 2
  1332. #define SDC_108M          0x03          // 324M divided by 3
  1333. #define SDC_81M           0x04          // 324M divided by 4
  1334. #endif /* MT1389_REV_P */
  1335. #define SDC_DPLD2         0x05          // DMPLL clock divided by 2
  1336. #define SDC_DPLD3         0x06          // DMPLL clock divided by 3
  1337. #define SDC_DPLD4         0x07          // DMPLL clock divided by 4
  1338. #define SDC_CLK_MASK      0x07
  1339. #define SDCLK_PD          (1 << 7)      // Source Decode Clock Power Down
  1340. #endif
  1341. #define BIM_CDCLKC        0xC4          // Channel Decode Clock Control Register
  1342. #define CDC_SDCD2         0x00          // Source decode clock divided by 2
  1343. #define CDC_SDCD4         0x01          // Source decode clock divided by 4
  1344. #define CDC_27M           0x02          // 27M
  1345. #define CDC_27MD2         0x03          // 27M clock divided by 2
  1346. #define CDC_27MD4         0x04          // 27M clock divided by 4
  1347. #define CDC_CLK_MASK      0x07
  1348. #define CDCLK_PD          (1 << 7)      // Channel Decode Clock Power Down
  1349. #define BIM_SCLKC         0xC5          // Servo DSP Clock Control Register
  1350. #define SC_27M            0x00          // 27M clock
  1351. #if 0
  1352. #define SC_APLD2          0x01          // APLL clock divided by 2
  1353. #define SC_APLD3          0x02          // APLL clock divided by 3
  1354. #define SC_APLD4          0x03          // APLL clock divided by 4
  1355. #define SC_APLD5          0x04          // APLL clock divided by 5
  1356. #endif /* if 0 */
  1357. #define SC_DPLD2          0x05          // DMPLL clock divided by 2
  1358. #define SC_DPLD3          0x06          // DMPLL clock divided by 3
  1359. #define SC_DPLD4          0x07          // DMPLL clock divided by 4
  1360. #define SCLK_PD           (1 << 7)      // Servo DSP Clock Power Down
  1361. #else /*!defined(MT1389_REV_E) && !defined(MT1389_REV_HD)*/
  1362. #define BIM_RCLKC         0xBF          // RISC Clock Control Register
  1363. #define RC_27M            0x00          // 27MHz
  1364. #define RC_APLD2          0x01          // APLL clock divided by 2
  1365. #define RC_DPL2D2         0x02          // APLL clock divided by 3
  1366. #define RC_DPL2D3         0x03          // APLL clock divided by 4
  1367. #define RC_DPL2D4         0x04          // APLL clock divided by 5
  1368. #define RC_DPLD2          0x05          // DMPLL clock divided by 2
  1369. #define RC_DPLD3          0x06          // DMPLL clock divided by 3
  1370. #define RC_DPLD4          0x07          // DMPLL clock divided by 4
  1371. #define RC_CLK_MASK       0x07
  1372. #define RCLK_PD           (1 << 7)      // RISC Clock Power Down
  1373. #define BIM_ACLKC         0xC0          // Audio DSP Clock Control Register
  1374. #define AC_27M            0x00          // 27MHz
  1375. #define AC_APLD2          0x01          // APLL clock divided by 2
  1376. #define AC_DPL2D2         0x02          // APLL clock divided by 3
  1377. #define AC_DPL2D3         0x03          // APLL clock divided by 4
  1378. #define AC_DPL2D4         0x04          // APLL clock divided by 5
  1379. #define AC_DPLD2          0x05          // DMPLL clock divided by 2
  1380. #define AC_DPLD3          0x06          // DMPLL clock divided by 3
  1381. #define AC_DPLD4          0x07          // DMPLL clock divided by 4
  1382. #define AC_CLK_MASK       0x07
  1383. #define ACLK_PD           (1 << 7)      // Audio DSP Clock Power Down
  1384. #define BIM_PCLKC         0xC1          // uP Clock Control Register
  1385. #define PC_7M             0x00          // 27M/4 clock
  1386. #define PC_13M            0x01          // 27M/2 clock
  1387. #define PC_27M            0x02          // 27M clock
  1388. #define PC_LOCAL_OSC      0x03
  1389. #define PC_DPLD16         0x04
  1390. #define PC_DPL2D16        0x05
  1391. #define PC_DPL_CNTR       0x05          // MT1389HD
  1392. #define PC_SDCD5          0x06
  1393. #define PC_SDCD6          0x07
  1394. #define BIM_DCLKC         0xC2          // DRAM Clock Control Register
  1395. #define DC_27M            0x00          // 27MHz
  1396. #define DC_APLD2          0x01          // APLL clock divided by 2
  1397. #define DC_DPL2D2         0x02          // APLL clock divided by 3
  1398. #define DC_DPL2D3         0x03          // APLL clock divided by 4
  1399. #define DC_DPL2D4         0x04          // APLL clock divided by 5
  1400. #define DC_DPLD2          0x05          // DMPLL clock divided by 2
  1401. #define DC_DPLD3          0x06          // DMPLL clock divided by 3
  1402. #define DC_DPLD4          0x07          // DMPLL clock divided by 4
  1403. #define DC_CLK_MASK       0x07
  1404. #define DCLK_SB           (1 << 6)      // DRAM clock standby
  1405. #define DCLK_PD           (1 << 7)      // DRAM clock Power Down
  1406. #define BIM_SDCLKC        0xC3          // Source Decode Clock Control Register
  1407. #define SDC_27M           0x00          // 27MHz
  1408. #define SDC_DPL2D2        0x01          // APLL clock divided by 3
  1409. #define SDC_DPL2D3        0x02          // APLL clock divided by 4
  1410. #define SDC_DPL2D4        0x03          // APLL clock divided by 5
  1411. #define SDC_DPL2D5        0x04          // APLL clock divided by 6
  1412. #define SDC_DPLD2         0x05          // DMPLL clock divided by 2
  1413. #define SDC_DPLD3         0x06          // DMPLL clock divided by 3
  1414. #define SDC_DPLD4         0x07          // DMPLL clock divided by 4
  1415. #define SDC_CLK_MASK      0x07
  1416. #define SDCLK_PD          (1 << 7)      // Source Decode Clock Power Down
  1417. #define BIM_CDCLKC        0xC4          // Channel Decode Clock Control Register
  1418. #define CDC_SDCD2         0x00          // Source decode clock divided by 2
  1419. #define CDC_SDCD4         0x01          // Source decode clock divided by 4
  1420. #define CDC_27M           0x02          // 27M
  1421. #define CDC_27MD2         0x03          // 27M clock divided by 2
  1422. #define CDC_27MD4         0x04          // 27M clock divided by 4
  1423. #define CDC_CLK_MASK      0x07
  1424. #define CDCLK_PD          (1 << 7)      // Channel Decode Clock Power Down
  1425. #define BIM_SCLKC         0xC5          // Servo DSP Clock Control Register
  1426. #define SC_27M            0x00          // 27M clock
  1427. #define SC_APLD2          0x01          // APLL clock divided by 2
  1428. #define SC_APLD3          0x02          // APLL clock divided by 3
  1429. #define SC_APLD4          0x03          // APLL clock divided by 4
  1430. #define SC_APLD5          0x04          // APLL clock divided by 5
  1431. #define SC_DPLD2          0x05          // DMPLL clock divided by 2
  1432. #define SC_DPLD3          0x06          // DMPLL clock divided by 3
  1433. #define SC_DPLD4          0x07          // DMPLL clock divided by 4
  1434. #define SCLK_PD           (1 << 7)      // Servo DSP Clock Power Down
  1435. #endif /* defined(MT1389_REV_E) || defined(MT1389_REV_HD) */
  1436. #define BIM_AOCLKC        0xC6          // Audio out Clock Control Register
  1437. #define AOC_APL27M        0x00
  1438. #define AOC_APLN1         0x01          // APLL-N1 clock
  1439. #define AOC_APLN1D2       0x02          // APLL-N1 clock divided by 2
  1440. #define AOC_APLN1D3       0x03          // APLL-N1 clock divided by 3
  1441. #define AOC_APLN1D4       0x04          // APLL-N1 clock divided by 4
  1442. #define AOC_APLN1D6       0x05          // APLL-N1 clock divided by 6
  1443. #define AOC_APLD4         0x06          // APLL clock divided by 4
  1444. #define AOC_APLD5         0x07          // APLL clock divided by 5
  1445. #define AOC_NORMAL        0x00          // Normal mode
  1446. #define AOC_1D2           0x08          // divided by 2 mode
  1447. #define AOC_1D4           0x10          // divided by 4 mode
  1448. #define AOC_1D3           0x18          // divided by 3 mode
  1449. #define AOC_2D3_66        0x20          // divided by 2/3 mode (duty cycle 66%)
  1450. #define AOC_2D3_33        0x21          // divided by 2/3 mode (duty cycle 33%)
  1451. #define AOCLK_PD          (1 << 7)      // Audio out Clock Power Down
  1452. /*
  1453. #define BIM_PL33C         0xC7          // PL33 Clock Control Register
  1454. #define P3C_27M           0x00          // 27MHz
  1455. #define P3C_APLD11        0x06          // APLL clock divided by 11
  1456. #define P3C_APLD10        0x05          // APLL clock divided by 10
  1457. #define P3C_APLD9         0x04          // APLL clock divided by 9
  1458. #define P3C_APLD8         0x03          // APLL clock divided by 8
  1459. #define P3C_APLD7         0x02          // APLL clock divided by 7
  1460. #define P3C_APLN1         0x01          // APLL N1 clock
  1461. #define PL33_PD           (1 << 7)      // PL33 Clock Power Down
  1462. */
  1463. #define BIM_DMPLL2        0xC7          // DMPLL2 Coefficient Register, non valid in 89E/HD
  1464. #define BIM_XCKC          0xC8          // XCK Clock Control Register
  1465. #define X4S_27M           0x80          // RF interface clock 27M
  1466. #define X4S_PL33          0x40          // RF interface clock PLL33
  1467. #define XCKC_SETTING      (X4S_27M)
  1468. #define BIM_FOFFS         0xC9          // Flash offset select register
  1469. #define BIM_DSTS          0xCA          // Channel Decode Status Register
  1470. #define CDRB              (1 << 3)      // 1:CD data buffering BUSY
  1471. #define CDDB              (1 << 2)      // 1:CD decoding BUSY
  1472. #define DVDRB             (1 << 1)      // 1:DVD data buffering BUSY
  1473. #define DVDDB             (1 << 0)      // 1:DVD decoding BUSY
  1474. #define BIM_OPD1H         0xCB          // Operand 1 High Register
  1475. #define BIM_OPD1M         0xCC          // Operand 1 Middle Register
  1476. #define BIM_OPD1L         0xCD          // Operand 1 Low Register
  1477. #define BIM_OPD2H         0xCE          // Operand 2 High Register
  1478. #define BIM_OPD2M         0xCF          // Operand 2 Middle Register
  1479. #define BIM_OPD2L         0xD0          // Operand 2 Low Register
  1480. #define BIM_OPR           0xD1          // Operation Register
  1481. #define OPR_MUL           0x01          // 1: Multiplication
  1482. #define OPR_DIV           0x02          // 1: Division
  1483. #define OPR_ADD           0x03          // Addition
  1484. #define OPR_SUB           0x04          // Subtraction
  1485. #define OPR_SQRT          0x05          // Square Root Extraction
  1486. #define OPR_NEG           0x06          // Negation
  1487. #define OPR_ZONE          0x07          // Zoning
  1488. #define OPR_CST_1         0x10          // Constant 1
  1489. #define OPR_CST_7         0x20          // Constant 7
  1490. #define OPR_CST_16        0x30          // Constant 16
  1491. #define OPR_CST_60        0x40          // Constant 60
  1492. #define OPR_CST_75        0x50          // Constant 75
  1493. #define OPR_CST_100       0x60          // Constant 100
  1494. #define OPR_CST_150       0x70          // Constant 150
  1495. #define OPR_CST_TRKPZ     0x80          // Constant Tracks/Zone
  1496. #define OPR_CST_30000     0x90          // Constant 0x30000
  1497. #define OPR_CST_31000     0xA0          // Constant 0x31000
  1498. #define BIM_CERR          0xD2
  1499. #define BIM_TEST          0xD3
  1500. #define BIM_CKOUT         0xD4
  1501. #define BIM_RDMA          0xD5          // ROM DMA control register
  1502. #define WOOF              (1 << 1)      // without flash offset address
  1503. #define RDMA_ST           (1 << 0)      // DMA trigger/status
  1504. //#define BIM_EARRH         0xD6
  1505. //#define BIM_EARRM         0xD7
  1506. //#define BIM_EARRL         0xD8
  1507. #define BIM_CHSUMH        0xD6
  1508. #define BIM_CHSUML        0xD7
  1509. #define BIM_DM2C          0xD8
  1510. #define BIM_PCTL3         0xD9          // Pin control register 3
  1511. #define MCOFF             (1 << 7)      // Microphone in is used as I/O pin
  1512. #define SOFF4             (1 << 6)      // Sdata4 is used as I/O pin
  1513. #define SOFF3             (1 << 5)      // Sdata3 is used as I/O pin
  1514. #define SOFF2             (1 << 4)      // Sdata2 is used as I/O pin
  1515. #define SOFF1             (1 << 3)      // Sdata1 is used as I/O pin
  1516. #define SOFF0             (1 << 2)      // Sdata0 is output with 0
  1517. #define AUCLKOFF          (1 << 1)      // Audio clock pins' GPIO control
  1518. #define BIM_IRTHD         0xDA          // IR threshold register
  1519. #define BIM_PCTL4         0xDB          // Pin control register 4
  1520. #define LINE_IN_SPDATA    0x00          // Audio line-in from SPDATA
  1521. #define LINE_IN_IOA20     0x01          // Audio line-in from IOA20
  1522. #define LINE_IN_YUV7      0x02          // Audio line-in from YUV7
  1523. #define LINE_IN_HSYN      0x03          // Audio line-in from HSYN
  1524. #define LINE_IN_VSYN      0x04          // Audio line-in from VSYN
  1525. #define LINE_IN_BLANK     0x05          // Audio line-in from BLANK
  1526. #define LINE_IN_ASDATA4   0x06          // Audio line-in from ASDATA4
  1527. #define LINE_IN_ASDATA3   0x07          // Audio line-in from ASDATA3
  1528. #define BIM_VCK4M         0xDC
  1529. #define BIM_BIST          0xDD
  1530. #define BIM_BISTS         0xDE
  1531. #define BIM_BISTEN        0xDF
  1532. #define BIM_GPR0          0xE0          // General Purpose Registers 0
  1533. #define BIM_GPR1          0xE1          // General Purpose Registers 1
  1534. #define BIM_GPR2          0xE2          // General Purpose Registers 2
  1535. #define BIM_GPR3          0xE3          // General Purpose Registers 3
  1536. #define BIM_GPR4          0xE4          // General Purpose Registers 4
  1537. #define BIM_GPR5          0xE5          // General Purpose Registers 5
  1538. #define BIM_GPR6          0xE6          // General Purpose Registers 6
  1539. #define BIM_GPR7          0xE7          // General Purpose Registers 7
  1540. #define BIM_GPR8          0xE8          // General Purpose Registers 8
  1541. #define BIM_GPR9          0xE9          // General Purpose Registers 9
  1542. #define BIM_GPRA          0xEA          // General Purpose Registers A
  1543. #define BIM_GPRB          0xEB          // General Purpose Registers B
  1544. #define BIM_GPRC          0xEC          // General Purpose Registers C
  1545. #define BIM_GPRD          0xED          // General Purpose Registers D
  1546. #define BIM_GPRE          0xEE          // General Purpose Registers E
  1547. #define BIM_GPRF          0xEF          // General Purpose Registers F
  1548. #define BIM_RIODRH        0xF0          // RAM GPIO direction registers
  1549. #define BIM_RIODRM        0xF1          // RAM GPIO direction registers
  1550. #define BIM_RIODRL        0xF2          // RAM GPIO direction registers
  1551. #define BIM_RIODOH        0xF3          // RAM GPIO data out registers
  1552. #define BIM_RIODOM        0xF4          // RAM GPIO data out registers
  1553. #define BIM_RIODOL        0xF5          // RAM GPIO data out registers
  1554. #define BIM_RIODIH        0xF6          // RAM GPIO data in registers
  1555. #define BIM_RIODIM        0xF7          // RAM GPIO data in registers
  1556. #define BIM_RIODIL        0xF8          // RAM GPIO data in registers
  1557. #define IOH_UP12            (1 << 7)  //up12
  1558. #define IOH_MC            (1 << 6)
  1559. #define IOH_SDATA4        (1 << 5)
  1560. #define IOH_SDATA3        (1 << 4)
  1561. #define IOH_SDATA2        (1 << 3)
  1562. #define IOH_SDATA1        (1 << 2)
  1563. #define IOH_DQM3          (1 << 1)
  1564. #define IOH_DQM2          (1 << 0)
  1565. #define IOM_RD31          (1 << 7)
  1566. #define IOM_RD30          (1 << 6)
  1567. #define IOM_RD29          (1 << 5)
  1568. #define IOM_RD28          (1 << 4)
  1569. #define IOM_RD27          (1 << 3)
  1570. #define IOM_RD26          (1 << 2)
  1571. #define IOM_RD25          (1 << 1)
  1572. #define IOM_RD24          (1 << 0)
  1573. #define IOL_RD23          (1 << 7)
  1574. #define IOL_RD22          (1 << 6)
  1575. #define IOL_RD21          (1 << 5)
  1576. #define IOL_RD20          (1 << 4)
  1577. #define IOL_RD19          (1 << 3)
  1578. #define IOL_RD18          (1 << 2)
  1579. #define IOL_RD17          (1 << 1)
  1580. #define IOL_RD16          (1 << 0)
  1581. // MT1389_REV_D only
  1582. #define IOL_FG            (1 << 6)
  1583. #define IOL_AR            (1 << 5)
  1584. #define IOL_AL            (1 << 4)
  1585. #define IOL_ASDATA0       (1 << 3)
  1586. #define IOL_ALRCK         (1 << 2)
  1587. #define IOL_ABCK          (1 << 1)
  1588. #define IOL_ACLK          (1 << 0)
  1589. #define IOL_BCK           (1 << 1)
  1590. #define IOL_CLK           (1 << 0)
  1591. #define BIM_SFIS          0xFD
  1592. #define BIM_SFID          0xFE
  1593. //////////////////////////////////////////////////////
  1594. // Audio registers definition
  1595. #define AUD_RSDATA        0x00          // RS-232 data register
  1596. #define AUD_RSSTA         0x01          // RS-232 status register
  1597. #define WALLOW            (1 << 1)      // Write data buiffer empty
  1598. #define RALLOW            (1 << 0)      // Read data available
  1599. #if defined(MT1389_REV_P) || defined(MT1389_REV_L) || defined(MT1389_REV_K)
  1600. #define AUD_ADACDITH0     0x20 //for 89P
  1601. #define NO_MUTE_PIN   (0<<5)
  1602. #define GPIO10_MUTE   (1<<5)
  1603. #define IOALE_MUTE   (2<<5)
  1604. #define RD_MUTE     (3<<5)
  1605.   #if defined(MT1389_REV_L ) || defined(MT1389_REV_K)
  1606. #define AKIN2_MUTE        (1<<6)
  1607. #define AKIN1_MUTE        (1<<5)
  1608.   #endif
  1609. //#else
  1610. #define AUD_ADSPSEL       0x20          // DSP Selected for Servo Control
  1611. #define M2DRS             (1 << 1)
  1612. #define ADSP_SEL          (1 << 0)
  1613. #else
  1614. #define AUD_ADSPSEL       0x20          // DSP Selected for Servo Control
  1615. #define M2DRS             (1 << 1)
  1616. #define ADSP_SEL          (1 << 0)
  1617. #endif
  1618. #define AUD_AOUTCFG       0x22          // Audio Output Configuration
  1619. #define INV_LRCK          (1 << 7)      // Invert LRCK
  1620. #define INV_BCK           (1 << 6)      // Invert bit clock
  1621. #define AOFMT_RJ          (0 << 4)      // Right aligned with LRCK
  1622. #define AOFMT_LJ          (2 << 4)      // Left aligned with LRCK
  1623. #define AOFMT_I2S         (3 << 4)      // I2S interface
  1624. #define LRCK_CYC16        (0 << 0)      // 16 cycles
  1625. #define LRCK_CYC24        (1 << 0)      // 24 cycles
  1626. #define LRCK_CYC32        (2 << 0)      // 32 cycles
  1627. #define DSD_MASK          (1 << 3)      // bit3 for DSD output
  1628. #define AUD_ADACCFG       0x23          // Audio DAC Configuration
  1629. #define INV_SD            (1 << 6)      // Invert the Sdata output
  1630. #define DAC_BNUM_MASK     0x3F          // Audio DAC bit number
  1631. #define DAC_16BIT         0x10          // Audio DAC 16-Bit
  1632. #define DAC_18BIT         0x12          // Audio DAC 18-Bit
  1633. #define DAC_20BIT         0x14          // Audio DAC 20-Bit
  1634. #define DAC_24BIT         0x18          // Audio DAC 24-Bit
  1635. #define AUD_ACLKCFG       0x24          // Audio Clock Configuration
  1636. #define ACK_128FS         (1 << 5)      // ACK is 128 times of audio frequency
  1637. #define ACK_256FS         (2 << 5)      // ACK is 256 times of audio frequency
  1638. #define ACK_384FS         (3 << 5)      // ACK is 384 times of audio frequency
  1639. #define ACK_512FS         (4 << 5)      // ACK is 384 times of audio frequency
  1640. #define ACK_EXSEL         (1 << 4)      // External ACK select
  1641. #define A2BCKX_MASK       0x0F          // Times of ACK/2 to BCK
  1642. #define AUD_IECCFG        0x25          // IEC958 Configuration
  1643. #define IEC_CUR_4         (1 << 5)      // IEC958 driving current 4mA
  1644. #define IEC_SSLEW         (1 << 4)      // IEC958 output slow slew rate
  1645. #define IEC_CH78          (1 << 2)      // Use this pin as channel 7/8
  1646. #define IEC_B21           (1 << 1)      // IEC channel status bit 21
  1647. #define IEC_B20           (1 << 0)      // IEC channel status bit 20
  1648. #define AUD_BSCFG         0x26          // Bit Stream Configuration
  1649. #define IEC_SWP           (1 << 1)      // Swap IEC raw data output high & low bytes
  1650. #define BS_SWP            (1 << 0)      // Swap bitstream high & low bytes
  1651. #define AUD_MPINCFG       0x28          // Micro Phone ADC Interface Configuration
  1652. #define MP_DATDLY         (1 << 6)      // Microphone serial data start cycle delay
  1653. #define MP_LALN           (1 << 5)      // Microphone serial data is left aligned to LRCK
  1654. #define MP_BNUM_MASK      0x1F          // (numbers of bits - 1) for microphone ADC
  1655. #define MP_16BIT          0x0F          // 16 bits
  1656. #define MP_18BIT          0x11          // 18 bits
  1657. #define MP_20BIT          0x13          // 20 bits
  1658. #define MP_24BIT          0x17          // 24 bits
  1659. #define AUD_MPINCFG1      0x31          // Micro Phone ADC Interface Configuration 1
  1660. #define SDATA5_SEL_OFF    0x00
  1661. #define SDATA5_SEL_YUV7   0x10
  1662. #define SDATA5_SEL_SPBCK  0x20
  1663. #define SDATA5_SEL_RD31   0x30
  1664. #define AUD_SPLIN0 0x34   // SPDIF/line in configuration interface 0
  1665. #define SPLIN_INV         (1 << 7)      // SPDIF/line in LRCK is inverted
  1666. #define SPLIN_RJ          (0 << 5)      // Right aligned with LRCK
  1667. #define SPLIN_LJ          (1 << 5)      // Left aligned with LRCK
  1668. #define SPLIN_I2S         (3 << 5)      // I2S interface
  1669. #define SPLIN_BNUM_MASK   0x1F          // (number of bits - 1) for line in ADC or SPDIF
  1670. #define SPLIN_16BIT       0x0F          // 16 bits
  1671. #define SPLIN_18BIT       0x11          // 18 bits
  1672. #define SPLIN_20BIT       0x13          // 20 bits
  1673. #define SPLIN_24BIT       0x17          // 24 bits
  1674. #define AUD_SPLIN1  0x35   // SPDIF/line in configuration interface 1
  1675. #define SPDIF_IN          (1 << 4)      // The interface is line in
  1676. #define SPDIF_CYC16       (0 << 0)      // 16 cycles
  1677. #define SPDIF_CYC24       (1 << 0)      // 24 cycles
  1678. #define SPDIF_CYC32       (2 << 0)      // 32 cycles
  1679. #if (defined(MT1389_REV_P) || defined(MT1389_REV_L) || defined(MT1389_REV_K))
  1680.   #define ADAC_CTRL0   0x02
  1681.     #define ADAC_OSR           (0x03<<6)
  1682.     #define ADAC_INV_MOD_OUT   (1<<5)
  1683.     #define ADAC_INV_SCF_CLK   (1<<4)
  1684.     #define ADAC_INV_MOD_CLK   (1<<3)
  1685.     #define ADAC_INV_LPF_CLK   (1<<2)
  1686.     #define ADAC_INV_LRCK      (1<<1)
  1687.     #define ADAC_MUTE          (1<<0)
  1688.   #define ADAC_CTRL01   0x03
  1689.     #define ADAC_MOD_SEL       (1<<4)
  1690.     #define ADAC_MOD_OUT_DELAY (0x0B)
  1691.   #define ADAC_DITH1    0x04
  1692.     #define ADAC_COEFF_A3      (0xF0)
  1693.     #define ADAC_COEFF_A2      (0x0F)
  1694.   #define ADAC_DITH2    0x05
  1695.     #define ADAC_DSM0101       (1<<7) //DSM0101 mode
  1696.     #define ADAC_COEFF_A4      (0x0F)
  1697.   #define ADAC_OUT_CFG0 0x06
  1698.     #if defined(MT1389_REV_L) || defined(MT1389_REV_K)
  1699.     #define ADAC_CONFIG_1_0    0x00
  1700.     #define ADAC_CONFIG_1_1    0x01
  1701.     #define ADAC_CONFIG_1_2    0x02
  1702.     #define ADAC_CONFIG_1_3    0x03
  1703.     #define ADAC_CONFIG_1_4    0x04
  1704.     #define ADAC_CONFIG_1_5    0x05
  1705.     #define ADAC_CONFIG_1_6    0x06
  1706.     #define ADAC_CONFIG_1_7    0x07
  1707.     #define ADAC_CONFIG_1_8    0x08
  1708.     #define ADAC_CONFIG_1_9    0x09
  1709.     #define ADAC_CONFIG_1_A    0x0A
  1710.     #define ADAC_CONFIG_1_B    0x0B
  1711.     #define ADAC_CH1_AUPDN     (1<<0)//GPIO
  1712.     #define ADAC_CH2_AUPDN     (1<<1)//GPIO
  1713.     #define ADAC_CH1_AUDGAIN   (1<<0)
  1714.     #define ADAC_CH2_AUDGAIN   (1<<1)
  1715.     #define ADAC_ALL_CH_AUDGAIN 0x3F
  1716.     #define ADAC_CH1_AUCTLI    (1<<0)
  1717.     #define ADAC_CH2_AUCTLI    (1<<1)
  1718.     #define ADAC_ALL_CH_AUCTLI  0x3F
  1719.     #else
  1720.     #define ADAC_CH1_AUPDN     (1<<0)
  1721.     #define ADAC_CH2_AUPDN     (1<<1)
  1722.     #define ADAC_CH1_AUDGAIN   (3<<2)
  1723.     #define ADAC_CH2_AUDGAIN   (3<<4)
  1724.     #define ADAC_CH1_AUCTLI    (1<<6)
  1725.     #define ADAC_CH2_AUCTLI    (1<<7)
  1726.     #endif
  1727.   #define ADAC_OUT_CFG1 0x07
  1728.     #define LR_PU              0x3c
  1729.     #define LR_PD              0x03
  1730.     #define all_PU             0x00
  1731.     #define all_PD             0x3F
  1732.     #define ADAC_CH1_AUCTLO    (1<<0)
  1733.     #define ADAC_CH2_AUCTLO    (1<<1)
  1734.     #if defined(MT1389_REV_L) || defined(MT1389_REV_K)
  1735.     #define ADAC_ALL_CH_AUCTLO  0x3F
  1736.     #define ADAC_CH1_SETZERO   (1<<0)
  1737.     #define ADAC_CH2_SETZERO   (1<<1)
  1738.     #define ADAC_ALL_CH_SETZERO  0x3F
  1739.     #define ADAC_CH1_TMSETZERO (1<<0)
  1740.     #define ADAC_CH2_TMSETZERO (1<<1)
  1741.     #define ADAC_ALL_CH_TMSETZERO  0x3F
  1742.     #define ADAC_CH1_MODOEN    (1<<0)
  1743.     #define ADAC_CH2_MODOEN    (1<<1)
  1744.     #define ADAC_ALL_CH_MODOENO  0x3F
  1745.     #define ADAC_AL            (1<<0)
  1746.     #define ADAC_AR            (1<<1)
  1747.     #define ADAC_ALS           (1<<2)
  1748.     #define ADAC_ARS           (1<<3)
  1749.     #define ADAC_ALF           (1<<4)
  1750.     #define ADAC_ARF           (1<<5)
  1751.     #else
  1752.     #define ADAC_CH1_SETZERO   (1<<2)
  1753.     #define ADAC_CH2_SETZERO   (1<<3)
  1754.     #define ADAC_CH1_TMSETZERO (1<<4)
  1755.     #define ADAC_CH2_TMSETZERO (1<<5)
  1756.     #define ADAC_CH1_MODOEN    (1<<6)
  1757.     #define ADAC_CH2_MODOEN    (1<<7)
  1758.     #endif
  1759.   #define ADAC_OUT_CFG2 0x08
  1760.     #define ADAC_CH1_COFF    (1<<0)//GPIO
  1761.     #define ADAC_CH2_COFF    (1<<1)//GPIO
  1762.     #define ADAC_AUPS        (0<<2)
  1763.     #define ADAC_EXT_CLK_EN  (1<<5)
  1764.     #define ADAC_RESET       (1<<6)// not finish
  1765.   #define ADAC_AUTEST  0x09
  1766.   #define ADAC_AUREV   0x0A
  1767.   #if defined(MT1389_REV_L) || defined(MT1389_REV_K)
  1768.    #define ADAC_AKIN2   0x0A
  1769.    #define ADAC_ADVCM   0x0B
  1770.    #define ADAC_AKIN1   0x0C
  1771.        #define AKIN1_EN   (1<<2)//
  1772.        #define AKIN1_E2  (1<<4) //
  1773.   #endif
  1774.   #define APLL_CAL_CNTL 0x0D //APLL calibration[7:0]
  1775.   #define ADAC_MON      0x0E
  1776.   #define ADAC_MUTE_ALCK 0x29
  1777.     #define ADAC_ACLK_MUTE    (0xE0)
  1778.  #if defined(MT1389_REV_L) || defined(MT1389_REV_K)
  1779.   #ifdef MTK_AUD_ADC
  1780.   #define AADC_CFG0    0x32
  1781.     #define OSR_SEL           (3<<1)
  1782.     #define IADC_SEL          (1<<0)
  1783.   #define AADC_CFG1    0x33
  1784.   #define ADC_ANALOG0   0x37  //AADC_CKDIV in 89E
  1785.   #define ADC_ANALOG1   0x38
  1786.   #define ADC_ANALOG2   0x39
  1787.   #define COMPTIMSEL        (1<<6)
  1788.   #define ADC_ANALOG3  0x3a
  1789.      #define AAD_RST     (1<<4)
  1790.    #define ADC_ANALOG4  0x3b
  1791.     #define CDSREN            (1<<0)
  1792.     #define AUADCR_PD         (1<<3)
  1793.     #define CDSENL            (1<<4)
  1794.     #define AUADCL_PD         (1<<7)
  1795.   #define AAD_TEST    0x3d
  1796.     #define AAD_TEST0         (1<<0)
  1797.   #endif
  1798.  #endif
  1799. #elif (defined(MT1389_REV_HD)||defined(MT1389_REV_E))
  1800.   #define IO_AL          (1<<5)
  1801.   #define IO_AR          (1<<4)
  1802.   #define IO_ALS         (1<<3)
  1803.   #define IO_ARS         (1<<2)
  1804.   #define IO_ALF         (1<<1)
  1805.   #define IO_ARF         (1<<0)
  1806. #ifdef MTK_AUD_ADC
  1807.   #define AAD_TEST    0x02
  1808.     #define AAD_TEST0         (1<<0)
  1809. #endif
  1810.   #define AADC_CKDIV  0x03
  1811.   #define ADAC_CH1    0x04
  1812.   #define ADAC_CH2    0x05
  1813.   #define ADAC_CH3    0x06
  1814.   #define ADAC_CH4    0x07
  1815.   #define ADAC_CH5    0x08
  1816.   #define ADAC_CH6    0x09
  1817.     #define ADAC_COFF         (1<<7)
  1818.     #define ADAC_TMSETZERO    (1<<6)
  1819.     #define ADAC_SETZERO      (1<<5)
  1820.     #define ADAC_AUCTLO       (1<<4)
  1821.     #define ADAC_AUCTLI       (1<<3)
  1822.     #define ADAC_AUPDN        (1<<2)
  1823.     #define ADAC_AUDGAIN      (3<<0)
  1824.   #define ADAC_MODOEN  0x0A
  1825.     #define ADAC_MODOEN6      (1<<5)
  1826.     #define ADAC_MODOEN5      (1<<4)
  1827.     #define ADAC_MODOEN4      (1<<3)
  1828.     #define ADAC_MODOEN3      (1<<2)
  1829.     #define ADAC_MODOEN2      (1<<1)
  1830.     #define ADAC_MODOEN1      (1<<0)
  1831.   #define ADAC_AUPS    0x0B
  1832.   #define ADAC_AUTEST  0x0C
  1833.     #define ADAC_RESET        (1<<7)
  1834.   #define ADAC_LPF_DIV 0x0D
  1835.   #define ADAC_MOD_DIV 0x0E
  1836.   #define ADAC_MUTE_ALCK 0x29
  1837.     #define ADAC_ACLK_MUTE    (0xE0)
  1838. #ifdef MTK_AUD_ADC
  1839.   #define AADC_CFG0    0x32
  1840.     #define OSR_SEL           (3<<1)
  1841.     #define IADC_SEL          (1<<0)
  1842.   #define AUADC_LEFT   0x37
  1843.   #define AUADC_RIGHT  0x38
  1844.     #define CDSXEN            (1<<1)
  1845.     #define AUADCX_PD         (1<<0)
  1846.   #define AUADC_BIAS   0x39
  1847.     #define EXTCLK_EN         (1<<4)
  1848.     #define COMPTIMSEL        (1<<3)
  1849.     #define AUADPS            (7<<0)
  1850. #endif
  1851.   #define ADAC_CTRL0   0x3A
  1852.     #define ADAC_OSR          (0x03<<6)
  1853.     #define ADAC_INV_MOD_OUT  (1<<5)
  1854.     #define ADAC_INV_SCF_CLK  (1<<4)
  1855.     #define ADAC_INV_MOD_CLK  (1<<3)
  1856.     #define ADAC_INV_LPF_CLK  (1<<2)
  1857.     #define ADAC_18BIT        (1<<1)
  1858.     #define ADAC_MUTE         (1<<0)
  1859.   #define ADAC_CTRL1   0x3B
  1860.     #define ADAC_ASD_PIN      (1<<7)
  1861.     #define ADAC_DSM0101      (1<<2)
  1862.     #define ADAC_INV_LRCK     (1<<0)
  1863.   #define ADAC_MOD_C0  0x3c
  1864.     #define ADAC_COEFF_A3     (0xF0)
  1865.     #define ADAC_COEFF_A2     (0x0F)
  1866.   #define ADAC_MOD_C1  0x3d
  1867.     #define ADAC_MOD_SEL       (1<<7)
  1868.     #define ADAC_MOD_OUT_DELAY (0x70)
  1869.     #define ADAC_COEFF_A4      (0x0F)
  1870. #elif defined(MT1389_REV_D)
  1871.   #define ADAC_ATOP0        0x39
  1872.   #define ADAC_TMSETZERO    (1<<7)
  1873.   #define ADAC_SETZERO      (1<<6)
  1874.   #define ADAC_AUCTLO       (1<<5)
  1875.   #define ADAC_AUCTLI       (1<<4)
  1876.   #define ADAC_TMAUPDN      (1<<3)
  1877.   #define ADAC_AUPDN        (1<<2)
  1878.   #define ADAC_AUDGAIN      (3<<0)
  1879.   #define ADAC_ATOP1        0x3a
  1880.   #define ADAC_CTRL_SEL     (1<<6)
  1881.   #define ADAC_EXTCLK_EN    (1<<5)
  1882.   #define ADAC_MONITOR      (1<<4)
  1883.   #define ADAC_AUTEST       (0x0F)
  1884.   #define ADAC_CTRL0        0x3b
  1885.   #define ADAC_OSR          (0x03<<6)
  1886.   #define ADAC_INV_MOD_OUT  (1<<5)
  1887.   #define ADAC_INV_SCF_CLK  (1<<4)
  1888.   #define ADAC_INV_MOD_CLK  (1<<3)
  1889.   #define ADAC_INV_LPF_CLK  (1<<2)
  1890.   #define ADAC_18BIT        (1<<1)
  1891.   #define ADAC_MUTE         (1<<0)
  1892.   #define ADAC_CTRL1        0x3b
  1893.   #define ADAC_CLOCK_MON    (3<<2)
  1894.   #define ADAC_FUNC_TEST    (1<<1)
  1895.   #define ADAC_INV_LRCK     (1<<0)
  1896.   #define ADAC_MOD_C0       0x3c
  1897.   #define ADAC_COEFF_A3     (0xF0)
  1898.   #define ADAC_COEFF_A2     (0x0F)
  1899.   #define ADAC_MOD_C1        0x3d
  1900.   #define ADAC_SYNC_CLK      (1<<7)
  1901.   #define ADAC_MOD_OUT_DELAY (0x70)
  1902.   #define ADAC_COEFF_A4      (0x0F)
  1903.   #define ADAC_CLK_SET1      0xF9
  1904.   #define ADAC_CLK_SET2      0xFA
  1905. #endif //MT1389_REV_D
  1906. #ifdef MT1389_REV_K
  1907.    #define ADAC_AKIN2   0x0A
  1908.    #define ADAC_ADVCM   0x0B
  1909.    #define ADAC_AKIN1   0x0C
  1910. #endif
  1911. //////////////////////////////////////////////////////
  1912. // RISC registers definition
  1913. // video register
  1914. //#define RW_FMTCTL         (0x10AC>>2)
  1915. //#define RW_VDO_PTRY       (0x0C00>>2)
  1916. //#define RW_VDO_PTRC       (0x0C04>>2)
  1917. //#define RW_VDO_PICSIZE    (0x0C0C>>2)
  1918. //#define RW_VDO_CTRL       (0x0C2C>>2)
  1919. // your register defined here
  1920. #define SRV_RDDVD_CMD      0x05
  1921. #define VFMT_REG_OFST     (0x1000 >> 2)
  1922. #define RO_IRQST          (VFMT_REG_OFST + 0x00)
  1923. #define RW_IRQEN          (VFMT_REG_OFST + (0x04 >> 2))
  1924. #define WO_IRQCR          (VFMT_REG_OFST + (0x08 >> 2))
  1925. #define IRQ_IRCI          0x1
  1926. #define IRQ_STAI          (0x1 << 1)
  1927. #define IRQ_OSDI          (0x1 << 2)
  1928. #define IRQ_VURI          (0x1 << 3)
  1929. #define IRQ_SURI          (0x1 << 4)
  1930. #define IRQ_OURI          (0x1 << 5)
  1931. #define IRQ_GI            (0x1 << 6)
  1932. #define IRQ_PI            (0x1 << 7)
  1933. #define IRQ_MCFI          (0x1 << 8)
  1934. #define IRQ_VLDI          (0x1 << 9)
  1935. #define IRQ_T0I           (0x1 << 10)
  1936. #define IRQ_T1I           (0x1 << 11)
  1937. #define IRQ_NSPAI         (0x1 << 13)    // RISC null space
  1938. #define IRQ_WFLAI         (0x1 << 14)    // RISC write to Flash
  1939. #define IRQ_DSPI          (0x1 << 15)
  1940. #define IRQ_RS232I        (0x1 << 16)
  1941. #define IRQ_VLDECI        (0x1 << 17)
  1942. #define RO_FIQST          (VFMT_REG_OFST + (0x0C >> 2))
  1943. #define RW_FIQEN          (VFMT_REG_OFST + (0x10 >> 2))
  1944. #define WO_FIQCR          (VFMT_REG_OFST + (0x14 >> 2))
  1945. #define FIQ_VSYNC         (0x1 << 17)
  1946. #define FIQ_GI            IRQ_GI
  1947. #define FIQ_PI            IRQ_PI
  1948. // ATAPI Command register to 8032
  1949. #define RW_TRBM0          (VFMT_REG_OFST + (0x18 >> 2))
  1950. #define RW_TRBM4          (VFMT_REG_OFST + (0x1C >> 2))
  1951. #define RW_TRBM8          (VFMT_REG_OFST + (0x20 >> 2))
  1952. #define IDE_BSY           (0x1 << 24)
  1953. #define IDE_SKEY          0xFF
  1954. #define IDE_SCODE         (0xFF << 8)
  1955. #define IDE_SQ            (0xFF << 16)
  1956. // Share-Memory register to 8032
  1957. #define RW_TRBMC          (VFMT_REG_OFST + (0x24 >> 2))
  1958. #define RW_SHAINFO        RW_TRBMC
  1959. #define ATAPI_COMPLETE    0x1
  1960. // ATAPI Status from 8032
  1961. #define RO_TRAS0          (VFMT_REG_OFST + (0x28 >> 2))
  1962. // IR Command from 8032
  1963. #define RO_TRAS4          (VFMT_REG_OFST + (0x2C >> 2))
  1964. // OSD Command from 8032
  1965. #define RO_TRAS8          (VFMT_REG_OFST + (0x30 >> 2))
  1966. #define WC_AINT           (VFMT_REG_OFST + (0x34 >> 2))
  1967. #define ACMDI             0x1
  1968. #define ASHAI             (0x1 << 1)
  1969. #define APOKI             (0x1 << 2)
  1970. #define RO_AINT           (VFMT_REG_OFST + (0x34 >> 2))
  1971. #define CMDBSY            0x1
  1972. #define SHAIBSY           (0x1 << 1)
  1973. // Servo Pin
  1974. #define DEC_BSIOEN        0x02
  1975. #define DEC_BSIOUT        0x03
  1976. #define DEC_BSIOIN        0x04
  1977. #define IO_DQS1           (1 << 6)
  1978. #define IO_DQS0           (1 << 5)
  1979. #define IO_TDO            (1 << 3)
  1980. #define IO_TMS            (1 << 2)
  1981. #define IO_TDI            (1 << 1)
  1982. #define IO_TCK            (1 << 0)
  1983. #endif //_H_MT1389_