au1x00.h 38 KB

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