mpc512x.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. /*
  2. * Copyright (C) 2004-2006 Freescale Semiconductor, Inc.
  3. * (C) Copyright 2007 DENX Software Engineering
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * Derived from the MPC83xx header.
  14. */
  15. #ifndef __MPC512X_H__
  16. #define __MPC512X_H__
  17. #include <config.h>
  18. #if defined(CONFIG_E300)
  19. #include <asm/e300.h>
  20. #endif
  21. /* System reset offset (PowerPC standard)
  22. */
  23. #define EXC_OFF_SYS_RESET 0x0100
  24. #define _START_OFFSET EXC_OFF_SYS_RESET
  25. /* IMMRBAR - Internal Memory Register Base Address
  26. */
  27. #define CONFIG_DEFAULT_IMMR 0xFF400000 /* Default IMMR base address */
  28. #define IMMRBAR 0x0000 /* Register offset to immr */
  29. #define IMMRBAR_BASE_ADDR 0xFFF00000 /* Base address mask */
  30. #define IMMRBAR_RES ~(IMMRBAR_BASE_ADDR)
  31. /* LAWBAR - Local Access Window Base Address Register
  32. */
  33. #define LPBAW 0x0020 /* Register offset to immr */
  34. #define LPCS0AW 0x0024
  35. #define LPCS1AW 0x0028
  36. #define LPCS2AW 0x002C
  37. #define LPCS3AW 0x0030
  38. #define LPCS4AW 0x0034
  39. #define LPCS5AW 0x0038
  40. #define LPCS6AW 0x003C
  41. #define LPCA7AW 0x0040
  42. #define SRAMBAR 0x00C4
  43. #define LAWBAR_BAR 0xFFFFF000 /* Base address mask */
  44. #define LPC_OFFSET 0x10000
  45. #define CS0_CONFIG 0x00000
  46. #define CS1_CONFIG 0x00004
  47. #define CS2_CONFIG 0x00008
  48. #define CS3_CONFIG 0x0000C
  49. #define CS4_CONFIG 0x00010
  50. #define CS5_CONFIG 0x00014
  51. #define CS6_CONFIG 0x00018
  52. #define CS7_CONFIG 0x0001C
  53. #define CS_ALE_TIMING_CONFIG 0x00034
  54. #define CS_CTRL 0x00020
  55. #define CS_CTRL_ME 0x01000000 /* CS Master Enable bit */
  56. #define CS_CTRL_IE 0x08000000 /* CS Interrupt Enable bit */
  57. /* SPRIDR - System Part and Revision ID Register
  58. */
  59. #define SPRIDR_PARTID 0xFFFF0000 /* Part Identification */
  60. #define SPRIDR_REVID 0x0000FFFF /* Revision Identification */
  61. #define SPR_5121E 0x80180000
  62. /* SPCR - System Priority Configuration Register
  63. */
  64. #define SPCR_PCIHPE 0x10000000 /* PCI Highest Priority Enable */
  65. #define SPCR_PCIHPE_SHIFT (31-3)
  66. #define SPCR_PCIPR 0x03000000 /* PCI bridge system bus request priority */
  67. #define SPCR_PCIPR_SHIFT (31-7)
  68. #define SPCR_TBEN 0x00400000 /* E300 PowerPC core time base unit enable */
  69. #define SPCR_TBEN_SHIFT (31-9)
  70. #define SPCR_COREPR 0x00300000 /* E300 PowerPC Core system bus request priority */
  71. #define SPCR_COREPR_SHIFT (31-11)
  72. /* SWCRR - System Watchdog Control Register
  73. */
  74. #define SWCRR 0x0904 /* Register offset to immr */
  75. #define SWCRR_SWTC 0xFFFF0000 /* Software Watchdog Time Count */
  76. #define SWCRR_SWEN 0x00000004 /* Watchdog Enable bit */
  77. #define SWCRR_SWRI 0x00000002 /* Software Watchdog Reset/Interrupt Select bit */
  78. #define SWCRR_SWPR 0x00000001 /* Software Watchdog Counter Prescale bit */
  79. #define SWCRR_RES ~(SWCRR_SWTC | SWCRR_SWEN | SWCRR_SWRI | SWCRR_SWPR)
  80. /* SWCNR - System Watchdog Counter Register
  81. */
  82. #define SWCNR 0x0908 /* Register offset to immr */
  83. #define SWCNR_SWCN 0x0000FFFF /* Software Watchdog Count mask */
  84. #define SWCNR_RES ~(SWCNR_SWCN)
  85. /* SWSRR - System Watchdog Service Register
  86. */
  87. #define SWSRR 0x090E /* Register offset to immr */
  88. /* ACR - Arbiter Configuration Register
  89. */
  90. #define ACR_COREDIS 0x10000000 /* Core disable */
  91. #define ACR_COREDIS_SHIFT (31-7)
  92. #define ACR_PIPE_DEP 0x00070000 /* Pipeline depth */
  93. #define ACR_PIPE_DEP_SHIFT (31-15)
  94. #define ACR_PCI_RPTCNT 0x00007000 /* PCI repeat count */
  95. #define ACR_PCI_RPTCNT_SHIFT (31-19)
  96. #define ACR_RPTCNT 0x00000700 /* Repeat count */
  97. #define ACR_RPTCNT_SHIFT (31-23)
  98. #define ACR_APARK 0x00000030 /* Address parking */
  99. #define ACR_APARK_SHIFT (31-27)
  100. #define ACR_PARKM 0x0000000F /* Parking master */
  101. #define ACR_PARKM_SHIFT (31-31)
  102. /* ATR - Arbiter Timers Register
  103. */
  104. #define ATR_DTO 0x00FF0000 /* Data time out */
  105. #define ATR_ATO 0x000000FF /* Address time out */
  106. /* AER - Arbiter Event Register
  107. */
  108. #define AER_ETEA 0x00000020 /* Transfer error */
  109. #define AER_RES 0x00000010 /* Reserved transfer type */
  110. #define AER_ECW 0x00000008 /* External control word transfer type */
  111. #define AER_AO 0x00000004 /* Address Only transfer type */
  112. #define AER_DTO 0x00000002 /* Data time out */
  113. #define AER_ATO 0x00000001 /* Address time out */
  114. /* AEATR - Arbiter Event Address Register
  115. */
  116. #define AEATR_EVENT 0x07000000 /* Event type */
  117. #define AEATR_MSTR_ID 0x001F0000 /* Master Id */
  118. #define AEATR_TBST 0x00000800 /* Transfer burst */
  119. #define AEATR_TSIZE 0x00000700 /* Transfer Size */
  120. #define AEATR_TTYPE 0x0000001F /* Transfer Type */
  121. /* RSR - Reset Status Register
  122. */
  123. #define RSR_SWSR 0x00002000 /* software soft reset */
  124. #define RSR_SWSR_SHIFT 13
  125. #define RSR_SWHR 0x00001000 /* software hard reset */
  126. #define RSR_SWHR_SHIFT 12
  127. #define RSR_JHRS 0x00000200 /* jtag hreset */
  128. #define RSR_JHRS_SHIFT 9
  129. #define RSR_JSRS 0x00000100 /* jtag sreset status */
  130. #define RSR_JSRS_SHIFT 8
  131. #define RSR_CSHR 0x00000010 /* checkstop reset status */
  132. #define RSR_CSHR_SHIFT 4
  133. #define RSR_SWRS 0x00000008 /* software watchdog reset status */
  134. #define RSR_SWRS_SHIFT 3
  135. #define RSR_BMRS 0x00000004 /* bus monitop reset status */
  136. #define RSR_BMRS_SHIFT 2
  137. #define RSR_SRS 0x00000002 /* soft reset status */
  138. #define RSR_SRS_SHIFT 1
  139. #define RSR_HRS 0x00000001 /* hard reset status */
  140. #define RSR_HRS_SHIFT 0
  141. #define RSR_RES ~(RSR_SWSR | RSR_SWHR |\
  142. RSR_JHRS | RSR_JSRS | RSR_CSHR | RSR_SWRS |\
  143. RSR_BMRS | RSR_SRS | RSR_HRS)
  144. /* RMR - Reset Mode Register
  145. */
  146. #define RMR_CSRE 0x00000001 /* checkstop reset enable */
  147. #define RMR_CSRE_SHIFT 0
  148. #define RMR_RES ~(RMR_CSRE)
  149. /* RCR - Reset Control Register
  150. */
  151. #define RCR_SWHR 0x00000002 /* software hard reset */
  152. #define RCR_SWSR 0x00000001 /* software soft reset */
  153. #define RCR_RES ~(RCR_SWHR | RCR_SWSR)
  154. /* RCER - Reset Control Enable Register
  155. */
  156. #define RCER_CRE 0x00000001 /* software hard reset */
  157. #define RCER_RES ~(RCER_CRE)
  158. /* SPMR - System PLL Mode Register
  159. */
  160. #define SPMR_SPMF 0x0F000000
  161. #define SPMR_SPMF_SHIFT 24
  162. #define SPMR_CPMF 0x000F0000
  163. #define SPMR_CPMF_SHIFT 16
  164. /* SCFR1 System Clock Frequency Register 1
  165. */
  166. #define SCFR1_IPS_DIV 0x3
  167. #define SCFR1_IPS_DIV_MASK 0x03800000
  168. #define SCFR1_IPS_DIV_SHIFT 23
  169. #define SCFR1_PCI_DIV 0x6
  170. #define SCFR1_PCI_DIV_MASK 0x00700000
  171. #define SCFR1_PCI_DIV_SHIFT 20
  172. /* SCFR2 System Clock Frequency Register 2
  173. */
  174. #define SCFR2_SYS_DIV 0xFC000000
  175. #define SCFR2_SYS_DIV_SHIFT 26
  176. /* SCCR - System Clock Control Registers
  177. */
  178. /* System Clock Control Register 1 commands */
  179. #define CLOCK_SCCR1_CFG_EN 0x80000000
  180. #define CLOCK_SCCR1_LPC_EN 0x40000000
  181. #define CLOCK_SCCR1_NFC_EN 0x20000000
  182. #define CLOCK_SCCR1_PATA_EN 0x10000000
  183. #define CLOCK_SCCR1_PSC_EN(cn) (0x08000000 >> (cn))
  184. #define CLOCK_SCCR1_PSCFIFO_EN 0x00008000
  185. #define CLOCK_SCCR1_SATA_EN 0x00004000
  186. #define CLOCK_SCCR1_FEC_EN 0x00002000
  187. #define CLOCK_SCCR1_TPR_EN 0x00001000
  188. #define CLOCK_SCCR1_PCI_EN 0x00000800
  189. #define CLOCK_SCCR1_DDR_EN 0x00000400
  190. /* System Clock Control Register 2 commands */
  191. #define CLOCK_SCCR2_DIU_EN 0x80000000
  192. #define CLOCK_SCCR2_AXE_EN 0x40000000
  193. #define CLOCK_SCCR2_MEM_EN 0x20000000
  194. #define CLOCK_SCCR2_USB2_EN 0x10000000
  195. #define CLOCK_SCCR2_USB1_EN 0x08000000
  196. #define CLOCK_SCCR2_I2C_EN 0x04000000
  197. #define CLOCK_SCCR2_BDLC_EN 0x02000000
  198. #define CLOCK_SCCR2_SDHC_EN 0x01000000
  199. #define CLOCK_SCCR2_SPDIF_EN 0x00800000
  200. #define CLOCK_SCCR2_MBX_BUS_EN 0x00400000
  201. #define CLOCK_SCCR2_MBX_EN 0x00200000
  202. #define CLOCK_SCCR2_MBX_3D_EN 0x00100000
  203. #define CLOCK_SCCR2_IIM_EN 0x00080000
  204. /* PSC FIFO Command values */
  205. #define PSC_FIFO_RESET_SLICE 0x80
  206. #define PSC_FIFO_ENABLE_SLICE 0x01
  207. /* PSC FIFO Controller Command values */
  208. #define FIFOC_ENABLE_CLOCK_GATE 0x01
  209. #define FIFOC_DISABLE_CLOCK_GATE 0x00
  210. /* PSC FIFO status */
  211. #define PSC_FIFO_EMPTY 0x01
  212. /* PSC Command values */
  213. #define PSC_RX_ENABLE 0x01
  214. #define PSC_RX_DISABLE 0x02
  215. #define PSC_TX_ENABLE 0x04
  216. #define PSC_TX_DISABLE 0x08
  217. #define PSC_SEL_MODE_REG_1 0x10
  218. #define PSC_RST_RX 0x20
  219. #define PSC_RST_TX 0x30
  220. #define PSC_RST_ERR_STAT 0x40
  221. #define PSC_RST_BRK_CHG_INT 0x50
  222. #define PSC_START_BRK 0x60
  223. #define PSC_STOP_BRK 0x70
  224. /* PSC status register bits */
  225. #define PSC_SR_CDE 0x0080
  226. #define PSC_SR_TXEMP 0x0800
  227. #define PSC_SR_OE 0x1000
  228. #define PSC_SR_PE 0x2000
  229. #define PSC_SR_FE 0x4000
  230. #define PSC_SR_RB 0x8000
  231. /* PSC mode fields */
  232. #define PSC_MODE_5_BITS 0x00
  233. #define PSC_MODE_6_BITS 0x01
  234. #define PSC_MODE_7_BITS 0x02
  235. #define PSC_MODE_8_BITS 0x03
  236. #define PSC_MODE_PAREVEN 0x00
  237. #define PSC_MODE_PARODD 0x04
  238. #define PSC_MODE_PARFORCE 0x08
  239. #define PSC_MODE_PARNONE 0x10
  240. #define PSC_MODE_ENTIMEOUT 0x20
  241. #define PSC_MODE_RXRTS 0x80
  242. #define PSC_MODE_1_STOPBIT 0x07
  243. /*
  244. * Centralized FIFO Controller has internal memory for all 12 PSCs FIFOs
  245. *
  246. * NOTE: individual PSC units are free to use whatever area (and size) of the
  247. * FIFOC internal memory, so make sure memory areas for FIFO slices used by
  248. * different PSCs do not overlap!
  249. *
  250. * Overall size of FIFOC memory is not documented in the MPC5121e RM, but
  251. * tests indicate that it is 1024 words total.
  252. */
  253. #define FIFOC_PSC0_TX_SIZE 0x0 /* number of 4-byte words for FIFO slice */
  254. #define FIFOC_PSC0_TX_ADDR 0x0
  255. #define FIFOC_PSC0_RX_SIZE 0x0
  256. #define FIFOC_PSC0_RX_ADDR 0x0
  257. #define FIFOC_PSC1_TX_SIZE 0x0
  258. #define FIFOC_PSC1_TX_ADDR 0x0
  259. #define FIFOC_PSC1_RX_SIZE 0x0
  260. #define FIFOC_PSC1_RX_ADDR 0x0
  261. #define FIFOC_PSC2_TX_SIZE 0x0
  262. #define FIFOC_PSC2_TX_ADDR 0x0
  263. #define FIFOC_PSC2_RX_SIZE 0x0
  264. #define FIFOC_PSC2_RX_ADDR 0x0
  265. #define FIFOC_PSC3_TX_SIZE 0x04
  266. #define FIFOC_PSC3_TX_ADDR 0x0
  267. #define FIFOC_PSC3_RX_SIZE 0x04
  268. #define FIFOC_PSC3_RX_ADDR 0x10
  269. #define FIFOC_PSC4_TX_SIZE 0x0
  270. #define FIFOC_PSC4_TX_ADDR 0x0
  271. #define FIFOC_PSC4_RX_SIZE 0x0
  272. #define FIFOC_PSC4_RX_ADDR 0x0
  273. #define FIFOC_PSC5_TX_SIZE 0x0
  274. #define FIFOC_PSC5_TX_ADDR 0x0
  275. #define FIFOC_PSC5_RX_SIZE 0x0
  276. #define FIFOC_PSC5_RX_ADDR 0x0
  277. #define FIFOC_PSC6_TX_SIZE 0x0
  278. #define FIFOC_PSC6_TX_ADDR 0x0
  279. #define FIFOC_PSC6_RX_SIZE 0x0
  280. #define FIFOC_PSC6_RX_ADDR 0x0
  281. #define FIFOC_PSC7_TX_SIZE 0x0
  282. #define FIFOC_PSC7_TX_ADDR 0x0
  283. #define FIFOC_PSC7_RX_SIZE 0x0
  284. #define FIFOC_PSC7_RX_ADDR 0x0
  285. #define FIFOC_PSC8_TX_SIZE 0x0
  286. #define FIFOC_PSC8_TX_ADDR 0x0
  287. #define FIFOC_PSC8_RX_SIZE 0x0
  288. #define FIFOC_PSC8_RX_ADDR 0x0
  289. #define FIFOC_PSC9_TX_SIZE 0x0
  290. #define FIFOC_PSC9_TX_ADDR 0x0
  291. #define FIFOC_PSC9_RX_SIZE 0x0
  292. #define FIFOC_PSC9_RX_ADDR 0x0
  293. #define FIFOC_PSC10_TX_SIZE 0x0
  294. #define FIFOC_PSC10_TX_ADDR 0x0
  295. #define FIFOC_PSC10_RX_SIZE 0x0
  296. #define FIFOC_PSC10_RX_ADDR 0x0
  297. #define FIFOC_PSC11_TX_SIZE 0x0
  298. #define FIFOC_PSC11_TX_ADDR 0x0
  299. #define FIFOC_PSC11_RX_SIZE 0x0
  300. #define FIFOC_PSC11_RX_ADDR 0x0
  301. /* IO Control Register
  302. */
  303. #define IOCTL_MEM 0x000
  304. #define IOCTL_GP 0x004
  305. #define IOCTL_LPC_CLK 0x008
  306. #define IOCTL_LPC_OE 0x00C
  307. #define IOCTL_LPC_RWB 0x010
  308. #define IOCTL_LPC_ACK 0x014
  309. #define IOCTL_LPC_CS0 0x018
  310. #define IOCTL_NFC_CE0 0x01C
  311. #define IOCTL_LPC_CS1 0x020
  312. #define IOCTL_LPC_CS2 0x024
  313. #define IOCTL_LPC_AX03 0x028
  314. #define IOCTL_EMB_AX02 0x02C
  315. #define IOCTL_EMB_AX01 0x030
  316. #define IOCTL_EMB_AX00 0x034
  317. #define IOCTL_EMB_AD31 0x038
  318. #define IOCTL_EMB_AD30 0x03C
  319. #define IOCTL_EMB_AD29 0x040
  320. #define IOCTL_EMB_AD28 0x044
  321. #define IOCTL_EMB_AD27 0x048
  322. #define IOCTL_EMB_AD26 0x04C
  323. #define IOCTL_EMB_AD25 0x050
  324. #define IOCTL_EMB_AD24 0x054
  325. #define IOCTL_EMB_AD23 0x058
  326. #define IOCTL_EMB_AD22 0x05C
  327. #define IOCTL_EMB_AD21 0x060
  328. #define IOCTL_EMB_AD20 0x064
  329. #define IOCTL_EMB_AD19 0x068
  330. #define IOCTL_EMB_AD18 0x06C
  331. #define IOCTL_EMB_AD17 0x070
  332. #define IOCTL_EMB_AD16 0x074
  333. #define IOCTL_EMB_AD15 0x078
  334. #define IOCTL_EMB_AD14 0x07C
  335. #define IOCTL_EMB_AD13 0x080
  336. #define IOCTL_EMB_AD12 0x084
  337. #define IOCTL_EMB_AD11 0x088
  338. #define IOCTL_EMB_AD10 0x08C
  339. #define IOCTL_EMB_AD09 0x090
  340. #define IOCTL_EMB_AD08 0x094
  341. #define IOCTL_EMB_AD07 0x098
  342. #define IOCTL_EMB_AD06 0x09C
  343. #define IOCTL_EMB_AD05 0x0A0
  344. #define IOCTL_EMB_AD04 0x0A4
  345. #define IOCTL_EMB_AD03 0x0A8
  346. #define IOCTL_EMB_AD02 0x0AC
  347. #define IOCTL_EMB_AD01 0x0B0
  348. #define IOCTL_EMB_AD00 0x0B4
  349. #define IOCTL_PATA_CE1 0x0B8
  350. #define IOCTL_PATA_CE2 0x0BC
  351. #define IOCTL_PATA_ISOLATE 0x0C0
  352. #define IOCTL_PATA_IOR 0x0C4
  353. #define IOCTL_PATA_IOW 0x0C8
  354. #define IOCTL_PATA_IOCHRDY 0x0CC
  355. #define IOCTL_PATA_INTRQ 0x0D0
  356. #define IOCTL_PATA_DRQ 0x0D4
  357. #define IOCTL_PATA_DACK 0x0D8
  358. #define IOCTL_NFC_WP 0x0DC
  359. #define IOCTL_NFC_RB 0x0E0
  360. #define IOCTL_NFC_ALE 0x0E4
  361. #define IOCTL_NFC_CLE 0x0E8
  362. #define IOCTL_NFC_WE 0x0EC
  363. #define IOCTL_NFC_RE 0x0F0
  364. #define IOCTL_PCI_AD31 0x0F4
  365. #define IOCTL_PCI_AD30 0x0F8
  366. #define IOCTL_PCI_AD29 0x0FC
  367. #define IOCTL_PCI_AD28 0x100
  368. #define IOCTL_PCI_AD27 0x104
  369. #define IOCTL_PCI_AD26 0x108
  370. #define IOCTL_PCI_AD25 0x10C
  371. #define IOCTL_PCI_AD24 0x110
  372. #define IOCTL_PCI_AD23 0x114
  373. #define IOCTL_PCI_AD22 0x118
  374. #define IOCTL_PCI_AD21 0x11C
  375. #define IOCTL_PCI_AD20 0x120
  376. #define IOCTL_PCI_AD19 0x124
  377. #define IOCTL_PCI_AD18 0x128
  378. #define IOCTL_PCI_AD17 0x12C
  379. #define IOCTL_PCI_AD16 0x130
  380. #define IOCTL_PCI_AD15 0x134
  381. #define IOCTL_PCI_AD14 0x138
  382. #define IOCTL_PCI_AD13 0x13C
  383. #define IOCTL_PCI_AD12 0x140
  384. #define IOCTL_PCI_AD11 0x144
  385. #define IOCTL_PCI_AD10 0x148
  386. #define IOCTL_PCI_AD09 0x14C
  387. #define IOCTL_PCI_AD08 0x150
  388. #define IOCTL_PCI_AD07 0x154
  389. #define IOCTL_PCI_AD06 0x158
  390. #define IOCTL_PCI_AD05 0x15C
  391. #define IOCTL_PCI_AD04 0x160
  392. #define IOCTL_PCI_AD03 0x164
  393. #define IOCTL_PCI_AD02 0x168
  394. #define IOCTL_PCI_AD01 0x16C
  395. #define IOCTL_PCI_AD00 0x170
  396. #define IOCTL_PCI_CBE0 0x174
  397. #define IOCTL_PCI_CBE1 0x178
  398. #define IOCTL_PCI_CBE2 0x17C
  399. #define IOCTL_PCI_CBE3 0x180
  400. #define IOCTL_PCI_GNT2 0x184
  401. #define IOCTL_PCI_REQ2 0x188
  402. #define IOCTL_PCI_GNT1 0x18C
  403. #define IOCTL_PCI_REQ1 0x190
  404. #define IOCTL_PCI_GNT0 0x194
  405. #define IOCTL_PCI_REQ0 0x198
  406. #define IOCTL_PCI_INTA 0x19C
  407. #define IOCTL_PCI_CLK 0x1A0
  408. #define IOCTL_PCI_RST_OUT 0x1A4
  409. #define IOCTL_PCI_FRAME 0x1A8
  410. #define IOCTL_PCI_IDSEL 0x1AC
  411. #define IOCTL_PCI_DEVSEL 0x1B0
  412. #define IOCTL_PCI_IRDY 0x1B4
  413. #define IOCTL_PCI_TRDY 0x1B8
  414. #define IOCTL_PCI_STOP 0x1BC
  415. #define IOCTL_PCI_PAR 0x1C0
  416. #define IOCTL_PCI_PERR 0x1C4
  417. #define IOCTL_PCI_SERR 0x1C8
  418. #define IOCTL_SPDIF_TXCLK 0x1CC
  419. #define IOCTL_SPDIF_TX 0x1D0
  420. #define IOCTL_SPDIF_RX 0x1D4
  421. #define IOCTL_I2C0_SCL 0x1D8
  422. #define IOCTL_I2C0_SDA 0x1DC
  423. #define IOCTL_I2C1_SCL 0x1E0
  424. #define IOCTL_I2C1_SDA 0x1E4
  425. #define IOCTL_I2C2_SCL 0x1E8
  426. #define IOCTL_I2C2_SDA 0x1EC
  427. #define IOCTL_IRQ0 0x1F0
  428. #define IOCTL_IRQ1 0x1F4
  429. #define IOCTL_CAN1_TX 0x1F8
  430. #define IOCTL_CAN2_TX 0x1FC
  431. #define IOCTL_J1850_TX 0x200
  432. #define IOCTL_J1850_RX 0x204
  433. #define IOCTL_PSC_MCLK_IN 0x208
  434. #define IOCTL_PSC0_0 0x20C
  435. #define IOCTL_PSC0_1 0x210
  436. #define IOCTL_PSC0_2 0x214
  437. #define IOCTL_PSC0_3 0x218
  438. #define IOCTL_PSC0_4 0x21C
  439. #define IOCTL_PSC1_0 0x220
  440. #define IOCTL_PSC1_1 0x224
  441. #define IOCTL_PSC1_2 0x228
  442. #define IOCTL_PSC1_3 0x22C
  443. #define IOCTL_PSC1_4 0x230
  444. #define IOCTL_PSC2_0 0x234
  445. #define IOCTL_PSC2_1 0x238
  446. #define IOCTL_PSC2_2 0x23C
  447. #define IOCTL_PSC2_3 0x240
  448. #define IOCTL_PSC2_4 0x244
  449. #define IOCTL_PSC3_0 0x248
  450. #define IOCTL_PSC3_1 0x24C
  451. #define IOCTL_PSC3_2 0x250
  452. #define IOCTL_PSC3_3 0x254
  453. #define IOCTL_PSC3_4 0x258
  454. #define IOCTL_PSC4_0 0x25C
  455. #define IOCTL_PSC4_1 0x260
  456. #define IOCTL_PSC4_2 0x264
  457. #define IOCTL_PSC4_3 0x268
  458. #define IOCTL_PSC4_4 0x26C
  459. #define IOCTL_PSC5_0 0x270
  460. #define IOCTL_PSC5_1 0x274
  461. #define IOCTL_PSC5_2 0x278
  462. #define IOCTL_PSC5_3 0x27C
  463. #define IOCTL_PSC5_4 0x280
  464. #define IOCTL_PSC6_0 0x284
  465. #define IOCTL_PSC6_1 0x288
  466. #define IOCTL_PSC6_2 0x28C
  467. #define IOCTL_PSC6_3 0x290
  468. #define IOCTL_PSC6_4 0x294
  469. #define IOCTL_PSC7_0 0x298
  470. #define IOCTL_PSC7_1 0x29C
  471. #define IOCTL_PSC7_2 0x2A0
  472. #define IOCTL_PSC7_3 0x2A4
  473. #define IOCTL_PSC7_4 0x2A8
  474. #define IOCTL_PSC8_0 0x2AC
  475. #define IOCTL_PSC8_1 0x2B0
  476. #define IOCTL_PSC8_2 0x2B4
  477. #define IOCTL_PSC8_3 0x2B8
  478. #define IOCTL_PSC8_4 0x2BC
  479. #define IOCTL_PSC9_0 0x2C0
  480. #define IOCTL_PSC9_1 0x2C4
  481. #define IOCTL_PSC9_2 0x2C8
  482. #define IOCTL_PSC9_3 0x2CC
  483. #define IOCTL_PSC9_4 0x2D0
  484. #define IOCTL_PSC10_0 0x2D4
  485. #define IOCTL_PSC10_1 0x2D8
  486. #define IOCTL_PSC10_2 0x2DC
  487. #define IOCTL_PSC10_3 0x2E0
  488. #define IOCTL_PSC10_4 0x2E4
  489. #define IOCTL_PSC11_0 0x2E8
  490. #define IOCTL_PSC11_1 0x2EC
  491. #define IOCTL_PSC11_2 0x2F0
  492. #define IOCTL_PSC11_3 0x2F4
  493. #define IOCTL_PSC11_4 0x2F8
  494. #define IOCTL_HRESET 0x2FC
  495. #define IOCTL_SRESET 0x300
  496. #define IOCTL_CKSTP_OUT 0x304
  497. #define IOCTL_USB2_VBUS_PWR_FAULT 0x308
  498. #define IOCTL_USB2_VBUS_PWR_SELECT 0x30C
  499. #define IOCTL_USB2_PHY_DRVV_BUS 0x310
  500. #ifndef __ASSEMBLY__
  501. /* IO pin fields */
  502. #define IO_PIN_FMUX(v) ((v) << 7) /* pin function */
  503. #define IO_PIN_HOLD(v) ((v) << 5) /* hold time, pci only */
  504. #define IO_PIN_PUD(v) ((v) << 4) /* if PUE, 0=pull-down, 1=pull-up */
  505. #define IO_PIN_PUE(v) ((v) << 3) /* pull up/down enable */
  506. #define IO_PIN_ST(v) ((v) << 2) /* schmitt trigger */
  507. #define IO_PIN_DS(v) ((v)) /* slew rate */
  508. typedef struct iopin_t {
  509. int p_offset; /* offset from IOCTL_MEM_OFFSET */
  510. int nr_pins; /* number of pins to set this way */
  511. int bit_or; /* or in the value instead of overwrite */
  512. u_long val; /* value to write or or */
  513. }iopin_t;
  514. void iopin_initialize(iopin_t *,int);
  515. #endif
  516. /* Indexes in regs array */
  517. /* Set for DDR */
  518. #define IOCTRL_MUX_DDR 0x00000036
  519. /* Register Offset Base */
  520. #define MPC512X_FEC (CONFIG_SYS_IMMR + 0x02800)
  521. #define MPC512X_PATA (CONFIG_SYS_IMMR + 0x10200)
  522. /* IIM control */
  523. #define IIM_SET_UA(bk, f) ((bk << 3) | (f >> 5))
  524. #define IIM_SET_LA(f, bit) (((f & 0x0000001f) << 3) | bit)
  525. #define IIM_STAT_BUSY 0x00000080
  526. #define IIM_STAT_PRGD 0x00000002
  527. #define IIM_STAT_SNSD 0x00000001
  528. #define IIM_ERR_WPE 0x00000040
  529. #define IIM_ERR_OPE 0x00000020
  530. #define IIM_ERR_RPE 0x00000010
  531. #define IIM_ERR_WLRE 0x00000008
  532. #define IIM_ERR_SNSE 0x00000004
  533. #define IIM_ERR_PARITYE 0x00000002
  534. #define IIM_PRG_P_SET 0x000000aa
  535. #define IIM_PRG_P_UNSET 0
  536. #define IIM_FCTL_PROG_PULSE 0x00000020
  537. #define IIM_FCTL_PROG 0x00000001
  538. #define IIM_FCTL_ESNS_N 0x00000008
  539. #define IIM_FBAC_FBWP 0x00000080
  540. #define IIM_FBAC_FBOP 0x00000040
  541. #define IIM_FBAC_FBRP 0x00000020
  542. #define IIM_FBAC_FBESP 0x00000008
  543. #define IIM_PROTECTION 0x000000e8
  544. #define IIM_FMAX 31
  545. /* Number of I2C buses */
  546. #define I2C_BUS_CNT 3
  547. /* I2Cn control register bits */
  548. #define I2C_EN 0x80
  549. #define I2C_IEN 0x40
  550. #define I2C_STA 0x20
  551. #define I2C_TX 0x10
  552. #define I2C_TXAK 0x08
  553. #define I2C_RSTA 0x04
  554. #define I2C_INIT_MASK (I2C_EN | I2C_STA | I2C_TX | I2C_RSTA)
  555. /* I2Cn status register bits */
  556. #define I2C_CF 0x80
  557. #define I2C_AAS 0x40
  558. #define I2C_BB 0x20
  559. #define I2C_AL 0x10
  560. #define I2C_SRW 0x04
  561. #define I2C_IF 0x02
  562. #define I2C_RXAK 0x01
  563. /* POTAR - PCI Outbound Translation Address Register
  564. */
  565. #define POTAR_TA_MASK 0x000fffff
  566. /* POBAR - PCI Outbound Base Address Register
  567. */
  568. #define POBAR_BA_MASK 0x000fffff
  569. /* POCMR - PCI Outbound Comparision Mask Register
  570. */
  571. #define POCMR_EN 0x80000000
  572. #define POCMR_IO 0x40000000 /* 0-memory space 1-I/O space */
  573. #define POCMR_PRE 0x20000000 /* prefetch enable */
  574. #define POCMR_SBS 0x00100000 /* special byte swap enable */
  575. #define POCMR_CM_MASK 0x000fffff
  576. #define POCMR_CM_4G 0x00000000
  577. #define POCMR_CM_2G 0x00080000
  578. #define POCMR_CM_1G 0x000C0000
  579. #define POCMR_CM_512M 0x000E0000
  580. #define POCMR_CM_256M 0x000F0000
  581. #define POCMR_CM_128M 0x000F8000
  582. #define POCMR_CM_64M 0x000FC000
  583. #define POCMR_CM_32M 0x000FE000
  584. #define POCMR_CM_16M 0x000FF000
  585. #define POCMR_CM_8M 0x000FF800
  586. #define POCMR_CM_4M 0x000FFC00
  587. #define POCMR_CM_2M 0x000FFE00
  588. #define POCMR_CM_1M 0x000FFF00
  589. #define POCMR_CM_512K 0x000FFF80
  590. #define POCMR_CM_256K 0x000FFFC0
  591. #define POCMR_CM_128K 0x000FFFE0
  592. #define POCMR_CM_64K 0x000FFFF0
  593. #define POCMR_CM_32K 0x000FFFF8
  594. #define POCMR_CM_16K 0x000FFFFC
  595. #define POCMR_CM_8K 0x000FFFFE
  596. #define POCMR_CM_4K 0x000FFFFF
  597. /* PITAR - PCI Inbound Translation Address Register
  598. */
  599. #define PITAR_TA_MASK 0x000fffff
  600. /* PIBAR - PCI Inbound Base/Extended Address Register
  601. */
  602. #define PIBAR_MASK 0xffffffff
  603. #define PIEBAR_EBA_MASK 0x000fffff
  604. /* PIWAR - PCI Inbound Windows Attributes Register
  605. */
  606. #define PIWAR_EN 0x80000000
  607. #define PIWAR_SBS 0x40000000
  608. #define PIWAR_PF 0x20000000
  609. #define PIWAR_RTT_MASK 0x000f0000
  610. #define PIWAR_RTT_NO_SNOOP 0x00040000
  611. #define PIWAR_RTT_SNOOP 0x00050000
  612. #define PIWAR_WTT_MASK 0x0000f000
  613. #define PIWAR_WTT_NO_SNOOP 0x00004000
  614. #define PIWAR_WTT_SNOOP 0x00005000
  615. #define PIWAR_IWS_MASK 0x0000003F
  616. #define PIWAR_IWS_4K 0x0000000B
  617. #define PIWAR_IWS_8K 0x0000000C
  618. #define PIWAR_IWS_16K 0x0000000D
  619. #define PIWAR_IWS_32K 0x0000000E
  620. #define PIWAR_IWS_64K 0x0000000F
  621. #define PIWAR_IWS_128K 0x00000010
  622. #define PIWAR_IWS_256K 0x00000011
  623. #define PIWAR_IWS_512K 0x00000012
  624. #define PIWAR_IWS_1M 0x00000013
  625. #define PIWAR_IWS_2M 0x00000014
  626. #define PIWAR_IWS_4M 0x00000015
  627. #define PIWAR_IWS_8M 0x00000016
  628. #define PIWAR_IWS_16M 0x00000017
  629. #define PIWAR_IWS_32M 0x00000018
  630. #define PIWAR_IWS_64M 0x00000019
  631. #define PIWAR_IWS_128M 0x0000001A
  632. #define PIWAR_IWS_256M 0x0000001B
  633. #define PIWAR_IWS_512M 0x0000001C
  634. #define PIWAR_IWS_1G 0x0000001D
  635. #define PIWAR_IWS_2G 0x0000001E
  636. #endif /* __MPC512X_H__ */