au1x00.h 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085
  1. /*
  2. *
  3. * BRIEF MODULE DESCRIPTION
  4. * Include file for Alchemy Semiconductor's Au1k CPU.
  5. *
  6. * Copyright 2000,2001 MontaVista Software Inc.
  7. * Author: MontaVista Software, Inc.
  8. * ppopov@mvista.com or source@mvista.com
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. *
  15. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  16. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  18. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  19. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  20. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  21. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  22. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  24. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. *
  26. * You should have received a copy of the GNU General Public License along
  27. * with this program; if not, write to the Free Software Foundation, Inc.,
  28. * 675 Mass Ave, Cambridge, MA 02139, USA.
  29. */
  30. /*
  31. * some definitions add by takuzo@sm.sony.co.jp and sato@sm.sony.co.jp
  32. */
  33. #ifndef _AU1X00_H_
  34. #define _AU1X00_H_
  35. #ifndef __ASSEMBLY__
  36. /* cpu pipeline flush */
  37. void static inline au_sync(void)
  38. {
  39. __asm__ volatile ("sync");
  40. }
  41. void static inline au_sync_udelay(int us)
  42. {
  43. __asm__ volatile ("sync");
  44. udelay(us);
  45. }
  46. void static inline au_writeb(u8 val, int reg)
  47. {
  48. *(volatile u8 *)(reg) = val;
  49. }
  50. void static inline au_writew(u16 val, int reg)
  51. {
  52. *(volatile u16 *)(reg) = val;
  53. }
  54. void static inline au_writel(u32 val, int reg)
  55. {
  56. *(volatile u32 *)(reg) = val;
  57. }
  58. static inline u8 au_readb(unsigned long port)
  59. {
  60. return (*(volatile u8 *)port);
  61. }
  62. static inline u16 au_readw(unsigned long port)
  63. {
  64. return (*(volatile u16 *)port);
  65. }
  66. static inline u32 au_readl(unsigned long port)
  67. {
  68. return (*(volatile u32 *)port);
  69. }
  70. /* These next three functions should be a generic part of the MIPS
  71. * kernel (with the 'au_' removed from the name) and selected for
  72. * processors that support the instructions.
  73. * Taken from PPC tree. -- Dan
  74. */
  75. /* Return the bit position of the most significant 1 bit in a word */
  76. static __inline__ int __ilog2(unsigned int x)
  77. {
  78. int lz;
  79. asm volatile (
  80. ".set\tnoreorder\n\t"
  81. ".set\tnoat\n\t"
  82. ".set\tmips32\n\t"
  83. "clz\t%0,%1\n\t"
  84. ".set\tmips0\n\t"
  85. ".set\tat\n\t"
  86. ".set\treorder"
  87. : "=r" (lz)
  88. : "r" (x));
  89. return 31 - lz;
  90. }
  91. static __inline__ int au_ffz(unsigned int x)
  92. {
  93. if ((x = ~x) == 0)
  94. return 32;
  95. return __ilog2(x & -x);
  96. }
  97. /*
  98. * ffs: find first bit set. This is defined the same way as
  99. * the libc and compiler builtin ffs routines, therefore
  100. * differs in spirit from the above ffz (man ffs).
  101. */
  102. static __inline__ int au_ffs(int x)
  103. {
  104. return __ilog2(x & -x) + 1;
  105. }
  106. #endif /* !ASSEMBLY */
  107. #ifdef CONFIG_PM
  108. /* no CP0 timer irq */
  109. #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4)
  110. #else
  111. #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
  112. #endif
  113. #define CP0_IWATCHLO $18,1
  114. #define CP0_DEBUG $23
  115. /* SDRAM Controller */
  116. #ifdef CONFIG_AU1550
  117. #define MEM_SDMODE0 0xB4000800
  118. #define MEM_SDMODE1 0xB4000808
  119. #define MEM_SDMODE2 0xB4000810
  120. #define MEM_SDADDR0 0xB4000820
  121. #define MEM_SDADDR1 0xB4000828
  122. #define MEM_SDADDR2 0xB4000830
  123. #define MEM_SDCONFIGA 0xB4000840
  124. #define MEM_SDCONFIGB 0xB4000848
  125. #define MEM_SDPRECMD 0xB40008c0
  126. #define MEM_SDAUTOREF 0xB40008c8
  127. #define MEM_SDWRMD0 0xB4000880
  128. #define MEM_SDWRMD1 0xB4000888
  129. #define MEM_SDWRMD2 0xB4000890
  130. #else /* CONFIG_AU1550 */
  131. #define MEM_SDMODE0 0xB4000000
  132. #define MEM_SDMODE1 0xB4000004
  133. #define MEM_SDMODE2 0xB4000008
  134. #define MEM_SDADDR0 0xB400000C
  135. #define MEM_SDADDR1 0xB4000010
  136. #define MEM_SDADDR2 0xB4000014
  137. #define MEM_SDREFCFG 0xB4000018
  138. #define MEM_SDPRECMD 0xB400001C
  139. #define MEM_SDAUTOREF 0xB4000020
  140. #define MEM_SDWRMD0 0xB4000024
  141. #define MEM_SDWRMD1 0xB4000028
  142. #define MEM_SDWRMD2 0xB400002C
  143. #endif /* CONFIG_AU1550 */
  144. #define MEM_SDSLEEP 0xB4000030
  145. #define MEM_SDSMCKE 0xB4000034
  146. /* Static Bus Controller */
  147. #define MEM_STCFG0 0xB4001000
  148. #define MEM_STTIME0 0xB4001004
  149. #define MEM_STADDR0 0xB4001008
  150. #define MEM_STCFG1 0xB4001010
  151. #define MEM_STTIME1 0xB4001014
  152. #define MEM_STADDR1 0xB4001018
  153. #define MEM_STCFG2 0xB4001020
  154. #define MEM_STTIME2 0xB4001024
  155. #define MEM_STADDR2 0xB4001028
  156. #define MEM_STCFG3 0xB4001030
  157. #define MEM_STTIME3 0xB4001034
  158. #define MEM_STADDR3 0xB4001038
  159. /* Interrupt Controller 0 */
  160. #define IC0_CFG0RD 0xB0400040
  161. #define IC0_CFG0SET 0xB0400040
  162. #define IC0_CFG0CLR 0xB0400044
  163. #define IC0_CFG1RD 0xB0400048
  164. #define IC0_CFG1SET 0xB0400048
  165. #define IC0_CFG1CLR 0xB040004C
  166. #define IC0_CFG2RD 0xB0400050
  167. #define IC0_CFG2SET 0xB0400050
  168. #define IC0_CFG2CLR 0xB0400054
  169. #define IC0_REQ0INT 0xB0400054
  170. #define IC0_SRCRD 0xB0400058
  171. #define IC0_SRCSET 0xB0400058
  172. #define IC0_SRCCLR 0xB040005C
  173. #define IC0_REQ1INT 0xB040005C
  174. #define IC0_ASSIGNRD 0xB0400060
  175. #define IC0_ASSIGNSET 0xB0400060
  176. #define IC0_ASSIGNCLR 0xB0400064
  177. #define IC0_WAKERD 0xB0400068
  178. #define IC0_WAKESET 0xB0400068
  179. #define IC0_WAKECLR 0xB040006C
  180. #define IC0_MASKRD 0xB0400070
  181. #define IC0_MASKSET 0xB0400070
  182. #define IC0_MASKCLR 0xB0400074
  183. #define IC0_RISINGRD 0xB0400078
  184. #define IC0_RISINGCLR 0xB0400078
  185. #define IC0_FALLINGRD 0xB040007C
  186. #define IC0_FALLINGCLR 0xB040007C
  187. #define IC0_TESTBIT 0xB0400080
  188. /* Interrupt Controller 1 */
  189. #define IC1_CFG0RD 0xB1800040
  190. #define IC1_CFG0SET 0xB1800040
  191. #define IC1_CFG0CLR 0xB1800044
  192. #define IC1_CFG1RD 0xB1800048
  193. #define IC1_CFG1SET 0xB1800048
  194. #define IC1_CFG1CLR 0xB180004C
  195. #define IC1_CFG2RD 0xB1800050
  196. #define IC1_CFG2SET 0xB1800050
  197. #define IC1_CFG2CLR 0xB1800054
  198. #define IC1_REQ0INT 0xB1800054
  199. #define IC1_SRCRD 0xB1800058
  200. #define IC1_SRCSET 0xB1800058
  201. #define IC1_SRCCLR 0xB180005C
  202. #define IC1_REQ1INT 0xB180005C
  203. #define IC1_ASSIGNRD 0xB1800060
  204. #define IC1_ASSIGNSET 0xB1800060
  205. #define IC1_ASSIGNCLR 0xB1800064
  206. #define IC1_WAKERD 0xB1800068
  207. #define IC1_WAKESET 0xB1800068
  208. #define IC1_WAKECLR 0xB180006C
  209. #define IC1_MASKRD 0xB1800070
  210. #define IC1_MASKSET 0xB1800070
  211. #define IC1_MASKCLR 0xB1800074
  212. #define IC1_RISINGRD 0xB1800078
  213. #define IC1_RISINGCLR 0xB1800078
  214. #define IC1_FALLINGRD 0xB180007C
  215. #define IC1_FALLINGCLR 0xB180007C
  216. #define IC1_TESTBIT 0xB1800080
  217. /* Interrupt Configuration Modes */
  218. #define INTC_INT_DISABLED 0
  219. #define INTC_INT_RISE_EDGE 0x1
  220. #define INTC_INT_FALL_EDGE 0x2
  221. #define INTC_INT_RISE_AND_FALL_EDGE 0x3
  222. #define INTC_INT_HIGH_LEVEL 0x5
  223. #define INTC_INT_LOW_LEVEL 0x6
  224. #define INTC_INT_HIGH_AND_LOW_LEVEL 0x7
  225. /* Interrupt Numbers */
  226. #define AU1X00_UART0_INT 0
  227. #define AU1000_UART1_INT 1 /* au1000 */
  228. #define AU1000_UART2_INT 2 /* au1000 */
  229. #define AU1500_PCI_INTA 1 /* au1500 */
  230. #define AU1500_PCI_INTB 2 /* au1500 */
  231. #define AU1X00_UART3_INT 3
  232. #define AU1000_SSI0_INT 4 /* au1000 */
  233. #define AU1000_SSI1_INT 5 /* au1000 */
  234. #define AU1500_PCI_INTC 4 /* au1500 */
  235. #define AU1500_PCI_INTD 5 /* au1500 */
  236. #define AU1X00_DMA_INT_BASE 6
  237. #define AU1X00_TOY_INT 14
  238. #define AU1X00_TOY_MATCH0_INT 15
  239. #define AU1X00_TOY_MATCH1_INT 16
  240. #define AU1X00_TOY_MATCH2_INT 17
  241. #define AU1X00_RTC_INT 18
  242. #define AU1X00_RTC_MATCH0_INT 19
  243. #define AU1X00_RTC_MATCH1_INT 20
  244. #define AU1X00_RTC_MATCH2_INT 21
  245. #define AU1000_IRDA_TX_INT 22 /* au1000 */
  246. #define AU1000_IRDA_RX_INT 23 /* au1000 */
  247. #define AU1X00_USB_DEV_REQ_INT 24
  248. #define AU1X00_USB_DEV_SUS_INT 25
  249. #define AU1X00_USB_HOST_INT 26
  250. #define AU1X00_ACSYNC_INT 27
  251. #define AU1X00_MAC0_DMA_INT 28
  252. #define AU1X00_MAC1_DMA_INT 29
  253. #define AU1X00_ETH0_IRQ AU1X00_MAC0_DMA_INT
  254. #define AU1X00_ETH1_IRQ AU1X00_MAC1_DMA_INT
  255. #define AU1000_I2S_UO_INT 30 /* au1000 */
  256. #define AU1X00_AC97C_INT 31
  257. #define AU1X00_LAST_INTC0_INT AU1X00_AC97C_INT
  258. #define AU1X00_GPIO_0 32
  259. #define AU1X00_GPIO_1 33
  260. #define AU1X00_GPIO_2 34
  261. #define AU1X00_GPIO_3 35
  262. #define AU1X00_GPIO_4 36
  263. #define AU1X00_GPIO_5 37
  264. #define AU1X00_GPIO_6 38
  265. #define AU1X00_GPIO_7 39
  266. #define AU1X00_GPIO_8 40
  267. #define AU1X00_GPIO_9 41
  268. #define AU1X00_GPIO_10 42
  269. #define AU1X00_GPIO_11 43
  270. #define AU1X00_GPIO_12 44
  271. #define AU1X00_GPIO_13 45
  272. #define AU1X00_GPIO_14 46
  273. #define AU1X00_GPIO_15 47
  274. /* Au1000 only */
  275. #define AU1000_GPIO_16 48
  276. #define AU1000_GPIO_17 49
  277. #define AU1000_GPIO_18 50
  278. #define AU1000_GPIO_19 51
  279. #define AU1000_GPIO_20 52
  280. #define AU1000_GPIO_21 53
  281. #define AU1000_GPIO_22 54
  282. #define AU1000_GPIO_23 55
  283. #define AU1000_GPIO_24 56
  284. #define AU1000_GPIO_25 57
  285. #define AU1000_GPIO_26 58
  286. #define AU1000_GPIO_27 59
  287. #define AU1000_GPIO_28 60
  288. #define AU1000_GPIO_29 61
  289. #define AU1000_GPIO_30 62
  290. #define AU1000_GPIO_31 63
  291. /* Au1500 only */
  292. #define AU1500_GPIO_200 48
  293. #define AU1500_GPIO_201 49
  294. #define AU1500_GPIO_202 50
  295. #define AU1500_GPIO_203 51
  296. #define AU1500_GPIO_20 52
  297. #define AU1500_GPIO_204 53
  298. #define AU1500_GPIO_205 54
  299. #define AU1500_GPIO_23 55
  300. #define AU1500_GPIO_24 56
  301. #define AU1500_GPIO_25 57
  302. #define AU1500_GPIO_26 58
  303. #define AU1500_GPIO_27 59
  304. #define AU1500_GPIO_28 60
  305. #define AU1500_GPIO_206 61
  306. #define AU1500_GPIO_207 62
  307. #define AU1500_GPIO_208_215 63
  308. #define AU1X00_MAX_INTR 63
  309. #define AU1100_SD 2
  310. #define AU1100_GPIO_208_215 29
  311. /* REDEFINE SECONDARY GPIO BLOCK INTO IC1 CONTROLLER HERE */
  312. /* Programmable Counters 0 and 1 */
  313. #define SYS_BASE 0xB1900000
  314. #define SYS_COUNTER_CNTRL (SYS_BASE + 0x14)
  315. #define SYS_CNTRL_E1S (1<<23)
  316. #define SYS_CNTRL_T1S (1<<20)
  317. #define SYS_CNTRL_M21 (1<<19)
  318. #define SYS_CNTRL_M11 (1<<18)
  319. #define SYS_CNTRL_M01 (1<<17)
  320. #define SYS_CNTRL_C1S (1<<16)
  321. #define SYS_CNTRL_BP (1<<14)
  322. #define SYS_CNTRL_EN1 (1<<13)
  323. #define SYS_CNTRL_BT1 (1<<12)
  324. #define SYS_CNTRL_EN0 (1<<11)
  325. #define SYS_CNTRL_BT0 (1<<10)
  326. #define SYS_CNTRL_E0 (1<<8)
  327. #define SYS_CNTRL_E0S (1<<7)
  328. #define SYS_CNTRL_32S (1<<5)
  329. #define SYS_CNTRL_T0S (1<<4)
  330. #define SYS_CNTRL_M20 (1<<3)
  331. #define SYS_CNTRL_M10 (1<<2)
  332. #define SYS_CNTRL_M00 (1<<1)
  333. #define SYS_CNTRL_C0S (1<<0)
  334. /* Programmable Counter 0 Registers */
  335. #define SYS_TOYTRIM (SYS_BASE + 0)
  336. #define SYS_TOYWRITE (SYS_BASE + 4)
  337. #define SYS_TOYMATCH0 (SYS_BASE + 8)
  338. #define SYS_TOYMATCH1 (SYS_BASE + 0xC)
  339. #define SYS_TOYMATCH2 (SYS_BASE + 0x10)
  340. #define SYS_TOYREAD (SYS_BASE + 0x40)
  341. /* Programmable Counter 1 Registers */
  342. #define SYS_RTCTRIM (SYS_BASE + 0x44)
  343. #define SYS_RTCWRITE (SYS_BASE + 0x48)
  344. #define SYS_RTCMATCH0 (SYS_BASE + 0x4C)
  345. #define SYS_RTCMATCH1 (SYS_BASE + 0x50)
  346. #define SYS_RTCMATCH2 (SYS_BASE + 0x54)
  347. #define SYS_RTCREAD (SYS_BASE + 0x58)
  348. /* I2S Controller */
  349. #define I2S_DATA 0xB1000000
  350. #define I2S_DATA_MASK (0xffffff)
  351. #define I2S_CONFIG 0xB1000004
  352. #define I2S_CONFIG_XU (1<<25)
  353. #define I2S_CONFIG_XO (1<<24)
  354. #define I2S_CONFIG_RU (1<<23)
  355. #define I2S_CONFIG_RO (1<<22)
  356. #define I2S_CONFIG_TR (1<<21)
  357. #define I2S_CONFIG_TE (1<<20)
  358. #define I2S_CONFIG_TF (1<<19)
  359. #define I2S_CONFIG_RR (1<<18)
  360. #define I2S_CONFIG_RE (1<<17)
  361. #define I2S_CONFIG_RF (1<<16)
  362. #define I2S_CONFIG_PD (1<<11)
  363. #define I2S_CONFIG_LB (1<<10)
  364. #define I2S_CONFIG_IC (1<<9)
  365. #define I2S_CONFIG_FM_BIT 7
  366. #define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT)
  367. #define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT)
  368. #define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT)
  369. #define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT)
  370. #define I2S_CONFIG_TN (1<<6)
  371. #define I2S_CONFIG_RN (1<<5)
  372. #define I2S_CONFIG_SZ_BIT 0
  373. #define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT)
  374. #define I2S_CONTROL 0xB1000008
  375. #define I2S_CONTROL_D (1<<1)
  376. #define I2S_CONTROL_CE (1<<0)
  377. /* USB Host Controller */
  378. /* We pass USB_OHCI_BASE to ioremap, so it needs to be a physical address */
  379. #define USB_OHCI_BASE 0x10100000
  380. #define USB_OHCI_LEN 0x00100000
  381. #define USB_HOST_CONFIG 0xB017fffc
  382. /* USB Device Controller */
  383. #define USBD_EP0RD 0xB0200000
  384. #define USBD_EP0WR 0xB0200004
  385. #define USBD_EP2WR 0xB0200008
  386. #define USBD_EP3WR 0xB020000C
  387. #define USBD_EP4RD 0xB0200010
  388. #define USBD_EP5RD 0xB0200014
  389. #define USBD_INTEN 0xB0200018
  390. #define USBD_INTSTAT 0xB020001C
  391. #define USBDEV_INT_SOF (1<<12)
  392. #define USBDEV_INT_HF_BIT 6
  393. #define USBDEV_INT_HF_MASK (0x3f << USBDEV_INT_HF_BIT)
  394. #define USBDEV_INT_CMPLT_BIT 0
  395. #define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT)
  396. #define USBD_CONFIG 0xB0200020
  397. #define USBD_EP0CS 0xB0200024
  398. #define USBD_EP2CS 0xB0200028
  399. #define USBD_EP3CS 0xB020002C
  400. #define USBD_EP4CS 0xB0200030
  401. #define USBD_EP5CS 0xB0200034
  402. #define USBDEV_CS_SU (1<<14)
  403. #define USBDEV_CS_NAK (1<<13)
  404. #define USBDEV_CS_ACK (1<<12)
  405. #define USBDEV_CS_BUSY (1<<11)
  406. #define USBDEV_CS_TSIZE_BIT 1
  407. #define USBDEV_CS_TSIZE_MASK (0x3ff << USBDEV_CS_TSIZE_BIT)
  408. #define USBDEV_CS_STALL (1<<0)
  409. #define USBD_EP0RDSTAT 0xB0200040
  410. #define USBD_EP0WRSTAT 0xB0200044
  411. #define USBD_EP2WRSTAT 0xB0200048
  412. #define USBD_EP3WRSTAT 0xB020004C
  413. #define USBD_EP4RDSTAT 0xB0200050
  414. #define USBD_EP5RDSTAT 0xB0200054
  415. #define USBDEV_FSTAT_FLUSH (1<<6)
  416. #define USBDEV_FSTAT_UF (1<<5)
  417. #define USBDEV_FSTAT_OF (1<<4)
  418. #define USBDEV_FSTAT_FCNT_BIT 0
  419. #define USBDEV_FSTAT_FCNT_MASK (0x0f << USBDEV_FSTAT_FCNT_BIT)
  420. #define USBD_ENABLE 0xB0200058
  421. #define USBDEV_ENABLE (1<<1)
  422. #define USBDEV_CE (1<<0)
  423. /* Ethernet Controllers */
  424. #define AU1000_ETH0_BASE 0xB0500000
  425. #define AU1000_ETH1_BASE 0xB0510000
  426. #define AU1500_ETH0_BASE 0xB1500000
  427. #define AU1500_ETH1_BASE 0xB1510000
  428. #define AU1100_ETH0_BASE 0xB0500000
  429. #define AU1550_ETH0_BASE 0xB0500000
  430. #define AU1550_ETH1_BASE 0xB0510000
  431. /* 4 byte offsets from AU1000_ETH_BASE */
  432. #define MAC_CONTROL 0x0
  433. #define MAC_RX_ENABLE (1<<2)
  434. #define MAC_TX_ENABLE (1<<3)
  435. #define MAC_DEF_CHECK (1<<5)
  436. #define MAC_SET_BL(X) (((X)&0x3)<<6)
  437. #define MAC_AUTO_PAD (1<<8)
  438. #define MAC_DISABLE_RETRY (1<<10)
  439. #define MAC_DISABLE_BCAST (1<<11)
  440. #define MAC_LATE_COL (1<<12)
  441. #define MAC_HASH_MODE (1<<13)
  442. #define MAC_HASH_ONLY (1<<15)
  443. #define MAC_PASS_ALL (1<<16)
  444. #define MAC_INVERSE_FILTER (1<<17)
  445. #define MAC_PROMISCUOUS (1<<18)
  446. #define MAC_PASS_ALL_MULTI (1<<19)
  447. #define MAC_FULL_DUPLEX (1<<20)
  448. #define MAC_NORMAL_MODE 0
  449. #define MAC_INT_LOOPBACK (1<<21)
  450. #define MAC_EXT_LOOPBACK (1<<22)
  451. #define MAC_DISABLE_RX_OWN (1<<23)
  452. #define MAC_BIG_ENDIAN (1<<30)
  453. #define MAC_RX_ALL (1<<31)
  454. #define MAC_ADDRESS_HIGH 0x4
  455. #define MAC_ADDRESS_LOW 0x8
  456. #define MAC_MCAST_HIGH 0xC
  457. #define MAC_MCAST_LOW 0x10
  458. #define MAC_MII_CNTRL 0x14
  459. #define MAC_MII_BUSY (1<<0)
  460. #define MAC_MII_READ 0
  461. #define MAC_MII_WRITE (1<<1)
  462. #define MAC_SET_MII_SELECT_REG(X) (((X)&0x1f)<<6)
  463. #define MAC_SET_MII_SELECT_PHY(X) (((X)&0x1f)<<11)
  464. #define MAC_MII_DATA 0x18
  465. #define MAC_FLOW_CNTRL 0x1C
  466. #define MAC_FLOW_CNTRL_BUSY (1<<0)
  467. #define MAC_FLOW_CNTRL_ENABLE (1<<1)
  468. #define MAC_PASS_CONTROL (1<<2)
  469. #define MAC_SET_PAUSE(X) (((X)&0xffff)<<16)
  470. #define MAC_VLAN1_TAG 0x20
  471. #define MAC_VLAN2_TAG 0x24
  472. /* Ethernet Controller Enable */
  473. #define AU1000_MAC0_ENABLE 0xB0520000
  474. #define AU1000_MAC1_ENABLE 0xB0520004
  475. #define AU1500_MAC0_ENABLE 0xB1520000
  476. #define AU1500_MAC1_ENABLE 0xB1520004
  477. #define AU1100_MAC0_ENABLE 0xB0520000
  478. #define AU1550_MAC0_ENABLE 0xB0520000
  479. #define AU1550_MAC1_ENABLE 0xB0520004
  480. #define MAC_EN_CLOCK_ENABLE (1<<0)
  481. #define MAC_EN_RESET0 (1<<1)
  482. #define MAC_EN_TOSS (0<<2)
  483. #define MAC_EN_CACHEABLE (1<<3)
  484. #define MAC_EN_RESET1 (1<<4)
  485. #define MAC_EN_RESET2 (1<<5)
  486. #define MAC_DMA_RESET (1<<6)
  487. /* Ethernet Controller DMA Channels */
  488. #define MAC0_TX_DMA_ADDR 0xB4004000
  489. #define MAC1_TX_DMA_ADDR 0xB4004200
  490. /* offsets from MAC_TX_RING_ADDR address */
  491. #define MAC_TX_BUFF0_STATUS 0x0
  492. #define TX_FRAME_ABORTED (1<<0)
  493. #define TX_JAB_TIMEOUT (1<<1)
  494. #define TX_NO_CARRIER (1<<2)
  495. #define TX_LOSS_CARRIER (1<<3)
  496. #define TX_EXC_DEF (1<<4)
  497. #define TX_LATE_COLL_ABORT (1<<5)
  498. #define TX_EXC_COLL (1<<6)
  499. #define TX_UNDERRUN (1<<7)
  500. #define TX_DEFERRED (1<<8)
  501. #define TX_LATE_COLL (1<<9)
  502. #define TX_COLL_CNT_MASK (0xF<<10)
  503. #define TX_PKT_RETRY (1<<31)
  504. #define MAC_TX_BUFF0_ADDR 0x4
  505. #define TX_DMA_ENABLE (1<<0)
  506. #define TX_T_DONE (1<<1)
  507. #define TX_GET_DMA_BUFFER(X) (((X)>>2)&0x3)
  508. #define MAC_TX_BUFF0_LEN 0x8
  509. #define MAC_TX_BUFF1_STATUS 0x10
  510. #define MAC_TX_BUFF1_ADDR 0x14
  511. #define MAC_TX_BUFF1_LEN 0x18
  512. #define MAC_TX_BUFF2_STATUS 0x20
  513. #define MAC_TX_BUFF2_ADDR 0x24
  514. #define MAC_TX_BUFF2_LEN 0x28
  515. #define MAC_TX_BUFF3_STATUS 0x30
  516. #define MAC_TX_BUFF3_ADDR 0x34
  517. #define MAC_TX_BUFF3_LEN 0x38
  518. #define MAC0_RX_DMA_ADDR 0xB4004100
  519. #define MAC1_RX_DMA_ADDR 0xB4004300
  520. /* offsets from MAC_RX_RING_ADDR */
  521. #define MAC_RX_BUFF0_STATUS 0x0
  522. #define RX_FRAME_LEN_MASK 0x3fff
  523. #define RX_WDOG_TIMER (1<<14)
  524. #define RX_RUNT (1<<15)
  525. #define RX_OVERLEN (1<<16)
  526. #define RX_COLL (1<<17)
  527. #define RX_ETHER (1<<18)
  528. #define RX_MII_ERROR (1<<19)
  529. #define RX_DRIBBLING (1<<20)
  530. #define RX_CRC_ERROR (1<<21)
  531. #define RX_VLAN1 (1<<22)
  532. #define RX_VLAN2 (1<<23)
  533. #define RX_LEN_ERROR (1<<24)
  534. #define RX_CNTRL_FRAME (1<<25)
  535. #define RX_U_CNTRL_FRAME (1<<26)
  536. #define RX_MCAST_FRAME (1<<27)
  537. #define RX_BCAST_FRAME (1<<28)
  538. #define RX_FILTER_FAIL (1<<29)
  539. #define RX_PACKET_FILTER (1<<30)
  540. #define RX_MISSED_FRAME (1<<31)
  541. #define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \
  542. RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \
  543. RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME)
  544. #define MAC_RX_BUFF0_ADDR 0x4
  545. #define RX_DMA_ENABLE (1<<0)
  546. #define RX_T_DONE (1<<1)
  547. #define RX_GET_DMA_BUFFER(X) (((X)>>2)&0x3)
  548. #define RX_SET_BUFF_ADDR(X) ((X)&0xffffffc0)
  549. #define MAC_RX_BUFF1_STATUS 0x10
  550. #define MAC_RX_BUFF1_ADDR 0x14
  551. #define MAC_RX_BUFF2_STATUS 0x20
  552. #define MAC_RX_BUFF2_ADDR 0x24
  553. #define MAC_RX_BUFF3_STATUS 0x30
  554. #define MAC_RX_BUFF3_ADDR 0x34
  555. /* UARTS 0-3 */
  556. #define UART0_ADDR 0xB1100000
  557. #define UART1_ADDR 0xB1200000
  558. #define UART2_ADDR 0xB1300000
  559. #define UART3_ADDR 0xB1400000
  560. #define UART_BASE UART0_ADDR
  561. #define UART_DEBUG_BASE UART2_ADDR
  562. #define UART_RX 0 /* Receive buffer */
  563. #define UART_TX 4 /* Transmit buffer */
  564. #define UART_IER 8 /* Interrupt Enable Register */
  565. #define UART_IIR 0xC /* Interrupt ID Register */
  566. #define UART_FCR 0x10 /* FIFO Control Register */
  567. #define UART_LCR 0x14 /* Line Control Register */
  568. #define UART_MCR 0x18 /* Modem Control Register */
  569. #define UART_LSR 0x1C /* Line Status Register */
  570. #define UART_MSR 0x20 /* Modem Status Register */
  571. #define UART_CLK 0x28 /* Baud Rate Clock Divider */
  572. #define UART_ENABLE 0x100 /* Uart enable */
  573. #define UART_EN_CE 1 /* Clock enable */
  574. #define UART_EN_E 2 /* Enable */
  575. #define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */
  576. #define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */
  577. #define UART_FCR_CLEAR_XMIT 0x04 /* Clear the XMIT FIFO */
  578. #define UART_FCR_DMA_SELECT 0x08 /* For DMA applications */
  579. #define UART_FCR_TRIGGER_MASK 0xF0 /* Mask for the FIFO trigger range */
  580. #define UART_FCR_R_TRIGGER_1 0x00 /* Mask for receive trigger set at 1 */
  581. #define UART_FCR_R_TRIGGER_4 0x40 /* Mask for receive trigger set at 4 */
  582. #define UART_FCR_R_TRIGGER_8 0x80 /* Mask for receive trigger set at 8 */
  583. #define UART_FCR_R_TRIGGER_14 0xA0 /* Mask for receive trigger set at 14 */
  584. #define UART_FCR_T_TRIGGER_0 0x00 /* Mask for transmit trigger set at 0 */
  585. #define UART_FCR_T_TRIGGER_4 0x10 /* Mask for transmit trigger set at 4 */
  586. #define UART_FCR_T_TRIGGER_8 0x20 /* Mask for transmit trigger set at 8 */
  587. #define UART_FCR_T_TRIGGER_12 0x30 /* Mask for transmit trigger set at 12 */
  588. /*
  589. * These are the definitions for the Line Control Register
  590. */
  591. #define UART_LCR_SBC 0x40 /* Set break control */
  592. #define UART_LCR_SPAR 0x20 /* Stick parity (?) */
  593. #define UART_LCR_EPAR 0x10 /* Even parity select */
  594. #define UART_LCR_PARITY 0x08 /* Parity Enable */
  595. #define UART_LCR_STOP 0x04 /* Stop bits: 0=1 stop bit, 1= 2 stop bits */
  596. #define UART_LCR_WLEN5 0x00 /* Wordlength: 5 bits */
  597. #define UART_LCR_WLEN6 0x01 /* Wordlength: 6 bits */
  598. #define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */
  599. #define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */
  600. /*
  601. * These are the definitions for the Line Status Register
  602. */
  603. #define UART_LSR_TEMT 0x40 /* Transmitter empty */
  604. #define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */
  605. #define UART_LSR_BI 0x10 /* Break interrupt indicator */
  606. #define UART_LSR_FE 0x08 /* Frame error indicator */
  607. #define UART_LSR_PE 0x04 /* Parity error indicator */
  608. #define UART_LSR_OE 0x02 /* Overrun error indicator */
  609. #define UART_LSR_DR 0x01 /* Receiver data ready */
  610. /*
  611. * These are the definitions for the Interrupt Identification Register
  612. */
  613. #define UART_IIR_NO_INT 0x01 /* No interrupts pending */
  614. #define UART_IIR_ID 0x06 /* Mask for the interrupt ID */
  615. #define UART_IIR_MSI 0x00 /* Modem status interrupt */
  616. #define UART_IIR_THRI 0x02 /* Transmitter holding register empty */
  617. #define UART_IIR_RDI 0x04 /* Receiver data interrupt */
  618. #define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */
  619. /*
  620. * These are the definitions for the Interrupt Enable Register
  621. */
  622. #define UART_IER_MSI 0x08 /* Enable Modem status interrupt */
  623. #define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */
  624. #define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */
  625. #define UART_IER_RDI 0x01 /* Enable receiver data interrupt */
  626. /*
  627. * These are the definitions for the Modem Control Register
  628. */
  629. #define UART_MCR_LOOP 0x10 /* Enable loopback test mode */
  630. #define UART_MCR_OUT2 0x08 /* Out2 complement */
  631. #define UART_MCR_OUT1 0x04 /* Out1 complement */
  632. #define UART_MCR_RTS 0x02 /* RTS complement */
  633. #define UART_MCR_DTR 0x01 /* DTR complement */
  634. /*
  635. * These are the definitions for the Modem Status Register
  636. */
  637. #define UART_MSR_DCD 0x80 /* Data Carrier Detect */
  638. #define UART_MSR_RI 0x40 /* Ring Indicator */
  639. #define UART_MSR_DSR 0x20 /* Data Set Ready */
  640. #define UART_MSR_CTS 0x10 /* Clear to Send */
  641. #define UART_MSR_DDCD 0x08 /* Delta DCD */
  642. #define UART_MSR_TERI 0x04 /* Trailing edge ring indicator */
  643. #define UART_MSR_DDSR 0x02 /* Delta DSR */
  644. #define UART_MSR_DCTS 0x01 /* Delta CTS */
  645. #define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */
  646. /* SSIO */
  647. #define SSI0_STATUS 0xB1600000
  648. #define SSI_STATUS_BF (1<<4)
  649. #define SSI_STATUS_OF (1<<3)
  650. #define SSI_STATUS_UF (1<<2)
  651. #define SSI_STATUS_D (1<<1)
  652. #define SSI_STATUS_B (1<<0)
  653. #define SSI0_INT 0xB1600004
  654. #define SSI_INT_OI (1<<3)
  655. #define SSI_INT_UI (1<<2)
  656. #define SSI_INT_DI (1<<1)
  657. #define SSI0_INT_ENABLE 0xB1600008
  658. #define SSI_INTE_OIE (1<<3)
  659. #define SSI_INTE_UIE (1<<2)
  660. #define SSI_INTE_DIE (1<<1)
  661. #define SSI0_CONFIG 0xB1600020
  662. #define SSI_CONFIG_AO (1<<24)
  663. #define SSI_CONFIG_DO (1<<23)
  664. #define SSI_CONFIG_ALEN_BIT 20
  665. #define SSI_CONFIG_ALEN_MASK (0x7<<20)
  666. #define SSI_CONFIG_DLEN_BIT 16
  667. #define SSI_CONFIG_DLEN_MASK (0x7<<16)
  668. #define SSI_CONFIG_DD (1<<11)
  669. #define SSI_CONFIG_AD (1<<10)
  670. #define SSI_CONFIG_BM_BIT 8
  671. #define SSI_CONFIG_BM_MASK (0x3<<8)
  672. #define SSI_CONFIG_CE (1<<7)
  673. #define SSI_CONFIG_DP (1<<6)
  674. #define SSI_CONFIG_DL (1<<5)
  675. #define SSI_CONFIG_EP (1<<4)
  676. #define SSI0_ADATA 0xB1600024
  677. #define SSI_AD_D (1<<24)
  678. #define SSI_AD_ADDR_BIT 16
  679. #define SSI_AD_ADDR_MASK (0xff<<16)
  680. #define SSI_AD_DATA_BIT 0
  681. #define SSI_AD_DATA_MASK (0xfff<<0)
  682. #define SSI0_CLKDIV 0xB1600028
  683. #define SSI0_CONTROL 0xB1600100
  684. #define SSI_CONTROL_CD (1<<1)
  685. #define SSI_CONTROL_E (1<<0)
  686. /* SSI1 */
  687. #define SSI1_STATUS 0xB1680000
  688. #define SSI1_INT 0xB1680004
  689. #define SSI1_INT_ENABLE 0xB1680008
  690. #define SSI1_CONFIG 0xB1680020
  691. #define SSI1_ADATA 0xB1680024
  692. #define SSI1_CLKDIV 0xB1680028
  693. #define SSI1_ENABLE 0xB1680100
  694. /*
  695. * Register content definitions
  696. */
  697. #define SSI_STATUS_BF (1<<4)
  698. #define SSI_STATUS_OF (1<<3)
  699. #define SSI_STATUS_UF (1<<2)
  700. #define SSI_STATUS_D (1<<1)
  701. #define SSI_STATUS_B (1<<0)
  702. /* SSI_INT */
  703. #define SSI_INT_OI (1<<3)
  704. #define SSI_INT_UI (1<<2)
  705. #define SSI_INT_DI (1<<1)
  706. /* SSI_INTEN */
  707. #define SSI_INTEN_OIE (1<<3)
  708. #define SSI_INTEN_UIE (1<<2)
  709. #define SSI_INTEN_DIE (1<<1)
  710. #define SSI_CONFIG_AO (1<<24)
  711. #define SSI_CONFIG_DO (1<<23)
  712. #define SSI_CONFIG_ALEN (7<<20)
  713. #define SSI_CONFIG_DLEN (15<<16)
  714. #define SSI_CONFIG_DD (1<<11)
  715. #define SSI_CONFIG_AD (1<<10)
  716. #define SSI_CONFIG_BM (3<<8)
  717. #define SSI_CONFIG_CE (1<<7)
  718. #define SSI_CONFIG_DP (1<<6)
  719. #define SSI_CONFIG_DL (1<<5)
  720. #define SSI_CONFIG_EP (1<<4)
  721. #define SSI_CONFIG_ALEN_N(N) ((N-1)<<20)
  722. #define SSI_CONFIG_DLEN_N(N) ((N-1)<<16)
  723. #define SSI_CONFIG_BM_HI (0<<8)
  724. #define SSI_CONFIG_BM_LO (1<<8)
  725. #define SSI_CONFIG_BM_CY (2<<8)
  726. #define SSI_ADATA_D (1<<24)
  727. #define SSI_ADATA_ADDR (0xFF<<16)
  728. #define SSI_ADATA_DATA (0x0FFF)
  729. #define SSI_ADATA_ADDR_N(N) (N<<16)
  730. #define SSI_ENABLE_CD (1<<1)
  731. #define SSI_ENABLE_E (1<<0)
  732. /* IrDA Controller */
  733. #define IRDA_BASE 0xB0300000
  734. #define IR_RING_PTR_STATUS (IRDA_BASE+0x00)
  735. #define IR_RING_BASE_ADDR_H (IRDA_BASE+0x04)
  736. #define IR_RING_BASE_ADDR_L (IRDA_BASE+0x08)
  737. #define IR_RING_SIZE (IRDA_BASE+0x0C)
  738. #define IR_RING_PROMPT (IRDA_BASE+0x10)
  739. #define IR_RING_ADDR_CMPR (IRDA_BASE+0x14)
  740. #define IR_INT_CLEAR (IRDA_BASE+0x18)
  741. #define IR_CONFIG_1 (IRDA_BASE+0x20)
  742. #define IR_RX_INVERT_LED (1<<0)
  743. #define IR_TX_INVERT_LED (1<<1)
  744. #define IR_ST (1<<2)
  745. #define IR_SF (1<<3)
  746. #define IR_SIR (1<<4)
  747. #define IR_MIR (1<<5)
  748. #define IR_FIR (1<<6)
  749. #define IR_16CRC (1<<7)
  750. #define IR_TD (1<<8)
  751. #define IR_RX_ALL (1<<9)
  752. #define IR_DMA_ENABLE (1<<10)
  753. #define IR_RX_ENABLE (1<<11)
  754. #define IR_TX_ENABLE (1<<12)
  755. #define IR_LOOPBACK (1<<14)
  756. #define IR_SIR_MODE (IR_SIR | IR_DMA_ENABLE | \
  757. IR_RX_ALL | IR_RX_ENABLE | IR_SF | IR_16CRC)
  758. #define IR_SIR_FLAGS (IRDA_BASE+0x24)
  759. #define IR_ENABLE (IRDA_BASE+0x28)
  760. #define IR_RX_STATUS (1<<9)
  761. #define IR_TX_STATUS (1<<10)
  762. #define IR_READ_PHY_CONFIG (IRDA_BASE+0x2C)
  763. #define IR_WRITE_PHY_CONFIG (IRDA_BASE+0x30)
  764. #define IR_MAX_PKT_LEN (IRDA_BASE+0x34)
  765. #define IR_RX_BYTE_CNT (IRDA_BASE+0x38)
  766. #define IR_CONFIG_2 (IRDA_BASE+0x3C)
  767. #define IR_MODE_INV (1<<0)
  768. #define IR_ONE_PIN (1<<1)
  769. #define IR_INTERFACE_CONFIG (IRDA_BASE+0x40)
  770. /* GPIO */
  771. #define SYS_PINFUNC 0xB190002C
  772. #define SYS_PF_USB (1<<15) /* 2nd USB device/host */
  773. #define SYS_PF_U3 (1<<14) /* GPIO23/U3TXD */
  774. #define SYS_PF_U2 (1<<13) /* GPIO22/U2TXD */
  775. #define SYS_PF_U1 (1<<12) /* GPIO21/U1TXD */
  776. #define SYS_PF_SRC (1<<11) /* GPIO6/SROMCKE */
  777. #define SYS_PF_CK5 (1<<10) /* GPIO3/CLK5 */
  778. #define SYS_PF_CK4 (1<<9) /* GPIO2/CLK4 */
  779. #define SYS_PF_IRF (1<<8) /* GPIO15/IRFIRSEL */
  780. #define SYS_PF_UR3 (1<<7) /* GPIO[14:9]/UART3 */
  781. #define SYS_PF_I2D (1<<6) /* GPIO8/I2SDI */
  782. #define SYS_PF_I2S (1<<5) /* I2S/GPIO[29:31] */
  783. #define SYS_PF_NI2 (1<<4) /* NI2/GPIO[24:28] */
  784. #define SYS_PF_U0 (1<<3) /* U0TXD/GPIO20 */
  785. #define SYS_PF_RD (1<<2) /* IRTXD/GPIO19 */
  786. #define SYS_PF_A97 (1<<1) /* AC97/SSL1 */
  787. #define SYS_PF_S0 (1<<0) /* SSI_0/GPIO[16:18] */
  788. #define SYS_TRIOUTRD 0xB1900100
  789. #define SYS_TRIOUTCLR 0xB1900100
  790. #define SYS_OUTPUTRD 0xB1900108
  791. #define SYS_OUTPUTSET 0xB1900108
  792. #define SYS_OUTPUTCLR 0xB190010C
  793. #define SYS_PINSTATERD 0xB1900110
  794. #define SYS_PININPUTEN 0xB1900110
  795. /* GPIO2, Au1500 only */
  796. #define GPIO2_BASE 0xB1700000
  797. #define GPIO2_DIR (GPIO2_BASE + 0)
  798. #define GPIO2_DATA_EN (GPIO2_BASE + 8)
  799. #define GPIO2_PIN_STATE (GPIO2_BASE + 0xC)
  800. #define GPIO2_INT_ENABLE (GPIO2_BASE + 0x10)
  801. #define GPIO2_ENABLE (GPIO2_BASE + 0x14)
  802. /* Power Management */
  803. #define SYS_SCRATCH0 0xB1900018
  804. #define SYS_SCRATCH1 0xB190001C
  805. #define SYS_WAKEMSK 0xB1900034
  806. #define SYS_ENDIAN 0xB1900038
  807. #define SYS_POWERCTRL 0xB190003C
  808. #define SYS_WAKESRC 0xB190005C
  809. #define SYS_SLPPWR 0xB1900078
  810. #define SYS_SLEEP 0xB190007C
  811. /* Clock Controller */
  812. #define SYS_FREQCTRL0 0xB1900020
  813. #define SYS_FC_FRDIV2_BIT 22
  814. #define SYS_FC_FRDIV2_MASK (0xff << FQC2_FRDIV2_BIT)
  815. #define SYS_FC_FE2 (1<<21)
  816. #define SYS_FC_FS2 (1<<20)
  817. #define SYS_FC_FRDIV1_BIT 12
  818. #define SYS_FC_FRDIV1_MASK (0xff << FQC2_FRDIV1_BIT)
  819. #define SYS_FC_FE1 (1<<11)
  820. #define SYS_FC_FS1 (1<<10)
  821. #define SYS_FC_FRDIV0_BIT 2
  822. #define SYS_FC_FRDIV0_MASK (0xff << FQC2_FRDIV0_BIT)
  823. #define SYS_FC_FE0 (1<<1)
  824. #define SYS_FC_FS0 (1<<0)
  825. #define SYS_FREQCTRL1 0xB1900024
  826. #define SYS_FC_FRDIV5_BIT 22
  827. #define SYS_FC_FRDIV5_MASK (0xff << FQC2_FRDIV5_BIT)
  828. #define SYS_FC_FE5 (1<<21)
  829. #define SYS_FC_FS5 (1<<20)
  830. #define SYS_FC_FRDIV4_BIT 12
  831. #define SYS_FC_FRDIV4_MASK (0xff << FQC2_FRDIV4_BIT)
  832. #define SYS_FC_FE4 (1<<11)
  833. #define SYS_FC_FS4 (1<<10)
  834. #define SYS_FC_FRDIV3_BIT 2
  835. #define SYS_FC_FRDIV3_MASK (0xff << FQC2_FRDIV3_BIT)
  836. #define SYS_FC_FE3 (1<<1)
  837. #define SYS_FC_FS3 (1<<0)
  838. #define SYS_CLKSRC 0xB1900028
  839. #define SYS_CS_ME1_BIT 27
  840. #define SYS_CS_ME1_MASK (0x7<<CSC_ME1_BIT)
  841. #define SYS_CS_DE1 (1<<26)
  842. #define SYS_CS_CE1 (1<<25)
  843. #define SYS_CS_ME0_BIT 22
  844. #define SYS_CS_ME0_MASK (0x7<<CSC_ME0_BIT)
  845. #define SYS_CS_DE0 (1<<21)
  846. #define SYS_CS_CE0 (1<<20)
  847. #define SYS_CS_MI2_BIT 17
  848. #define SYS_CS_MI2_MASK (0x7<<CSC_MI2_BIT)
  849. #define SYS_CS_DI2 (1<<16)
  850. #define SYS_CS_CI2 (1<<15)
  851. #define SYS_CS_MUH_BIT 12
  852. #define SYS_CS_MUH_MASK (0x7<<CSC_MUH_BIT)
  853. #define SYS_CS_DUH (1<<11)
  854. #define SYS_CS_CUH (1<<10)
  855. #define SYS_CS_MUD_BIT 7
  856. #define SYS_CS_MUD_MASK (0x7<<CSC_MUD_BIT)
  857. #define SYS_CS_DUD (1<<6)
  858. #define SYS_CS_CUD (1<<5)
  859. #define SYS_CS_MIR_BIT 2
  860. #define SYS_CS_MIR_MASK (0x7<<CSC_MIR_BIT)
  861. #define SYS_CS_DIR (1<<1)
  862. #define SYS_CS_CIR (1<<0)
  863. #define SYS_CS_MUX_AUX 0x1
  864. #define SYS_CS_MUX_FQ0 0x2
  865. #define SYS_CS_MUX_FQ1 0x3
  866. #define SYS_CS_MUX_FQ2 0x4
  867. #define SYS_CS_MUX_FQ3 0x5
  868. #define SYS_CS_MUX_FQ4 0x6
  869. #define SYS_CS_MUX_FQ5 0x7
  870. #define SYS_CPUPLL 0xB1900060
  871. #define SYS_AUXPLL 0xB1900064
  872. /* AC97 Controller */
  873. #define AC97C_CONFIG 0xB0000000
  874. #define AC97C_RECV_SLOTS_BIT 13
  875. #define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT)
  876. #define AC97C_XMIT_SLOTS_BIT 3
  877. #define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT)
  878. #define AC97C_SG (1<<2)
  879. #define AC97C_SYNC (1<<1)
  880. #define AC97C_RESET (1<<0)
  881. #define AC97C_STATUS 0xB0000004
  882. #define AC97C_XU (1<<11)
  883. #define AC97C_XO (1<<10)
  884. #define AC97C_RU (1<<9)
  885. #define AC97C_RO (1<<8)
  886. #define AC97C_READY (1<<7)
  887. #define AC97C_CP (1<<6)
  888. #define AC97C_TR (1<<5)
  889. #define AC97C_TE (1<<4)
  890. #define AC97C_TF (1<<3)
  891. #define AC97C_RR (1<<2)
  892. #define AC97C_RE (1<<1)
  893. #define AC97C_RF (1<<0)
  894. #define AC97C_DATA 0xB0000008
  895. #define AC97C_CMD 0xB000000C
  896. #define AC97C_WD_BIT 16
  897. #define AC97C_READ (1<<7)
  898. #define AC97C_INDEX_MASK 0x7f
  899. #define AC97C_CNTRL 0xB0000010
  900. #define AC97C_RS (1<<1)
  901. #define AC97C_CE (1<<0)
  902. #define DB1000_BCSR_ADDR 0xAE000000
  903. #define DB1550_BCSR_ADDR 0xAF000000
  904. #ifdef CONFIG_DBAU1550
  905. #define DB1XX0_BCSR_ADDR DB1550_BCSR_ADDR
  906. #else
  907. #define DB1XX0_BCSR_ADDR DB1000_BCSR_ADDR
  908. #endif
  909. #ifdef CONFIG_SOC_AU1500
  910. /* Au1500 PCI Controller */
  911. #define Au1500_CFG_BASE 0xB4005000 /* virtual, kseg0 addr */
  912. #define Au1500_PCI_CMEM (Au1500_CFG_BASE + 0)
  913. #define Au1500_PCI_CFG (Au1500_CFG_BASE + 4)
  914. #define PCI_ERROR ((1<<22) | (1<<23) | (1<<24) | (1<<25) | (1<<26) | (1<<27))
  915. #define Au1500_PCI_B2BMASK_CCH (Au1500_CFG_BASE + 8)
  916. #define Au1500_PCI_B2B0_VID (Au1500_CFG_BASE + 0xC)
  917. #define Au1500_PCI_B2B1_ID (Au1500_CFG_BASE + 0x10)
  918. #define Au1500_PCI_MWMASK_DEV (Au1500_CFG_BASE + 0x14)
  919. #define Au1500_PCI_MWBASE_REV_CCL (Au1500_CFG_BASE + 0x18)
  920. #define Au1500_PCI_ERR_ADDR (Au1500_CFG_BASE + 0x1C)
  921. #define Au1500_PCI_SPEC_INTACK (Au1500_CFG_BASE + 0x20)
  922. #define Au1500_PCI_ID (Au1500_CFG_BASE + 0x100)
  923. #define Au1500_PCI_STATCMD (Au1500_CFG_BASE + 0x104)
  924. #define Au1500_PCI_CLASSREV (Au1500_CFG_BASE + 0x108)
  925. #define Au1500_PCI_HDRTYPE (Au1500_CFG_BASE + 0x10C)
  926. #define Au1500_PCI_MBAR (Au1500_CFG_BASE + 0x110)
  927. #define Au1500_PCI_HDR 0xB4005100 /* virtual, kseg0 addr */
  928. /* All of our structures, like pci resource, have 32 bit members.
  929. * Drivers are expected to do an ioremap on the PCI MEM resource, but it's
  930. * hard to store 0x4 0000 0000 in a 32 bit type. We require a small patch
  931. * to __ioremap to check for addresses between (u32)Au1500_PCI_MEM_START and
  932. * (u32)Au1500_PCI_MEM_END and change those to the full 36 bit PCI MEM
  933. * addresses. For PCI IO, it's simpler because we get to do the ioremap
  934. * ourselves and then adjust the device's resources.
  935. */
  936. #define Au1500_EXT_CFG 0x600000000
  937. #define Au1500_EXT_CFG_TYPE1 0x680000000
  938. #define Au1500_PCI_IO_START 0x500000000
  939. #define Au1500_PCI_IO_END 0x5000FFFFF
  940. #define Au1500_PCI_MEM_START 0x440000000
  941. #define Au1500_PCI_MEM_END 0x443FFFFFF
  942. #define PCI_IO_START (Au1500_PCI_IO_START + 0x300)
  943. #define PCI_IO_END (Au1500_PCI_IO_END)
  944. #define PCI_MEM_START (Au1500_PCI_MEM_START)
  945. #define PCI_MEM_END (Au1500_PCI_MEM_END)
  946. #define PCI_FIRST_DEVFN (0<<3)
  947. #define PCI_LAST_DEVFN (19<<3)
  948. #endif
  949. #if defined(CONFIG_SOC_AU1100) || (defined(CONFIG_SOC_AU1000) && !defined(CONFIG_MIPS_PB1000))
  950. /* no PCI bus controller */
  951. #define PCI_IO_START 0
  952. #define PCI_IO_END 0
  953. #define PCI_MEM_START 0
  954. #define PCI_MEM_END 0
  955. #define PCI_FIRST_DEVFN 0
  956. #define PCI_LAST_DEVFN 0
  957. #endif
  958. #define AU1X_SOCK0_IO 0xF00000000
  959. #define AU1X_SOCK0_PHYS_ATTR 0xF40000000
  960. #define AU1X_SOCK0_PHYS_MEM 0xF80000000
  961. /* pcmcia socket 1 needs external glue logic so the memory map
  962. * differs from board to board.
  963. */
  964. /* Only for db board, not older pb */
  965. #define AU1X_SOCK1_IO 0xF04000000
  966. #define AU1X_SOCK1_PHYS_ATTR 0xF44000000
  967. #define AU1X_SOCK1_PHYS_MEM 0xF84000000
  968. #endif