au1x00.h 40 KB

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