ixp4xx-regs.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. /*
  2. * arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
  3. *
  4. * Register definitions for IXP4xx chipset. This file contains
  5. * register location and bit definitions only. Platform specific
  6. * definitions and helper function declarations are in platform.h
  7. * and machine-name.h.
  8. *
  9. * Copyright (C) 2002 Intel Corporation.
  10. * Copyright (C) 2003-2004 MontaVista Software, Inc.
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. *
  16. */
  17. #ifndef _ASM_ARM_IXP4XX_H_
  18. #define _ASM_ARM_IXP4XX_H_
  19. /*
  20. * IXP4xx Linux Memory Map:
  21. *
  22. * Phy Size Virt Description
  23. * =========================================================================
  24. *
  25. * 0x00000000 0x10000000(max) PAGE_OFFSET System RAM
  26. *
  27. * 0x48000000 0x04000000 ioremap'd PCI Memory Space
  28. *
  29. * 0x50000000 0x10000000 ioremap'd EXP BUS
  30. *
  31. * 0x6000000 0x00004000 ioremap'd QMgr
  32. *
  33. * 0xC0000000 0x00001000 0xffbff000 PCI CFG
  34. *
  35. * 0xC4000000 0x00001000 0xffbfe000 EXP CFG
  36. *
  37. * 0xC8000000 0x00013000 0xffbeb000 On-Chip Peripherals
  38. */
  39. /*
  40. * Queue Manager
  41. */
  42. #define IXP4XX_QMGR_BASE_PHYS (0x60000000)
  43. #define IXP4XX_QMGR_REGION_SIZE (0x00004000)
  44. /*
  45. * Expansion BUS Configuration registers
  46. */
  47. #define IXP4XX_EXP_CFG_BASE_PHYS (0xC4000000)
  48. #define IXP4XX_EXP_CFG_BASE_VIRT (0xFFBFE000)
  49. #define IXP4XX_EXP_CFG_REGION_SIZE (0x00001000)
  50. /*
  51. * PCI Config registers
  52. */
  53. #define IXP4XX_PCI_CFG_BASE_PHYS (0xC0000000)
  54. #define IXP4XX_PCI_CFG_BASE_VIRT (0xFFBFF000)
  55. #define IXP4XX_PCI_CFG_REGION_SIZE (0x00001000)
  56. /*
  57. * Peripheral space
  58. */
  59. #define IXP4XX_PERIPHERAL_BASE_PHYS (0xC8000000)
  60. #define IXP4XX_PERIPHERAL_BASE_VIRT (0xFFBEB000)
  61. #define IXP4XX_PERIPHERAL_REGION_SIZE (0x00013000)
  62. /*
  63. * Debug UART
  64. *
  65. * This is basically a remap of UART1 into a region that is section
  66. * aligned so that it * can be used with the low-level debug code.
  67. */
  68. #define IXP4XX_DEBUG_UART_BASE_PHYS (0xC8000000)
  69. #define IXP4XX_DEBUG_UART_BASE_VIRT (0xffb00000)
  70. #define IXP4XX_DEBUG_UART_REGION_SIZE (0x00001000)
  71. #define IXP4XX_EXP_CS0_OFFSET 0x00
  72. #define IXP4XX_EXP_CS1_OFFSET 0x04
  73. #define IXP4XX_EXP_CS2_OFFSET 0x08
  74. #define IXP4XX_EXP_CS3_OFFSET 0x0C
  75. #define IXP4XX_EXP_CS4_OFFSET 0x10
  76. #define IXP4XX_EXP_CS5_OFFSET 0x14
  77. #define IXP4XX_EXP_CS6_OFFSET 0x18
  78. #define IXP4XX_EXP_CS7_OFFSET 0x1C
  79. #define IXP4XX_EXP_CFG0_OFFSET 0x20
  80. #define IXP4XX_EXP_CFG1_OFFSET 0x24
  81. #define IXP4XX_EXP_CFG2_OFFSET 0x28
  82. #define IXP4XX_EXP_CFG3_OFFSET 0x2C
  83. /*
  84. * Expansion Bus Controller registers.
  85. */
  86. #define IXP4XX_EXP_REG(x) ((volatile u32 *)(IXP4XX_EXP_CFG_BASE_VIRT+(x)))
  87. #define IXP4XX_EXP_CS0 IXP4XX_EXP_REG(IXP4XX_EXP_CS0_OFFSET)
  88. #define IXP4XX_EXP_CS1 IXP4XX_EXP_REG(IXP4XX_EXP_CS1_OFFSET)
  89. #define IXP4XX_EXP_CS2 IXP4XX_EXP_REG(IXP4XX_EXP_CS2_OFFSET)
  90. #define IXP4XX_EXP_CS3 IXP4XX_EXP_REG(IXP4XX_EXP_CS3_OFFSET)
  91. #define IXP4XX_EXP_CS4 IXP4XX_EXP_REG(IXP4XX_EXP_CS4_OFFSET)
  92. #define IXP4XX_EXP_CS5 IXP4XX_EXP_REG(IXP4XX_EXP_CS5_OFFSET)
  93. #define IXP4XX_EXP_CS6 IXP4XX_EXP_REG(IXP4XX_EXP_CS6_OFFSET)
  94. #define IXP4XX_EXP_CS7 IXP4XX_EXP_REG(IXP4XX_EXP_CS7_OFFSET)
  95. #define IXP4XX_EXP_CFG0 IXP4XX_EXP_REG(IXP4XX_EXP_CFG0_OFFSET)
  96. #define IXP4XX_EXP_CFG1 IXP4XX_EXP_REG(IXP4XX_EXP_CFG1_OFFSET)
  97. #define IXP4XX_EXP_CFG2 IXP4XX_EXP_REG(IXP4XX_EXP_CFG2_OFFSET)
  98. #define IXP4XX_EXP_CFG3 IXP4XX_EXP_REG(IXP4XX_EXP_CFG3_OFFSET)
  99. /*
  100. * Peripheral Space Register Region Base Addresses
  101. */
  102. #define IXP4XX_UART1_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x0000)
  103. #define IXP4XX_UART2_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x1000)
  104. #define IXP4XX_PMU_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x2000)
  105. #define IXP4XX_INTC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x3000)
  106. #define IXP4XX_GPIO_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x4000)
  107. #define IXP4XX_TIMER_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x5000)
  108. #define IXP4XX_NPEA_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x6000)
  109. #define IXP4XX_NPEB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x7000)
  110. #define IXP4XX_NPEC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x8000)
  111. #define IXP4XX_EthB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x9000)
  112. #define IXP4XX_EthC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xA000)
  113. #define IXP4XX_USB_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xB000)
  114. /* ixp46X only */
  115. #define IXP4XX_EthA_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xC000)
  116. #define IXP4XX_EthB1_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xD000)
  117. #define IXP4XX_EthB2_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xE000)
  118. #define IXP4XX_EthB3_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0xF000)
  119. #define IXP4XX_TIMESYNC_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x10000)
  120. #define IXP4XX_I2C_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x11000)
  121. #define IXP4XX_SSP_BASE_PHYS (IXP4XX_PERIPHERAL_BASE_PHYS + 0x12000)
  122. #define IXP4XX_UART1_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x0000)
  123. #define IXP4XX_UART2_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x1000)
  124. #define IXP4XX_PMU_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x2000)
  125. #define IXP4XX_INTC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000)
  126. #define IXP4XX_GPIO_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000)
  127. #define IXP4XX_TIMER_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000)
  128. #define IXP4XX_NPEA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x6000)
  129. #define IXP4XX_NPEB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x7000)
  130. #define IXP4XX_NPEC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x8000)
  131. #define IXP4XX_EthB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000)
  132. #define IXP4XX_EthC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000)
  133. #define IXP4XX_USB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000)
  134. /* ixp46X only */
  135. #define IXP4XX_EthA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xC000)
  136. #define IXP4XX_EthB1_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xD000)
  137. #define IXP4XX_EthB2_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xE000)
  138. #define IXP4XX_EthB3_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xF000)
  139. #define IXP4XX_TIMESYNC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x10000)
  140. #define IXP4XX_I2C_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x11000)
  141. #define IXP4XX_SSP_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x12000)
  142. /*
  143. * Constants to make it easy to access Interrupt Controller registers
  144. */
  145. #define IXP4XX_ICPR_OFFSET 0x00 /* Interrupt Status */
  146. #define IXP4XX_ICMR_OFFSET 0x04 /* Interrupt Enable */
  147. #define IXP4XX_ICLR_OFFSET 0x08 /* Interrupt IRQ/FIQ Select */
  148. #define IXP4XX_ICIP_OFFSET 0x0C /* IRQ Status */
  149. #define IXP4XX_ICFP_OFFSET 0x10 /* FIQ Status */
  150. #define IXP4XX_ICHR_OFFSET 0x14 /* Interrupt Priority */
  151. #define IXP4XX_ICIH_OFFSET 0x18 /* IRQ Highest Pri Int */
  152. #define IXP4XX_ICFH_OFFSET 0x1C /* FIQ Highest Pri Int */
  153. /*
  154. * IXP465-only
  155. */
  156. #define IXP4XX_ICPR2_OFFSET 0x20 /* Interrupt Status 2 */
  157. #define IXP4XX_ICMR2_OFFSET 0x24 /* Interrupt Enable 2 */
  158. #define IXP4XX_ICLR2_OFFSET 0x28 /* Interrupt IRQ/FIQ Select 2 */
  159. #define IXP4XX_ICIP2_OFFSET 0x2C /* IRQ Status */
  160. #define IXP4XX_ICFP2_OFFSET 0x30 /* FIQ Status */
  161. #define IXP4XX_ICEEN_OFFSET 0x34 /* Error High Pri Enable */
  162. /*
  163. * Interrupt Controller Register Definitions.
  164. */
  165. #define IXP4XX_INTC_REG(x) ((volatile u32 *)(IXP4XX_INTC_BASE_VIRT+(x)))
  166. #define IXP4XX_ICPR IXP4XX_INTC_REG(IXP4XX_ICPR_OFFSET)
  167. #define IXP4XX_ICMR IXP4XX_INTC_REG(IXP4XX_ICMR_OFFSET)
  168. #define IXP4XX_ICLR IXP4XX_INTC_REG(IXP4XX_ICLR_OFFSET)
  169. #define IXP4XX_ICIP IXP4XX_INTC_REG(IXP4XX_ICIP_OFFSET)
  170. #define IXP4XX_ICFP IXP4XX_INTC_REG(IXP4XX_ICFP_OFFSET)
  171. #define IXP4XX_ICHR IXP4XX_INTC_REG(IXP4XX_ICHR_OFFSET)
  172. #define IXP4XX_ICIH IXP4XX_INTC_REG(IXP4XX_ICIH_OFFSET)
  173. #define IXP4XX_ICFH IXP4XX_INTC_REG(IXP4XX_ICFH_OFFSET)
  174. #define IXP4XX_ICPR2 IXP4XX_INTC_REG(IXP4XX_ICPR2_OFFSET)
  175. #define IXP4XX_ICMR2 IXP4XX_INTC_REG(IXP4XX_ICMR2_OFFSET)
  176. #define IXP4XX_ICLR2 IXP4XX_INTC_REG(IXP4XX_ICLR2_OFFSET)
  177. #define IXP4XX_ICIP2 IXP4XX_INTC_REG(IXP4XX_ICIP2_OFFSET)
  178. #define IXP4XX_ICFP2 IXP4XX_INTC_REG(IXP4XX_ICFP2_OFFSET)
  179. #define IXP4XX_ICEEN IXP4XX_INTC_REG(IXP4XX_ICEEN_OFFSET)
  180. /*
  181. * Constants to make it easy to access GPIO registers
  182. */
  183. #define IXP4XX_GPIO_GPOUTR_OFFSET 0x00
  184. #define IXP4XX_GPIO_GPOER_OFFSET 0x04
  185. #define IXP4XX_GPIO_GPINR_OFFSET 0x08
  186. #define IXP4XX_GPIO_GPISR_OFFSET 0x0C
  187. #define IXP4XX_GPIO_GPIT1R_OFFSET 0x10
  188. #define IXP4XX_GPIO_GPIT2R_OFFSET 0x14
  189. #define IXP4XX_GPIO_GPCLKR_OFFSET 0x18
  190. #define IXP4XX_GPIO_GPDBSELR_OFFSET 0x1C
  191. /*
  192. * GPIO Register Definitions.
  193. * [Only perform 32bit reads/writes]
  194. */
  195. #define IXP4XX_GPIO_REG(x) ((volatile u32 *)(IXP4XX_GPIO_BASE_VIRT+(x)))
  196. #define IXP4XX_GPIO_GPOUTR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOUTR_OFFSET)
  197. #define IXP4XX_GPIO_GPOER IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOER_OFFSET)
  198. #define IXP4XX_GPIO_GPINR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPINR_OFFSET)
  199. #define IXP4XX_GPIO_GPISR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPISR_OFFSET)
  200. #define IXP4XX_GPIO_GPIT1R IXP4XX_GPIO_REG(IXP4XX_GPIO_GPIT1R_OFFSET)
  201. #define IXP4XX_GPIO_GPIT2R IXP4XX_GPIO_REG(IXP4XX_GPIO_GPIT2R_OFFSET)
  202. #define IXP4XX_GPIO_GPCLKR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPCLKR_OFFSET)
  203. #define IXP4XX_GPIO_GPDBSELR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPDBSELR_OFFSET)
  204. /*
  205. * GPIO register bit definitions
  206. */
  207. /* Interrupt styles
  208. */
  209. #define IXP4XX_GPIO_STYLE_ACTIVE_HIGH 0x0
  210. #define IXP4XX_GPIO_STYLE_ACTIVE_LOW 0x1
  211. #define IXP4XX_GPIO_STYLE_RISING_EDGE 0x2
  212. #define IXP4XX_GPIO_STYLE_FALLING_EDGE 0x3
  213. #define IXP4XX_GPIO_STYLE_TRANSITIONAL 0x4
  214. /*
  215. * Mask used to clear interrupt styles
  216. */
  217. #define IXP4XX_GPIO_STYLE_CLEAR 0x7
  218. #define IXP4XX_GPIO_STYLE_SIZE 3
  219. /*
  220. * Constants to make it easy to access Timer Control/Status registers
  221. */
  222. #define IXP4XX_OSTS_OFFSET 0x00 /* Continious TimeStamp */
  223. #define IXP4XX_OST1_OFFSET 0x04 /* Timer 1 Timestamp */
  224. #define IXP4XX_OSRT1_OFFSET 0x08 /* Timer 1 Reload */
  225. #define IXP4XX_OST2_OFFSET 0x0C /* Timer 2 Timestamp */
  226. #define IXP4XX_OSRT2_OFFSET 0x10 /* Timer 2 Reload */
  227. #define IXP4XX_OSWT_OFFSET 0x14 /* Watchdog Timer */
  228. #define IXP4XX_OSWE_OFFSET 0x18 /* Watchdog Enable */
  229. #define IXP4XX_OSWK_OFFSET 0x1C /* Watchdog Key */
  230. #define IXP4XX_OSST_OFFSET 0x20 /* Timer Status */
  231. /*
  232. * Operating System Timer Register Definitions.
  233. */
  234. #define IXP4XX_TIMER_REG(x) ((volatile u32 *)(IXP4XX_TIMER_BASE_VIRT+(x)))
  235. #define IXP4XX_OSTS IXP4XX_TIMER_REG(IXP4XX_OSTS_OFFSET)
  236. #define IXP4XX_OST1 IXP4XX_TIMER_REG(IXP4XX_OST1_OFFSET)
  237. #define IXP4XX_OSRT1 IXP4XX_TIMER_REG(IXP4XX_OSRT1_OFFSET)
  238. #define IXP4XX_OST2 IXP4XX_TIMER_REG(IXP4XX_OST2_OFFSET)
  239. #define IXP4XX_OSRT2 IXP4XX_TIMER_REG(IXP4XX_OSRT2_OFFSET)
  240. #define IXP4XX_OSWT IXP4XX_TIMER_REG(IXP4XX_OSWT_OFFSET)
  241. #define IXP4XX_OSWE IXP4XX_TIMER_REG(IXP4XX_OSWE_OFFSET)
  242. #define IXP4XX_OSWK IXP4XX_TIMER_REG(IXP4XX_OSWK_OFFSET)
  243. #define IXP4XX_OSST IXP4XX_TIMER_REG(IXP4XX_OSST_OFFSET)
  244. /*
  245. * Timer register values and bit definitions
  246. */
  247. #define IXP4XX_OST_ENABLE 0x00000001
  248. #define IXP4XX_OST_ONE_SHOT 0x00000002
  249. /* Low order bits of reload value ignored */
  250. #define IXP4XX_OST_RELOAD_MASK 0x00000003
  251. #define IXP4XX_OST_DISABLED 0x00000000
  252. #define IXP4XX_OSST_TIMER_1_PEND 0x00000001
  253. #define IXP4XX_OSST_TIMER_2_PEND 0x00000002
  254. #define IXP4XX_OSST_TIMER_TS_PEND 0x00000004
  255. #define IXP4XX_OSST_TIMER_WDOG_PEND 0x00000008
  256. #define IXP4XX_OSST_TIMER_WARM_RESET 0x00000010
  257. #define IXP4XX_WDT_KEY 0x0000482E
  258. #define IXP4XX_WDT_RESET_ENABLE 0x00000001
  259. #define IXP4XX_WDT_IRQ_ENABLE 0x00000002
  260. #define IXP4XX_WDT_COUNT_ENABLE 0x00000004
  261. /*
  262. * Constants to make it easy to access PCI Control/Status registers
  263. */
  264. #define PCI_NP_AD_OFFSET 0x00
  265. #define PCI_NP_CBE_OFFSET 0x04
  266. #define PCI_NP_WDATA_OFFSET 0x08
  267. #define PCI_NP_RDATA_OFFSET 0x0c
  268. #define PCI_CRP_AD_CBE_OFFSET 0x10
  269. #define PCI_CRP_WDATA_OFFSET 0x14
  270. #define PCI_CRP_RDATA_OFFSET 0x18
  271. #define PCI_CSR_OFFSET 0x1c
  272. #define PCI_ISR_OFFSET 0x20
  273. #define PCI_INTEN_OFFSET 0x24
  274. #define PCI_DMACTRL_OFFSET 0x28
  275. #define PCI_AHBMEMBASE_OFFSET 0x2c
  276. #define PCI_AHBIOBASE_OFFSET 0x30
  277. #define PCI_PCIMEMBASE_OFFSET 0x34
  278. #define PCI_AHBDOORBELL_OFFSET 0x38
  279. #define PCI_PCIDOORBELL_OFFSET 0x3C
  280. #define PCI_ATPDMA0_AHBADDR_OFFSET 0x40
  281. #define PCI_ATPDMA0_PCIADDR_OFFSET 0x44
  282. #define PCI_ATPDMA0_LENADDR_OFFSET 0x48
  283. #define PCI_ATPDMA1_AHBADDR_OFFSET 0x4C
  284. #define PCI_ATPDMA1_PCIADDR_OFFSET 0x50
  285. #define PCI_ATPDMA1_LENADDR_OFFSET 0x54
  286. /*
  287. * PCI Control/Status Registers
  288. */
  289. #define IXP4XX_PCI_CSR(x) ((volatile u32 *)(IXP4XX_PCI_CFG_BASE_VIRT+(x)))
  290. #define PCI_NP_AD IXP4XX_PCI_CSR(PCI_NP_AD_OFFSET)
  291. #define PCI_NP_CBE IXP4XX_PCI_CSR(PCI_NP_CBE_OFFSET)
  292. #define PCI_NP_WDATA IXP4XX_PCI_CSR(PCI_NP_WDATA_OFFSET)
  293. #define PCI_NP_RDATA IXP4XX_PCI_CSR(PCI_NP_RDATA_OFFSET)
  294. #define PCI_CRP_AD_CBE IXP4XX_PCI_CSR(PCI_CRP_AD_CBE_OFFSET)
  295. #define PCI_CRP_WDATA IXP4XX_PCI_CSR(PCI_CRP_WDATA_OFFSET)
  296. #define PCI_CRP_RDATA IXP4XX_PCI_CSR(PCI_CRP_RDATA_OFFSET)
  297. #define PCI_CSR IXP4XX_PCI_CSR(PCI_CSR_OFFSET)
  298. #define PCI_ISR IXP4XX_PCI_CSR(PCI_ISR_OFFSET)
  299. #define PCI_INTEN IXP4XX_PCI_CSR(PCI_INTEN_OFFSET)
  300. #define PCI_DMACTRL IXP4XX_PCI_CSR(PCI_DMACTRL_OFFSET)
  301. #define PCI_AHBMEMBASE IXP4XX_PCI_CSR(PCI_AHBMEMBASE_OFFSET)
  302. #define PCI_AHBIOBASE IXP4XX_PCI_CSR(PCI_AHBIOBASE_OFFSET)
  303. #define PCI_PCIMEMBASE IXP4XX_PCI_CSR(PCI_PCIMEMBASE_OFFSET)
  304. #define PCI_AHBDOORBELL IXP4XX_PCI_CSR(PCI_AHBDOORBELL_OFFSET)
  305. #define PCI_PCIDOORBELL IXP4XX_PCI_CSR(PCI_PCIDOORBELL_OFFSET)
  306. #define PCI_ATPDMA0_AHBADDR IXP4XX_PCI_CSR(PCI_ATPDMA0_AHBADDR_OFFSET)
  307. #define PCI_ATPDMA0_PCIADDR IXP4XX_PCI_CSR(PCI_ATPDMA0_PCIADDR_OFFSET)
  308. #define PCI_ATPDMA0_LENADDR IXP4XX_PCI_CSR(PCI_ATPDMA0_LENADDR_OFFSET)
  309. #define PCI_ATPDMA1_AHBADDR IXP4XX_PCI_CSR(PCI_ATPDMA1_AHBADDR_OFFSET)
  310. #define PCI_ATPDMA1_PCIADDR IXP4XX_PCI_CSR(PCI_ATPDMA1_PCIADDR_OFFSET)
  311. #define PCI_ATPDMA1_LENADDR IXP4XX_PCI_CSR(PCI_ATPDMA1_LENADDR_OFFSET)
  312. /*
  313. * PCI register values and bit definitions
  314. */
  315. /* CSR bit definitions */
  316. #define PCI_CSR_HOST 0x00000001
  317. #define PCI_CSR_ARBEN 0x00000002
  318. #define PCI_CSR_ADS 0x00000004
  319. #define PCI_CSR_PDS 0x00000008
  320. #define PCI_CSR_ABE 0x00000010
  321. #define PCI_CSR_DBT 0x00000020
  322. #define PCI_CSR_ASE 0x00000100
  323. #define PCI_CSR_IC 0x00008000
  324. /* ISR (Interrupt status) Register bit definitions */
  325. #define PCI_ISR_PSE 0x00000001
  326. #define PCI_ISR_PFE 0x00000002
  327. #define PCI_ISR_PPE 0x00000004
  328. #define PCI_ISR_AHBE 0x00000008
  329. #define PCI_ISR_APDC 0x00000010
  330. #define PCI_ISR_PADC 0x00000020
  331. #define PCI_ISR_ADB 0x00000040
  332. #define PCI_ISR_PDB 0x00000080
  333. /* INTEN (Interrupt Enable) Register bit definitions */
  334. #define PCI_INTEN_PSE 0x00000001
  335. #define PCI_INTEN_PFE 0x00000002
  336. #define PCI_INTEN_PPE 0x00000004
  337. #define PCI_INTEN_AHBE 0x00000008
  338. #define PCI_INTEN_APDC 0x00000010
  339. #define PCI_INTEN_PADC 0x00000020
  340. #define PCI_INTEN_ADB 0x00000040
  341. #define PCI_INTEN_PDB 0x00000080
  342. /*
  343. * Shift value for byte enable on NP cmd/byte enable register
  344. */
  345. #define IXP4XX_PCI_NP_CBE_BESL 4
  346. /*
  347. * PCI commands supported by NP access unit
  348. */
  349. #define NP_CMD_IOREAD 0x2
  350. #define NP_CMD_IOWRITE 0x3
  351. #define NP_CMD_CONFIGREAD 0xa
  352. #define NP_CMD_CONFIGWRITE 0xb
  353. #define NP_CMD_MEMREAD 0x6
  354. #define NP_CMD_MEMWRITE 0x7
  355. /*
  356. * Constants for CRP access into local config space
  357. */
  358. #define CRP_AD_CBE_BESL 20
  359. #define CRP_AD_CBE_WRITE 0x00010000
  360. /*
  361. * USB Device Controller
  362. *
  363. * These are used by the USB gadget driver, so they don't follow the
  364. * IXP4XX_ naming convetions.
  365. *
  366. */
  367. # define IXP4XX_USB_REG(x) (*((volatile u32 *)(x)))
  368. /* UDC Undocumented - Reserved1 */
  369. #define UDC_RES1 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0004)
  370. /* UDC Undocumented - Reserved2 */
  371. #define UDC_RES2 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0008)
  372. /* UDC Undocumented - Reserved3 */
  373. #define UDC_RES3 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x000C)
  374. /* UDC Control Register */
  375. #define UDCCR IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0000)
  376. /* UDC Endpoint 0 Control/Status Register */
  377. #define UDCCS0 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0010)
  378. /* UDC Endpoint 1 (IN) Control/Status Register */
  379. #define UDCCS1 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0014)
  380. /* UDC Endpoint 2 (OUT) Control/Status Register */
  381. #define UDCCS2 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0018)
  382. /* UDC Endpoint 3 (IN) Control/Status Register */
  383. #define UDCCS3 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x001C)
  384. /* UDC Endpoint 4 (OUT) Control/Status Register */
  385. #define UDCCS4 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0020)
  386. /* UDC Endpoint 5 (Interrupt) Control/Status Register */
  387. #define UDCCS5 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0024)
  388. /* UDC Endpoint 6 (IN) Control/Status Register */
  389. #define UDCCS6 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0028)
  390. /* UDC Endpoint 7 (OUT) Control/Status Register */
  391. #define UDCCS7 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x002C)
  392. /* UDC Endpoint 8 (IN) Control/Status Register */
  393. #define UDCCS8 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0030)
  394. /* UDC Endpoint 9 (OUT) Control/Status Register */
  395. #define UDCCS9 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0034)
  396. /* UDC Endpoint 10 (Interrupt) Control/Status Register */
  397. #define UDCCS10 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0038)
  398. /* UDC Endpoint 11 (IN) Control/Status Register */
  399. #define UDCCS11 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x003C)
  400. /* UDC Endpoint 12 (OUT) Control/Status Register */
  401. #define UDCCS12 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0040)
  402. /* UDC Endpoint 13 (IN) Control/Status Register */
  403. #define UDCCS13 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0044)
  404. /* UDC Endpoint 14 (OUT) Control/Status Register */
  405. #define UDCCS14 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0048)
  406. /* UDC Endpoint 15 (Interrupt) Control/Status Register */
  407. #define UDCCS15 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x004C)
  408. /* UDC Frame Number Register High */
  409. #define UFNRH IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0060)
  410. /* UDC Frame Number Register Low */
  411. #define UFNRL IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0064)
  412. /* UDC Byte Count Reg 2 */
  413. #define UBCR2 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0068)
  414. /* UDC Byte Count Reg 4 */
  415. #define UBCR4 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x006c)
  416. /* UDC Byte Count Reg 7 */
  417. #define UBCR7 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0070)
  418. /* UDC Byte Count Reg 9 */
  419. #define UBCR9 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0074)
  420. /* UDC Byte Count Reg 12 */
  421. #define UBCR12 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0078)
  422. /* UDC Byte Count Reg 14 */
  423. #define UBCR14 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x007c)
  424. /* UDC Endpoint 0 Data Register */
  425. #define UDDR0 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0080)
  426. /* UDC Endpoint 1 Data Register */
  427. #define UDDR1 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0100)
  428. /* UDC Endpoint 2 Data Register */
  429. #define UDDR2 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0180)
  430. /* UDC Endpoint 3 Data Register */
  431. #define UDDR3 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0200)
  432. /* UDC Endpoint 4 Data Register */
  433. #define UDDR4 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0400)
  434. /* UDC Endpoint 5 Data Register */
  435. #define UDDR5 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x00A0)
  436. /* UDC Endpoint 6 Data Register */
  437. #define UDDR6 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0600)
  438. /* UDC Endpoint 7 Data Register */
  439. #define UDDR7 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0680)
  440. /* UDC Endpoint 8 Data Register */
  441. #define UDDR8 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0700)
  442. /* UDC Endpoint 9 Data Register */
  443. #define UDDR9 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0900)
  444. /* UDC Endpoint 10 Data Register */
  445. #define UDDR10 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x00C0)
  446. /* UDC Endpoint 11 Data Register */
  447. #define UDDR11 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0B00)
  448. /* UDC Endpoint 12 Data Register */
  449. #define UDDR12 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0B80)
  450. /* UDC Endpoint 13 Data Register */
  451. #define UDDR13 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0C00)
  452. /* UDC Endpoint 14 Data Register */
  453. #define UDDR14 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0E00)
  454. /* UDC Endpoint 15 Data Register */
  455. #define UDDR15 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x00E0)
  456. /* UDC Interrupt Control Register 0 */
  457. #define UICR0 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0050)
  458. /* UDC Interrupt Control Register 1 */
  459. #define UICR1 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0054)
  460. /* UDC Status Interrupt Register 0 */
  461. #define USIR0 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0058)
  462. /* UDC Status Interrupt Register 1 */
  463. #define USIR1 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x005C)
  464. #define UDCCR_UDE (1 << 0) /* UDC enable */
  465. #define UDCCR_UDA (1 << 1) /* UDC active */
  466. #define UDCCR_RSM (1 << 2) /* Device resume */
  467. #define UDCCR_RESIR (1 << 3) /* Resume interrupt request */
  468. #define UDCCR_SUSIR (1 << 4) /* Suspend interrupt request */
  469. #define UDCCR_SRM (1 << 5) /* Suspend/resume interrupt mask */
  470. #define UDCCR_RSTIR (1 << 6) /* Reset interrupt request */
  471. #define UDCCR_REM (1 << 7) /* Reset interrupt mask */
  472. #define UDCCS0_OPR (1 << 0) /* OUT packet ready */
  473. #define UDCCS0_IPR (1 << 1) /* IN packet ready */
  474. #define UDCCS0_FTF (1 << 2) /* Flush Tx FIFO */
  475. #define UDCCS0_DRWF (1 << 3) /* Device remote wakeup feature */
  476. #define UDCCS0_SST (1 << 4) /* Sent stall */
  477. #define UDCCS0_FST (1 << 5) /* Force stall */
  478. #define UDCCS0_RNE (1 << 6) /* Receive FIFO no empty */
  479. #define UDCCS0_SA (1 << 7) /* Setup active */
  480. #define UDCCS_BI_TFS (1 << 0) /* Transmit FIFO service */
  481. #define UDCCS_BI_TPC (1 << 1) /* Transmit packet complete */
  482. #define UDCCS_BI_FTF (1 << 2) /* Flush Tx FIFO */
  483. #define UDCCS_BI_TUR (1 << 3) /* Transmit FIFO underrun */
  484. #define UDCCS_BI_SST (1 << 4) /* Sent stall */
  485. #define UDCCS_BI_FST (1 << 5) /* Force stall */
  486. #define UDCCS_BI_TSP (1 << 7) /* Transmit short packet */
  487. #define UDCCS_BO_RFS (1 << 0) /* Receive FIFO service */
  488. #define UDCCS_BO_RPC (1 << 1) /* Receive packet complete */
  489. #define UDCCS_BO_DME (1 << 3) /* DMA enable */
  490. #define UDCCS_BO_SST (1 << 4) /* Sent stall */
  491. #define UDCCS_BO_FST (1 << 5) /* Force stall */
  492. #define UDCCS_BO_RNE (1 << 6) /* Receive FIFO not empty */
  493. #define UDCCS_BO_RSP (1 << 7) /* Receive short packet */
  494. #define UDCCS_II_TFS (1 << 0) /* Transmit FIFO service */
  495. #define UDCCS_II_TPC (1 << 1) /* Transmit packet complete */
  496. #define UDCCS_II_FTF (1 << 2) /* Flush Tx FIFO */
  497. #define UDCCS_II_TUR (1 << 3) /* Transmit FIFO underrun */
  498. #define UDCCS_II_TSP (1 << 7) /* Transmit short packet */
  499. #define UDCCS_IO_RFS (1 << 0) /* Receive FIFO service */
  500. #define UDCCS_IO_RPC (1 << 1) /* Receive packet complete */
  501. #define UDCCS_IO_ROF (1 << 3) /* Receive overflow */
  502. #define UDCCS_IO_DME (1 << 3) /* DMA enable */
  503. #define UDCCS_IO_RNE (1 << 6) /* Receive FIFO not empty */
  504. #define UDCCS_IO_RSP (1 << 7) /* Receive short packet */
  505. #define UDCCS_INT_TFS (1 << 0) /* Transmit FIFO service */
  506. #define UDCCS_INT_TPC (1 << 1) /* Transmit packet complete */
  507. #define UDCCS_INT_FTF (1 << 2) /* Flush Tx FIFO */
  508. #define UDCCS_INT_TUR (1 << 3) /* Transmit FIFO underrun */
  509. #define UDCCS_INT_SST (1 << 4) /* Sent stall */
  510. #define UDCCS_INT_FST (1 << 5) /* Force stall */
  511. #define UDCCS_INT_TSP (1 << 7) /* Transmit short packet */
  512. #define UICR0_IM0 (1 << 0) /* Interrupt mask ep 0 */
  513. #define UICR0_IM1 (1 << 1) /* Interrupt mask ep 1 */
  514. #define UICR0_IM2 (1 << 2) /* Interrupt mask ep 2 */
  515. #define UICR0_IM3 (1 << 3) /* Interrupt mask ep 3 */
  516. #define UICR0_IM4 (1 << 4) /* Interrupt mask ep 4 */
  517. #define UICR0_IM5 (1 << 5) /* Interrupt mask ep 5 */
  518. #define UICR0_IM6 (1 << 6) /* Interrupt mask ep 6 */
  519. #define UICR0_IM7 (1 << 7) /* Interrupt mask ep 7 */
  520. #define UICR1_IM8 (1 << 0) /* Interrupt mask ep 8 */
  521. #define UICR1_IM9 (1 << 1) /* Interrupt mask ep 9 */
  522. #define UICR1_IM10 (1 << 2) /* Interrupt mask ep 10 */
  523. #define UICR1_IM11 (1 << 3) /* Interrupt mask ep 11 */
  524. #define UICR1_IM12 (1 << 4) /* Interrupt mask ep 12 */
  525. #define UICR1_IM13 (1 << 5) /* Interrupt mask ep 13 */
  526. #define UICR1_IM14 (1 << 6) /* Interrupt mask ep 14 */
  527. #define UICR1_IM15 (1 << 7) /* Interrupt mask ep 15 */
  528. #define USIR0_IR0 (1 << 0) /* Interrupt request ep 0 */
  529. #define USIR0_IR1 (1 << 1) /* Interrupt request ep 1 */
  530. #define USIR0_IR2 (1 << 2) /* Interrupt request ep 2 */
  531. #define USIR0_IR3 (1 << 3) /* Interrupt request ep 3 */
  532. #define USIR0_IR4 (1 << 4) /* Interrupt request ep 4 */
  533. #define USIR0_IR5 (1 << 5) /* Interrupt request ep 5 */
  534. #define USIR0_IR6 (1 << 6) /* Interrupt request ep 6 */
  535. #define USIR0_IR7 (1 << 7) /* Interrupt request ep 7 */
  536. #define USIR1_IR8 (1 << 0) /* Interrupt request ep 8 */
  537. #define USIR1_IR9 (1 << 1) /* Interrupt request ep 9 */
  538. #define USIR1_IR10 (1 << 2) /* Interrupt request ep 10 */
  539. #define USIR1_IR11 (1 << 3) /* Interrupt request ep 11 */
  540. #define USIR1_IR12 (1 << 4) /* Interrupt request ep 12 */
  541. #define USIR1_IR13 (1 << 5) /* Interrupt request ep 13 */
  542. #define USIR1_IR14 (1 << 6) /* Interrupt request ep 14 */
  543. #define USIR1_IR15 (1 << 7) /* Interrupt request ep 15 */
  544. #define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */
  545. /* "fuse" bits of IXP_EXP_CFG2 */
  546. #define IXP4XX_FEATURE_RCOMP (1 << 0)
  547. #define IXP4XX_FEATURE_USB_DEVICE (1 << 1)
  548. #define IXP4XX_FEATURE_HASH (1 << 2)
  549. #define IXP4XX_FEATURE_AES (1 << 3)
  550. #define IXP4XX_FEATURE_DES (1 << 4)
  551. #define IXP4XX_FEATURE_HDLC (1 << 5)
  552. #define IXP4XX_FEATURE_AAL (1 << 6)
  553. #define IXP4XX_FEATURE_HSS (1 << 7)
  554. #define IXP4XX_FEATURE_UTOPIA (1 << 8)
  555. #define IXP4XX_FEATURE_NPEB_ETH0 (1 << 9)
  556. #define IXP4XX_FEATURE_NPEC_ETH (1 << 10)
  557. #define IXP4XX_FEATURE_RESET_NPEA (1 << 11)
  558. #define IXP4XX_FEATURE_RESET_NPEB (1 << 12)
  559. #define IXP4XX_FEATURE_RESET_NPEC (1 << 13)
  560. #define IXP4XX_FEATURE_PCI (1 << 14)
  561. #define IXP4XX_FEATURE_ECC_TIMESYNC (1 << 15)
  562. #define IXP4XX_FEATURE_UTOPIA_PHY_LIMIT (3 << 16)
  563. #define IXP4XX_FEATURE_USB_HOST (1 << 18)
  564. #define IXP4XX_FEATURE_NPEA_ETH (1 << 19)
  565. #define IXP4XX_FEATURE_NPEB_ETH_1_TO_3 (1 << 20)
  566. #define IXP4XX_FEATURE_RSA (1 << 21)
  567. #define IXP4XX_FEATURE_XSCALE_MAX_FREQ (3 << 22)
  568. #define IXP4XX_FEATURE_RESERVED (0xFF << 24)
  569. #define IXP4XX_FEATURE_IXP46X_ONLY (IXP4XX_FEATURE_ECC_TIMESYNC | \
  570. IXP4XX_FEATURE_USB_HOST | \
  571. IXP4XX_FEATURE_NPEA_ETH | \
  572. IXP4XX_FEATURE_NPEB_ETH_1_TO_3 | \
  573. IXP4XX_FEATURE_RSA | \
  574. IXP4XX_FEATURE_XSCALE_MAX_FREQ)
  575. #endif