ixp425.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. /*
  2. * include/asm-arm/arch-ixp425/ixp425.h
  3. *
  4. * Register definitions for IXP425
  5. *
  6. * Copyright (C) 2002 Intel Corporation.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #ifndef _ASM_ARM_IXP425_H_
  14. #define _ASM_ARM_IXP425_H_
  15. #define BIT(x) (1<<(x))
  16. /* FIXME: Only this does work for u-boot... find out why... [RS] */
  17. #define UBOOT_REG_FIX 1
  18. #ifdef UBOOT_REG_FIX
  19. # undef io_p2v
  20. # undef __REG
  21. # ifndef __ASSEMBLY__
  22. # define io_p2v(PhAdd) (PhAdd)
  23. # define __REG(x) (*((volatile u32 *)io_p2v(x)))
  24. # define __REG2(x,y) (*(volatile u32 *)((u32)&__REG(x) + (y)))
  25. # else
  26. # define __REG(x) (x)
  27. # endif
  28. #endif /* UBOOT_REG_FIX */
  29. /*
  30. *
  31. * IXP425 Memory map:
  32. *
  33. * Phy Phy Size Map Size Virt Description
  34. * =========================================================================
  35. *
  36. * 0x00000000 0x10000000 SDRAM 1
  37. *
  38. * 0x10000000 0x10000000 SDRAM 2
  39. *
  40. * 0x20000000 0x10000000 SDRAM 3
  41. *
  42. * 0x30000000 0x10000000 SDRAM 4
  43. *
  44. * The above four are aliases to the same memory location (0x00000000)
  45. *
  46. * 0x48000000 0x4000000 PCI Memory
  47. *
  48. * 0x50000000 0x10000000 Not Mapped EXP BUS
  49. *
  50. * 0x6000000 0x00004000 0x4000 0xFFFEB000 QMgr
  51. *
  52. * 0xC0000000 0x100 0x1000 0xFFFDD000 PCI CFG
  53. *
  54. * 0xC4000000 0x100 0x1000 0xFFFDE000 EXP CFG
  55. *
  56. * 0xC8000000 0xC000 0xC000 0xFFFDF000 PERIPHERAL
  57. *
  58. * 0xCC000000 0x100 0x1000 Not Mapped SDRAM CFG
  59. */
  60. /*
  61. * SDRAM
  62. */
  63. #define IXP425_SDRAM_BASE (0x00000000)
  64. #define IXP425_SDRAM_BASE_ALT (0x10000000)
  65. /*
  66. * PCI Configuration space
  67. */
  68. #define IXP425_PCI_CFG_BASE_PHYS (0xC0000000)
  69. #define IXP425_PCI_CFG_REGION_SIZE (0x00001000)
  70. /*
  71. * Expansion BUS Configuration registers
  72. */
  73. #define IXP425_EXP_CFG_BASE_PHYS (0xC4000000)
  74. #define IXP425_EXP_CFG_REGION_SIZE (0x00001000)
  75. /*
  76. * Peripheral space
  77. */
  78. #define IXP425_PERIPHERAL_BASE_PHYS (0xC8000000)
  79. #define IXP425_PERIPHERAL_REGION_SIZE (0x0000C000)
  80. /*
  81. * SDRAM configuration registers
  82. */
  83. #define IXP425_SDRAM_CFG_BASE_PHYS (0xCC000000)
  84. /*
  85. * Q Manager space .. not static mapped
  86. */
  87. #define IXP425_QMGR_BASE_PHYS (0x60000000)
  88. #define IXP425_QMGR_REGION_SIZE (0x00004000)
  89. /*
  90. * Expansion BUS
  91. *
  92. * Expansion Bus 'lives' at either base1 or base 2 depending on the value of
  93. * Exp Bus config registers:
  94. *
  95. * Setting bit 31 of IXP425_EXP_CFG0 puts SDRAM at zero,
  96. * and The expansion bus to IXP425_EXP_BUS_BASE2
  97. */
  98. #define IXP425_EXP_BUS_BASE1_PHYS (0x00000000)
  99. #define IXP425_EXP_BUS_BASE2_PHYS (0x50000000)
  100. #define IXP425_EXP_BUS_BASE_PHYS IXP425_EXP_BUS_BASE2_PHYS
  101. #define IXP425_EXP_BUS_REGION_SIZE (0x08000000)
  102. #define IXP425_EXP_BUS_CSX_REGION_SIZE (0x01000000)
  103. #define IXP425_EXP_BUS_CS0_BASE_PHYS (IXP425_EXP_BUS_BASE2_PHYS + 0x00000000)
  104. #define IXP425_EXP_BUS_CS1_BASE_PHYS (IXP425_EXP_BUS_BASE2_PHYS + 0x01000000)
  105. #define IXP425_EXP_BUS_CS2_BASE_PHYS (IXP425_EXP_BUS_BASE2_PHYS + 0x02000000)
  106. #define IXP425_EXP_BUS_CS3_BASE_PHYS (IXP425_EXP_BUS_BASE2_PHYS + 0x03000000)
  107. #define IXP425_EXP_BUS_CS4_BASE_PHYS (IXP425_EXP_BUS_BASE2_PHYS + 0x04000000)
  108. #define IXP425_EXP_BUS_CS5_BASE_PHYS (IXP425_EXP_BUS_BASE2_PHYS + 0x05000000)
  109. #define IXP425_EXP_BUS_CS6_BASE_PHYS (IXP425_EXP_BUS_BASE2_PHYS + 0x06000000)
  110. #define IXP425_EXP_BUS_CS7_BASE_PHYS (IXP425_EXP_BUS_BASE2_PHYS + 0x07000000)
  111. #define IXP425_FLASH_WRITABLE (0x2)
  112. #define IXP425_FLASH_DEFAULT (0xbcd23c40)
  113. #define IXP425_FLASH_WRITE (0xbcd23c42)
  114. #define IXP425_EXP_CS0_OFFSET 0x00
  115. #define IXP425_EXP_CS1_OFFSET 0x04
  116. #define IXP425_EXP_CS2_OFFSET 0x08
  117. #define IXP425_EXP_CS3_OFFSET 0x0C
  118. #define IXP425_EXP_CS4_OFFSET 0x10
  119. #define IXP425_EXP_CS5_OFFSET 0x14
  120. #define IXP425_EXP_CS6_OFFSET 0x18
  121. #define IXP425_EXP_CS7_OFFSET 0x1C
  122. #define IXP425_EXP_CFG0_OFFSET 0x20
  123. #define IXP425_EXP_CFG1_OFFSET 0x24
  124. #define IXP425_EXP_CFG2_OFFSET 0x28
  125. #define IXP425_EXP_CFG3_OFFSET 0x2C
  126. /*
  127. * Expansion Bus Controller registers.
  128. */
  129. #ifndef __ASSEMBLY__
  130. #define IXP425_EXP_REG(x) ((volatile u32 *)(IXP425_EXP_CFG_BASE_PHYS+(x)))
  131. #else
  132. #define IXP425_EXP_REG(x) (IXP425_EXP_CFG_BASE_PHYS+(x))
  133. #endif
  134. #define IXP425_EXP_CS0 IXP425_EXP_REG(IXP425_EXP_CS0_OFFSET)
  135. #define IXP425_EXP_CS1 IXP425_EXP_REG(IXP425_EXP_CS1_OFFSET)
  136. #define IXP425_EXP_CS2 IXP425_EXP_REG(IXP425_EXP_CS2_OFFSET)
  137. #define IXP425_EXP_CS3 IXP425_EXP_REG(IXP425_EXP_CS3_OFFSET)
  138. #define IXP425_EXP_CS4 IXP425_EXP_REG(IXP425_EXP_CS4_OFFSET)
  139. #define IXP425_EXP_CS5 IXP425_EXP_REG(IXP425_EXP_CS5_OFFSET)
  140. #define IXP425_EXP_CS6 IXP425_EXP_REG(IXP425_EXP_CS6_OFFSET)
  141. #define IXP425_EXP_CS7 IXP425_EXP_REG(IXP425_EXP_CS7_OFFSET)
  142. #define IXP425_EXP_CFG0 IXP425_EXP_REG(IXP425_EXP_CFG0_OFFSET)
  143. #define IXP425_EXP_CFG1 IXP425_EXP_REG(IXP425_EXP_CFG1_OFFSET)
  144. #define IXP425_EXP_CFG2 IXP425_EXP_REG(IXP425_EXP_CFG2_OFFSET)
  145. #define IXP425_EXP_CFG3 IXP425_EXP_REG(IXP425_EXP_CFG3_OFFSET)
  146. /*
  147. * SDRAM Controller registers.
  148. */
  149. #define IXP425_SDR_CONFIG_OFFSET 0x00
  150. #define IXP425_SDR_REFRESH_OFFSET 0x04
  151. #define IXP425_SDR_IR_OFFSET 0x08
  152. #define IXP425_SDRAM_REG(x) (IXP425_SDRAM_CFG_BASE_PHYS+(x))
  153. #define IXP425_SDR_CONFIG IXP425_SDRAM_REG(IXP425_SDR_CONFIG_OFFSET)
  154. #define IXP425_SDR_REFRESH IXP425_SDRAM_REG(IXP425_SDR_REFRESH_OFFSET)
  155. #define IXP425_SDR_IR IXP425_SDRAM_REG(IXP425_SDR_IR_OFFSET)
  156. /*
  157. * UART registers
  158. */
  159. #define IXP425_UART1 0
  160. #define IXP425_UART2 0x1000
  161. #define IXP425_UART_RBR_OFFSET 0x00
  162. #define IXP425_UART_THR_OFFSET 0x00
  163. #define IXP425_UART_DLL_OFFSET 0x00
  164. #define IXP425_UART_IER_OFFSET 0x04
  165. #define IXP425_UART_DLH_OFFSET 0x04
  166. #define IXP425_UART_IIR_OFFSET 0x08
  167. #define IXP425_UART_FCR_OFFSET 0x00
  168. #define IXP425_UART_LCR_OFFSET 0x0c
  169. #define IXP425_UART_MCR_OFFSET 0x10
  170. #define IXP425_UART_LSR_OFFSET 0x14
  171. #define IXP425_UART_MSR_OFFSET 0x18
  172. #define IXP425_UART_SPR_OFFSET 0x1c
  173. #define IXP425_UART_ISR_OFFSET 0x20
  174. #define IXP425_UART_CFG_BASE_PHYS (0xc8000000)
  175. #define RBR(x) __REG(IXP425_UART_CFG_BASE_PHYS+(x)+IXP425_UART_RBR_OFFSET)
  176. #define THR(x) __REG(IXP425_UART_CFG_BASE_PHYS+(x)+IXP425_UART_THR_OFFSET)
  177. #define DLL(x) __REG(IXP425_UART_CFG_BASE_PHYS+(x)+IXP425_UART_DLL_OFFSET)
  178. #define IER(x) __REG(IXP425_UART_CFG_BASE_PHYS+(x)+IXP425_UART_IER_OFFSET)
  179. #define DLH(x) __REG(IXP425_UART_CFG_BASE_PHYS+(x)+IXP425_UART_DLH_OFFSET)
  180. #define IIR(x) __REG(IXP425_UART_CFG_BASE_PHYS+(x)+IXP425_UART_IIR_OFFSET)
  181. #define FCR(x) __REG(IXP425_UART_CFG_BASE_PHYS+(x)+IXP425_UART_FCR_OFFSET)
  182. #define LCR(x) __REG(IXP425_UART_CFG_BASE_PHYS+(x)+IXP425_UART_LCR_OFFSET)
  183. #define MCR(x) __REG(IXP425_UART_CFG_BASE_PHYS+(x)+IXP425_UART_MCR_OFFSET)
  184. #define LSR(x) __REG(IXP425_UART_CFG_BASE_PHYS+(x)+IXP425_UART_LSR_OFFSET)
  185. #define MSR(x) __REG(IXP425_UART_CFG_BASE_PHYS+(x)+IXP425_UART_MSR_OFFSET)
  186. #define SPR(x) __REG(IXP425_UART_CFG_BASE_PHYS+(x)+IXP425_UART_SPR_OFFSET)
  187. #define ISR(x) __REG(IXP425_UART_CFG_BASE_PHYS+(x)+IXP425_UART_ISR_OFFSET)
  188. #define IER_DMAE (1 << 7) /* DMA Requests Enable */
  189. #define IER_UUE (1 << 6) /* UART Unit Enable */
  190. #define IER_NRZE (1 << 5) /* NRZ coding Enable */
  191. #define IER_RTIOE (1 << 4) /* Receiver Time Out Interrupt Enable */
  192. #define IER_MIE (1 << 3) /* Modem Interrupt Enable */
  193. #define IER_RLSE (1 << 2) /* Receiver Line Status Interrupt Enable */
  194. #define IER_TIE (1 << 1) /* Transmit Data request Interrupt Enable */
  195. #define IER_RAVIE (1 << 0) /* Receiver Data Available Interrupt Enable */
  196. #define IIR_FIFOES1 (1 << 7) /* FIFO Mode Enable Status */
  197. #define IIR_FIFOES0 (1 << 6) /* FIFO Mode Enable Status */
  198. #define IIR_TOD (1 << 3) /* Time Out Detected */
  199. #define IIR_IID2 (1 << 2) /* Interrupt Source Encoded */
  200. #define IIR_IID1 (1 << 1) /* Interrupt Source Encoded */
  201. #define IIR_IP (1 << 0) /* Interrupt Pending (active low) */
  202. #define FCR_ITL2 (1 << 7) /* Interrupt Trigger Level */
  203. #define FCR_ITL1 (1 << 6) /* Interrupt Trigger Level */
  204. #define FCR_RESETTF (1 << 2) /* Reset Transmitter FIFO */
  205. #define FCR_RESETRF (1 << 1) /* Reset Receiver FIFO */
  206. #define FCR_TRFIFOE (1 << 0) /* Transmit and Receive FIFO Enable */
  207. #define FCR_ITL_1 (0)
  208. #define FCR_ITL_8 (FCR_ITL1)
  209. #define FCR_ITL_16 (FCR_ITL2)
  210. #define FCR_ITL_32 (FCR_ITL2|FCR_ITL1)
  211. #define LCR_DLAB (1 << 7) /* Divisor Latch Access Bit */
  212. #define LCR_SB (1 << 6) /* Set Break */
  213. #define LCR_STKYP (1 << 5) /* Sticky Parity */
  214. #define LCR_EPS (1 << 4) /* Even Parity Select */
  215. #define LCR_PEN (1 << 3) /* Parity Enable */
  216. #define LCR_STB (1 << 2) /* Stop Bit */
  217. #define LCR_WLS1 (1 << 1) /* Word Length Select */
  218. #define LCR_WLS0 (1 << 0) /* Word Length Select */
  219. #define LSR_FIFOE (1 << 7) /* FIFO Error Status */
  220. #define LSR_TEMT (1 << 6) /* Transmitter Empty */
  221. #define LSR_TDRQ (1 << 5) /* Transmit Data Request */
  222. #define LSR_BI (1 << 4) /* Break Interrupt */
  223. #define LSR_FE (1 << 3) /* Framing Error */
  224. #define LSR_PE (1 << 2) /* Parity Error */
  225. #define LSR_OE (1 << 1) /* Overrun Error */
  226. #define LSR_DR (1 << 0) /* Data Ready */
  227. #define MCR_LOOP (1 << 4) */
  228. #define MCR_OUT2 (1 << 3) /* force MSR_DCD in loopback mode */
  229. #define MCR_OUT1 (1 << 2) /* force MSR_RI in loopback mode */
  230. #define MCR_RTS (1 << 1) /* Request to Send */
  231. #define MCR_DTR (1 << 0) /* Data Terminal Ready */
  232. #define MSR_DCD (1 << 7) /* Data Carrier Detect */
  233. #define MSR_RI (1 << 6) /* Ring Indicator */
  234. #define MSR_DSR (1 << 5) /* Data Set Ready */
  235. #define MSR_CTS (1 << 4) /* Clear To Send */
  236. #define MSR_DDCD (1 << 3) /* Delta Data Carrier Detect */
  237. #define MSR_TERI (1 << 2) /* Trailing Edge Ring Indicator */
  238. #define MSR_DDSR (1 << 1) /* Delta Data Set Ready */
  239. #define MSR_DCTS (1 << 0) /* Delta Clear To Send */
  240. #define IXP425_CONSOLE_UART_BASE_PHYS IXP425_UART1_BASE_PHYS
  241. /*
  242. * Peripheral Space Registers
  243. */
  244. #define IXP425_UART1_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0x0000)
  245. #define IXP425_UART2_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0x1000)
  246. #define IXP425_PMU_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0x2000)
  247. #define IXP425_INTC_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0x3000)
  248. #define IXP425_GPIO_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0x4000)
  249. #define IXP425_TIMER_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0x5000)
  250. #define IXP425_NPEA_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0x6000)
  251. #define IXP425_NPEB_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0x7000)
  252. #define IXP425_NPEC_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0x8000)
  253. #define IXP425_EthA_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0x9000)
  254. #define IXP425_EthB_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0xA000)
  255. #define IXP425_USB_BASE_PHYS (IXP425_PERIPHERAL_BASE_PHYS + 0xB000)
  256. /*
  257. * UART Register Definitions , Offsets only as there are 2 UARTS.
  258. * IXP425_UART1_BASE , IXP425_UART2_BASE.
  259. */
  260. #undef UART_NO_RX_INTERRUPT
  261. #define IXP425_UART_XTAL 14745600
  262. /*
  263. * Constants to make it easy to access Interrupt Controller registers
  264. */
  265. #define IXP425_ICPR_OFFSET 0x00 /* Interrupt Status */
  266. #define IXP425_ICMR_OFFSET 0x04 /* Interrupt Enable */
  267. #define IXP425_ICLR_OFFSET 0x08 /* Interrupt IRQ/FIQ Select */
  268. #define IXP425_ICIP_OFFSET 0x0C /* IRQ Status */
  269. #define IXP425_ICFP_OFFSET 0x10 /* FIQ Status */
  270. #define IXP425_ICHR_OFFSET 0x14 /* Interrupt Priority */
  271. #define IXP425_ICIH_OFFSET 0x18 /* IRQ Highest Pri Int */
  272. #define IXP425_ICFH_OFFSET 0x1C /* FIQ Highest Pri Int */
  273. #define N_IRQS 32
  274. #define IXP425_TIMER_2_IRQ 11
  275. /*
  276. * Interrupt Controller Register Definitions.
  277. */
  278. #ifndef __ASSEMBLY__
  279. #define IXP425_INTC_REG(x) ((volatile u32 *)(IXP425_INTC_BASE_PHYS+(x)))
  280. #else
  281. #define IXP425_INTC_REG(x) (IXP425_INTC_BASE_PHYS+(x))
  282. #endif
  283. #define IXP425_ICPR IXP425_INTC_REG(IXP425_ICPR_OFFSET)
  284. #define IXP425_ICMR IXP425_INTC_REG(IXP425_ICMR_OFFSET)
  285. #define IXP425_ICLR IXP425_INTC_REG(IXP425_ICLR_OFFSET)
  286. #define IXP425_ICIP IXP425_INTC_REG(IXP425_ICIP_OFFSET)
  287. #define IXP425_ICFP IXP425_INTC_REG(IXP425_ICFP_OFFSET)
  288. #define IXP425_ICHR IXP425_INTC_REG(IXP425_ICHR_OFFSET)
  289. #define IXP425_ICIH IXP425_INTC_REG(IXP425_ICIH_OFFSET)
  290. #define IXP425_ICFH IXP425_INTC_REG(IXP425_ICFH_OFFSET)
  291. /*
  292. * Constants to make it easy to access GPIO registers
  293. */
  294. #define IXP425_GPIO_GPOUTR_OFFSET 0x00
  295. #define IXP425_GPIO_GPOER_OFFSET 0x04
  296. #define IXP425_GPIO_GPINR_OFFSET 0x08
  297. #define IXP425_GPIO_GPISR_OFFSET 0x0C
  298. #define IXP425_GPIO_GPIT1R_OFFSET 0x10
  299. #define IXP425_GPIO_GPIT2R_OFFSET 0x14
  300. #define IXP425_GPIO_GPCLKR_OFFSET 0x18
  301. #define IXP425_GPIO_GPDBSELR_OFFSET 0x1C
  302. /*
  303. * GPIO Register Definitions.
  304. * [Only perform 32bit reads/writes]
  305. */
  306. #define IXP425_GPIO_REG(x) ((volatile u32 *)(IXP425_GPIO_BASE_PHYS+(x)))
  307. #define IXP425_GPIO_GPOUTR IXP425_GPIO_REG(IXP425_GPIO_GPOUTR_OFFSET)
  308. #define IXP425_GPIO_GPOER IXP425_GPIO_REG(IXP425_GPIO_GPOER_OFFSET)
  309. #define IXP425_GPIO_GPINR IXP425_GPIO_REG(IXP425_GPIO_GPINR_OFFSET)
  310. #define IXP425_GPIO_GPISR IXP425_GPIO_REG(IXP425_GPIO_GPISR_OFFSET)
  311. #define IXP425_GPIO_GPIT1R IXP425_GPIO_REG(IXP425_GPIO_GPIT1R_OFFSET)
  312. #define IXP425_GPIO_GPIT2R IXP425_GPIO_REG(IXP425_GPIO_GPIT2R_OFFSET)
  313. #define IXP425_GPIO_GPCLKR IXP425_GPIO_REG(IXP425_GPIO_GPCLKR_OFFSET)
  314. #define IXP425_GPIO_GPDBSELR IXP425_GPIO_REG(IXP425_GPIO_GPDBSELR_OFFSET)
  315. /*
  316. * Macros to make it easy to access the GPIO registers
  317. */
  318. #define GPIO_OUTPUT_ENABLE(line) *IXP425_GPIO_GPOER &= ~(1 << (line))
  319. #define GPIO_OUTPUT_DISABLE(line) *IXP425_GPIO_GPOER |= (1 << (line))
  320. #define GPIO_OUTPUT_SET(line) *IXP425_GPIO_GPOUTR |= (1 << (line))
  321. #define GPIO_OUTPUT_CLEAR(line) *IXP425_GPIO_GPOUTR &= ~(1 << (line))
  322. #define GPIO_INT_ACT_LOW_SET(line) *IXP425_GPIO_GPIT1R = \
  323. (*IXP425_GPIO_GPIT1R & ~(0x7 << (line * 3))) | (0x1 << (line * 3))
  324. /*
  325. * Constants to make it easy to access Timer Control/Status registers
  326. */
  327. #define IXP425_OSTS_OFFSET 0x00 /* Continious TimeStamp */
  328. #define IXP425_OST1_OFFSET 0x04 /* Timer 1 Timestamp */
  329. #define IXP425_OSRT1_OFFSET 0x08 /* Timer 1 Reload */
  330. #define IXP425_OST2_OFFSET 0x0C /* Timer 2 Timestamp */
  331. #define IXP425_OSRT2_OFFSET 0x10 /* Timer 2 Reload */
  332. #define IXP425_OSWT_OFFSET 0x14 /* Watchdog Timer */
  333. #define IXP425_OSWE_OFFSET 0x18 /* Watchdog Enable */
  334. #define IXP425_OSWK_OFFSET 0x1C /* Watchdog Key */
  335. #define IXP425_OSST_OFFSET 0x20 /* Timer Status */
  336. /*
  337. * Operating System Timer Register Definitions.
  338. */
  339. #ifndef __ASSEMBLY__
  340. #define IXP425_TIMER_REG(x) ((volatile u32 *)(IXP425_TIMER_BASE_PHYS+(x)))
  341. #else
  342. #define IXP425_TIMER_REG(x) (IXP425_TIMER_BASE_PHYS+(x))
  343. #endif
  344. #if 0 /* test-only: also defined in npe/include/... */
  345. #define IXP425_OSTS IXP425_TIMER_REG(IXP425_OSTS_OFFSET)
  346. #endif
  347. #define IXP425_OST1 IXP425_TIMER_REG(IXP425_OST1_OFFSET)
  348. #define IXP425_OSRT1 IXP425_TIMER_REG(IXP425_OSRT1_OFFSET)
  349. #define IXP425_OST2 IXP425_TIMER_REG(IXP425_OST2_OFFSET)
  350. #define IXP425_OSRT2 IXP425_TIMER_REG(IXP425_OSRT2_OFFSET)
  351. #define IXP425_OSWT IXP425_TIMER_REG(IXP425_OSWT_OFFSET)
  352. #define IXP425_OSWE IXP425_TIMER_REG(IXP425_OSWE_OFFSET)
  353. #define IXP425_OSWK IXP425_TIMER_REG(IXP425_OSWK_OFFSET)
  354. #define IXP425_OSST IXP425_TIMER_REG(IXP425_OSST_OFFSET)
  355. /*
  356. * Timer register values and bit definitions
  357. */
  358. #define IXP425_OST_ENABLE BIT(0)
  359. #define IXP425_OST_ONE_SHOT BIT(1)
  360. /* Low order bits of reload value ignored */
  361. #define IXP425_OST_RELOAD_MASK (0x3)
  362. #define IXP425_OST_DISABLED (0x0)
  363. #define IXP425_OSST_TIMER_1_PEND BIT(0)
  364. #define IXP425_OSST_TIMER_2_PEND BIT(1)
  365. #define IXP425_OSST_TIMER_TS_PEND BIT(2)
  366. #define IXP425_OSST_TIMER_WDOG_PEND BIT(3)
  367. #define IXP425_OSST_TIMER_WARM_RESET BIT(4)
  368. /*
  369. * Constants to make it easy to access PCI Control/Status registers
  370. */
  371. #define PCI_NP_AD_OFFSET 0x00
  372. #define PCI_NP_CBE_OFFSET 0x04
  373. #define PCI_NP_WDATA_OFFSET 0x08
  374. #define PCI_NP_RDATA_OFFSET 0x0c
  375. #define PCI_CRP_AD_CBE_OFFSET 0x10
  376. #define PCI_CRP_WDATA_OFFSET 0x14
  377. #define PCI_CRP_RDATA_OFFSET 0x18
  378. #define PCI_CSR_OFFSET 0x1c
  379. #define PCI_ISR_OFFSET 0x20
  380. #define PCI_INTEN_OFFSET 0x24
  381. #define PCI_DMACTRL_OFFSET 0x28
  382. #define PCI_AHBMEMBASE_OFFSET 0x2c
  383. #define PCI_AHBIOBASE_OFFSET 0x30
  384. #define PCI_PCIMEMBASE_OFFSET 0x34
  385. #define PCI_AHBDOORBELL_OFFSET 0x38
  386. #define PCI_PCIDOORBELL_OFFSET 0x3C
  387. #define PCI_ATPDMA0_AHBADDR_OFFSET 0x40
  388. #define PCI_ATPDMA0_PCIADDR_OFFSET 0x44
  389. #define PCI_ATPDMA0_LENADDR_OFFSET 0x48
  390. #define PCI_ATPDMA1_AHBADDR_OFFSET 0x4C
  391. #define PCI_ATPDMA1_PCIADDR_OFFSET 0x50
  392. #define PCI_ATPDMA1_LENADDR_OFFSET 0x54
  393. /*
  394. * PCI Control/Status Registers
  395. */
  396. #define IXP425_PCI_CSR(x) ((volatile u32 *)(IXP425_PCI_CFG_BASE_PHYS+(x)))
  397. #define PCI_NP_AD IXP425_PCI_CSR(PCI_NP_AD_OFFSET)
  398. #define PCI_NP_CBE IXP425_PCI_CSR(PCI_NP_CBE_OFFSET)
  399. #define PCI_NP_WDATA IXP425_PCI_CSR(PCI_NP_WDATA_OFFSET)
  400. #define PCI_NP_RDATA IXP425_PCI_CSR(PCI_NP_RDATA_OFFSET)
  401. #define PCI_CRP_AD_CBE IXP425_PCI_CSR(PCI_CRP_AD_CBE_OFFSET)
  402. #define PCI_CRP_WDATA IXP425_PCI_CSR(PCI_CRP_WDATA_OFFSET)
  403. #define PCI_CRP_RDATA IXP425_PCI_CSR(PCI_CRP_RDATA_OFFSET)
  404. #define PCI_CSR IXP425_PCI_CSR(PCI_CSR_OFFSET)
  405. #define PCI_ISR IXP425_PCI_CSR(PCI_ISR_OFFSET)
  406. #define PCI_INTEN IXP425_PCI_CSR(PCI_INTEN_OFFSET)
  407. #define PCI_DMACTRL IXP425_PCI_CSR(PCI_DMACTRL_OFFSET)
  408. #define PCI_AHBMEMBASE IXP425_PCI_CSR(PCI_AHBMEMBASE_OFFSET)
  409. #define PCI_AHBIOBASE IXP425_PCI_CSR(PCI_AHBIOBASE_OFFSET)
  410. #define PCI_PCIMEMBASE IXP425_PCI_CSR(PCI_PCIMEMBASE_OFFSET)
  411. #define PCI_AHBDOORBELL IXP425_PCI_CSR(PCI_AHBDOORBELL_OFFSET)
  412. #define PCI_PCIDOORBELL IXP425_PCI_CSR(PCI_PCIDOORBELL_OFFSET)
  413. #define PCI_ATPDMA0_AHBADDR IXP425_PCI_CSR(PCI_ATPDMA0_AHBADDR_OFFSET)
  414. #define PCI_ATPDMA0_PCIADDR IXP425_PCI_CSR(PCI_ATPDMA0_PCIADDR_OFFSET)
  415. #define PCI_ATPDMA0_LENADDR IXP425_PCI_CSR(PCI_ATPDMA0_LENADDR_OFFSET)
  416. #define PCI_ATPDMA1_AHBADDR IXP425_PCI_CSR(PCI_ATPDMA1_AHBADDR_OFFSET)
  417. #define PCI_ATPDMA1_PCIADDR IXP425_PCI_CSR(PCI_ATPDMA1_PCIADDR_OFFSET)
  418. #define PCI_ATPDMA1_LENADDR IXP425_PCI_CSR(PCI_ATPDMA1_LENADDR_OFFSET)
  419. /*
  420. * PCI register values and bit definitions
  421. */
  422. /* CSR bit definitions */
  423. #define PCI_CSR_HOST BIT(0)
  424. #define PCI_CSR_ARBEN BIT(1)
  425. #define PCI_CSR_ADS BIT(2)
  426. #define PCI_CSR_PDS BIT(3)
  427. #define PCI_CSR_ABE BIT(4)
  428. #define PCI_CSR_DBT BIT(5)
  429. #define PCI_CSR_ASE BIT(8)
  430. #define PCI_CSR_IC BIT(15)
  431. /* ISR (Interrupt status) Register bit definitions */
  432. #define PCI_ISR_PSE BIT(0)
  433. #define PCI_ISR_PFE BIT(1)
  434. #define PCI_ISR_PPE BIT(2)
  435. #define PCI_ISR_AHBE BIT(3)
  436. #define PCI_ISR_APDC BIT(4)
  437. #define PCI_ISR_PADC BIT(5)
  438. #define PCI_ISR_ADB BIT(6)
  439. #define PCI_ISR_PDB BIT(7)
  440. /* INTEN (Interrupt Enable) Register bit definitions */
  441. #define PCI_INTEN_PSE BIT(0)
  442. #define PCI_INTEN_PFE BIT(1)
  443. #define PCI_INTEN_PPE BIT(2)
  444. #define PCI_INTEN_AHBE BIT(3)
  445. #define PCI_INTEN_APDC BIT(4)
  446. #define PCI_INTEN_PADC BIT(5)
  447. #define PCI_INTEN_ADB BIT(6)
  448. #define PCI_INTEN_PDB BIT(7)
  449. /*
  450. * Shift value for byte enable on NP cmd/byte enable register
  451. */
  452. #define IXP425_PCI_NP_CBE_BESL 4
  453. /*
  454. * PCI commands supported by NP access unit
  455. */
  456. #define NP_CMD_IOREAD 0x2
  457. #define NP_CMD_IOWRITE 0x3
  458. #define NP_CMD_CONFIGREAD 0xa
  459. #define NP_CMD_CONFIGWRITE 0xb
  460. #define NP_CMD_MEMREAD 0x6
  461. #define NP_CMD_MEMWRITE 0x7
  462. #if 0
  463. #ifndef __ASSEMBLY__
  464. extern int ixp425_pci_read(u32 addr, u32 cmd, u32* data);
  465. extern int ixp425_pci_write(u32 addr, u32 cmd, u32 data);
  466. extern void ixp425_pci_init(void *);
  467. #endif
  468. #endif
  469. /*
  470. * Constants for CRP access into local config space
  471. */
  472. #define CRP_AD_CBE_BESL 20
  473. #define CRP_AD_CBE_WRITE BIT(16)
  474. /*
  475. * Clock Speed Definitions.
  476. */
  477. #define IXP425_PERIPHERAL_BUS_CLOCK (66) /* 66Mhzi APB BUS */
  478. #endif