it8172.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. /*
  2. *
  3. * BRIEF MODULE DESCRIPTION
  4. * IT8172 system controller defines.
  5. *
  6. * Copyright 2000 MontaVista Software Inc.
  7. * Author: MontaVista Software, Inc.
  8. * ppopov@mvista.com or source@mvista.com
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. *
  15. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  16. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  18. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  19. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  20. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  21. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  22. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  24. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. *
  26. * You should have received a copy of the GNU General Public License along
  27. * with this program; if not, write to the Free Software Foundation, Inc.,
  28. * 675 Mass Ave, Cambridge, MA 02139, USA.
  29. */
  30. #ifndef __IT8172__H__
  31. #define __IT8172__H__
  32. #include <asm/addrspace.h>
  33. #define IT8172_BASE 0x18000000
  34. #define IT8172_PCI_IO_BASE 0x14000000
  35. #define IT8172_PCI_MEM_BASE 0x10000000
  36. // System registers offsets from IT8172_BASE
  37. #define IT_CMFPCR 0x0
  38. #define IT_DSRR 0x2
  39. #define IT_PCDCR 0x4
  40. #define IT_SPLLCR 0x6
  41. #define IT_CIDR 0x10
  42. #define IT_CRNR 0x12
  43. #define IT_CPUTR 0x14
  44. #define IT_CTCR 0x16
  45. #define IT_SDPR 0xF0
  46. // Power management register offset from IT8172_PCI_IO_BASE
  47. // Power Management Device Standby Register
  48. #define IT_PM_DSR 0x15800
  49. #define IT_PM_DSR_TMR0SB 0x0001
  50. #define IT_PM_DSR_TMR1SB 0x0002
  51. #define IT_PM_DSR_CIR0SB 0x0004
  52. #define IT_PM_DSR_CIR1SB 0x0008
  53. #define IT_PM_DSR_SCR0SB 0x0010
  54. #define IT_PM_DSR_SCR1SB 0x0020
  55. #define IT_PM_DSR_PPSB 0x0040
  56. #define IT_PM_DSR_I2CSB 0x0080
  57. #define IT_PM_DSR_UARTSB 0x0100
  58. #define IT_PM_DSR_IDESB 0x0200
  59. #define IT_PM_DSR_ACSB 0x0400
  60. #define IT_PM_DSR_M68KSB 0x0800
  61. // Power Management PCI Device Software Reset Register
  62. #define IT_PM_PCISR 0x15802
  63. #define IT_PM_PCISR_IDESR 0x0001
  64. #define IT_PM_PCISR_CDMASR 0x0002
  65. #define IT_PM_PCISR_USBSR 0x0004
  66. #define IT_PM_PCISR_DMASR 0x0008
  67. #define IT_PM_PCISR_ACSR 0x0010
  68. #define IT_PM_PCISR_MEMSR 0x0020
  69. #define IT_PM_PCISR_68KSR 0x0040
  70. // PCI Configuration address and data register offsets
  71. // from IT8172_BASE
  72. #define IT_CONFADDR 0x4000
  73. #define IT_BUSNUM_SHF 16
  74. #define IT_DEVNUM_SHF 11
  75. #define IT_FUNCNUM_SHF 8
  76. #define IT_REGNUM_SHF 2
  77. #define IT_CONFDATA 0x4004
  78. // PCI configuration header common register offsets
  79. #define IT_VID 0x00
  80. #define IT_DID 0x02
  81. #define IT_PCICMD 0x04
  82. #define IT_PCISTS 0x06
  83. #define IT_RID 0x08
  84. #define IT_CLASSC 0x09
  85. #define IT_HEADT 0x0E
  86. #define IT_SERIRQC 0x49
  87. // PCI to Internal/LPC Bus Bridge configuration header register offset
  88. #define IT_P2I_BCR 0x4C
  89. #define IT_P2I_D0IOSC 0x50
  90. #define IT_P2I_D1IOSC 0x54
  91. #define IT_P2I_D2IOSC 0x58
  92. #define IT_P2I_D3IOSC 0x5C
  93. #define IT_P2I_D4IOSC 0x60
  94. #define IT_P2I_D5IOSC 0x64
  95. #define IT_P2I_D6IOSC 0x68
  96. #define IT_P2I_D7IOSC 0x6C
  97. #define IT_P2I_D8IOSC 0x70
  98. #define IT_P2I_D9IOSC 0x74
  99. #define IT_P2I_D10IOSC 0x78
  100. #define IT_P2I_D11IOSC 0x7C
  101. // Memory controller register offsets from IT8172_BASE
  102. #define IT_MC_SDRMR 0x1000
  103. #define IT_MC_SDRTR 0x1004
  104. #define IT_MC_MCR 0x1008
  105. #define IT_MC_SDTYPE 0x100C
  106. #define IT_MC_WPBA 0x1010
  107. #define IT_MC_WPTA 0x1014
  108. #define IT_MC_HATR 0x1018
  109. #define IT_MC_PCICR 0x101C
  110. // Flash/ROM control register offsets from IT8172_BASE
  111. #define IT_FC_BRCR 0x2000
  112. #define IT_FC_FCR 0x2004
  113. #define IT_FC_DCR 0x2008
  114. // M68K interface bridge configuration header register offset
  115. #define IT_M68K_MBCSR 0x54
  116. #define IT_M68K_TMR 0x58
  117. #define IT_M68K_BCR 0x5C
  118. #define IT_M68K_BSR 0x5D
  119. #define IT_M68K_DTR 0x5F
  120. // Register offset from IT8172_PCI_IO_BASE
  121. // These registers are accessible through 8172 PCI IO window.
  122. // INTC
  123. #define IT_INTC_BASE 0x10000
  124. #define IT_INTC_LBDNIRR 0x10000
  125. #define IT_INTC_LBDNIMR 0x10002
  126. #define IT_INTC_LBDNITR 0x10004
  127. #define IT_INTC_LBDNIAR 0x10006
  128. #define IT_INTC_LPCNIRR 0x10010
  129. #define IT_INTC_LPCNIMR 0x10012
  130. #define IT_INTC_LPCNITR 0x10014
  131. #define IT_INTC_LPCNIAR 0x10016
  132. #define IT_INTC_PDNIRR 0x10020
  133. #define IT_INTC_PDNIMR 0x10022
  134. #define IT_INTC_PDNITR 0x10024
  135. #define IT_INTC_PDNIAR 0x10026
  136. #define IT_INTC_UMNIRR 0x10030
  137. #define IT_INTC_UMNITR 0x10034
  138. #define IT_INTC_UMNIAR 0x10036
  139. #define IT_INTC_TYPER 0x107FE
  140. // IT8172 PCI device number
  141. #define IT_C2P_DEVICE 0
  142. #define IT_AUDIO_DEVICE 1
  143. #define IT_DMAC_DEVICE 1
  144. #define IT_CDMAC_DEVICE 1
  145. #define IT_USB_DEVICE 1
  146. #define IT_P2I_DEVICE 1
  147. #define IT_IDE_DEVICE 1
  148. #define IT_M68K_DEVICE 1
  149. // IT8172 PCI function number
  150. #define IT_C2P_FUNCION 0
  151. #define IT_AUDIO_FUNCTION 0
  152. #define IT_DMAC_FUNCTION 1
  153. #define IT_CDMAC_FUNCTION 2
  154. #define IT_USB_FUNCTION 3
  155. #define IT_P2I_FUNCTION 4
  156. #define IT_IDE_FUNCTION 5
  157. #define IT_M68K_FUNCTION 6
  158. // IT8172 GPIO
  159. #define IT_GPADR 0x13800
  160. #define IT_GPBDR 0x13808
  161. #define IT_GPCDR 0x13810
  162. #define IT_GPACR 0x13802
  163. #define IT_GPBCR 0x1380A
  164. #define IT_GPCCR 0x13812
  165. #define IT_GPAICR 0x13804
  166. #define IT_GPBICR 0x1380C
  167. #define IT_GPCICR 0x13814
  168. #define IT_GPAISR 0x13806
  169. #define IT_GPBISR 0x1380E
  170. #define IT_GPCISR 0x13816
  171. #define IT_GCR 0x13818
  172. // IT8172 RTC
  173. #define IT_RTC_BASE 0x14800
  174. #define IT_RTC_CENTURY 0x14808
  175. #define IT_RTC_RIR0 0x00
  176. #define IT_RTC_RTR0 0x01
  177. #define IT_RTC_RIR1 0x02
  178. #define IT_RTC_RTR1 0x03
  179. #define IT_RTC_RIR2 0x04
  180. #define IT_RTC_RTR2 0x05
  181. #define IT_RTC_RCTR 0x08
  182. #define IT_RTC_RA 0x0A
  183. #define IT_RTC_RB 0x0B
  184. #define IT_RTC_RC 0x0C
  185. #define IT_RTC_RD 0x0D
  186. #define RTC_SEC_INDEX 0x00
  187. #define RTC_MIN_INDEX 0x02
  188. #define RTC_HOUR_INDEX 0x04
  189. #define RTC_DAY_INDEX 0x06
  190. #define RTC_DATE_INDEX 0x07
  191. #define RTC_MONTH_INDEX 0x08
  192. #define RTC_YEAR_INDEX 0x09
  193. // IT8172 internal device registers
  194. #define IT_TIMER_BASE 0x10800
  195. #define IT_CIR0_BASE 0x11000
  196. #define IT_UART_BASE 0x11800
  197. #define IT_SCR0_BASE 0x12000
  198. #define IT_SCR1_BASE 0x12800
  199. #define IT_PP_BASE 0x13000
  200. #define IT_I2C_BASE 0x14000
  201. #define IT_CIR1_BASE 0x15000
  202. // IT8172 Smart Card Reader offsets from IT_SCR*_BASE
  203. #define IT_SCR_SFR 0x08
  204. #define IT_SCR_SCDR 0x09
  205. // IT8172 IT_SCR_SFR bit definition & mask
  206. #define IT_SCR_SFR_GATE_UART 0x40
  207. #define IT_SCR_SFR_GATE_UART_BIT 6
  208. #define IT_SCR_SFR_GATE_UART_OFF 0
  209. #define IT_SCR_SFR_GATE_UART_ON 1
  210. #define IT_SCR_SFR_FET_CHARGE 0x30
  211. #define IT_SCR_SFR_FET_CHARGE_BIT 4
  212. #define IT_SCR_SFR_FET_CHARGE_3_3_US 3
  213. #define IT_SCR_SFR_FET_CHARGE_13_US 2
  214. #define IT_SCR_SFR_FET_CHARGE_53_US 1
  215. #define IT_SCR_SFR_FET_CHARGE_213_US 0
  216. #define IT_SCR_SFR_CARD_FREQ 0x0C
  217. #define IT_SCR_SFR_CARD_FREQ_BIT 2
  218. #define IT_SCR_SFR_CARD_FREQ_STOP 3
  219. #define IT_SCR_SFR_CARD_FREQ_3_5_MHZ 0
  220. #define IT_SCR_SFR_CARD_FREQ_7_1_MHZ 2
  221. #define IT_SCR_SFR_CARD_FREQ_96_DIV_MHZ 1
  222. #define IT_SCR_SFR_FET_ACTIVE 0x02
  223. #define IT_SCR_SFR_FET_ACTIVE_BIT 1
  224. #define IT_SCR_SFR_FET_ACTIVE_INVERT 0
  225. #define IT_SCR_SFR_FET_ACTIVE_NONINVERT 1
  226. #define IT_SCR_SFR_ENABLE 0x01
  227. #define IT_SCR_SFR_ENABLE_BIT 0
  228. #define IT_SCR_SFR_ENABLE_OFF 0
  229. #define IT_SCR_SFR_ENABLE_ON 1
  230. // IT8172 IT_SCR_SCDR bit definition & mask
  231. #define IT_SCR_SCDR_RESET_MODE 0x80
  232. #define IT_SCR_SCDR_RESET_MODE_BIT 7
  233. #define IT_SCR_SCDR_RESET_MODE_ASYNC 0
  234. #define IT_SCR_SCDR_RESET_MODE_SYNC 1
  235. #define IT_SCR_SCDR_DIVISOR 0x7F
  236. #define IT_SCR_SCDR_DIVISOR_BIT 0
  237. #define IT_SCR_SCDR_DIVISOR_STOP_VAL_1 0x00
  238. #define IT_SCR_SCDR_DIVISOR_STOP_VAL_2 0x01
  239. #define IT_SCR_SCDR_DIVISOR_STOP_VAL_3 0x7F
  240. // IT8172 DMA
  241. #define IT_DMAC_BASE 0x16000
  242. #define IT_DMAC_BCAR0 0x00
  243. #define IT_DMAC_BCAR1 0x04
  244. #define IT_DMAC_BCAR2 0x08
  245. #define IT_DMAC_BCAR3 0x0C
  246. #define IT_DMAC_BCCR0 0x02
  247. #define IT_DMAC_BCCR1 0x06
  248. #define IT_DMAC_BCCR2 0x0a
  249. #define IT_DMAC_BCCR3 0x0e
  250. #define IT_DMAC_CR 0x10
  251. #define IT_DMAC_SR 0x12
  252. #define IT_DMAC_ESR 0x13
  253. #define IT_DMAC_RQR 0x14
  254. #define IT_DMAC_MR 0x16
  255. #define IT_DMAC_EMR 0x17
  256. #define IT_DMAC_MKR 0x18
  257. #define IT_DMAC_PAR0 0x20
  258. #define IT_DMAC_PAR1 0x22
  259. #define IT_DMAC_PAR2 0x24
  260. #define IT_DMAC_PAR3 0x26
  261. // IT8172 IDE
  262. #define IT_IDE_BASE 0x17800
  263. #define IT_IDE_STATUS 0x1F7
  264. // IT8172 Audio Controller
  265. #define IT_AC_BASE 0x17000
  266. #define IT_AC_PCMOV 0x00
  267. #define IT_AC_FMOV 0x02
  268. #define IT_AC_I2SV 0x04
  269. #define IT_AC_DRSS 0x06
  270. #define IT_AC_PCC 0x08
  271. #define IT_AC_PCDL 0x0A
  272. #define IT_AC_PCB1STA 0x0C
  273. #define IT_AC_PCB2STA 0x10
  274. #define IT_AC_CAPCC 0x14
  275. #define IT_AC_CAPCDL 0x16
  276. #define IT_AC_CAPB1STA 0x18
  277. #define IT_AC_CAPB2STA 0x1C
  278. #define IT_AC_CODECC 0x22
  279. #define IT_AC_I2SMC 0x24
  280. #define IT_AC_VS 0x26
  281. #define IT_AC_SRCS 0x28
  282. #define IT_AC_CIRCP 0x2A
  283. #define IT_AC_CIRDP 0x2C
  284. #define IT_AC_TM 0x4A
  285. #define IT_AC_PFDP 0x4C
  286. #define IT_AC_GC 0x54
  287. #define IT_AC_IMC 0x56
  288. #define IT_AC_ISC 0x5B
  289. #define IT_AC_OPL3SR 0x68
  290. #define IT_AC_OPL3DWDR 0x69
  291. #define IT_AC_OPL3AB1W 0x6A
  292. #define IT_AC_OPL3DW 0x6B
  293. #define IT_AC_BPDC 0x70
  294. // IT8172 Timer
  295. #define IT_TIMER_BASE 0x10800
  296. #define TIMER_TCVR0 0x00
  297. #define TIMER_TRVR0 0x02
  298. #define TIMER_TCR0 0x04
  299. #define TIMER_TIRR 0x06
  300. #define TIMER_TCVR1 0x08
  301. #define TIMER_TRVR1 0x0A
  302. #define TIMER_TCR1 0x0C
  303. #define TIMER_TIDR 0x0E
  304. #define IT_WRITE(ofs, data) *(volatile u32 *)KSEG1ADDR((IT8172_BASE+ofs)) = data
  305. #define IT_READ(ofs, data) data = *(volatile u32 *)KSEG1ADDR((IT8172_BASE+ofs))
  306. #define IT_IO_WRITE(ofs, data) *(volatile u32 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs)) = data
  307. #define IT_IO_READ(ofs, data) data = *(volatile u32 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs))
  308. #define IT_IO_WRITE16(ofs, data) *(volatile u16 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs)) = data
  309. #define IT_IO_READ16(ofs, data) data = *(volatile u16 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs))
  310. #endif