ppc405.h 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272
  1. /*----------------------------------------------------------------------------+
  2. |
  3. | This source code has been made available to you by IBM on an AS-IS
  4. | basis. Anyone receiving this source is licensed under IBM
  5. | copyrights to use it in any way he or she deems fit, including
  6. | copying it, modifying it, compiling it, and redistributing it either
  7. | with or without modifications. No license under IBM patents or
  8. | patent applications is to be implied by the copyright license.
  9. |
  10. | Any user of this software should understand that IBM cannot provide
  11. | technical support for this software and will not be responsible for
  12. | any consequences resulting from the use of this software.
  13. |
  14. | Any person who transfers this source code or any derivative work
  15. | must include the IBM copyright notice, this paragraph, and the
  16. | preceding two paragraphs in the transferred software.
  17. |
  18. | COPYRIGHT I B M CORPORATION 1999
  19. | LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
  20. +----------------------------------------------------------------------------*/
  21. #ifndef __PPC405_H__
  22. #define __PPC405_H__
  23. /*--------------------------------------------------------------------- */
  24. /* Special Purpose Registers */
  25. /*--------------------------------------------------------------------- */
  26. #define srr2 0x3de /* save/restore register 2 */
  27. #define srr3 0x3df /* save/restore register 3 */
  28. /*
  29. * 405 does not really have CSRR0/1 but SRR2/3 are used during critical
  30. * exception for the exact same purposes - let's alias them and have a
  31. * common handling in crit_return() and CRIT_EXCEPTION
  32. */
  33. #define csrr0 srr2
  34. #define csrr1 srr3
  35. #define dbsr 0x3f0 /* debug status register */
  36. #define dbcr0 0x3f2 /* debug control register 0 */
  37. #define dbcr1 0x3bd /* debug control register 1 */
  38. #define iac1 0x3f4 /* instruction address comparator 1 */
  39. #define iac2 0x3f5 /* instruction address comparator 2 */
  40. #define iac3 0x3b4 /* instruction address comparator 3 */
  41. #define iac4 0x3b5 /* instruction address comparator 4 */
  42. #define dac1 0x3f6 /* data address comparator 1 */
  43. #define dac2 0x3f7 /* data address comparator 2 */
  44. #define dccr 0x3fa /* data cache control register */
  45. #define iccr 0x3fb /* instruction cache control register */
  46. #define esr 0x3d4 /* execption syndrome register */
  47. #define dear 0x3d5 /* data exeption address register */
  48. #define evpr 0x3d6 /* exeption vector prefix register */
  49. #define tsr 0x3d8 /* timer status register */
  50. #define tcr 0x3da /* timer control register */
  51. #define pit 0x3db /* programmable interval timer */
  52. #define sgr 0x3b9 /* storage guarded reg */
  53. #define dcwr 0x3ba /* data cache write-thru reg*/
  54. #define sler 0x3bb /* storage little-endian reg */
  55. #define cdbcr 0x3d7 /* cache debug cntrl reg */
  56. #define icdbdr 0x3d3 /* instr cache dbug data reg*/
  57. #define ccr0 0x3b3 /* core configuration register */
  58. #define dvc1 0x3b6 /* data value compare register 1 */
  59. #define dvc2 0x3b7 /* data value compare register 2 */
  60. #define pid 0x3b1 /* process ID */
  61. #define su0r 0x3bc /* storage user-defined register 0 */
  62. #define zpr 0x3b0 /* zone protection regsiter */
  63. #define tbl 0x11c /* time base lower - privileged write */
  64. #define tbu 0x11d /* time base upper - privileged write */
  65. #define sprg4r 0x104 /* Special purpose general 4 - read only */
  66. #define sprg5r 0x105 /* Special purpose general 5 - read only */
  67. #define sprg6r 0x106 /* Special purpose general 6 - read only */
  68. #define sprg7r 0x107 /* Special purpose general 7 - read only */
  69. #define sprg4w 0x114 /* Special purpose general 4 - write only */
  70. #define sprg5w 0x115 /* Special purpose general 5 - write only */
  71. #define sprg6w 0x116 /* Special purpose general 6 - write only */
  72. #define sprg7w 0x117 /* Special purpose general 7 - write only */
  73. /******************************************************************************
  74. * Special for PPC405GP
  75. ******************************************************************************/
  76. /******************************************************************************
  77. * DMA
  78. ******************************************************************************/
  79. #define DMA_DCR_BASE 0x100
  80. #define dmacr0 (DMA_DCR_BASE+0x00) /* DMA channel control register 0 */
  81. #define dmact0 (DMA_DCR_BASE+0x01) /* DMA count register 0 */
  82. #define dmada0 (DMA_DCR_BASE+0x02) /* DMA destination address register 0 */
  83. #define dmasa0 (DMA_DCR_BASE+0x03) /* DMA source address register 0 */
  84. #define dmasb0 (DMA_DCR_BASE+0x04) /* DMA scatter/gather descriptor addr 0 */
  85. #define dmacr1 (DMA_DCR_BASE+0x08) /* DMA channel control register 1 */
  86. #define dmact1 (DMA_DCR_BASE+0x09) /* DMA count register 1 */
  87. #define dmada1 (DMA_DCR_BASE+0x0a) /* DMA destination address register 1 */
  88. #define dmasa1 (DMA_DCR_BASE+0x0b) /* DMA source address register 1 */
  89. #define dmasb1 (DMA_DCR_BASE+0x0c) /* DMA scatter/gather descriptor addr 1 */
  90. #define dmacr2 (DMA_DCR_BASE+0x10) /* DMA channel control register 2 */
  91. #define dmact2 (DMA_DCR_BASE+0x11) /* DMA count register 2 */
  92. #define dmada2 (DMA_DCR_BASE+0x12) /* DMA destination address register 2 */
  93. #define dmasa2 (DMA_DCR_BASE+0x13) /* DMA source address register 2 */
  94. #define dmasb2 (DMA_DCR_BASE+0x14) /* DMA scatter/gather descriptor addr 2 */
  95. #define dmacr3 (DMA_DCR_BASE+0x18) /* DMA channel control register 3 */
  96. #define dmact3 (DMA_DCR_BASE+0x19) /* DMA count register 3 */
  97. #define dmada3 (DMA_DCR_BASE+0x1a) /* DMA destination address register 3 */
  98. #define dmasa3 (DMA_DCR_BASE+0x1b) /* DMA source address register 3 */
  99. #define dmasb3 (DMA_DCR_BASE+0x1c) /* DMA scatter/gather descriptor addr 3 */
  100. #define dmasr (DMA_DCR_BASE+0x20) /* DMA status register */
  101. #define dmasgc (DMA_DCR_BASE+0x23) /* DMA scatter/gather command register */
  102. #define dmaadr (DMA_DCR_BASE+0x24) /* DMA address decode register */
  103. /******************************************************************************
  104. * Universal interrupt controller
  105. ******************************************************************************/
  106. #define UIC_DCR_BASE 0xc0
  107. #define uicsr (UIC_DCR_BASE+0x0) /* UIC status */
  108. #define uicsrs (UIC_DCR_BASE+0x1) /* UIC status set */
  109. #define uicer (UIC_DCR_BASE+0x2) /* UIC enable */
  110. #define uiccr (UIC_DCR_BASE+0x3) /* UIC critical */
  111. #define uicpr (UIC_DCR_BASE+0x4) /* UIC polarity */
  112. #define uictr (UIC_DCR_BASE+0x5) /* UIC triggering */
  113. #define uicmsr (UIC_DCR_BASE+0x6) /* UIC masked status */
  114. #define uicvr (UIC_DCR_BASE+0x7) /* UIC vector */
  115. #define uicvcr (UIC_DCR_BASE+0x8) /* UIC vector configuration */
  116. /*-----------------------------------------------------------------------------+
  117. | Universal interrupt controller interrupts
  118. +-----------------------------------------------------------------------------*/
  119. #if defined(CONFIG_405EZ)
  120. #define UIC_DMA0 0x80000000 /* DMA chan. 0 */
  121. #define UIC_DMA1 0x40000000 /* DMA chan. 1 */
  122. #define UIC_DMA2 0x20000000 /* DMA chan. 2 */
  123. #define UIC_DMA3 0x10000000 /* DMA chan. 3 */
  124. #define UIC_1588 0x08000000 /* IEEE 1588 network synchronization */
  125. #define UIC_UART0 0x04000000 /* UART 0 */
  126. #define UIC_UART1 0x02000000 /* UART 1 */
  127. #define UIC_CAN0 0x01000000 /* CAN 0 */
  128. #define UIC_CAN1 0x00800000 /* CAN 1 */
  129. #define UIC_SPI 0x00400000 /* SPI */
  130. #define UIC_IIC 0x00200000 /* IIC */
  131. #define UIC_CHT0 0x00100000 /* Chameleon timer high pri interrupt */
  132. #define UIC_CHT1 0x00080000 /* Chameleon timer high pri interrupt */
  133. #define UIC_USBH1 0x00040000 /* USB Host 1 */
  134. #define UIC_USBH2 0x00020000 /* USB Host 2 */
  135. #define UIC_USBDEV 0x00010000 /* USB Device */
  136. #define UIC_ENET 0x00008000 /* Ethernet interrupt status */
  137. #define UIC_ENET1 0x00008000 /* dummy define */
  138. #define UIC_EMAC_WAKE 0x00004000 /* EMAC wake up */
  139. #define UIC_MADMAL 0x00002000 /* Logical OR of following MadMAL int */
  140. #define UIC_MAL_SERR 0x00002000 /* MAL SERR */
  141. #define UIC_MAL_TXDE 0x00002000 /* MAL TXDE */
  142. #define UIC_MAL_RXDE 0x00002000 /* MAL RXDE */
  143. #define UIC_MAL_TXEOB 0x00001000 /* MAL TXEOB */
  144. #define UIC_MAL_TXEOB1 0x00000800 /* MAL TXEOB1 */
  145. #define UIC_MAL_RXEOB 0x00000400 /* MAL RXEOB */
  146. #define UIC_NAND 0x00000200 /* NAND Flash controller */
  147. #define UIC_ADC 0x00000100 /* ADC */
  148. #define UIC_DAC 0x00000080 /* DAC */
  149. #define UIC_OPB2PLB 0x00000040 /* OPB to PLB bridge interrupt */
  150. #define UIC_RESERVED0 0x00000020 /* Reserved */
  151. #define UIC_EXT0 0x00000010 /* External interrupt 0 */
  152. #define UIC_EXT1 0x00000008 /* External interrupt 1 */
  153. #define UIC_EXT2 0x00000004 /* External interrupt 2 */
  154. #define UIC_EXT3 0x00000002 /* External interrupt 3 */
  155. #define UIC_EXT4 0x00000001 /* External interrupt 4 */
  156. #else /* !defined(CONFIG_405EZ) */
  157. #define UIC_UART0 0x80000000 /* UART 0 */
  158. #define UIC_UART1 0x40000000 /* UART 1 */
  159. #define UIC_IIC 0x20000000 /* IIC */
  160. #define UIC_EXT_MAST 0x10000000 /* External Master */
  161. #define UIC_PCI 0x08000000 /* PCI write to command reg */
  162. #define UIC_DMA0 0x04000000 /* DMA chan. 0 */
  163. #define UIC_DMA1 0x02000000 /* DMA chan. 1 */
  164. #define UIC_DMA2 0x01000000 /* DMA chan. 2 */
  165. #define UIC_DMA3 0x00800000 /* DMA chan. 3 */
  166. #define UIC_EMAC_WAKE 0x00400000 /* EMAC wake up */
  167. #define UIC_MAL_SERR 0x00200000 /* MAL SERR */
  168. #define UIC_MAL_TXEOB 0x00100000 /* MAL TXEOB */
  169. #define UIC_MAL_RXEOB 0x00080000 /* MAL RXEOB */
  170. #define UIC_MAL_TXDE 0x00040000 /* MAL TXDE */
  171. #define UIC_MAL_RXDE 0x00020000 /* MAL RXDE */
  172. #define UIC_ENET 0x00010000 /* Ethernet0 */
  173. #define UIC_ENET1 0x00004000 /* Ethernet1 on 405EP */
  174. #define UIC_ECC_CE 0x00004000 /* ECC Correctable Error on 405GP */
  175. #define UIC_EXT_PCI_SERR 0x00008000 /* External PCI SERR# */
  176. #define UIC_PCI_PM 0x00002000 /* PCI Power Management */
  177. #define UIC_EXT0 0x00000040 /* External interrupt 0 */
  178. #define UIC_EXT1 0x00000020 /* External interrupt 1 */
  179. #define UIC_EXT2 0x00000010 /* External interrupt 2 */
  180. #define UIC_EXT3 0x00000008 /* External interrupt 3 */
  181. #define UIC_EXT4 0x00000004 /* External interrupt 4 */
  182. #define UIC_EXT5 0x00000002 /* External interrupt 5 */
  183. #define UIC_EXT6 0x00000001 /* External interrupt 6 */
  184. #endif /* defined(CONFIG_405EZ) */
  185. /******************************************************************************
  186. * SDRAM Controller
  187. ******************************************************************************/
  188. #define SDRAM_DCR_BASE 0x10
  189. #define memcfga (SDRAM_DCR_BASE+0x0) /* Memory configuration address reg */
  190. #define memcfgd (SDRAM_DCR_BASE+0x1) /* Memory configuration data reg */
  191. /* values for memcfga register - indirect addressing of these regs */
  192. #ifndef CONFIG_405EP
  193. #define mem_besra 0x00 /* bus error syndrome reg a */
  194. #define mem_besrsa 0x04 /* bus error syndrome reg set a */
  195. #define mem_besrb 0x08 /* bus error syndrome reg b */
  196. #define mem_besrsb 0x0c /* bus error syndrome reg set b */
  197. #define mem_bear 0x10 /* bus error address reg */
  198. #endif
  199. #define mem_mcopt1 0x20 /* memory controller options 1 */
  200. #define mem_status 0x24 /* memory status */
  201. #define mem_rtr 0x30 /* refresh timer reg */
  202. #define mem_pmit 0x34 /* power management idle timer */
  203. #define mem_mb0cf 0x40 /* memory bank 0 configuration */
  204. #define mem_mb1cf 0x44 /* memory bank 1 configuration */
  205. #ifndef CONFIG_405EP
  206. #define mem_mb2cf 0x48 /* memory bank 2 configuration */
  207. #define mem_mb3cf 0x4c /* memory bank 3 configuration */
  208. #endif
  209. #define mem_sdtr1 0x80 /* timing reg 1 */
  210. #ifndef CONFIG_405EP
  211. #define mem_ecccf 0x94 /* ECC configuration */
  212. #define mem_eccerr 0x98 /* ECC error status */
  213. #endif
  214. #ifndef CONFIG_405EP
  215. /******************************************************************************
  216. * Decompression Controller
  217. ******************************************************************************/
  218. #define DECOMP_DCR_BASE 0x14
  219. #define kiar (DECOMP_DCR_BASE+0x0) /* Decompression controller addr reg */
  220. #define kidr (DECOMP_DCR_BASE+0x1) /* Decompression controller data reg */
  221. /* values for kiar register - indirect addressing of these regs */
  222. #define kitor0 0x00 /* index table origin register 0 */
  223. #define kitor1 0x01 /* index table origin register 1 */
  224. #define kitor2 0x02 /* index table origin register 2 */
  225. #define kitor3 0x03 /* index table origin register 3 */
  226. #define kaddr0 0x04 /* address decode definition regsiter 0 */
  227. #define kaddr1 0x05 /* address decode definition regsiter 1 */
  228. #define kconf 0x40 /* decompression core config register */
  229. #define kid 0x41 /* decompression core ID register */
  230. #define kver 0x42 /* decompression core version # reg */
  231. #define kpear 0x50 /* bus error addr reg (PLB addr) */
  232. #define kbear 0x51 /* bus error addr reg (DCP to EBIU addr)*/
  233. #define kesr0 0x52 /* bus error status reg 0 (R/clear) */
  234. #define kesr0s 0x53 /* bus error status reg 0 (set) */
  235. /* There are 0x400 of the following registers, from krom0 to krom3ff*/
  236. /* Only the first one is given here. */
  237. #define krom0 0x400 /* SRAM/ROM read/write */
  238. #endif
  239. /******************************************************************************
  240. * Power Management
  241. ******************************************************************************/
  242. #define POWERMAN_DCR_BASE 0xb8
  243. #define cpmsr (POWERMAN_DCR_BASE+0x0) /* Power management status */
  244. #define cpmer (POWERMAN_DCR_BASE+0x1) /* Power management enable */
  245. #define cpmfr (POWERMAN_DCR_BASE+0x2) /* Power management force */
  246. /******************************************************************************
  247. * Extrnal Bus Controller
  248. ******************************************************************************/
  249. #define EBC_DCR_BASE 0x12
  250. #define ebccfga (EBC_DCR_BASE+0x0) /* External bus controller addr reg */
  251. #define ebccfgd (EBC_DCR_BASE+0x1) /* External bus controller data reg */
  252. /* values for ebccfga register - indirect addressing of these regs */
  253. #define pb0cr 0x00 /* periph bank 0 config reg */
  254. #define pb1cr 0x01 /* periph bank 1 config reg */
  255. #define pb2cr 0x02 /* periph bank 2 config reg */
  256. #define pb3cr 0x03 /* periph bank 3 config reg */
  257. #define pb4cr 0x04 /* periph bank 4 config reg */
  258. #ifndef CONFIG_405EP
  259. #define pb5cr 0x05 /* periph bank 5 config reg */
  260. #define pb6cr 0x06 /* periph bank 6 config reg */
  261. #define pb7cr 0x07 /* periph bank 7 config reg */
  262. #endif
  263. #define pb0ap 0x10 /* periph bank 0 access parameters */
  264. #define pb1ap 0x11 /* periph bank 1 access parameters */
  265. #define pb2ap 0x12 /* periph bank 2 access parameters */
  266. #define pb3ap 0x13 /* periph bank 3 access parameters */
  267. #define pb4ap 0x14 /* periph bank 4 access parameters */
  268. #ifndef CONFIG_405EP
  269. #define pb5ap 0x15 /* periph bank 5 access parameters */
  270. #define pb6ap 0x16 /* periph bank 6 access parameters */
  271. #define pb7ap 0x17 /* periph bank 7 access parameters */
  272. #endif
  273. #define pbear 0x20 /* periph bus error addr reg */
  274. #define pbesr0 0x21 /* periph bus error status reg 0 */
  275. #define pbesr1 0x22 /* periph bus error status reg 1 */
  276. #define epcr 0x23 /* external periph control reg */
  277. #define EBC0_CFG 0x23 /* external bus configuration reg */
  278. #ifdef CONFIG_405EP
  279. /******************************************************************************
  280. * Control
  281. ******************************************************************************/
  282. #define CNTRL_DCR_BASE 0x0f0
  283. #define cpc0_pllmr0 (CNTRL_DCR_BASE+0x0) /* PLL mode register 0 */
  284. #define cpc0_boot (CNTRL_DCR_BASE+0x1) /* Clock status register */
  285. #define cpc0_epctl (CNTRL_DCR_BASE+0x3) /* EMAC to PHY control register */
  286. #define cpc0_pllmr1 (CNTRL_DCR_BASE+0x4) /* PLL mode register 1 */
  287. #define cpc0_ucr (CNTRL_DCR_BASE+0x5) /* UART control register */
  288. #define cpc0_pci (CNTRL_DCR_BASE+0x9) /* PCI control register */
  289. #define CPC0_PLLMR0 (CNTRL_DCR_BASE+0x0) /* PLL mode 0 register */
  290. #define CPC0_BOOT (CNTRL_DCR_BASE+0x1) /* Chip Clock Status register */
  291. #define CPC0_CR1 (CNTRL_DCR_BASE+0x2) /* Chip Control 1 register */
  292. #define CPC0_EPRCSR (CNTRL_DCR_BASE+0x3) /* EMAC PHY Rcv Clk Src register*/
  293. #define CPC0_PLLMR1 (CNTRL_DCR_BASE+0x4) /* PLL mode 1 register */
  294. #define CPC0_UCR (CNTRL_DCR_BASE+0x5) /* UART Control register */
  295. #define CPC0_SRR (CNTRL_DCR_BASE+0x6) /* Soft Reset register */
  296. #define CPC0_JTAGID (CNTRL_DCR_BASE+0x7) /* JTAG ID register */
  297. #define CPC0_SPARE (CNTRL_DCR_BASE+0x8) /* Spare DCR */
  298. #define CPC0_PCI (CNTRL_DCR_BASE+0x9) /* PCI Control register */
  299. /* Bit definitions */
  300. #define PLLMR0_CPU_DIV_MASK 0x00300000 /* CPU clock divider */
  301. #define PLLMR0_CPU_DIV_BYPASS 0x00000000
  302. #define PLLMR0_CPU_DIV_2 0x00100000
  303. #define PLLMR0_CPU_DIV_3 0x00200000
  304. #define PLLMR0_CPU_DIV_4 0x00300000
  305. #define PLLMR0_CPU_TO_PLB_MASK 0x00030000 /* CPU:PLB Frequency Divisor */
  306. #define PLLMR0_CPU_PLB_DIV_1 0x00000000
  307. #define PLLMR0_CPU_PLB_DIV_2 0x00010000
  308. #define PLLMR0_CPU_PLB_DIV_3 0x00020000
  309. #define PLLMR0_CPU_PLB_DIV_4 0x00030000
  310. #define PLLMR0_OPB_TO_PLB_MASK 0x00003000 /* OPB:PLB Frequency Divisor */
  311. #define PLLMR0_OPB_PLB_DIV_1 0x00000000
  312. #define PLLMR0_OPB_PLB_DIV_2 0x00001000
  313. #define PLLMR0_OPB_PLB_DIV_3 0x00002000
  314. #define PLLMR0_OPB_PLB_DIV_4 0x00003000
  315. #define PLLMR0_EXB_TO_PLB_MASK 0x00000300 /* External Bus:PLB Divisor */
  316. #define PLLMR0_EXB_PLB_DIV_2 0x00000000
  317. #define PLLMR0_EXB_PLB_DIV_3 0x00000100
  318. #define PLLMR0_EXB_PLB_DIV_4 0x00000200
  319. #define PLLMR0_EXB_PLB_DIV_5 0x00000300
  320. #define PLLMR0_MAL_TO_PLB_MASK 0x00000030 /* MAL:PLB Divisor */
  321. #define PLLMR0_MAL_PLB_DIV_1 0x00000000
  322. #define PLLMR0_MAL_PLB_DIV_2 0x00000010
  323. #define PLLMR0_MAL_PLB_DIV_3 0x00000020
  324. #define PLLMR0_MAL_PLB_DIV_4 0x00000030
  325. #define PLLMR0_PCI_TO_PLB_MASK 0x00000003 /* PCI:PLB Frequency Divisor */
  326. #define PLLMR0_PCI_PLB_DIV_1 0x00000000
  327. #define PLLMR0_PCI_PLB_DIV_2 0x00000001
  328. #define PLLMR0_PCI_PLB_DIV_3 0x00000002
  329. #define PLLMR0_PCI_PLB_DIV_4 0x00000003
  330. #define PLLMR1_SSCS_MASK 0x80000000 /* Select system clock source */
  331. #define PLLMR1_PLLR_MASK 0x40000000 /* PLL reset */
  332. #define PLLMR1_FBMUL_MASK 0x00F00000 /* PLL feedback multiplier value */
  333. #define PLLMR1_FBMUL_DIV_16 0x00000000
  334. #define PLLMR1_FBMUL_DIV_1 0x00100000
  335. #define PLLMR1_FBMUL_DIV_2 0x00200000
  336. #define PLLMR1_FBMUL_DIV_3 0x00300000
  337. #define PLLMR1_FBMUL_DIV_4 0x00400000
  338. #define PLLMR1_FBMUL_DIV_5 0x00500000
  339. #define PLLMR1_FBMUL_DIV_6 0x00600000
  340. #define PLLMR1_FBMUL_DIV_7 0x00700000
  341. #define PLLMR1_FBMUL_DIV_8 0x00800000
  342. #define PLLMR1_FBMUL_DIV_9 0x00900000
  343. #define PLLMR1_FBMUL_DIV_10 0x00A00000
  344. #define PLLMR1_FBMUL_DIV_11 0x00B00000
  345. #define PLLMR1_FBMUL_DIV_12 0x00C00000
  346. #define PLLMR1_FBMUL_DIV_13 0x00D00000
  347. #define PLLMR1_FBMUL_DIV_14 0x00E00000
  348. #define PLLMR1_FBMUL_DIV_15 0x00F00000
  349. #define PLLMR1_FWDVA_MASK 0x00070000 /* PLL forward divider A value */
  350. #define PLLMR1_FWDVA_DIV_8 0x00000000
  351. #define PLLMR1_FWDVA_DIV_7 0x00010000
  352. #define PLLMR1_FWDVA_DIV_6 0x00020000
  353. #define PLLMR1_FWDVA_DIV_5 0x00030000
  354. #define PLLMR1_FWDVA_DIV_4 0x00040000
  355. #define PLLMR1_FWDVA_DIV_3 0x00050000
  356. #define PLLMR1_FWDVA_DIV_2 0x00060000
  357. #define PLLMR1_FWDVA_DIV_1 0x00070000
  358. #define PLLMR1_FWDVB_MASK 0x00007000 /* PLL forward divider B value */
  359. #define PLLMR1_TUNING_MASK 0x000003FF /* PLL tune bits */
  360. /* Defines for CPC0_EPRCSR register */
  361. #define CPC0_EPRCSR_E0NFE 0x80000000
  362. #define CPC0_EPRCSR_E1NFE 0x40000000
  363. #define CPC0_EPRCSR_E1RPP 0x00000080
  364. #define CPC0_EPRCSR_E0RPP 0x00000040
  365. #define CPC0_EPRCSR_E1ERP 0x00000020
  366. #define CPC0_EPRCSR_E0ERP 0x00000010
  367. #define CPC0_EPRCSR_E1PCI 0x00000002
  368. #define CPC0_EPRCSR_E0PCI 0x00000001
  369. /* Defines for CPC0_PCI Register */
  370. #define CPC0_PCI_SPE 0x00000010 /* PCIINT/WE select */
  371. #define CPC0_PCI_HOST_CFG_EN 0x00000008 /* PCI host config Enable */
  372. #define CPC0_PCI_ARBIT_EN 0x00000001 /* PCI Internal Arb Enabled*/
  373. /* Defines for CPC0_BOOR Register */
  374. #define CPC0_BOOT_SEP 0x00000002 /* serial EEPROM present */
  375. /* Defines for CPC0_PLLMR1 Register fields */
  376. #define PLL_ACTIVE 0x80000000
  377. #define CPC0_PLLMR1_SSCS 0x80000000
  378. #define PLL_RESET 0x40000000
  379. #define CPC0_PLLMR1_PLLR 0x40000000
  380. /* Feedback multiplier */
  381. #define PLL_FBKDIV 0x00F00000
  382. #define CPC0_PLLMR1_FBDV 0x00F00000
  383. #define PLL_FBKDIV_16 0x00000000
  384. #define PLL_FBKDIV_1 0x00100000
  385. #define PLL_FBKDIV_2 0x00200000
  386. #define PLL_FBKDIV_3 0x00300000
  387. #define PLL_FBKDIV_4 0x00400000
  388. #define PLL_FBKDIV_5 0x00500000
  389. #define PLL_FBKDIV_6 0x00600000
  390. #define PLL_FBKDIV_7 0x00700000
  391. #define PLL_FBKDIV_8 0x00800000
  392. #define PLL_FBKDIV_9 0x00900000
  393. #define PLL_FBKDIV_10 0x00A00000
  394. #define PLL_FBKDIV_11 0x00B00000
  395. #define PLL_FBKDIV_12 0x00C00000
  396. #define PLL_FBKDIV_13 0x00D00000
  397. #define PLL_FBKDIV_14 0x00E00000
  398. #define PLL_FBKDIV_15 0x00F00000
  399. /* Forward A divisor */
  400. #define PLL_FWDDIVA 0x00070000
  401. #define CPC0_PLLMR1_FWDVA 0x00070000
  402. #define PLL_FWDDIVA_8 0x00000000
  403. #define PLL_FWDDIVA_7 0x00010000
  404. #define PLL_FWDDIVA_6 0x00020000
  405. #define PLL_FWDDIVA_5 0x00030000
  406. #define PLL_FWDDIVA_4 0x00040000
  407. #define PLL_FWDDIVA_3 0x00050000
  408. #define PLL_FWDDIVA_2 0x00060000
  409. #define PLL_FWDDIVA_1 0x00070000
  410. /* Forward B divisor */
  411. #define PLL_FWDDIVB 0x00007000
  412. #define CPC0_PLLMR1_FWDVB 0x00007000
  413. #define PLL_FWDDIVB_8 0x00000000
  414. #define PLL_FWDDIVB_7 0x00001000
  415. #define PLL_FWDDIVB_6 0x00002000
  416. #define PLL_FWDDIVB_5 0x00003000
  417. #define PLL_FWDDIVB_4 0x00004000
  418. #define PLL_FWDDIVB_3 0x00005000
  419. #define PLL_FWDDIVB_2 0x00006000
  420. #define PLL_FWDDIVB_1 0x00007000
  421. /* PLL tune bits */
  422. #define PLL_TUNE_MASK 0x000003FF
  423. #define PLL_TUNE_2_M_3 0x00000133 /* 2 <= M <= 3 */
  424. #define PLL_TUNE_4_M_6 0x00000134 /* 3 < M <= 6 */
  425. #define PLL_TUNE_7_M_10 0x00000138 /* 6 < M <= 10 */
  426. #define PLL_TUNE_11_M_14 0x0000013C /* 10 < M <= 14 */
  427. #define PLL_TUNE_15_M_40 0x0000023E /* 14 < M <= 40 */
  428. #define PLL_TUNE_VCO_LOW 0x00000000 /* 500MHz <= VCO <= 800MHz */
  429. #define PLL_TUNE_VCO_HI 0x00000080 /* 800MHz < VCO <= 1000MHz */
  430. /* Defines for CPC0_PLLMR0 Register fields */
  431. /* CPU divisor */
  432. #define PLL_CPUDIV 0x00300000
  433. #define CPC0_PLLMR0_CCDV 0x00300000
  434. #define PLL_CPUDIV_1 0x00000000
  435. #define PLL_CPUDIV_2 0x00100000
  436. #define PLL_CPUDIV_3 0x00200000
  437. #define PLL_CPUDIV_4 0x00300000
  438. /* PLB divisor */
  439. #define PLL_PLBDIV 0x00030000
  440. #define CPC0_PLLMR0_CBDV 0x00030000
  441. #define PLL_PLBDIV_1 0x00000000
  442. #define PLL_PLBDIV_2 0x00010000
  443. #define PLL_PLBDIV_3 0x00020000
  444. #define PLL_PLBDIV_4 0x00030000
  445. /* OPB divisor */
  446. #define PLL_OPBDIV 0x00003000
  447. #define CPC0_PLLMR0_OPDV 0x00003000
  448. #define PLL_OPBDIV_1 0x00000000
  449. #define PLL_OPBDIV_2 0x00001000
  450. #define PLL_OPBDIV_3 0x00002000
  451. #define PLL_OPBDIV_4 0x00003000
  452. /* EBC divisor */
  453. #define PLL_EXTBUSDIV 0x00000300
  454. #define CPC0_PLLMR0_EPDV 0x00000300
  455. #define PLL_EXTBUSDIV_2 0x00000000
  456. #define PLL_EXTBUSDIV_3 0x00000100
  457. #define PLL_EXTBUSDIV_4 0x00000200
  458. #define PLL_EXTBUSDIV_5 0x00000300
  459. /* MAL divisor */
  460. #define PLL_MALDIV 0x00000030
  461. #define CPC0_PLLMR0_MPDV 0x00000030
  462. #define PLL_MALDIV_1 0x00000000
  463. #define PLL_MALDIV_2 0x00000010
  464. #define PLL_MALDIV_3 0x00000020
  465. #define PLL_MALDIV_4 0x00000030
  466. /* PCI divisor */
  467. #define PLL_PCIDIV 0x00000003
  468. #define CPC0_PLLMR0_PPFD 0x00000003
  469. #define PLL_PCIDIV_1 0x00000000
  470. #define PLL_PCIDIV_2 0x00000001
  471. #define PLL_PCIDIV_3 0x00000002
  472. #define PLL_PCIDIV_4 0x00000003
  473. /*
  474. *-------------------------------------------------------------------------------
  475. * PLL settings for 266MHz CPU, 133MHz PLB/SDRAM, 66MHz EBC, 33MHz PCI,
  476. * assuming a 33.3MHz input clock to the 405EP.
  477. *-------------------------------------------------------------------------------
  478. */
  479. #define PLLMR0_266_133_66 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
  480. PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
  481. PLL_MALDIV_1 | PLL_PCIDIV_4)
  482. #define PLLMR1_266_133_66 (PLL_FBKDIV_8 | \
  483. PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
  484. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  485. #define PLLMR0_133_66_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_1 | \
  486. PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
  487. PLL_MALDIV_1 | PLL_PCIDIV_4)
  488. #define PLLMR1_133_66_66_33 (PLL_FBKDIV_4 | \
  489. PLL_FWDDIVA_6 | PLL_FWDDIVB_6 | \
  490. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  491. #define PLLMR0_200_100_50_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
  492. PLL_OPBDIV_2 | PLL_EXTBUSDIV_3 | \
  493. PLL_MALDIV_1 | PLL_PCIDIV_4)
  494. #define PLLMR1_200_100_50_33 (PLL_FBKDIV_6 | \
  495. PLL_FWDDIVA_4 | PLL_FWDDIVB_4 | \
  496. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  497. #define PLLMR0_266_133_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
  498. PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
  499. PLL_MALDIV_1 | PLL_PCIDIV_4)
  500. #define PLLMR1_266_133_66_33 (PLL_FBKDIV_8 | \
  501. PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
  502. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  503. #define PLLMR0_266_66_33_33 (PLL_CPUDIV_1 | PLL_PLBDIV_4 | \
  504. PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
  505. PLL_MALDIV_1 | PLL_PCIDIV_2)
  506. #define PLLMR1_266_66_33_33 (PLL_FBKDIV_8 | \
  507. PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
  508. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  509. #define PLLMR0_333_111_55_37 (PLL_CPUDIV_1 | PLL_PLBDIV_3 | \
  510. PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
  511. PLL_MALDIV_1 | PLL_PCIDIV_3)
  512. #define PLLMR1_333_111_55_37 (PLL_FBKDIV_10 | \
  513. PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
  514. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_HI)
  515. #define PLLMR0_333_111_55_111 (PLL_CPUDIV_1 | PLL_PLBDIV_3 | \
  516. PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
  517. PLL_MALDIV_1 | PLL_PCIDIV_1)
  518. #define PLLMR1_333_111_55_111 (PLL_FBKDIV_10 | \
  519. PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
  520. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_HI)
  521. /*
  522. * PLL Voltage Controlled Oscillator (VCO) definitions
  523. * Maximum and minimum values (in MHz) for correct PLL operation.
  524. */
  525. #define VCO_MIN 500
  526. #define VCO_MAX 1000
  527. #elif defined(CONFIG_405EZ)
  528. /******************************************************************************
  529. * SDR Registers
  530. ******************************************************************************/
  531. #define SDR_DCR_BASE 0x0E
  532. #define sdrcfga (SDR_DCR_BASE+0x0) /* ADDR */
  533. #define sdrcfgd (SDR_DCR_BASE+0x1) /* Data */
  534. #define mtsdr(reg, data) do { mtdcr(sdrcfga,reg);mtdcr(sdrcfgd,data); } while (0)
  535. #define mfsdr(reg, data) do { mtdcr(sdrcfga,reg);data = mfdcr(sdrcfgd); } while (0)
  536. #define sdrnand0 0x4000
  537. #define sdrultra0 0x4040
  538. #define sdrultra1 0x4050
  539. #define sdricintstat 0x4510
  540. #define SDR_NAND0_NDEN 0x80000000
  541. #define SDR_NAND0_NDBTEN 0x40000000
  542. #define SDR_NAND0_NDBADR_MASK 0x30000000
  543. #define SDR_NAND0_NDBPG_MASK 0x0f000000
  544. #define SDR_NAND0_NDAREN 0x00800000
  545. #define SDR_NAND0_NDRBEN 0x00400000
  546. #define SDR_ULTRA0_NDGPIOBP 0x80000000
  547. #define SDR_ULTRA0_CSN_MASK 0x78000000
  548. #define SDR_ULTRA0_CSNSEL0 0x40000000
  549. #define SDR_ULTRA0_CSNSEL1 0x20000000
  550. #define SDR_ULTRA0_CSNSEL2 0x10000000
  551. #define SDR_ULTRA0_CSNSEL3 0x08000000
  552. #define SDR_ULTRA0_EBCRDYEN 0x04000000
  553. #define SDR_ULTRA0_SPISSINEN 0x02000000
  554. #define SDR_ULTRA0_NFSRSTEN 0x01000000
  555. #define SDR_ULTRA1_LEDNENABLE 0x40000000
  556. #define SDR_ICRX_STAT 0x80000000
  557. #define SDR_ICTX0_STAT 0x40000000
  558. #define SDR_ICTX1_STAT 0x20000000
  559. #define SDR_PINSTP 0x40
  560. /******************************************************************************
  561. * Control
  562. ******************************************************************************/
  563. #define CNTRL_DCR_BASE 0x0C
  564. #define cprcfga (CNTRL_DCR_BASE+0x0) /* CPR addr reg */
  565. #define cprcfgd (CNTRL_DCR_BASE+0x1) /* CPR data reg */
  566. /* CPR Registers */
  567. #define cprclkupd 0x020 /* CPR_CLKUPD */
  568. #define cprpllc 0x040 /* CPR_PLLC */
  569. #define cprplld 0x060 /* CPR_PLLD */
  570. #define cprprimad 0x080 /* CPR_PRIMAD */
  571. #define cprperd0 0x0e0 /* CPR_PERD0 */
  572. #define cprperd1 0x0e1 /* CPR_PERD1 */
  573. #define cprperc0 0x180 /* CPR_PERC0 */
  574. #define cprmisc0 0x181 /* CPR_MISC0 */
  575. #define cprmisc1 0x182 /* CPR_MISC1 */
  576. /*
  577. * Macro for accessing the indirect CPR register
  578. */
  579. #define mtcpr(reg, data) do { mtdcr(cprcfga,reg);mtdcr(cprcfgd,data); } while (0)
  580. #define mfcpr(reg, data) do { mtdcr(cprcfga,reg);data = mfdcr(cprcfgd); } while (0)
  581. #define CPR_CLKUPD_ENPLLCH_EN 0x40000000 /* Enable CPR PLL Changes */
  582. #define CPR_CLKUPD_ENDVCH_EN 0x20000000 /* Enable CPR Sys. Div. Changes */
  583. #define CPR_PERD0_SPIDV_MASK 0x000F0000 /* SPI Clock Divider */
  584. #define PLLC_SRC_MASK 0x20000000 /* PLL feedback source */
  585. #define PLLD_FBDV_MASK 0x1F000000 /* PLL feedback divider value */
  586. #define PLLD_FWDVA_MASK 0x000F0000 /* PLL forward divider A value */
  587. #define PLLD_FWDVB_MASK 0x00000700 /* PLL forward divider B value */
  588. #define PRIMAD_CPUDV_MASK 0x0F000000 /* CPU Clock Divisor Mask */
  589. #define PRIMAD_PLBDV_MASK 0x000F0000 /* PLB Clock Divisor Mask */
  590. #define PRIMAD_OPBDV_MASK 0x00000F00 /* OPB Clock Divisor Mask */
  591. #define PRIMAD_EBCDV_MASK 0x0000000F /* EBC Clock Divisor Mask */
  592. #define PERD0_PWMDV_MASK 0xFF000000 /* PWM Divider Mask */
  593. #define PERD0_SPIDV_MASK 0x000F0000 /* SPI Divider Mask */
  594. #define PERD0_U0DV_MASK 0x0000FF00 /* UART 0 Divider Mask */
  595. #define PERD0_U1DV_MASK 0x000000FF /* UART 1 Divider Mask */
  596. #if 0 /* Deprecated */
  597. #define CNTRL_DCR_BASE 0x0f0
  598. #define cpc0_pllmr0 (CNTRL_DCR_BASE+0x0) /* PLL mode register 0 */
  599. #define cpc0_boot (CNTRL_DCR_BASE+0x1) /* Clock status register */
  600. #define cpc0_epctl (CNTRL_DCR_BASE+0x3) /* EMAC to PHY control register */
  601. #define cpc0_pllmr1 (CNTRL_DCR_BASE+0x4) /* PLL mode register 1 */
  602. #define cpc0_ucr (CNTRL_DCR_BASE+0x5) /* UART control register */
  603. #define cpc0_pci (CNTRL_DCR_BASE+0x9) /* PCI control register */
  604. #define CPC0_PLLMR0 (CNTRL_DCR_BASE+0x0) /* PLL mode 0 register */
  605. #define CPC0_BOOT (CNTRL_DCR_BASE+0x1) /* Chip Clock Status register */
  606. #define CPC0_CR1 (CNTRL_DCR_BASE+0x2) /* Chip Control 1 register */
  607. #define CPC0_EPRCSR (CNTRL_DCR_BASE+0x3) /* EMAC PHY Rcv Clk Src register*/
  608. #define CPC0_PLLMR1 (CNTRL_DCR_BASE+0x4) /* PLL mode 1 register */
  609. #define CPC0_UCR (CNTRL_DCR_BASE+0x5) /* UART Control register */
  610. #define CPC0_SRR (CNTRL_DCR_BASE+0x6) /* Soft Reset register */
  611. #define CPC0_JTAGID (CNTRL_DCR_BASE+0x7) /* JTAG ID register */
  612. #define CPC0_SPARE (CNTRL_DCR_BASE+0x8) /* Spare DCR */
  613. #define CPC0_PCI (CNTRL_DCR_BASE+0x9) /* PCI Control register */
  614. /* Bit definitions */
  615. #define PLLMR0_CPU_DIV_MASK 0x00300000 /* CPU clock divider */
  616. #define PLLMR0_CPU_DIV_BYPASS 0x00000000
  617. #define PLLMR0_CPU_DIV_2 0x00100000
  618. #define PLLMR0_CPU_DIV_3 0x00200000
  619. #define PLLMR0_CPU_DIV_4 0x00300000
  620. #define PLLMR0_CPU_TO_PLB_MASK 0x00030000 /* CPU:PLB Frequency Divisor */
  621. #define PLLMR0_CPU_PLB_DIV_1 0x00000000
  622. #define PLLMR0_CPU_PLB_DIV_2 0x00010000
  623. #define PLLMR0_CPU_PLB_DIV_3 0x00020000
  624. #define PLLMR0_CPU_PLB_DIV_4 0x00030000
  625. #define PLLMR0_OPB_TO_PLB_MASK 0x00003000 /* OPB:PLB Frequency Divisor */
  626. #define PLLMR0_OPB_PLB_DIV_1 0x00000000
  627. #define PLLMR0_OPB_PLB_DIV_2 0x00001000
  628. #define PLLMR0_OPB_PLB_DIV_3 0x00002000
  629. #define PLLMR0_OPB_PLB_DIV_4 0x00003000
  630. #define PLLMR0_EXB_TO_PLB_MASK 0x00000300 /* External Bus:PLB Divisor */
  631. #define PLLMR0_EXB_PLB_DIV_2 0x00000000
  632. #define PLLMR0_EXB_PLB_DIV_3 0x00000100
  633. #define PLLMR0_EXB_PLB_DIV_4 0x00000200
  634. #define PLLMR0_EXB_PLB_DIV_5 0x00000300
  635. #define PLLMR0_MAL_TO_PLB_MASK 0x00000030 /* MAL:PLB Divisor */
  636. #define PLLMR0_MAL_PLB_DIV_1 0x00000000
  637. #define PLLMR0_MAL_PLB_DIV_2 0x00000010
  638. #define PLLMR0_MAL_PLB_DIV_3 0x00000020
  639. #define PLLMR0_MAL_PLB_DIV_4 0x00000030
  640. #define PLLMR0_PCI_TO_PLB_MASK 0x00000003 /* PCI:PLB Frequency Divisor */
  641. #define PLLMR0_PCI_PLB_DIV_1 0x00000000
  642. #define PLLMR0_PCI_PLB_DIV_2 0x00000001
  643. #define PLLMR0_PCI_PLB_DIV_3 0x00000002
  644. #define PLLMR0_PCI_PLB_DIV_4 0x00000003
  645. #define PLLMR1_SSCS_MASK 0x80000000 /* Select system clock source */
  646. #define PLLMR1_PLLR_MASK 0x40000000 /* PLL reset */
  647. #define PLLMR1_FBMUL_MASK 0x00F00000 /* PLL feedback multiplier value */
  648. #define PLLMR1_FBMUL_DIV_16 0x00000000
  649. #define PLLMR1_FBMUL_DIV_1 0x00100000
  650. #define PLLMR1_FBMUL_DIV_2 0x00200000
  651. #define PLLMR1_FBMUL_DIV_3 0x00300000
  652. #define PLLMR1_FBMUL_DIV_4 0x00400000
  653. #define PLLMR1_FBMUL_DIV_5 0x00500000
  654. #define PLLMR1_FBMUL_DIV_6 0x00600000
  655. #define PLLMR1_FBMUL_DIV_7 0x00700000
  656. #define PLLMR1_FBMUL_DIV_8 0x00800000
  657. #define PLLMR1_FBMUL_DIV_9 0x00900000
  658. #define PLLMR1_FBMUL_DIV_10 0x00A00000
  659. #define PLLMR1_FBMUL_DIV_11 0x00B00000
  660. #define PLLMR1_FBMUL_DIV_12 0x00C00000
  661. #define PLLMR1_FBMUL_DIV_13 0x00D00000
  662. #define PLLMR1_FBMUL_DIV_14 0x00E00000
  663. #define PLLMR1_FBMUL_DIV_15 0x00F00000
  664. #define PLLMR1_FWDVA_MASK 0x00070000 /* PLL forward divider A value */
  665. #define PLLMR1_FWDVA_DIV_8 0x00000000
  666. #define PLLMR1_FWDVA_DIV_7 0x00010000
  667. #define PLLMR1_FWDVA_DIV_6 0x00020000
  668. #define PLLMR1_FWDVA_DIV_5 0x00030000
  669. #define PLLMR1_FWDVA_DIV_4 0x00040000
  670. #define PLLMR1_FWDVA_DIV_3 0x00050000
  671. #define PLLMR1_FWDVA_DIV_2 0x00060000
  672. #define PLLMR1_FWDVA_DIV_1 0x00070000
  673. #define PLLMR1_FWDVB_MASK 0x00007000 /* PLL forward divider B value */
  674. #define PLLMR1_TUNING_MASK 0x000003FF /* PLL tune bits */
  675. /* Defines for CPC0_EPRCSR register */
  676. #define CPC0_EPRCSR_E0NFE 0x80000000
  677. #define CPC0_EPRCSR_E1NFE 0x40000000
  678. #define CPC0_EPRCSR_E1RPP 0x00000080
  679. #define CPC0_EPRCSR_E0RPP 0x00000040
  680. #define CPC0_EPRCSR_E1ERP 0x00000020
  681. #define CPC0_EPRCSR_E0ERP 0x00000010
  682. #define CPC0_EPRCSR_E1PCI 0x00000002
  683. #define CPC0_EPRCSR_E0PCI 0x00000001
  684. /* Defines for CPC0_BOOR Register */
  685. #define CPC0_BOOT_SEP 0x00000002 /* serial EEPROM present */
  686. /* Defines for CPC0_PLLMR1 Register fields */
  687. #define PLL_ACTIVE 0x80000000
  688. #define CPC0_PLLMR1_SSCS 0x80000000
  689. #define PLL_RESET 0x40000000
  690. #define CPC0_PLLMR1_PLLR 0x40000000
  691. /* Feedback multiplier */
  692. #define PLL_FBKDIV 0x00F00000
  693. #define CPC0_PLLMR1_FBDV 0x00F00000
  694. #define PLL_FBKDIV_16 0x00000000
  695. #define PLL_FBKDIV_1 0x00100000
  696. #define PLL_FBKDIV_2 0x00200000
  697. #define PLL_FBKDIV_3 0x00300000
  698. #define PLL_FBKDIV_4 0x00400000
  699. #define PLL_FBKDIV_5 0x00500000
  700. #define PLL_FBKDIV_6 0x00600000
  701. #define PLL_FBKDIV_7 0x00700000
  702. #define PLL_FBKDIV_8 0x00800000
  703. #define PLL_FBKDIV_9 0x00900000
  704. #define PLL_FBKDIV_10 0x00A00000
  705. #define PLL_FBKDIV_11 0x00B00000
  706. #define PLL_FBKDIV_12 0x00C00000
  707. #define PLL_FBKDIV_13 0x00D00000
  708. #define PLL_FBKDIV_14 0x00E00000
  709. #define PLL_FBKDIV_15 0x00F00000
  710. /* Forward A divisor */
  711. #define PLL_FWDDIVA 0x00070000
  712. #define CPC0_PLLMR1_FWDVA 0x00070000
  713. #define PLL_FWDDIVA_8 0x00000000
  714. #define PLL_FWDDIVA_7 0x00010000
  715. #define PLL_FWDDIVA_6 0x00020000
  716. #define PLL_FWDDIVA_5 0x00030000
  717. #define PLL_FWDDIVA_4 0x00040000
  718. #define PLL_FWDDIVA_3 0x00050000
  719. #define PLL_FWDDIVA_2 0x00060000
  720. #define PLL_FWDDIVA_1 0x00070000
  721. /* Forward B divisor */
  722. #define PLL_FWDDIVB 0x00007000
  723. #define CPC0_PLLMR1_FWDVB 0x00007000
  724. #define PLL_FWDDIVB_8 0x00000000
  725. #define PLL_FWDDIVB_7 0x00001000
  726. #define PLL_FWDDIVB_6 0x00002000
  727. #define PLL_FWDDIVB_5 0x00003000
  728. #define PLL_FWDDIVB_4 0x00004000
  729. #define PLL_FWDDIVB_3 0x00005000
  730. #define PLL_FWDDIVB_2 0x00006000
  731. #define PLL_FWDDIVB_1 0x00007000
  732. /* PLL tune bits */
  733. #define PLL_TUNE_MASK 0x000003FF
  734. #define PLL_TUNE_2_M_3 0x00000133 /* 2 <= M <= 3 */
  735. #define PLL_TUNE_4_M_6 0x00000134 /* 3 < M <= 6 */
  736. #define PLL_TUNE_7_M_10 0x00000138 /* 6 < M <= 10 */
  737. #define PLL_TUNE_11_M_14 0x0000013C /* 10 < M <= 14 */
  738. #define PLL_TUNE_15_M_40 0x0000023E /* 14 < M <= 40 */
  739. #define PLL_TUNE_VCO_LOW 0x00000000 /* 500MHz <= VCO <= 800MHz */
  740. #define PLL_TUNE_VCO_HI 0x00000080 /* 800MHz < VCO <= 1000MHz */
  741. /* Defines for CPC0_PLLMR0 Register fields */
  742. /* CPU divisor */
  743. #define PLL_CPUDIV 0x00300000
  744. #define CPC0_PLLMR0_CCDV 0x00300000
  745. #define PLL_CPUDIV_1 0x00000000
  746. #define PLL_CPUDIV_2 0x00100000
  747. #define PLL_CPUDIV_3 0x00200000
  748. #define PLL_CPUDIV_4 0x00300000
  749. /* PLB divisor */
  750. #define PLL_PLBDIV 0x00030000
  751. #define CPC0_PLLMR0_CBDV 0x00030000
  752. #define PLL_PLBDIV_1 0x00000000
  753. #define PLL_PLBDIV_2 0x00010000
  754. #define PLL_PLBDIV_3 0x00020000
  755. #define PLL_PLBDIV_4 0x00030000
  756. /* OPB divisor */
  757. #define PLL_OPBDIV 0x00003000
  758. #define CPC0_PLLMR0_OPDV 0x00003000
  759. #define PLL_OPBDIV_1 0x00000000
  760. #define PLL_OPBDIV_2 0x00001000
  761. #define PLL_OPBDIV_3 0x00002000
  762. #define PLL_OPBDIV_4 0x00003000
  763. /* EBC divisor */
  764. #define PLL_EXTBUSDIV 0x00000300
  765. #define CPC0_PLLMR0_EPDV 0x00000300
  766. #define PLL_EXTBUSDIV_2 0x00000000
  767. #define PLL_EXTBUSDIV_3 0x00000100
  768. #define PLL_EXTBUSDIV_4 0x00000200
  769. #define PLL_EXTBUSDIV_5 0x00000300
  770. /* MAL divisor */
  771. #define PLL_MALDIV 0x00000030
  772. #define CPC0_PLLMR0_MPDV 0x00000030
  773. #define PLL_MALDIV_1 0x00000000
  774. #define PLL_MALDIV_2 0x00000010
  775. #define PLL_MALDIV_3 0x00000020
  776. #define PLL_MALDIV_4 0x00000030
  777. /* PCI divisor */
  778. #define PLL_PCIDIV 0x00000003
  779. #define CPC0_PLLMR0_PPFD 0x00000003
  780. #define PLL_PCIDIV_1 0x00000000
  781. #define PLL_PCIDIV_2 0x00000001
  782. #define PLL_PCIDIV_3 0x00000002
  783. #define PLL_PCIDIV_4 0x00000003
  784. /*
  785. *-------------------------------------------------------------------------------
  786. * PLL settings for 266MHz CPU, 133MHz PLB/SDRAM, 66MHz EBC, 33MHz PCI,
  787. * assuming a 33.3MHz input clock to the 405EP.
  788. *-------------------------------------------------------------------------------
  789. */
  790. #define PLLMR0_266_133_66 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
  791. PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
  792. PLL_MALDIV_1 | PLL_PCIDIV_4)
  793. #define PLLMR1_266_133_66 (PLL_FBKDIV_8 | \
  794. PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
  795. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  796. #define PLLMR0_133_66_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_1 | \
  797. PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
  798. PLL_MALDIV_1 | PLL_PCIDIV_4)
  799. #define PLLMR1_133_66_66_33 (PLL_FBKDIV_4 | \
  800. PLL_FWDDIVA_6 | PLL_FWDDIVB_6 | \
  801. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  802. #define PLLMR0_200_100_50_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
  803. PLL_OPBDIV_2 | PLL_EXTBUSDIV_3 | \
  804. PLL_MALDIV_1 | PLL_PCIDIV_4)
  805. #define PLLMR1_200_100_50_33 (PLL_FBKDIV_6 | \
  806. PLL_FWDDIVA_4 | PLL_FWDDIVB_4 | \
  807. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  808. #define PLLMR0_266_133_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
  809. PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
  810. PLL_MALDIV_1 | PLL_PCIDIV_4)
  811. #define PLLMR1_266_133_66_33 (PLL_FBKDIV_8 | \
  812. PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
  813. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  814. #define PLLMR0_266_66_33_33 (PLL_CPUDIV_1 | PLL_PLBDIV_4 | \
  815. PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
  816. PLL_MALDIV_1 | PLL_PCIDIV_2)
  817. #define PLLMR1_266_66_33_33 (PLL_FBKDIV_8 | \
  818. PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
  819. PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
  820. /*
  821. * PLL Voltage Controlled Oscillator (VCO) definitions
  822. * Maximum and minimum values (in MHz) for correct PLL operation.
  823. */
  824. #define VCO_MIN 500
  825. #define VCO_MAX 1000
  826. #endif /* #if 0 */
  827. #else /* #ifdef CONFIG_405EP */
  828. /******************************************************************************
  829. * Control
  830. ******************************************************************************/
  831. #define CNTRL_DCR_BASE 0x0b0
  832. #define pllmd (CNTRL_DCR_BASE+0x0) /* PLL mode register */
  833. #define cntrl0 (CNTRL_DCR_BASE+0x1) /* Control 0 register */
  834. #define cntrl1 (CNTRL_DCR_BASE+0x2) /* Control 1 register */
  835. #define reset (CNTRL_DCR_BASE+0x3) /* reset register */
  836. #define strap (CNTRL_DCR_BASE+0x4) /* strap register */
  837. #define ecr (0xaa) /* edge conditioner register (405gpr) */
  838. /* Bit definitions */
  839. #define PLLMR_FWD_DIV_MASK 0xE0000000 /* Forward Divisor */
  840. #define PLLMR_FWD_DIV_BYPASS 0xE0000000
  841. #define PLLMR_FWD_DIV_3 0xA0000000
  842. #define PLLMR_FWD_DIV_4 0x80000000
  843. #define PLLMR_FWD_DIV_6 0x40000000
  844. #define PLLMR_FB_DIV_MASK 0x1E000000 /* Feedback Divisor */
  845. #define PLLMR_FB_DIV_1 0x02000000
  846. #define PLLMR_FB_DIV_2 0x04000000
  847. #define PLLMR_FB_DIV_3 0x06000000
  848. #define PLLMR_FB_DIV_4 0x08000000
  849. #define PLLMR_TUNING_MASK 0x01F80000
  850. #define PLLMR_CPU_TO_PLB_MASK 0x00060000 /* CPU:PLB Frequency Divisor */
  851. #define PLLMR_CPU_PLB_DIV_1 0x00000000
  852. #define PLLMR_CPU_PLB_DIV_2 0x00020000
  853. #define PLLMR_CPU_PLB_DIV_3 0x00040000
  854. #define PLLMR_CPU_PLB_DIV_4 0x00060000
  855. #define PLLMR_OPB_TO_PLB_MASK 0x00018000 /* OPB:PLB Frequency Divisor */
  856. #define PLLMR_OPB_PLB_DIV_1 0x00000000
  857. #define PLLMR_OPB_PLB_DIV_2 0x00008000
  858. #define PLLMR_OPB_PLB_DIV_3 0x00010000
  859. #define PLLMR_OPB_PLB_DIV_4 0x00018000
  860. #define PLLMR_PCI_TO_PLB_MASK 0x00006000 /* PCI:PLB Frequency Divisor */
  861. #define PLLMR_PCI_PLB_DIV_1 0x00000000
  862. #define PLLMR_PCI_PLB_DIV_2 0x00002000
  863. #define PLLMR_PCI_PLB_DIV_3 0x00004000
  864. #define PLLMR_PCI_PLB_DIV_4 0x00006000
  865. #define PLLMR_EXB_TO_PLB_MASK 0x00001800 /* External Bus:PLB Divisor */
  866. #define PLLMR_EXB_PLB_DIV_2 0x00000000
  867. #define PLLMR_EXB_PLB_DIV_3 0x00000800
  868. #define PLLMR_EXB_PLB_DIV_4 0x00001000
  869. #define PLLMR_EXB_PLB_DIV_5 0x00001800
  870. /* definitions for PPC405GPr (new mode strapping) */
  871. #define PLLMR_FWDB_DIV_MASK 0x00000007 /* Forward Divisor B */
  872. #define PSR_PLL_FWD_MASK 0xC0000000
  873. #define PSR_PLL_FDBACK_MASK 0x30000000
  874. #define PSR_PLL_TUNING_MASK 0x0E000000
  875. #define PSR_PLB_CPU_MASK 0x01800000
  876. #define PSR_OPB_PLB_MASK 0x00600000
  877. #define PSR_PCI_PLB_MASK 0x00180000
  878. #define PSR_EB_PLB_MASK 0x00060000
  879. #define PSR_ROM_WIDTH_MASK 0x00018000
  880. #define PSR_ROM_LOC 0x00004000
  881. #define PSR_PCI_ASYNC_EN 0x00001000
  882. #define PSR_PERCLK_SYNC_MODE_EN 0x00000800 /* PPC405GPr only */
  883. #define PSR_PCI_ARBIT_EN 0x00000400
  884. #define PSR_NEW_MODE_EN 0x00000020 /* PPC405GPr only */
  885. #ifndef CONFIG_IOP480
  886. /*
  887. * PLL Voltage Controlled Oscillator (VCO) definitions
  888. * Maximum and minimum values (in MHz) for correct PLL operation.
  889. */
  890. #define VCO_MIN 400
  891. #define VCO_MAX 800
  892. #endif /* #ifndef CONFIG_IOP480 */
  893. #endif /* #ifdef CONFIG_405EP */
  894. /******************************************************************************
  895. * Memory Access Layer
  896. ******************************************************************************/
  897. #if defined(CONFIG_405EZ)
  898. #define MAL_DCR_BASE 0x380
  899. #define malmcr (MAL_DCR_BASE+0x00) /* MAL Config reg */
  900. #define malesr (MAL_DCR_BASE+0x01) /* Err Status reg (Read/Clear)*/
  901. #define malier (MAL_DCR_BASE+0x02) /* Interrupt enable reg */
  902. #define maldbr (MAL_DCR_BASE+0x03) /* Mal Debug reg (Read only) */
  903. #define maltxcasr (MAL_DCR_BASE+0x04) /* TX Channel active reg (set)*/
  904. #define maltxcarr (MAL_DCR_BASE+0x05) /* TX Channel active reg (Reset) */
  905. #define maltxeobisr (MAL_DCR_BASE+0x06) /* TX End of buffer int status reg */
  906. #define maltxdeir (MAL_DCR_BASE+0x07) /* TX Descr. Error Int reg */
  907. /* 0x08-0x0F Reserved */
  908. #define malrxcasr (MAL_DCR_BASE+0x10) /* RX Channel active reg (set)*/
  909. #define malrxcarr (MAL_DCR_BASE+0x11) /* RX Channel active reg (Reset) */
  910. #define malrxeobisr (MAL_DCR_BASE+0x12) /* RX End of buffer int status reg */
  911. #define malrxdeir (MAL_DCR_BASE+0x13) /* RX Descr. Error Int reg */
  912. /* 0x14-0x1F Reserved */
  913. #define maltxctp0r (MAL_DCR_BASE+0x20) /* TX 0 Channel table ptr reg */
  914. #define maltxctp1r (MAL_DCR_BASE+0x21) /* TX 1 Channel table ptr reg */
  915. #define maltxctp2r (MAL_DCR_BASE+0x22) /* TX 2 Channel table ptr reg */
  916. #define maltxctp3r (MAL_DCR_BASE+0x23) /* TX 3 Channel table ptr reg */
  917. #define maltxctp4r (MAL_DCR_BASE+0x24) /* TX 4 Channel table ptr reg */
  918. #define maltxctp5r (MAL_DCR_BASE+0x25) /* TX 5 Channel table ptr reg */
  919. #define maltxctp6r (MAL_DCR_BASE+0x26) /* TX 6 Channel table ptr reg */
  920. #define maltxctp7r (MAL_DCR_BASE+0x27) /* TX 7 Channel table ptr reg */
  921. #define maltxctp8r (MAL_DCR_BASE+0x28) /* TX 8 Channel table ptr reg */
  922. #define maltxctp9r (MAL_DCR_BASE+0x29) /* TX 9 Channel table ptr reg */
  923. #define maltxctp10r (MAL_DCR_BASE+0x2A) /* TX 10 Channel table ptr reg */
  924. #define maltxctp11r (MAL_DCR_BASE+0x2B) /* TX 11 Channel table ptr reg */
  925. #define maltxctp12r (MAL_DCR_BASE+0x2C) /* TX 12 Channel table ptr reg */
  926. #define maltxctp13r (MAL_DCR_BASE+0x2D) /* TX 13 Channel table ptr reg */
  927. #define maltxctp14r (MAL_DCR_BASE+0x2E) /* TX 14 Channel table ptr reg */
  928. #define maltxctp15r (MAL_DCR_BASE+0x2F) /* TX 15 Channel table ptr reg */
  929. #define maltxctp16r (MAL_DCR_BASE+0x30) /* TX 16 Channel table ptr reg */
  930. #define maltxctp17r (MAL_DCR_BASE+0x31) /* TX 17 Channel table ptr reg */
  931. #define maltxctp18r (MAL_DCR_BASE+0x32) /* TX 18 Channel table ptr reg */
  932. #define maltxctp19r (MAL_DCR_BASE+0x33) /* TX 19 Channel table ptr reg */
  933. #define maltxctp20r (MAL_DCR_BASE+0x34) /* TX 20 Channel table ptr reg */
  934. #define maltxctp21r (MAL_DCR_BASE+0x35) /* TX 21 Channel table ptr reg */
  935. #define maltxctp22r (MAL_DCR_BASE+0x36) /* TX 22 Channel table ptr reg */
  936. #define maltxctp23r (MAL_DCR_BASE+0x37) /* TX 23 Channel table ptr reg */
  937. #define maltxctp24r (MAL_DCR_BASE+0x38) /* TX 24 Channel table ptr reg */
  938. #define maltxctp25r (MAL_DCR_BASE+0x39) /* TX 25 Channel table ptr reg */
  939. #define maltxctp26r (MAL_DCR_BASE+0x3A) /* TX 26 Channel table ptr reg */
  940. #define maltxctp27r (MAL_DCR_BASE+0x3B) /* TX 27 Channel table ptr reg */
  941. #define maltxctp28r (MAL_DCR_BASE+0x3C) /* TX 28 Channel table ptr reg */
  942. #define maltxctp29r (MAL_DCR_BASE+0x3D) /* TX 29 Channel table ptr reg */
  943. #define maltxctp30r (MAL_DCR_BASE+0x3E) /* TX 30 Channel table ptr reg */
  944. #define maltxctp31r (MAL_DCR_BASE+0x3F) /* TX 31 Channel table ptr reg */
  945. #define malrxctp0r (MAL_DCR_BASE+0x40) /* RX 0 Channel table ptr reg */
  946. #define malrxctp1r (MAL_DCR_BASE+0x41) /* RX 1 Channel table ptr reg */
  947. #define malrxctp2r (MAL_DCR_BASE+0x42) /* RX 2 Channel table ptr reg */
  948. #define malrxctp3r (MAL_DCR_BASE+0x43) /* RX 3 Channel table ptr reg */
  949. #define malrxctp4r (MAL_DCR_BASE+0x44) /* RX 4 Channel table ptr reg */
  950. #define malrxctp5r (MAL_DCR_BASE+0x45) /* RX 5 Channel table ptr reg */
  951. #define malrxctp6r (MAL_DCR_BASE+0x46) /* RX 6 Channel table ptr reg */
  952. #define malrxctp7r (MAL_DCR_BASE+0x47) /* RX 7 Channel table ptr reg */
  953. #define malrxctp8r (MAL_DCR_BASE+0x48) /* RX 8 Channel table ptr reg */
  954. #define malrxctp9r (MAL_DCR_BASE+0x49) /* RX 9 Channel table ptr reg */
  955. #define malrxctp10r (MAL_DCR_BASE+0x4A) /* RX 10 Channel table ptr reg */
  956. #define malrxctp11r (MAL_DCR_BASE+0x4B) /* RX 11 Channel table ptr reg */
  957. #define malrxctp12r (MAL_DCR_BASE+0x4C) /* RX 12 Channel table ptr reg */
  958. #define malrxctp13r (MAL_DCR_BASE+0x4D) /* RX 13 Channel table ptr reg */
  959. #define malrxctp14r (MAL_DCR_BASE+0x4E) /* RX 14 Channel table ptr reg */
  960. #define malrxctp15r (MAL_DCR_BASE+0x4F) /* RX 15 Channel table ptr reg */
  961. #define malrxctp16r (MAL_DCR_BASE+0x50) /* RX 16 Channel table ptr reg */
  962. #define malrxctp17r (MAL_DCR_BASE+0x51) /* RX 17 Channel table ptr reg */
  963. #define malrxctp18r (MAL_DCR_BASE+0x52) /* RX 18 Channel table ptr reg */
  964. #define malrxctp19r (MAL_DCR_BASE+0x53) /* RX 19 Channel table ptr reg */
  965. #define malrxctp20r (MAL_DCR_BASE+0x54) /* RX 20 Channel table ptr reg */
  966. #define malrxctp21r (MAL_DCR_BASE+0x55) /* RX 21 Channel table ptr reg */
  967. #define malrxctp22r (MAL_DCR_BASE+0x56) /* RX 22 Channel table ptr reg */
  968. #define malrxctp23r (MAL_DCR_BASE+0x57) /* RX 23 Channel table ptr reg */
  969. #define malrxctp24r (MAL_DCR_BASE+0x58) /* RX 24 Channel table ptr reg */
  970. #define malrxctp25r (MAL_DCR_BASE+0x59) /* RX 25 Channel table ptr reg */
  971. #define malrxctp26r (MAL_DCR_BASE+0x5A) /* RX 26 Channel table ptr reg */
  972. #define malrxctp27r (MAL_DCR_BASE+0x5B) /* RX 27 Channel table ptr reg */
  973. #define malrxctp28r (MAL_DCR_BASE+0x5C) /* RX 28 Channel table ptr reg */
  974. #define malrxctp29r (MAL_DCR_BASE+0x5D) /* RX 29 Channel table ptr reg */
  975. #define malrxctp30r (MAL_DCR_BASE+0x5E) /* RX 30 Channel table ptr reg */
  976. #define malrxctp31r (MAL_DCR_BASE+0x5F) /* RX 31 Channel table ptr reg */
  977. #define malrcbs0 (MAL_DCR_BASE+0x60) /* RX 0 Channel buffer size reg */
  978. #define malrcbs1 (MAL_DCR_BASE+0x61) /* RX 1 Channel buffer size reg */
  979. #define malrcbs2 (MAL_DCR_BASE+0x62) /* RX 2 Channel buffer size reg */
  980. #define malrcbs3 (MAL_DCR_BASE+0x63) /* RX 3 Channel buffer size reg */
  981. #define malrcbs4 (MAL_DCR_BASE+0x64) /* RX 4 Channel buffer size reg */
  982. #define malrcbs5 (MAL_DCR_BASE+0x65) /* RX 5 Channel buffer size reg */
  983. #define malrcbs6 (MAL_DCR_BASE+0x66) /* RX 6 Channel buffer size reg */
  984. #define malrcbs7 (MAL_DCR_BASE+0x67) /* RX 7 Channel buffer size reg */
  985. #define malrcbs8 (MAL_DCR_BASE+0x68) /* RX 8 Channel buffer size reg */
  986. #define malrcbs9 (MAL_DCR_BASE+0x69) /* RX 9 Channel buffer size reg */
  987. #define malrcbs10 (MAL_DCR_BASE+0x6A) /* RX 10 Channel buffer size reg */
  988. #define malrcbs11 (MAL_DCR_BASE+0x6B) /* RX 11 Channel buffer size reg */
  989. #define malrcbs12 (MAL_DCR_BASE+0x6C) /* RX 12 Channel buffer size reg */
  990. #define malrcbs13 (MAL_DCR_BASE+0x6D) /* RX 13 Channel buffer size reg */
  991. #define malrcbs14 (MAL_DCR_BASE+0x6E) /* RX 14 Channel buffer size reg */
  992. #define malrcbs15 (MAL_DCR_BASE+0x6F) /* RX 15 Channel buffer size reg */
  993. #define malrcbs16 (MAL_DCR_BASE+0x70) /* RX 16 Channel buffer size reg */
  994. #define malrcbs17 (MAL_DCR_BASE+0x71) /* RX 17 Channel buffer size reg */
  995. #define malrcbs18 (MAL_DCR_BASE+0x72) /* RX 18 Channel buffer size reg */
  996. #define malrcbs19 (MAL_DCR_BASE+0x73) /* RX 19 Channel buffer size reg */
  997. #define malrcbs20 (MAL_DCR_BASE+0x74) /* RX 20 Channel buffer size reg */
  998. #define malrcbs21 (MAL_DCR_BASE+0x75) /* RX 21 Channel buffer size reg */
  999. #define malrcbs22 (MAL_DCR_BASE+0x76) /* RX 22 Channel buffer size reg */
  1000. #define malrcbs23 (MAL_DCR_BASE+0x77) /* RX 23 Channel buffer size reg */
  1001. #define malrcbs24 (MAL_DCR_BASE+0x78) /* RX 24 Channel buffer size reg */
  1002. #define malrcbs25 (MAL_DCR_BASE+0x79) /* RX 25 Channel buffer size reg */
  1003. #define malrcbs26 (MAL_DCR_BASE+0x7A) /* RX 26 Channel buffer size reg */
  1004. #define malrcbs27 (MAL_DCR_BASE+0x7B) /* RX 27 Channel buffer size reg */
  1005. #define malrcbs28 (MAL_DCR_BASE+0x7C) /* RX 28 Channel buffer size reg */
  1006. #define malrcbs29 (MAL_DCR_BASE+0x7D) /* RX 29 Channel buffer size reg */
  1007. #define malrcbs30 (MAL_DCR_BASE+0x7E) /* RX 30 Channel buffer size reg */
  1008. #define malrcbs31 (MAL_DCR_BASE+0x7F) /* RX 31 Channel buffer size reg */
  1009. #else /* !defined(CONFIG_405EZ) */
  1010. #define MAL_DCR_BASE 0x180
  1011. #define malmcr (MAL_DCR_BASE+0x00) /* MAL Config reg */
  1012. #define malesr (MAL_DCR_BASE+0x01) /* Error Status reg (Read/Clear) */
  1013. #define malier (MAL_DCR_BASE+0x02) /* Interrupt enable reg */
  1014. #define maldbr (MAL_DCR_BASE+0x03) /* Mal Debug reg (Read only) */
  1015. #define maltxcasr (MAL_DCR_BASE+0x04) /* TX Channel active reg (set) */
  1016. #define maltxcarr (MAL_DCR_BASE+0x05) /* TX Channel active reg (Reset) */
  1017. #define maltxeobisr (MAL_DCR_BASE+0x06) /* TX End of buffer int status reg */
  1018. #define maltxdeir (MAL_DCR_BASE+0x07) /* TX Descr. Error Int reg */
  1019. #define malrxcasr (MAL_DCR_BASE+0x10) /* RX Channel active reg (set) */
  1020. #define malrxcarr (MAL_DCR_BASE+0x11) /* RX Channel active reg (Reset) */
  1021. #define malrxeobisr (MAL_DCR_BASE+0x12) /* RX End of buffer int status reg */
  1022. #define malrxdeir (MAL_DCR_BASE+0x13) /* RX Descr. Error Int reg */
  1023. #define maltxctp0r (MAL_DCR_BASE+0x20) /* TX 0 Channel table pointer reg */
  1024. #define maltxctp1r (MAL_DCR_BASE+0x21) /* TX 1 Channel table pointer reg */
  1025. #define maltxctp2r (MAL_DCR_BASE+0x22) /* TX 2 Channel table pointer reg */
  1026. #define malrxctp0r (MAL_DCR_BASE+0x40) /* RX 0 Channel table pointer reg */
  1027. #define malrxctp1r (MAL_DCR_BASE+0x41) /* RX 1 Channel table pointer reg */
  1028. #define malrcbs0 (MAL_DCR_BASE+0x60) /* RX 0 Channel buffer size reg */
  1029. #define malrcbs1 (MAL_DCR_BASE+0x61) /* RX 1 Channel buffer size reg */
  1030. #endif /* defined(CONFIG_405EZ) */
  1031. /*-----------------------------------------------------------------------------
  1032. | IIC Register Offsets
  1033. '----------------------------------------------------------------------------*/
  1034. #define IICMDBUF 0x00
  1035. #define IICSDBUF 0x02
  1036. #define IICLMADR 0x04
  1037. #define IICHMADR 0x05
  1038. #define IICCNTL 0x06
  1039. #define IICMDCNTL 0x07
  1040. #define IICSTS 0x08
  1041. #define IICEXTSTS 0x09
  1042. #define IICLSADR 0x0A
  1043. #define IICHSADR 0x0B
  1044. #define IICCLKDIV 0x0C
  1045. #define IICINTRMSK 0x0D
  1046. #define IICXFRCNT 0x0E
  1047. #define IICXTCNTLSS 0x0F
  1048. #define IICDIRECTCNTL 0x10
  1049. /*-----------------------------------------------------------------------------
  1050. | UART Register Offsets
  1051. '----------------------------------------------------------------------------*/
  1052. #define DATA_REG 0x00
  1053. #define DL_LSB 0x00
  1054. #define DL_MSB 0x01
  1055. #define INT_ENABLE 0x01
  1056. #define FIFO_CONTROL 0x02
  1057. #define LINE_CONTROL 0x03
  1058. #define MODEM_CONTROL 0x04
  1059. #define LINE_STATUS 0x05
  1060. #define MODEM_STATUS 0x06
  1061. #define SCRATCH 0x07
  1062. /******************************************************************************
  1063. * On Chip Memory
  1064. ******************************************************************************/
  1065. #if defined(CONFIG_405EZ)
  1066. #define OCM_DCR_BASE 0x020
  1067. #define ocmplb3cr1 (OCM_DCR_BASE+0x00) /* OCM PLB3 Bank 1 Config Reg */
  1068. #define ocmplb3cr2 (OCM_DCR_BASE+0x01) /* OCM PLB3 Bank 2 Config Reg */
  1069. #define ocmplb3bear (OCM_DCR_BASE+0x02) /* OCM PLB3 Bus Error Add Reg */
  1070. #define ocmplb3besr0 (OCM_DCR_BASE+0x03) /* OCM PLB3 Bus Error Stat Reg 0 */
  1071. #define ocmplb3besr1 (OCM_DCR_BASE+0x04) /* OCM PLB3 Bus Error Stat Reg 1 */
  1072. #define ocmcid (OCM_DCR_BASE+0x05) /* OCM Core ID */
  1073. #define ocmrevid (OCM_DCR_BASE+0x06) /* OCM Revision ID */
  1074. #define ocmplb3dpc (OCM_DCR_BASE+0x07) /* OCM PLB3 Data Parity Check */
  1075. #define ocmdscr1 (OCM_DCR_BASE+0x08) /* OCM D-side Bank 1 Config Reg */
  1076. #define ocmdscr2 (OCM_DCR_BASE+0x09) /* OCM D-side Bank 2 Config Reg */
  1077. #define ocmiscr1 (OCM_DCR_BASE+0x0A) /* OCM I-side Bank 1 Config Reg */
  1078. #define ocmiscr2 (OCM_DCR_BASE+0x0B) /* OCM I-side Bank 2 Config Reg */
  1079. #define ocmdsisdpc (OCM_DCR_BASE+0x0C) /* OCM D-side/I-side Data Par Chk*/
  1080. #define ocmdsisbear (OCM_DCR_BASE+0x0D) /* OCM D-side/I-side Bus Err Addr*/
  1081. #define ocmdsisbesr (OCM_DCR_BASE+0x0E) /* OCM D-side/I-side Bus Err Stat*/
  1082. #else
  1083. #define OCM_DCR_BASE 0x018
  1084. #define ocmisarc (OCM_DCR_BASE+0x00) /* OCM I-side address compare reg */
  1085. #define ocmiscntl (OCM_DCR_BASE+0x01) /* OCM I-side control reg */
  1086. #define ocmdsarc (OCM_DCR_BASE+0x02) /* OCM D-side address compare reg */
  1087. #define ocmdscntl (OCM_DCR_BASE+0x03) /* OCM D-side control reg */
  1088. #endif /* CONFIG_405EZ */
  1089. /******************************************************************************
  1090. * GPIO macro register defines
  1091. ******************************************************************************/
  1092. #if defined(CONFIG_405EZ)
  1093. /* Only the 405EZ has 2 GPIOs */
  1094. #define GPIO_BASE 0xEF600700
  1095. #define GPIO0_OR (GPIO_BASE+0x0)
  1096. #define GPIO0_TCR (GPIO_BASE+0x4)
  1097. #define GPIO0_OSRL (GPIO_BASE+0x8)
  1098. #define GPIO0_OSRH (GPIO_BASE+0xC)
  1099. #define GPIO0_TSRL (GPIO_BASE+0x10)
  1100. #define GPIO0_TSRH (GPIO_BASE+0x14)
  1101. #define GPIO0_ODR (GPIO_BASE+0x18)
  1102. #define GPIO0_IR (GPIO_BASE+0x1C)
  1103. #define GPIO0_RR1 (GPIO_BASE+0x20)
  1104. #define GPIO0_RR2 (GPIO_BASE+0x24)
  1105. #define GPIO0_RR3 (GPIO_BASE+0x28)
  1106. #define GPIO0_ISR1L (GPIO_BASE+0x30)
  1107. #define GPIO0_ISR1H (GPIO_BASE+0x34)
  1108. #define GPIO0_ISR2L (GPIO_BASE+0x38)
  1109. #define GPIO0_ISR2H (GPIO_BASE+0x3C)
  1110. #define GPIO0_ISR3L (GPIO_BASE+0x40)
  1111. #define GPIO0_ISR3H (GPIO_BASE+0x44)
  1112. #define GPIO1_BASE 0xEF600800
  1113. #define GPIO1_OR (GPIO1_BASE+0x0)
  1114. #define GPIO1_TCR (GPIO1_BASE+0x4)
  1115. #define GPIO1_OSRL (GPIO1_BASE+0x8)
  1116. #define GPIO1_OSRH (GPIO1_BASE+0xC)
  1117. #define GPIO1_TSRL (GPIO1_BASE+0x10)
  1118. #define GPIO1_TSRH (GPIO1_BASE+0x14)
  1119. #define GPIO1_ODR (GPIO1_BASE+0x18)
  1120. #define GPIO1_IR (GPIO1_BASE+0x1C)
  1121. #define GPIO1_RR1 (GPIO1_BASE+0x20)
  1122. #define GPIO1_RR2 (GPIO1_BASE+0x24)
  1123. #define GPIO1_RR3 (GPIO1_BASE+0x28)
  1124. #define GPIO1_ISR1L (GPIO1_BASE+0x30)
  1125. #define GPIO1_ISR1H (GPIO1_BASE+0x34)
  1126. #define GPIO1_ISR2L (GPIO1_BASE+0x38)
  1127. #define GPIO1_ISR2H (GPIO1_BASE+0x3C)
  1128. #define GPIO1_ISR3L (GPIO1_BASE+0x40)
  1129. #define GPIO1_ISR3H (GPIO1_BASE+0x44)
  1130. #else /* !405EZ */
  1131. #define GPIO_BASE 0xEF600700
  1132. #define GPIO0_OR (GPIO_BASE+0x0)
  1133. #define GPIO0_TCR (GPIO_BASE+0x4)
  1134. #define GPIO0_OSRH (GPIO_BASE+0x8)
  1135. #define GPIO0_OSRL (GPIO_BASE+0xC)
  1136. #define GPIO0_TSRH (GPIO_BASE+0x10)
  1137. #define GPIO0_TSRL (GPIO_BASE+0x14)
  1138. #define GPIO0_ODR (GPIO_BASE+0x18)
  1139. #define GPIO0_IR (GPIO_BASE+0x1C)
  1140. #define GPIO0_RR1 (GPIO_BASE+0x20)
  1141. #define GPIO0_RR2 (GPIO_BASE+0x24)
  1142. #define GPIO0_ISR1H (GPIO_BASE+0x30)
  1143. #define GPIO0_ISR1L (GPIO_BASE+0x34)
  1144. #define GPIO0_ISR2H (GPIO_BASE+0x38)
  1145. #define GPIO0_ISR2L (GPIO_BASE+0x3C)
  1146. #endif /* CONFIG_405EZ */
  1147. /*
  1148. * Macro for accessing the indirect EBC register
  1149. */
  1150. #define mtebc(reg, data) mtdcr(ebccfga,reg);mtdcr(ebccfgd,data)
  1151. #define mfebc(reg, data) mtdcr(ebccfga,reg);data = mfdcr(ebccfgd)
  1152. #define mtsdram(reg, data) do { mtdcr(memcfga,reg);mtdcr(memcfgd,data); } while (0)
  1153. #define mfsdram(reg, data) do { mtdcr(memcfga,reg);data = mfdcr(memcfgd); } while (0)
  1154. #ifndef __ASSEMBLY__
  1155. typedef struct
  1156. {
  1157. unsigned long pllFwdDiv;
  1158. unsigned long pllFwdDivB;
  1159. unsigned long pllFbkDiv;
  1160. unsigned long pllPlbDiv;
  1161. unsigned long pllPciDiv;
  1162. unsigned long pllExtBusDiv;
  1163. unsigned long pllOpbDiv;
  1164. unsigned long freqVCOMhz; /* in MHz */
  1165. unsigned long freqProcessor;
  1166. unsigned long freqPLB;
  1167. unsigned long freqPCI;
  1168. unsigned long pciIntArbEn; /* Internal PCI arbiter is enabled */
  1169. unsigned long pciClkSync; /* PCI clock is synchronous */
  1170. unsigned long freqVCOHz;
  1171. } PPC405_SYS_INFO;
  1172. #endif /* _ASMLANGUAGE */
  1173. #define RESET_VECTOR 0xfffffffc
  1174. #define CACHELINE_MASK (CFG_CACHELINE_SIZE - 1) /* Address mask for cache
  1175. line aligned data. */
  1176. #endif /* __PPC405_H__ */