au1000.h 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630
  1. /*
  2. *
  3. * BRIEF MODULE DESCRIPTION
  4. * Include file for Alchemy Semiconductor's Au1k CPU.
  5. *
  6. * Copyright 2000-2001, 2006-2008 MontaVista Software Inc.
  7. * Author: MontaVista Software, Inc. <source@mvista.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. *
  14. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  15. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  16. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  17. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  18. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  19. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  20. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  21. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. *
  25. * You should have received a copy of the GNU General Public License along
  26. * with this program; if not, write to the Free Software Foundation, Inc.,
  27. * 675 Mass Ave, Cambridge, MA 02139, USA.
  28. */
  29. /*
  30. * some definitions add by takuzo@sm.sony.co.jp and sato@sm.sony.co.jp
  31. */
  32. #ifndef _AU1000_H_
  33. #define _AU1000_H_
  34. #ifndef _LANGUAGE_ASSEMBLY
  35. #include <linux/delay.h>
  36. #include <linux/types.h>
  37. #include <linux/io.h>
  38. #include <linux/irq.h>
  39. /* cpu pipeline flush */
  40. void static inline au_sync(void)
  41. {
  42. __asm__ volatile ("sync");
  43. }
  44. void static inline au_sync_udelay(int us)
  45. {
  46. __asm__ volatile ("sync");
  47. udelay(us);
  48. }
  49. void static inline au_sync_delay(int ms)
  50. {
  51. __asm__ volatile ("sync");
  52. mdelay(ms);
  53. }
  54. void static inline au_writeb(u8 val, unsigned long reg)
  55. {
  56. *(volatile u8 *)reg = val;
  57. }
  58. void static inline au_writew(u16 val, unsigned long reg)
  59. {
  60. *(volatile u16 *)reg = val;
  61. }
  62. void static inline au_writel(u32 val, unsigned long reg)
  63. {
  64. *(volatile u32 *)reg = val;
  65. }
  66. static inline u8 au_readb(unsigned long reg)
  67. {
  68. return *(volatile u8 *)reg;
  69. }
  70. static inline u16 au_readw(unsigned long reg)
  71. {
  72. return *(volatile u16 *)reg;
  73. }
  74. static inline u32 au_readl(unsigned long reg)
  75. {
  76. return *(volatile u32 *)reg;
  77. }
  78. /* Early Au1000 have a write-only SYS_CPUPLL register. */
  79. static inline int au1xxx_cpu_has_pll_wo(void)
  80. {
  81. switch (read_c0_prid()) {
  82. case 0x00030100: /* Au1000 DA */
  83. case 0x00030201: /* Au1000 HA */
  84. case 0x00030202: /* Au1000 HB */
  85. return 1;
  86. }
  87. return 0;
  88. }
  89. /* does CPU need CONFIG[OD] set to fix tons of errata? */
  90. static inline int au1xxx_cpu_needs_config_od(void)
  91. {
  92. /*
  93. * c0_config.od (bit 19) was write only (and read as 0) on the
  94. * early revisions of Alchemy SOCs. It disables the bus trans-
  95. * action overlapping and needs to be set to fix various errata.
  96. */
  97. switch (read_c0_prid()) {
  98. case 0x00030100: /* Au1000 DA */
  99. case 0x00030201: /* Au1000 HA */
  100. case 0x00030202: /* Au1000 HB */
  101. case 0x01030200: /* Au1500 AB */
  102. /*
  103. * Au1100/Au1200 errata actually keep silence about this bit,
  104. * so we set it just in case for those revisions that require
  105. * it to be set according to the (now gone) cpu_table.
  106. */
  107. case 0x02030200: /* Au1100 AB */
  108. case 0x02030201: /* Au1100 BA */
  109. case 0x02030202: /* Au1100 BC */
  110. case 0x04030201: /* Au1200 AC */
  111. return 1;
  112. }
  113. return 0;
  114. }
  115. #define ALCHEMY_CPU_UNKNOWN -1
  116. #define ALCHEMY_CPU_AU1000 0
  117. #define ALCHEMY_CPU_AU1500 1
  118. #define ALCHEMY_CPU_AU1100 2
  119. #define ALCHEMY_CPU_AU1550 3
  120. #define ALCHEMY_CPU_AU1200 4
  121. static inline int alchemy_get_cputype(void)
  122. {
  123. switch (read_c0_prid() & 0xffff0000) {
  124. case 0x00030000:
  125. return ALCHEMY_CPU_AU1000;
  126. break;
  127. case 0x01030000:
  128. return ALCHEMY_CPU_AU1500;
  129. break;
  130. case 0x02030000:
  131. return ALCHEMY_CPU_AU1100;
  132. break;
  133. case 0x03030000:
  134. return ALCHEMY_CPU_AU1550;
  135. break;
  136. case 0x04030000:
  137. case 0x05030000:
  138. return ALCHEMY_CPU_AU1200;
  139. break;
  140. }
  141. return ALCHEMY_CPU_UNKNOWN;
  142. }
  143. /* return number of uarts on a given cputype */
  144. static inline int alchemy_get_uarts(int type)
  145. {
  146. switch (type) {
  147. case ALCHEMY_CPU_AU1000:
  148. return 4;
  149. case ALCHEMY_CPU_AU1500:
  150. case ALCHEMY_CPU_AU1200:
  151. return 2;
  152. case ALCHEMY_CPU_AU1100:
  153. case ALCHEMY_CPU_AU1550:
  154. return 3;
  155. }
  156. return 0;
  157. }
  158. /* enable an UART block if it isn't already */
  159. static inline void alchemy_uart_enable(u32 uart_phys)
  160. {
  161. void __iomem *addr = (void __iomem *)KSEG1ADDR(uart_phys);
  162. /* reset, enable clock, deassert reset */
  163. if ((__raw_readl(addr + 0x100) & 3) != 3) {
  164. __raw_writel(0, addr + 0x100);
  165. wmb();
  166. __raw_writel(1, addr + 0x100);
  167. wmb();
  168. }
  169. __raw_writel(3, addr + 0x100);
  170. wmb();
  171. }
  172. static inline void alchemy_uart_disable(u32 uart_phys)
  173. {
  174. void __iomem *addr = (void __iomem *)KSEG1ADDR(uart_phys);
  175. __raw_writel(0, addr + 0x100); /* UART_MOD_CNTRL */
  176. wmb();
  177. }
  178. static inline void alchemy_uart_putchar(u32 uart_phys, u8 c)
  179. {
  180. void __iomem *base = (void __iomem *)KSEG1ADDR(uart_phys);
  181. int timeout, i;
  182. /* check LSR TX_EMPTY bit */
  183. timeout = 0xffffff;
  184. do {
  185. if (__raw_readl(base + 0x1c) & 0x20)
  186. break;
  187. /* slow down */
  188. for (i = 10000; i; i--)
  189. asm volatile ("nop");
  190. } while (--timeout);
  191. __raw_writel(c, base + 0x04); /* tx */
  192. wmb();
  193. }
  194. /* arch/mips/au1000/common/clocks.c */
  195. extern void set_au1x00_speed(unsigned int new_freq);
  196. extern unsigned int get_au1x00_speed(void);
  197. extern void set_au1x00_uart_baud_base(unsigned long new_baud_base);
  198. extern unsigned long get_au1x00_uart_baud_base(void);
  199. extern unsigned long au1xxx_calc_clock(void);
  200. /* PM: arch/mips/alchemy/common/sleeper.S, power.c, irq.c */
  201. void alchemy_sleep_au1000(void);
  202. void alchemy_sleep_au1550(void);
  203. void au_sleep(void);
  204. /* SOC Interrupt numbers */
  205. #define AU1000_INTC0_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
  206. #define AU1000_INTC0_INT_LAST (AU1000_INTC0_INT_BASE + 31)
  207. #define AU1000_INTC1_INT_BASE (AU1000_INTC0_INT_LAST + 1)
  208. #define AU1000_INTC1_INT_LAST (AU1000_INTC1_INT_BASE + 31)
  209. #define AU1000_MAX_INTR AU1000_INTC1_INT_LAST
  210. enum soc_au1000_ints {
  211. AU1000_FIRST_INT = AU1000_INTC0_INT_BASE,
  212. AU1000_UART0_INT = AU1000_FIRST_INT,
  213. AU1000_UART1_INT,
  214. AU1000_UART2_INT,
  215. AU1000_UART3_INT,
  216. AU1000_SSI0_INT,
  217. AU1000_SSI1_INT,
  218. AU1000_DMA_INT_BASE,
  219. AU1000_TOY_INT = AU1000_FIRST_INT + 14,
  220. AU1000_TOY_MATCH0_INT,
  221. AU1000_TOY_MATCH1_INT,
  222. AU1000_TOY_MATCH2_INT,
  223. AU1000_RTC_INT,
  224. AU1000_RTC_MATCH0_INT,
  225. AU1000_RTC_MATCH1_INT,
  226. AU1000_RTC_MATCH2_INT,
  227. AU1000_IRDA_TX_INT,
  228. AU1000_IRDA_RX_INT,
  229. AU1000_USB_DEV_REQ_INT,
  230. AU1000_USB_DEV_SUS_INT,
  231. AU1000_USB_HOST_INT,
  232. AU1000_ACSYNC_INT,
  233. AU1000_MAC0_DMA_INT,
  234. AU1000_MAC1_DMA_INT,
  235. AU1000_I2S_UO_INT,
  236. AU1000_AC97C_INT,
  237. AU1000_GPIO0_INT,
  238. AU1000_GPIO1_INT,
  239. AU1000_GPIO2_INT,
  240. AU1000_GPIO3_INT,
  241. AU1000_GPIO4_INT,
  242. AU1000_GPIO5_INT,
  243. AU1000_GPIO6_INT,
  244. AU1000_GPIO7_INT,
  245. AU1000_GPIO8_INT,
  246. AU1000_GPIO9_INT,
  247. AU1000_GPIO10_INT,
  248. AU1000_GPIO11_INT,
  249. AU1000_GPIO12_INT,
  250. AU1000_GPIO13_INT,
  251. AU1000_GPIO14_INT,
  252. AU1000_GPIO15_INT,
  253. AU1000_GPIO16_INT,
  254. AU1000_GPIO17_INT,
  255. AU1000_GPIO18_INT,
  256. AU1000_GPIO19_INT,
  257. AU1000_GPIO20_INT,
  258. AU1000_GPIO21_INT,
  259. AU1000_GPIO22_INT,
  260. AU1000_GPIO23_INT,
  261. AU1000_GPIO24_INT,
  262. AU1000_GPIO25_INT,
  263. AU1000_GPIO26_INT,
  264. AU1000_GPIO27_INT,
  265. AU1000_GPIO28_INT,
  266. AU1000_GPIO29_INT,
  267. AU1000_GPIO30_INT,
  268. AU1000_GPIO31_INT,
  269. };
  270. enum soc_au1100_ints {
  271. AU1100_FIRST_INT = AU1000_INTC0_INT_BASE,
  272. AU1100_UART0_INT = AU1100_FIRST_INT,
  273. AU1100_UART1_INT,
  274. AU1100_SD_INT,
  275. AU1100_UART3_INT,
  276. AU1100_SSI0_INT,
  277. AU1100_SSI1_INT,
  278. AU1100_DMA_INT_BASE,
  279. AU1100_TOY_INT = AU1100_FIRST_INT + 14,
  280. AU1100_TOY_MATCH0_INT,
  281. AU1100_TOY_MATCH1_INT,
  282. AU1100_TOY_MATCH2_INT,
  283. AU1100_RTC_INT,
  284. AU1100_RTC_MATCH0_INT,
  285. AU1100_RTC_MATCH1_INT,
  286. AU1100_RTC_MATCH2_INT,
  287. AU1100_IRDA_TX_INT,
  288. AU1100_IRDA_RX_INT,
  289. AU1100_USB_DEV_REQ_INT,
  290. AU1100_USB_DEV_SUS_INT,
  291. AU1100_USB_HOST_INT,
  292. AU1100_ACSYNC_INT,
  293. AU1100_MAC0_DMA_INT,
  294. AU1100_GPIO208_215_INT,
  295. AU1100_LCD_INT,
  296. AU1100_AC97C_INT,
  297. AU1100_GPIO0_INT,
  298. AU1100_GPIO1_INT,
  299. AU1100_GPIO2_INT,
  300. AU1100_GPIO3_INT,
  301. AU1100_GPIO4_INT,
  302. AU1100_GPIO5_INT,
  303. AU1100_GPIO6_INT,
  304. AU1100_GPIO7_INT,
  305. AU1100_GPIO8_INT,
  306. AU1100_GPIO9_INT,
  307. AU1100_GPIO10_INT,
  308. AU1100_GPIO11_INT,
  309. AU1100_GPIO12_INT,
  310. AU1100_GPIO13_INT,
  311. AU1100_GPIO14_INT,
  312. AU1100_GPIO15_INT,
  313. AU1100_GPIO16_INT,
  314. AU1100_GPIO17_INT,
  315. AU1100_GPIO18_INT,
  316. AU1100_GPIO19_INT,
  317. AU1100_GPIO20_INT,
  318. AU1100_GPIO21_INT,
  319. AU1100_GPIO22_INT,
  320. AU1100_GPIO23_INT,
  321. AU1100_GPIO24_INT,
  322. AU1100_GPIO25_INT,
  323. AU1100_GPIO26_INT,
  324. AU1100_GPIO27_INT,
  325. AU1100_GPIO28_INT,
  326. AU1100_GPIO29_INT,
  327. AU1100_GPIO30_INT,
  328. AU1100_GPIO31_INT,
  329. };
  330. enum soc_au1500_ints {
  331. AU1500_FIRST_INT = AU1000_INTC0_INT_BASE,
  332. AU1500_UART0_INT = AU1500_FIRST_INT,
  333. AU1500_PCI_INTA,
  334. AU1500_PCI_INTB,
  335. AU1500_UART3_INT,
  336. AU1500_PCI_INTC,
  337. AU1500_PCI_INTD,
  338. AU1500_DMA_INT_BASE,
  339. AU1500_TOY_INT = AU1500_FIRST_INT + 14,
  340. AU1500_TOY_MATCH0_INT,
  341. AU1500_TOY_MATCH1_INT,
  342. AU1500_TOY_MATCH2_INT,
  343. AU1500_RTC_INT,
  344. AU1500_RTC_MATCH0_INT,
  345. AU1500_RTC_MATCH1_INT,
  346. AU1500_RTC_MATCH2_INT,
  347. AU1500_PCI_ERR_INT,
  348. AU1500_RESERVED_INT,
  349. AU1500_USB_DEV_REQ_INT,
  350. AU1500_USB_DEV_SUS_INT,
  351. AU1500_USB_HOST_INT,
  352. AU1500_ACSYNC_INT,
  353. AU1500_MAC0_DMA_INT,
  354. AU1500_MAC1_DMA_INT,
  355. AU1500_AC97C_INT = AU1500_FIRST_INT + 31,
  356. AU1500_GPIO0_INT,
  357. AU1500_GPIO1_INT,
  358. AU1500_GPIO2_INT,
  359. AU1500_GPIO3_INT,
  360. AU1500_GPIO4_INT,
  361. AU1500_GPIO5_INT,
  362. AU1500_GPIO6_INT,
  363. AU1500_GPIO7_INT,
  364. AU1500_GPIO8_INT,
  365. AU1500_GPIO9_INT,
  366. AU1500_GPIO10_INT,
  367. AU1500_GPIO11_INT,
  368. AU1500_GPIO12_INT,
  369. AU1500_GPIO13_INT,
  370. AU1500_GPIO14_INT,
  371. AU1500_GPIO15_INT,
  372. AU1500_GPIO200_INT,
  373. AU1500_GPIO201_INT,
  374. AU1500_GPIO202_INT,
  375. AU1500_GPIO203_INT,
  376. AU1500_GPIO20_INT,
  377. AU1500_GPIO204_INT,
  378. AU1500_GPIO205_INT,
  379. AU1500_GPIO23_INT,
  380. AU1500_GPIO24_INT,
  381. AU1500_GPIO25_INT,
  382. AU1500_GPIO26_INT,
  383. AU1500_GPIO27_INT,
  384. AU1500_GPIO28_INT,
  385. AU1500_GPIO206_INT,
  386. AU1500_GPIO207_INT,
  387. AU1500_GPIO208_215_INT,
  388. };
  389. enum soc_au1550_ints {
  390. AU1550_FIRST_INT = AU1000_INTC0_INT_BASE,
  391. AU1550_UART0_INT = AU1550_FIRST_INT,
  392. AU1550_PCI_INTA,
  393. AU1550_PCI_INTB,
  394. AU1550_DDMA_INT,
  395. AU1550_CRYPTO_INT,
  396. AU1550_PCI_INTC,
  397. AU1550_PCI_INTD,
  398. AU1550_PCI_RST_INT,
  399. AU1550_UART1_INT,
  400. AU1550_UART3_INT,
  401. AU1550_PSC0_INT,
  402. AU1550_PSC1_INT,
  403. AU1550_PSC2_INT,
  404. AU1550_PSC3_INT,
  405. AU1550_TOY_INT,
  406. AU1550_TOY_MATCH0_INT,
  407. AU1550_TOY_MATCH1_INT,
  408. AU1550_TOY_MATCH2_INT,
  409. AU1550_RTC_INT,
  410. AU1550_RTC_MATCH0_INT,
  411. AU1550_RTC_MATCH1_INT,
  412. AU1550_RTC_MATCH2_INT,
  413. AU1550_NAND_INT = AU1550_FIRST_INT + 23,
  414. AU1550_USB_DEV_REQ_INT,
  415. AU1550_USB_DEV_SUS_INT,
  416. AU1550_USB_HOST_INT,
  417. AU1550_MAC0_DMA_INT,
  418. AU1550_MAC1_DMA_INT,
  419. AU1550_GPIO0_INT = AU1550_FIRST_INT + 32,
  420. AU1550_GPIO1_INT,
  421. AU1550_GPIO2_INT,
  422. AU1550_GPIO3_INT,
  423. AU1550_GPIO4_INT,
  424. AU1550_GPIO5_INT,
  425. AU1550_GPIO6_INT,
  426. AU1550_GPIO7_INT,
  427. AU1550_GPIO8_INT,
  428. AU1550_GPIO9_INT,
  429. AU1550_GPIO10_INT,
  430. AU1550_GPIO11_INT,
  431. AU1550_GPIO12_INT,
  432. AU1550_GPIO13_INT,
  433. AU1550_GPIO14_INT,
  434. AU1550_GPIO15_INT,
  435. AU1550_GPIO200_INT,
  436. AU1550_GPIO201_205_INT, /* Logical or of GPIO201:205 */
  437. AU1550_GPIO16_INT,
  438. AU1550_GPIO17_INT,
  439. AU1550_GPIO20_INT,
  440. AU1550_GPIO21_INT,
  441. AU1550_GPIO22_INT,
  442. AU1550_GPIO23_INT,
  443. AU1550_GPIO24_INT,
  444. AU1550_GPIO25_INT,
  445. AU1550_GPIO26_INT,
  446. AU1550_GPIO27_INT,
  447. AU1550_GPIO28_INT,
  448. AU1550_GPIO206_INT,
  449. AU1550_GPIO207_INT,
  450. AU1550_GPIO208_215_INT, /* Logical or of GPIO208:215 */
  451. };
  452. enum soc_au1200_ints {
  453. AU1200_FIRST_INT = AU1000_INTC0_INT_BASE,
  454. AU1200_UART0_INT = AU1200_FIRST_INT,
  455. AU1200_SWT_INT,
  456. AU1200_SD_INT,
  457. AU1200_DDMA_INT,
  458. AU1200_MAE_BE_INT,
  459. AU1200_GPIO200_INT,
  460. AU1200_GPIO201_INT,
  461. AU1200_GPIO202_INT,
  462. AU1200_UART1_INT,
  463. AU1200_MAE_FE_INT,
  464. AU1200_PSC0_INT,
  465. AU1200_PSC1_INT,
  466. AU1200_AES_INT,
  467. AU1200_CAMERA_INT,
  468. AU1200_TOY_INT,
  469. AU1200_TOY_MATCH0_INT,
  470. AU1200_TOY_MATCH1_INT,
  471. AU1200_TOY_MATCH2_INT,
  472. AU1200_RTC_INT,
  473. AU1200_RTC_MATCH0_INT,
  474. AU1200_RTC_MATCH1_INT,
  475. AU1200_RTC_MATCH2_INT,
  476. AU1200_GPIO203_INT,
  477. AU1200_NAND_INT,
  478. AU1200_GPIO204_INT,
  479. AU1200_GPIO205_INT,
  480. AU1200_GPIO206_INT,
  481. AU1200_GPIO207_INT,
  482. AU1200_GPIO208_215_INT, /* Logical OR of 208:215 */
  483. AU1200_USB_INT,
  484. AU1200_LCD_INT,
  485. AU1200_MAE_BOTH_INT,
  486. AU1200_GPIO0_INT,
  487. AU1200_GPIO1_INT,
  488. AU1200_GPIO2_INT,
  489. AU1200_GPIO3_INT,
  490. AU1200_GPIO4_INT,
  491. AU1200_GPIO5_INT,
  492. AU1200_GPIO6_INT,
  493. AU1200_GPIO7_INT,
  494. AU1200_GPIO8_INT,
  495. AU1200_GPIO9_INT,
  496. AU1200_GPIO10_INT,
  497. AU1200_GPIO11_INT,
  498. AU1200_GPIO12_INT,
  499. AU1200_GPIO13_INT,
  500. AU1200_GPIO14_INT,
  501. AU1200_GPIO15_INT,
  502. AU1200_GPIO16_INT,
  503. AU1200_GPIO17_INT,
  504. AU1200_GPIO18_INT,
  505. AU1200_GPIO19_INT,
  506. AU1200_GPIO20_INT,
  507. AU1200_GPIO21_INT,
  508. AU1200_GPIO22_INT,
  509. AU1200_GPIO23_INT,
  510. AU1200_GPIO24_INT,
  511. AU1200_GPIO25_INT,
  512. AU1200_GPIO26_INT,
  513. AU1200_GPIO27_INT,
  514. AU1200_GPIO28_INT,
  515. AU1200_GPIO29_INT,
  516. AU1200_GPIO30_INT,
  517. AU1200_GPIO31_INT,
  518. };
  519. #endif /* !defined (_LANGUAGE_ASSEMBLY) */
  520. /*
  521. * SDRAM register offsets
  522. */
  523. #if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || \
  524. defined(CONFIG_SOC_AU1100)
  525. #define MEM_SDMODE0 0x0000
  526. #define MEM_SDMODE1 0x0004
  527. #define MEM_SDMODE2 0x0008
  528. #define MEM_SDADDR0 0x000C
  529. #define MEM_SDADDR1 0x0010
  530. #define MEM_SDADDR2 0x0014
  531. #define MEM_SDREFCFG 0x0018
  532. #define MEM_SDPRECMD 0x001C
  533. #define MEM_SDAUTOREF 0x0020
  534. #define MEM_SDWRMD0 0x0024
  535. #define MEM_SDWRMD1 0x0028
  536. #define MEM_SDWRMD2 0x002C
  537. #define MEM_SDSLEEP 0x0030
  538. #define MEM_SDSMCKE 0x0034
  539. /*
  540. * MEM_SDMODE register content definitions
  541. */
  542. #define MEM_SDMODE_F (1 << 22)
  543. #define MEM_SDMODE_SR (1 << 21)
  544. #define MEM_SDMODE_BS (1 << 20)
  545. #define MEM_SDMODE_RS (3 << 18)
  546. #define MEM_SDMODE_CS (7 << 15)
  547. #define MEM_SDMODE_TRAS (15 << 11)
  548. #define MEM_SDMODE_TMRD (3 << 9)
  549. #define MEM_SDMODE_TWR (3 << 7)
  550. #define MEM_SDMODE_TRP (3 << 5)
  551. #define MEM_SDMODE_TRCD (3 << 3)
  552. #define MEM_SDMODE_TCL (7 << 0)
  553. #define MEM_SDMODE_BS_2Bank (0 << 20)
  554. #define MEM_SDMODE_BS_4Bank (1 << 20)
  555. #define MEM_SDMODE_RS_11Row (0 << 18)
  556. #define MEM_SDMODE_RS_12Row (1 << 18)
  557. #define MEM_SDMODE_RS_13Row (2 << 18)
  558. #define MEM_SDMODE_RS_N(N) ((N) << 18)
  559. #define MEM_SDMODE_CS_7Col (0 << 15)
  560. #define MEM_SDMODE_CS_8Col (1 << 15)
  561. #define MEM_SDMODE_CS_9Col (2 << 15)
  562. #define MEM_SDMODE_CS_10Col (3 << 15)
  563. #define MEM_SDMODE_CS_11Col (4 << 15)
  564. #define MEM_SDMODE_CS_N(N) ((N) << 15)
  565. #define MEM_SDMODE_TRAS_N(N) ((N) << 11)
  566. #define MEM_SDMODE_TMRD_N(N) ((N) << 9)
  567. #define MEM_SDMODE_TWR_N(N) ((N) << 7)
  568. #define MEM_SDMODE_TRP_N(N) ((N) << 5)
  569. #define MEM_SDMODE_TRCD_N(N) ((N) << 3)
  570. #define MEM_SDMODE_TCL_N(N) ((N) << 0)
  571. /*
  572. * MEM_SDADDR register contents definitions
  573. */
  574. #define MEM_SDADDR_E (1 << 20)
  575. #define MEM_SDADDR_CSBA (0x03FF << 10)
  576. #define MEM_SDADDR_CSMASK (0x03FF << 0)
  577. #define MEM_SDADDR_CSBA_N(N) ((N) & (0x03FF << 22) >> 12)
  578. #define MEM_SDADDR_CSMASK_N(N) ((N)&(0x03FF << 22) >> 22)
  579. /*
  580. * MEM_SDREFCFG register content definitions
  581. */
  582. #define MEM_SDREFCFG_TRC (15 << 28)
  583. #define MEM_SDREFCFG_TRPM (3 << 26)
  584. #define MEM_SDREFCFG_E (1 << 25)
  585. #define MEM_SDREFCFG_RE (0x1ffffff << 0)
  586. #define MEM_SDREFCFG_TRC_N(N) ((N) << MEM_SDREFCFG_TRC)
  587. #define MEM_SDREFCFG_TRPM_N(N) ((N) << MEM_SDREFCFG_TRPM)
  588. #define MEM_SDREFCFG_REF_N(N) (N)
  589. #endif
  590. /***********************************************************************/
  591. /*
  592. * Au1550 SDRAM Register Offsets
  593. */
  594. /***********************************************************************/
  595. #if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
  596. #define MEM_SDMODE0 0x0800
  597. #define MEM_SDMODE1 0x0808
  598. #define MEM_SDMODE2 0x0810
  599. #define MEM_SDADDR0 0x0820
  600. #define MEM_SDADDR1 0x0828
  601. #define MEM_SDADDR2 0x0830
  602. #define MEM_SDCONFIGA 0x0840
  603. #define MEM_SDCONFIGB 0x0848
  604. #define MEM_SDSTAT 0x0850
  605. #define MEM_SDERRADDR 0x0858
  606. #define MEM_SDSTRIDE0 0x0860
  607. #define MEM_SDSTRIDE1 0x0868
  608. #define MEM_SDSTRIDE2 0x0870
  609. #define MEM_SDWRMD0 0x0880
  610. #define MEM_SDWRMD1 0x0888
  611. #define MEM_SDWRMD2 0x0890
  612. #define MEM_SDPRECMD 0x08C0
  613. #define MEM_SDAUTOREF 0x08C8
  614. #define MEM_SDSREF 0x08D0
  615. #define MEM_SDSLEEP MEM_SDSREF
  616. #endif
  617. /*
  618. * Physical base addresses for integrated peripherals
  619. * 0..au1000 1..au1500 2..au1100 3..au1550 4..au1200
  620. */
  621. #define AU1000_IC0_PHYS_ADDR 0x10400000 /* 01234 */
  622. #define AU1000_UART0_PHYS_ADDR 0x11100000 /* 01234 */
  623. #define AU1000_UART1_PHYS_ADDR 0x11200000 /* 0234 */
  624. #define AU1000_UART2_PHYS_ADDR 0x11300000 /* 0 */
  625. #define AU1000_UART3_PHYS_ADDR 0x11400000 /* 0123 */
  626. #define AU1000_IC1_PHYS_ADDR 0x11800000 /* 01234 */
  627. #define AU1550_DBDMA_PHYS_ADDR 0x14002000 /* 34 */
  628. #define AU1550_DBDMA_CONF_PHYS_ADDR 0x14003000 /* 34 */
  629. #ifdef CONFIG_SOC_AU1000
  630. #define MEM_PHYS_ADDR 0x14000000
  631. #define STATIC_MEM_PHYS_ADDR 0x14001000
  632. #define DMA0_PHYS_ADDR 0x14002000
  633. #define DMA1_PHYS_ADDR 0x14002100
  634. #define DMA2_PHYS_ADDR 0x14002200
  635. #define DMA3_PHYS_ADDR 0x14002300
  636. #define DMA4_PHYS_ADDR 0x14002400
  637. #define DMA5_PHYS_ADDR 0x14002500
  638. #define DMA6_PHYS_ADDR 0x14002600
  639. #define DMA7_PHYS_ADDR 0x14002700
  640. #define AC97_PHYS_ADDR 0x10000000
  641. #define USBH_PHYS_ADDR 0x10100000
  642. #define USBD_PHYS_ADDR 0x10200000
  643. #define IRDA_PHYS_ADDR 0x10300000
  644. #define MAC0_PHYS_ADDR 0x10500000
  645. #define MAC1_PHYS_ADDR 0x10510000
  646. #define MACEN_PHYS_ADDR 0x10520000
  647. #define MACDMA0_PHYS_ADDR 0x14004000
  648. #define MACDMA1_PHYS_ADDR 0x14004200
  649. #define I2S_PHYS_ADDR 0x11000000
  650. #define SSI0_PHYS_ADDR 0x11600000
  651. #define SSI1_PHYS_ADDR 0x11680000
  652. #define SYS_PHYS_ADDR 0x11900000
  653. #define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
  654. #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
  655. #define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
  656. #endif
  657. /********************************************************************/
  658. #ifdef CONFIG_SOC_AU1500
  659. #define MEM_PHYS_ADDR 0x14000000
  660. #define STATIC_MEM_PHYS_ADDR 0x14001000
  661. #define DMA0_PHYS_ADDR 0x14002000
  662. #define DMA1_PHYS_ADDR 0x14002100
  663. #define DMA2_PHYS_ADDR 0x14002200
  664. #define DMA3_PHYS_ADDR 0x14002300
  665. #define DMA4_PHYS_ADDR 0x14002400
  666. #define DMA5_PHYS_ADDR 0x14002500
  667. #define DMA6_PHYS_ADDR 0x14002600
  668. #define DMA7_PHYS_ADDR 0x14002700
  669. #define AC97_PHYS_ADDR 0x10000000
  670. #define USBH_PHYS_ADDR 0x10100000
  671. #define USBD_PHYS_ADDR 0x10200000
  672. #define PCI_PHYS_ADDR 0x14005000
  673. #define MAC0_PHYS_ADDR 0x11500000
  674. #define MAC1_PHYS_ADDR 0x11510000
  675. #define MACEN_PHYS_ADDR 0x11520000
  676. #define MACDMA0_PHYS_ADDR 0x14004000
  677. #define MACDMA1_PHYS_ADDR 0x14004200
  678. #define I2S_PHYS_ADDR 0x11000000
  679. #define GPIO2_PHYS_ADDR 0x11700000
  680. #define SYS_PHYS_ADDR 0x11900000
  681. #define PCI_MEM_PHYS_ADDR 0x400000000ULL
  682. #define PCI_IO_PHYS_ADDR 0x500000000ULL
  683. #define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
  684. #define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
  685. #define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
  686. #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
  687. #define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
  688. #endif
  689. /********************************************************************/
  690. #ifdef CONFIG_SOC_AU1100
  691. #define MEM_PHYS_ADDR 0x14000000
  692. #define STATIC_MEM_PHYS_ADDR 0x14001000
  693. #define DMA0_PHYS_ADDR 0x14002000
  694. #define DMA1_PHYS_ADDR 0x14002100
  695. #define DMA2_PHYS_ADDR 0x14002200
  696. #define DMA3_PHYS_ADDR 0x14002300
  697. #define DMA4_PHYS_ADDR 0x14002400
  698. #define DMA5_PHYS_ADDR 0x14002500
  699. #define DMA6_PHYS_ADDR 0x14002600
  700. #define DMA7_PHYS_ADDR 0x14002700
  701. #define SD0_PHYS_ADDR 0x10600000
  702. #define SD1_PHYS_ADDR 0x10680000
  703. #define AC97_PHYS_ADDR 0x10000000
  704. #define USBH_PHYS_ADDR 0x10100000
  705. #define USBD_PHYS_ADDR 0x10200000
  706. #define IRDA_PHYS_ADDR 0x10300000
  707. #define MAC0_PHYS_ADDR 0x10500000
  708. #define MACEN_PHYS_ADDR 0x10520000
  709. #define MACDMA0_PHYS_ADDR 0x14004000
  710. #define MACDMA1_PHYS_ADDR 0x14004200
  711. #define I2S_PHYS_ADDR 0x11000000
  712. #define SSI0_PHYS_ADDR 0x11600000
  713. #define SSI1_PHYS_ADDR 0x11680000
  714. #define GPIO2_PHYS_ADDR 0x11700000
  715. #define SYS_PHYS_ADDR 0x11900000
  716. #define LCD_PHYS_ADDR 0x15000000
  717. #define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
  718. #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
  719. #define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
  720. #endif
  721. /***********************************************************************/
  722. #ifdef CONFIG_SOC_AU1550
  723. #define MEM_PHYS_ADDR 0x14000000
  724. #define STATIC_MEM_PHYS_ADDR 0x14001000
  725. #define USBH_PHYS_ADDR 0x14020000
  726. #define USBD_PHYS_ADDR 0x10200000
  727. #define PCI_PHYS_ADDR 0x14005000
  728. #define MAC0_PHYS_ADDR 0x10500000
  729. #define MAC1_PHYS_ADDR 0x10510000
  730. #define MACEN_PHYS_ADDR 0x10520000
  731. #define MACDMA0_PHYS_ADDR 0x14004000
  732. #define MACDMA1_PHYS_ADDR 0x14004200
  733. #define GPIO2_PHYS_ADDR 0x11700000
  734. #define SYS_PHYS_ADDR 0x11900000
  735. #define PE_PHYS_ADDR 0x14008000
  736. #define PSC0_PHYS_ADDR 0x11A00000
  737. #define PSC1_PHYS_ADDR 0x11B00000
  738. #define PSC2_PHYS_ADDR 0x10A00000
  739. #define PSC3_PHYS_ADDR 0x10B00000
  740. #define PCI_MEM_PHYS_ADDR 0x400000000ULL
  741. #define PCI_IO_PHYS_ADDR 0x500000000ULL
  742. #define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
  743. #define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
  744. #define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
  745. #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
  746. #define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
  747. #endif
  748. /***********************************************************************/
  749. #ifdef CONFIG_SOC_AU1200
  750. #define MEM_PHYS_ADDR 0x14000000
  751. #define STATIC_MEM_PHYS_ADDR 0x14001000
  752. #define AES_PHYS_ADDR 0x10300000
  753. #define CIM_PHYS_ADDR 0x14004000
  754. #define USBM_PHYS_ADDR 0x14020000
  755. #define USBH_PHYS_ADDR 0x14020100
  756. #define GPIO2_PHYS_ADDR 0x11700000
  757. #define SYS_PHYS_ADDR 0x11900000
  758. #define PSC0_PHYS_ADDR 0x11A00000
  759. #define PSC1_PHYS_ADDR 0x11B00000
  760. #define SD0_PHYS_ADDR 0x10600000
  761. #define SD1_PHYS_ADDR 0x10680000
  762. #define LCD_PHYS_ADDR 0x15000000
  763. #define SWCNT_PHYS_ADDR 0x1110010C
  764. #define MAEFE_PHYS_ADDR 0x14012000
  765. #define MAEBE_PHYS_ADDR 0x14010000
  766. #define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
  767. #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
  768. #define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
  769. #endif
  770. /* Static Bus Controller */
  771. #define MEM_STCFG0 0xB4001000
  772. #define MEM_STTIME0 0xB4001004
  773. #define MEM_STADDR0 0xB4001008
  774. #define MEM_STCFG1 0xB4001010
  775. #define MEM_STTIME1 0xB4001014
  776. #define MEM_STADDR1 0xB4001018
  777. #define MEM_STCFG2 0xB4001020
  778. #define MEM_STTIME2 0xB4001024
  779. #define MEM_STADDR2 0xB4001028
  780. #define MEM_STCFG3 0xB4001030
  781. #define MEM_STTIME3 0xB4001034
  782. #define MEM_STADDR3 0xB4001038
  783. #if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
  784. #define MEM_STNDCTL 0xB4001100
  785. #define MEM_STSTAT 0xB4001104
  786. #define MEM_STNAND_CMD 0x0
  787. #define MEM_STNAND_ADDR 0x4
  788. #define MEM_STNAND_DATA 0x20
  789. #endif
  790. /* Au1000 */
  791. #ifdef CONFIG_SOC_AU1000
  792. #define UART0_ADDR 0xB1100000
  793. #define UART3_ADDR 0xB1400000
  794. #define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
  795. #define USB_HOST_CONFIG 0xB017FFFC
  796. #define FOR_PLATFORM_C_USB_HOST_INT AU1000_USB_HOST_INT
  797. #define AU1000_ETH0_BASE 0xB0500000
  798. #define AU1000_ETH1_BASE 0xB0510000
  799. #define AU1000_MAC0_ENABLE 0xB0520000
  800. #define AU1000_MAC1_ENABLE 0xB0520004
  801. #define NUM_ETH_INTERFACES 2
  802. #endif /* CONFIG_SOC_AU1000 */
  803. /* Au1500 */
  804. #ifdef CONFIG_SOC_AU1500
  805. #define UART0_ADDR 0xB1100000
  806. #define UART3_ADDR 0xB1400000
  807. #define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
  808. #define USB_HOST_CONFIG 0xB017fffc
  809. #define FOR_PLATFORM_C_USB_HOST_INT AU1500_USB_HOST_INT
  810. #define AU1500_ETH0_BASE 0xB1500000
  811. #define AU1500_ETH1_BASE 0xB1510000
  812. #define AU1500_MAC0_ENABLE 0xB1520000
  813. #define AU1500_MAC1_ENABLE 0xB1520004
  814. #define NUM_ETH_INTERFACES 2
  815. #endif /* CONFIG_SOC_AU1500 */
  816. /* Au1100 */
  817. #ifdef CONFIG_SOC_AU1100
  818. #define UART0_ADDR 0xB1100000
  819. #define UART3_ADDR 0xB1400000
  820. #define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
  821. #define USB_HOST_CONFIG 0xB017FFFC
  822. #define FOR_PLATFORM_C_USB_HOST_INT AU1100_USB_HOST_INT
  823. #define AU1100_ETH0_BASE 0xB0500000
  824. #define AU1100_MAC0_ENABLE 0xB0520000
  825. #define NUM_ETH_INTERFACES 1
  826. #endif /* CONFIG_SOC_AU1100 */
  827. #ifdef CONFIG_SOC_AU1550
  828. #define UART0_ADDR 0xB1100000
  829. #define USB_OHCI_BASE 0x14020000 /* phys addr for ioremap */
  830. #define USB_OHCI_LEN 0x00060000
  831. #define USB_HOST_CONFIG 0xB4027ffc
  832. #define FOR_PLATFORM_C_USB_HOST_INT AU1550_USB_HOST_INT
  833. #define AU1550_ETH0_BASE 0xB0500000
  834. #define AU1550_ETH1_BASE 0xB0510000
  835. #define AU1550_MAC0_ENABLE 0xB0520000
  836. #define AU1550_MAC1_ENABLE 0xB0520004
  837. #define NUM_ETH_INTERFACES 2
  838. #endif /* CONFIG_SOC_AU1550 */
  839. #ifdef CONFIG_SOC_AU1200
  840. #define UART0_ADDR 0xB1100000
  841. #define USB_UOC_BASE 0x14020020
  842. #define USB_UOC_LEN 0x20
  843. #define USB_OHCI_BASE 0x14020100
  844. #define USB_OHCI_LEN 0x100
  845. #define USB_EHCI_BASE 0x14020200
  846. #define USB_EHCI_LEN 0x100
  847. #define USB_UDC_BASE 0x14022000
  848. #define USB_UDC_LEN 0x2000
  849. #define USB_MSR_BASE 0xB4020000
  850. #define USB_MSR_MCFG 4
  851. #define USBMSRMCFG_OMEMEN 0
  852. #define USBMSRMCFG_OBMEN 1
  853. #define USBMSRMCFG_EMEMEN 2
  854. #define USBMSRMCFG_EBMEN 3
  855. #define USBMSRMCFG_DMEMEN 4
  856. #define USBMSRMCFG_DBMEN 5
  857. #define USBMSRMCFG_GMEMEN 6
  858. #define USBMSRMCFG_OHCCLKEN 16
  859. #define USBMSRMCFG_EHCCLKEN 17
  860. #define USBMSRMCFG_UDCCLKEN 18
  861. #define USBMSRMCFG_PHYPLLEN 19
  862. #define USBMSRMCFG_RDCOMB 30
  863. #define USBMSRMCFG_PFEN 31
  864. #define FOR_PLATFORM_C_USB_HOST_INT AU1200_USB_INT
  865. #endif /* CONFIG_SOC_AU1200 */
  866. /* Programmable Counters 0 and 1 */
  867. #define SYS_BASE 0xB1900000
  868. #define SYS_COUNTER_CNTRL (SYS_BASE + 0x14)
  869. # define SYS_CNTRL_E1S (1 << 23)
  870. # define SYS_CNTRL_T1S (1 << 20)
  871. # define SYS_CNTRL_M21 (1 << 19)
  872. # define SYS_CNTRL_M11 (1 << 18)
  873. # define SYS_CNTRL_M01 (1 << 17)
  874. # define SYS_CNTRL_C1S (1 << 16)
  875. # define SYS_CNTRL_BP (1 << 14)
  876. # define SYS_CNTRL_EN1 (1 << 13)
  877. # define SYS_CNTRL_BT1 (1 << 12)
  878. # define SYS_CNTRL_EN0 (1 << 11)
  879. # define SYS_CNTRL_BT0 (1 << 10)
  880. # define SYS_CNTRL_E0 (1 << 8)
  881. # define SYS_CNTRL_E0S (1 << 7)
  882. # define SYS_CNTRL_32S (1 << 5)
  883. # define SYS_CNTRL_T0S (1 << 4)
  884. # define SYS_CNTRL_M20 (1 << 3)
  885. # define SYS_CNTRL_M10 (1 << 2)
  886. # define SYS_CNTRL_M00 (1 << 1)
  887. # define SYS_CNTRL_C0S (1 << 0)
  888. /* Programmable Counter 0 Registers */
  889. #define SYS_TOYTRIM (SYS_BASE + 0)
  890. #define SYS_TOYWRITE (SYS_BASE + 4)
  891. #define SYS_TOYMATCH0 (SYS_BASE + 8)
  892. #define SYS_TOYMATCH1 (SYS_BASE + 0xC)
  893. #define SYS_TOYMATCH2 (SYS_BASE + 0x10)
  894. #define SYS_TOYREAD (SYS_BASE + 0x40)
  895. /* Programmable Counter 1 Registers */
  896. #define SYS_RTCTRIM (SYS_BASE + 0x44)
  897. #define SYS_RTCWRITE (SYS_BASE + 0x48)
  898. #define SYS_RTCMATCH0 (SYS_BASE + 0x4C)
  899. #define SYS_RTCMATCH1 (SYS_BASE + 0x50)
  900. #define SYS_RTCMATCH2 (SYS_BASE + 0x54)
  901. #define SYS_RTCREAD (SYS_BASE + 0x58)
  902. /* I2S Controller */
  903. #define I2S_DATA 0xB1000000
  904. # define I2S_DATA_MASK 0xffffff
  905. #define I2S_CONFIG 0xB1000004
  906. # define I2S_CONFIG_XU (1 << 25)
  907. # define I2S_CONFIG_XO (1 << 24)
  908. # define I2S_CONFIG_RU (1 << 23)
  909. # define I2S_CONFIG_RO (1 << 22)
  910. # define I2S_CONFIG_TR (1 << 21)
  911. # define I2S_CONFIG_TE (1 << 20)
  912. # define I2S_CONFIG_TF (1 << 19)
  913. # define I2S_CONFIG_RR (1 << 18)
  914. # define I2S_CONFIG_RE (1 << 17)
  915. # define I2S_CONFIG_RF (1 << 16)
  916. # define I2S_CONFIG_PD (1 << 11)
  917. # define I2S_CONFIG_LB (1 << 10)
  918. # define I2S_CONFIG_IC (1 << 9)
  919. # define I2S_CONFIG_FM_BIT 7
  920. # define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT)
  921. # define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT)
  922. # define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT)
  923. # define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT)
  924. # define I2S_CONFIG_TN (1 << 6)
  925. # define I2S_CONFIG_RN (1 << 5)
  926. # define I2S_CONFIG_SZ_BIT 0
  927. # define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT)
  928. #define I2S_CONTROL 0xB1000008
  929. # define I2S_CONTROL_D (1 << 1)
  930. # define I2S_CONTROL_CE (1 << 0)
  931. /* USB Host Controller */
  932. #ifndef USB_OHCI_LEN
  933. #define USB_OHCI_LEN 0x00100000
  934. #endif
  935. #ifndef CONFIG_SOC_AU1200
  936. /* USB Device Controller */
  937. #define USBD_EP0RD 0xB0200000
  938. #define USBD_EP0WR 0xB0200004
  939. #define USBD_EP2WR 0xB0200008
  940. #define USBD_EP3WR 0xB020000C
  941. #define USBD_EP4RD 0xB0200010
  942. #define USBD_EP5RD 0xB0200014
  943. #define USBD_INTEN 0xB0200018
  944. #define USBD_INTSTAT 0xB020001C
  945. # define USBDEV_INT_SOF (1 << 12)
  946. # define USBDEV_INT_HF_BIT 6
  947. # define USBDEV_INT_HF_MASK (0x3f << USBDEV_INT_HF_BIT)
  948. # define USBDEV_INT_CMPLT_BIT 0
  949. # define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT)
  950. #define USBD_CONFIG 0xB0200020
  951. #define USBD_EP0CS 0xB0200024
  952. #define USBD_EP2CS 0xB0200028
  953. #define USBD_EP3CS 0xB020002C
  954. #define USBD_EP4CS 0xB0200030
  955. #define USBD_EP5CS 0xB0200034
  956. # define USBDEV_CS_SU (1 << 14)
  957. # define USBDEV_CS_NAK (1 << 13)
  958. # define USBDEV_CS_ACK (1 << 12)
  959. # define USBDEV_CS_BUSY (1 << 11)
  960. # define USBDEV_CS_TSIZE_BIT 1
  961. # define USBDEV_CS_TSIZE_MASK (0x3ff << USBDEV_CS_TSIZE_BIT)
  962. # define USBDEV_CS_STALL (1 << 0)
  963. #define USBD_EP0RDSTAT 0xB0200040
  964. #define USBD_EP0WRSTAT 0xB0200044
  965. #define USBD_EP2WRSTAT 0xB0200048
  966. #define USBD_EP3WRSTAT 0xB020004C
  967. #define USBD_EP4RDSTAT 0xB0200050
  968. #define USBD_EP5RDSTAT 0xB0200054
  969. # define USBDEV_FSTAT_FLUSH (1 << 6)
  970. # define USBDEV_FSTAT_UF (1 << 5)
  971. # define USBDEV_FSTAT_OF (1 << 4)
  972. # define USBDEV_FSTAT_FCNT_BIT 0
  973. # define USBDEV_FSTAT_FCNT_MASK (0x0f << USBDEV_FSTAT_FCNT_BIT)
  974. #define USBD_ENABLE 0xB0200058
  975. # define USBDEV_ENABLE (1 << 1)
  976. # define USBDEV_CE (1 << 0)
  977. #endif /* !CONFIG_SOC_AU1200 */
  978. /* Ethernet Controllers */
  979. /* 4 byte offsets from AU1000_ETH_BASE */
  980. #define MAC_CONTROL 0x0
  981. # define MAC_RX_ENABLE (1 << 2)
  982. # define MAC_TX_ENABLE (1 << 3)
  983. # define MAC_DEF_CHECK (1 << 5)
  984. # define MAC_SET_BL(X) (((X) & 0x3) << 6)
  985. # define MAC_AUTO_PAD (1 << 8)
  986. # define MAC_DISABLE_RETRY (1 << 10)
  987. # define MAC_DISABLE_BCAST (1 << 11)
  988. # define MAC_LATE_COL (1 << 12)
  989. # define MAC_HASH_MODE (1 << 13)
  990. # define MAC_HASH_ONLY (1 << 15)
  991. # define MAC_PASS_ALL (1 << 16)
  992. # define MAC_INVERSE_FILTER (1 << 17)
  993. # define MAC_PROMISCUOUS (1 << 18)
  994. # define MAC_PASS_ALL_MULTI (1 << 19)
  995. # define MAC_FULL_DUPLEX (1 << 20)
  996. # define MAC_NORMAL_MODE 0
  997. # define MAC_INT_LOOPBACK (1 << 21)
  998. # define MAC_EXT_LOOPBACK (1 << 22)
  999. # define MAC_DISABLE_RX_OWN (1 << 23)
  1000. # define MAC_BIG_ENDIAN (1 << 30)
  1001. # define MAC_RX_ALL (1 << 31)
  1002. #define MAC_ADDRESS_HIGH 0x4
  1003. #define MAC_ADDRESS_LOW 0x8
  1004. #define MAC_MCAST_HIGH 0xC
  1005. #define MAC_MCAST_LOW 0x10
  1006. #define MAC_MII_CNTRL 0x14
  1007. # define MAC_MII_BUSY (1 << 0)
  1008. # define MAC_MII_READ 0
  1009. # define MAC_MII_WRITE (1 << 1)
  1010. # define MAC_SET_MII_SELECT_REG(X) (((X) & 0x1f) << 6)
  1011. # define MAC_SET_MII_SELECT_PHY(X) (((X) & 0x1f) << 11)
  1012. #define MAC_MII_DATA 0x18
  1013. #define MAC_FLOW_CNTRL 0x1C
  1014. # define MAC_FLOW_CNTRL_BUSY (1 << 0)
  1015. # define MAC_FLOW_CNTRL_ENABLE (1 << 1)
  1016. # define MAC_PASS_CONTROL (1 << 2)
  1017. # define MAC_SET_PAUSE(X) (((X) & 0xffff) << 16)
  1018. #define MAC_VLAN1_TAG 0x20
  1019. #define MAC_VLAN2_TAG 0x24
  1020. /* Ethernet Controller Enable */
  1021. # define MAC_EN_CLOCK_ENABLE (1 << 0)
  1022. # define MAC_EN_RESET0 (1 << 1)
  1023. # define MAC_EN_TOSS (0 << 2)
  1024. # define MAC_EN_CACHEABLE (1 << 3)
  1025. # define MAC_EN_RESET1 (1 << 4)
  1026. # define MAC_EN_RESET2 (1 << 5)
  1027. # define MAC_DMA_RESET (1 << 6)
  1028. /* Ethernet Controller DMA Channels */
  1029. #define MAC0_TX_DMA_ADDR 0xB4004000
  1030. #define MAC1_TX_DMA_ADDR 0xB4004200
  1031. /* offsets from MAC_TX_RING_ADDR address */
  1032. #define MAC_TX_BUFF0_STATUS 0x0
  1033. # define TX_FRAME_ABORTED (1 << 0)
  1034. # define TX_JAB_TIMEOUT (1 << 1)
  1035. # define TX_NO_CARRIER (1 << 2)
  1036. # define TX_LOSS_CARRIER (1 << 3)
  1037. # define TX_EXC_DEF (1 << 4)
  1038. # define TX_LATE_COLL_ABORT (1 << 5)
  1039. # define TX_EXC_COLL (1 << 6)
  1040. # define TX_UNDERRUN (1 << 7)
  1041. # define TX_DEFERRED (1 << 8)
  1042. # define TX_LATE_COLL (1 << 9)
  1043. # define TX_COLL_CNT_MASK (0xF << 10)
  1044. # define TX_PKT_RETRY (1 << 31)
  1045. #define MAC_TX_BUFF0_ADDR 0x4
  1046. # define TX_DMA_ENABLE (1 << 0)
  1047. # define TX_T_DONE (1 << 1)
  1048. # define TX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
  1049. #define MAC_TX_BUFF0_LEN 0x8
  1050. #define MAC_TX_BUFF1_STATUS 0x10
  1051. #define MAC_TX_BUFF1_ADDR 0x14
  1052. #define MAC_TX_BUFF1_LEN 0x18
  1053. #define MAC_TX_BUFF2_STATUS 0x20
  1054. #define MAC_TX_BUFF2_ADDR 0x24
  1055. #define MAC_TX_BUFF2_LEN 0x28
  1056. #define MAC_TX_BUFF3_STATUS 0x30
  1057. #define MAC_TX_BUFF3_ADDR 0x34
  1058. #define MAC_TX_BUFF3_LEN 0x38
  1059. #define MAC0_RX_DMA_ADDR 0xB4004100
  1060. #define MAC1_RX_DMA_ADDR 0xB4004300
  1061. /* offsets from MAC_RX_RING_ADDR */
  1062. #define MAC_RX_BUFF0_STATUS 0x0
  1063. # define RX_FRAME_LEN_MASK 0x3fff
  1064. # define RX_WDOG_TIMER (1 << 14)
  1065. # define RX_RUNT (1 << 15)
  1066. # define RX_OVERLEN (1 << 16)
  1067. # define RX_COLL (1 << 17)
  1068. # define RX_ETHER (1 << 18)
  1069. # define RX_MII_ERROR (1 << 19)
  1070. # define RX_DRIBBLING (1 << 20)
  1071. # define RX_CRC_ERROR (1 << 21)
  1072. # define RX_VLAN1 (1 << 22)
  1073. # define RX_VLAN2 (1 << 23)
  1074. # define RX_LEN_ERROR (1 << 24)
  1075. # define RX_CNTRL_FRAME (1 << 25)
  1076. # define RX_U_CNTRL_FRAME (1 << 26)
  1077. # define RX_MCAST_FRAME (1 << 27)
  1078. # define RX_BCAST_FRAME (1 << 28)
  1079. # define RX_FILTER_FAIL (1 << 29)
  1080. # define RX_PACKET_FILTER (1 << 30)
  1081. # define RX_MISSED_FRAME (1 << 31)
  1082. # define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \
  1083. RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \
  1084. RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME)
  1085. #define MAC_RX_BUFF0_ADDR 0x4
  1086. # define RX_DMA_ENABLE (1 << 0)
  1087. # define RX_T_DONE (1 << 1)
  1088. # define RX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
  1089. # define RX_SET_BUFF_ADDR(X) ((X) & 0xffffffc0)
  1090. #define MAC_RX_BUFF1_STATUS 0x10
  1091. #define MAC_RX_BUFF1_ADDR 0x14
  1092. #define MAC_RX_BUFF2_STATUS 0x20
  1093. #define MAC_RX_BUFF2_ADDR 0x24
  1094. #define MAC_RX_BUFF3_STATUS 0x30
  1095. #define MAC_RX_BUFF3_ADDR 0x34
  1096. #define UART_RX 0 /* Receive buffer */
  1097. #define UART_TX 4 /* Transmit buffer */
  1098. #define UART_IER 8 /* Interrupt Enable Register */
  1099. #define UART_IIR 0xC /* Interrupt ID Register */
  1100. #define UART_FCR 0x10 /* FIFO Control Register */
  1101. #define UART_LCR 0x14 /* Line Control Register */
  1102. #define UART_MCR 0x18 /* Modem Control Register */
  1103. #define UART_LSR 0x1C /* Line Status Register */
  1104. #define UART_MSR 0x20 /* Modem Status Register */
  1105. #define UART_CLK 0x28 /* Baud Rate Clock Divider */
  1106. #define UART_MOD_CNTRL 0x100 /* Module Control */
  1107. /* SSIO */
  1108. #define SSI0_STATUS 0xB1600000
  1109. # define SSI_STATUS_BF (1 << 4)
  1110. # define SSI_STATUS_OF (1 << 3)
  1111. # define SSI_STATUS_UF (1 << 2)
  1112. # define SSI_STATUS_D (1 << 1)
  1113. # define SSI_STATUS_B (1 << 0)
  1114. #define SSI0_INT 0xB1600004
  1115. # define SSI_INT_OI (1 << 3)
  1116. # define SSI_INT_UI (1 << 2)
  1117. # define SSI_INT_DI (1 << 1)
  1118. #define SSI0_INT_ENABLE 0xB1600008
  1119. # define SSI_INTE_OIE (1 << 3)
  1120. # define SSI_INTE_UIE (1 << 2)
  1121. # define SSI_INTE_DIE (1 << 1)
  1122. #define SSI0_CONFIG 0xB1600020
  1123. # define SSI_CONFIG_AO (1 << 24)
  1124. # define SSI_CONFIG_DO (1 << 23)
  1125. # define SSI_CONFIG_ALEN_BIT 20
  1126. # define SSI_CONFIG_ALEN_MASK (0x7 << 20)
  1127. # define SSI_CONFIG_DLEN_BIT 16
  1128. # define SSI_CONFIG_DLEN_MASK (0x7 << 16)
  1129. # define SSI_CONFIG_DD (1 << 11)
  1130. # define SSI_CONFIG_AD (1 << 10)
  1131. # define SSI_CONFIG_BM_BIT 8
  1132. # define SSI_CONFIG_BM_MASK (0x3 << 8)
  1133. # define SSI_CONFIG_CE (1 << 7)
  1134. # define SSI_CONFIG_DP (1 << 6)
  1135. # define SSI_CONFIG_DL (1 << 5)
  1136. # define SSI_CONFIG_EP (1 << 4)
  1137. #define SSI0_ADATA 0xB1600024
  1138. # define SSI_AD_D (1 << 24)
  1139. # define SSI_AD_ADDR_BIT 16
  1140. # define SSI_AD_ADDR_MASK (0xff << 16)
  1141. # define SSI_AD_DATA_BIT 0
  1142. # define SSI_AD_DATA_MASK (0xfff << 0)
  1143. #define SSI0_CLKDIV 0xB1600028
  1144. #define SSI0_CONTROL 0xB1600100
  1145. # define SSI_CONTROL_CD (1 << 1)
  1146. # define SSI_CONTROL_E (1 << 0)
  1147. /* SSI1 */
  1148. #define SSI1_STATUS 0xB1680000
  1149. #define SSI1_INT 0xB1680004
  1150. #define SSI1_INT_ENABLE 0xB1680008
  1151. #define SSI1_CONFIG 0xB1680020
  1152. #define SSI1_ADATA 0xB1680024
  1153. #define SSI1_CLKDIV 0xB1680028
  1154. #define SSI1_ENABLE 0xB1680100
  1155. /*
  1156. * Register content definitions
  1157. */
  1158. #define SSI_STATUS_BF (1 << 4)
  1159. #define SSI_STATUS_OF (1 << 3)
  1160. #define SSI_STATUS_UF (1 << 2)
  1161. #define SSI_STATUS_D (1 << 1)
  1162. #define SSI_STATUS_B (1 << 0)
  1163. /* SSI_INT */
  1164. #define SSI_INT_OI (1 << 3)
  1165. #define SSI_INT_UI (1 << 2)
  1166. #define SSI_INT_DI (1 << 1)
  1167. /* SSI_INTEN */
  1168. #define SSI_INTEN_OIE (1 << 3)
  1169. #define SSI_INTEN_UIE (1 << 2)
  1170. #define SSI_INTEN_DIE (1 << 1)
  1171. #define SSI_CONFIG_AO (1 << 24)
  1172. #define SSI_CONFIG_DO (1 << 23)
  1173. #define SSI_CONFIG_ALEN (7 << 20)
  1174. #define SSI_CONFIG_DLEN (15 << 16)
  1175. #define SSI_CONFIG_DD (1 << 11)
  1176. #define SSI_CONFIG_AD (1 << 10)
  1177. #define SSI_CONFIG_BM (3 << 8)
  1178. #define SSI_CONFIG_CE (1 << 7)
  1179. #define SSI_CONFIG_DP (1 << 6)
  1180. #define SSI_CONFIG_DL (1 << 5)
  1181. #define SSI_CONFIG_EP (1 << 4)
  1182. #define SSI_CONFIG_ALEN_N(N) ((N-1) << 20)
  1183. #define SSI_CONFIG_DLEN_N(N) ((N-1) << 16)
  1184. #define SSI_CONFIG_BM_HI (0 << 8)
  1185. #define SSI_CONFIG_BM_LO (1 << 8)
  1186. #define SSI_CONFIG_BM_CY (2 << 8)
  1187. #define SSI_ADATA_D (1 << 24)
  1188. #define SSI_ADATA_ADDR (0xFF << 16)
  1189. #define SSI_ADATA_DATA 0x0FFF
  1190. #define SSI_ADATA_ADDR_N(N) (N << 16)
  1191. #define SSI_ENABLE_CD (1 << 1)
  1192. #define SSI_ENABLE_E (1 << 0)
  1193. /* IrDA Controller */
  1194. #define IRDA_BASE 0xB0300000
  1195. #define IR_RING_PTR_STATUS (IRDA_BASE + 0x00)
  1196. #define IR_RING_BASE_ADDR_H (IRDA_BASE + 0x04)
  1197. #define IR_RING_BASE_ADDR_L (IRDA_BASE + 0x08)
  1198. #define IR_RING_SIZE (IRDA_BASE + 0x0C)
  1199. #define IR_RING_PROMPT (IRDA_BASE + 0x10)
  1200. #define IR_RING_ADDR_CMPR (IRDA_BASE + 0x14)
  1201. #define IR_INT_CLEAR (IRDA_BASE + 0x18)
  1202. #define IR_CONFIG_1 (IRDA_BASE + 0x20)
  1203. # define IR_RX_INVERT_LED (1 << 0)
  1204. # define IR_TX_INVERT_LED (1 << 1)
  1205. # define IR_ST (1 << 2)
  1206. # define IR_SF (1 << 3)
  1207. # define IR_SIR (1 << 4)
  1208. # define IR_MIR (1 << 5)
  1209. # define IR_FIR (1 << 6)
  1210. # define IR_16CRC (1 << 7)
  1211. # define IR_TD (1 << 8)
  1212. # define IR_RX_ALL (1 << 9)
  1213. # define IR_DMA_ENABLE (1 << 10)
  1214. # define IR_RX_ENABLE (1 << 11)
  1215. # define IR_TX_ENABLE (1 << 12)
  1216. # define IR_LOOPBACK (1 << 14)
  1217. # define IR_SIR_MODE (IR_SIR | IR_DMA_ENABLE | \
  1218. IR_RX_ALL | IR_RX_ENABLE | IR_SF | IR_16CRC)
  1219. #define IR_SIR_FLAGS (IRDA_BASE + 0x24)
  1220. #define IR_ENABLE (IRDA_BASE + 0x28)
  1221. # define IR_RX_STATUS (1 << 9)
  1222. # define IR_TX_STATUS (1 << 10)
  1223. #define IR_READ_PHY_CONFIG (IRDA_BASE + 0x2C)
  1224. #define IR_WRITE_PHY_CONFIG (IRDA_BASE + 0x30)
  1225. #define IR_MAX_PKT_LEN (IRDA_BASE + 0x34)
  1226. #define IR_RX_BYTE_CNT (IRDA_BASE + 0x38)
  1227. #define IR_CONFIG_2 (IRDA_BASE + 0x3C)
  1228. # define IR_MODE_INV (1 << 0)
  1229. # define IR_ONE_PIN (1 << 1)
  1230. #define IR_INTERFACE_CONFIG (IRDA_BASE + 0x40)
  1231. /* GPIO */
  1232. #define SYS_PINFUNC 0xB190002C
  1233. # define SYS_PF_USB (1 << 15) /* 2nd USB device/host */
  1234. # define SYS_PF_U3 (1 << 14) /* GPIO23/U3TXD */
  1235. # define SYS_PF_U2 (1 << 13) /* GPIO22/U2TXD */
  1236. # define SYS_PF_U1 (1 << 12) /* GPIO21/U1TXD */
  1237. # define SYS_PF_SRC (1 << 11) /* GPIO6/SROMCKE */
  1238. # define SYS_PF_CK5 (1 << 10) /* GPIO3/CLK5 */
  1239. # define SYS_PF_CK4 (1 << 9) /* GPIO2/CLK4 */
  1240. # define SYS_PF_IRF (1 << 8) /* GPIO15/IRFIRSEL */
  1241. # define SYS_PF_UR3 (1 << 7) /* GPIO[14:9]/UART3 */
  1242. # define SYS_PF_I2D (1 << 6) /* GPIO8/I2SDI */
  1243. # define SYS_PF_I2S (1 << 5) /* I2S/GPIO[29:31] */
  1244. # define SYS_PF_NI2 (1 << 4) /* NI2/GPIO[24:28] */
  1245. # define SYS_PF_U0 (1 << 3) /* U0TXD/GPIO20 */
  1246. # define SYS_PF_RD (1 << 2) /* IRTXD/GPIO19 */
  1247. # define SYS_PF_A97 (1 << 1) /* AC97/SSL1 */
  1248. # define SYS_PF_S0 (1 << 0) /* SSI_0/GPIO[16:18] */
  1249. /* Au1100 only */
  1250. # define SYS_PF_PC (1 << 18) /* PCMCIA/GPIO[207:204] */
  1251. # define SYS_PF_LCD (1 << 17) /* extern lcd/GPIO[203:200] */
  1252. # define SYS_PF_CS (1 << 16) /* EXTCLK0/32KHz to gpio2 */
  1253. # define SYS_PF_EX0 (1 << 9) /* GPIO2/clock */
  1254. /* Au1550 only. Redefines lots of pins */
  1255. # define SYS_PF_PSC2_MASK (7 << 17)
  1256. # define SYS_PF_PSC2_AC97 0
  1257. # define SYS_PF_PSC2_SPI 0
  1258. # define SYS_PF_PSC2_I2S (1 << 17)
  1259. # define SYS_PF_PSC2_SMBUS (3 << 17)
  1260. # define SYS_PF_PSC2_GPIO (7 << 17)
  1261. # define SYS_PF_PSC3_MASK (7 << 20)
  1262. # define SYS_PF_PSC3_AC97 0
  1263. # define SYS_PF_PSC3_SPI 0
  1264. # define SYS_PF_PSC3_I2S (1 << 20)
  1265. # define SYS_PF_PSC3_SMBUS (3 << 20)
  1266. # define SYS_PF_PSC3_GPIO (7 << 20)
  1267. # define SYS_PF_PSC1_S1 (1 << 1)
  1268. # define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2))
  1269. /* Au1200 only */
  1270. #ifdef CONFIG_SOC_AU1200
  1271. #define SYS_PINFUNC_DMA (1 << 31)
  1272. #define SYS_PINFUNC_S0A (1 << 30)
  1273. #define SYS_PINFUNC_S1A (1 << 29)
  1274. #define SYS_PINFUNC_LP0 (1 << 28)
  1275. #define SYS_PINFUNC_LP1 (1 << 27)
  1276. #define SYS_PINFUNC_LD16 (1 << 26)
  1277. #define SYS_PINFUNC_LD8 (1 << 25)
  1278. #define SYS_PINFUNC_LD1 (1 << 24)
  1279. #define SYS_PINFUNC_LD0 (1 << 23)
  1280. #define SYS_PINFUNC_P1A (3 << 21)
  1281. #define SYS_PINFUNC_P1B (1 << 20)
  1282. #define SYS_PINFUNC_FS3 (1 << 19)
  1283. #define SYS_PINFUNC_P0A (3 << 17)
  1284. #define SYS_PINFUNC_CS (1 << 16)
  1285. #define SYS_PINFUNC_CIM (1 << 15)
  1286. #define SYS_PINFUNC_P1C (1 << 14)
  1287. #define SYS_PINFUNC_U1T (1 << 12)
  1288. #define SYS_PINFUNC_U1R (1 << 11)
  1289. #define SYS_PINFUNC_EX1 (1 << 10)
  1290. #define SYS_PINFUNC_EX0 (1 << 9)
  1291. #define SYS_PINFUNC_U0R (1 << 8)
  1292. #define SYS_PINFUNC_MC (1 << 7)
  1293. #define SYS_PINFUNC_S0B (1 << 6)
  1294. #define SYS_PINFUNC_S0C (1 << 5)
  1295. #define SYS_PINFUNC_P0B (1 << 4)
  1296. #define SYS_PINFUNC_U0T (1 << 3)
  1297. #define SYS_PINFUNC_S1B (1 << 2)
  1298. #endif
  1299. #define SYS_TRIOUTRD 0xB1900100
  1300. #define SYS_TRIOUTCLR 0xB1900100
  1301. #define SYS_OUTPUTRD 0xB1900108
  1302. #define SYS_OUTPUTSET 0xB1900108
  1303. #define SYS_OUTPUTCLR 0xB190010C
  1304. #define SYS_PINSTATERD 0xB1900110
  1305. #define SYS_PININPUTEN 0xB1900110
  1306. /* GPIO2, Au1500, Au1550 only */
  1307. #define GPIO2_BASE 0xB1700000
  1308. #define GPIO2_DIR (GPIO2_BASE + 0)
  1309. #define GPIO2_OUTPUT (GPIO2_BASE + 8)
  1310. #define GPIO2_PINSTATE (GPIO2_BASE + 0xC)
  1311. #define GPIO2_INTENABLE (GPIO2_BASE + 0x10)
  1312. #define GPIO2_ENABLE (GPIO2_BASE + 0x14)
  1313. /* Power Management */
  1314. #define SYS_SCRATCH0 0xB1900018
  1315. #define SYS_SCRATCH1 0xB190001C
  1316. #define SYS_WAKEMSK 0xB1900034
  1317. #define SYS_ENDIAN 0xB1900038
  1318. #define SYS_POWERCTRL 0xB190003C
  1319. #define SYS_WAKESRC 0xB190005C
  1320. #define SYS_SLPPWR 0xB1900078
  1321. #define SYS_SLEEP 0xB190007C
  1322. #define SYS_WAKEMSK_D2 (1 << 9)
  1323. #define SYS_WAKEMSK_M2 (1 << 8)
  1324. #define SYS_WAKEMSK_GPIO(x) (1 << (x))
  1325. /* Clock Controller */
  1326. #define SYS_FREQCTRL0 0xB1900020
  1327. # define SYS_FC_FRDIV2_BIT 22
  1328. # define SYS_FC_FRDIV2_MASK (0xff << SYS_FC_FRDIV2_BIT)
  1329. # define SYS_FC_FE2 (1 << 21)
  1330. # define SYS_FC_FS2 (1 << 20)
  1331. # define SYS_FC_FRDIV1_BIT 12
  1332. # define SYS_FC_FRDIV1_MASK (0xff << SYS_FC_FRDIV1_BIT)
  1333. # define SYS_FC_FE1 (1 << 11)
  1334. # define SYS_FC_FS1 (1 << 10)
  1335. # define SYS_FC_FRDIV0_BIT 2
  1336. # define SYS_FC_FRDIV0_MASK (0xff << SYS_FC_FRDIV0_BIT)
  1337. # define SYS_FC_FE0 (1 << 1)
  1338. # define SYS_FC_FS0 (1 << 0)
  1339. #define SYS_FREQCTRL1 0xB1900024
  1340. # define SYS_FC_FRDIV5_BIT 22
  1341. # define SYS_FC_FRDIV5_MASK (0xff << SYS_FC_FRDIV5_BIT)
  1342. # define SYS_FC_FE5 (1 << 21)
  1343. # define SYS_FC_FS5 (1 << 20)
  1344. # define SYS_FC_FRDIV4_BIT 12
  1345. # define SYS_FC_FRDIV4_MASK (0xff << SYS_FC_FRDIV4_BIT)
  1346. # define SYS_FC_FE4 (1 << 11)
  1347. # define SYS_FC_FS4 (1 << 10)
  1348. # define SYS_FC_FRDIV3_BIT 2
  1349. # define SYS_FC_FRDIV3_MASK (0xff << SYS_FC_FRDIV3_BIT)
  1350. # define SYS_FC_FE3 (1 << 1)
  1351. # define SYS_FC_FS3 (1 << 0)
  1352. #define SYS_CLKSRC 0xB1900028
  1353. # define SYS_CS_ME1_BIT 27
  1354. # define SYS_CS_ME1_MASK (0x7 << SYS_CS_ME1_BIT)
  1355. # define SYS_CS_DE1 (1 << 26)
  1356. # define SYS_CS_CE1 (1 << 25)
  1357. # define SYS_CS_ME0_BIT 22
  1358. # define SYS_CS_ME0_MASK (0x7 << SYS_CS_ME0_BIT)
  1359. # define SYS_CS_DE0 (1 << 21)
  1360. # define SYS_CS_CE0 (1 << 20)
  1361. # define SYS_CS_MI2_BIT 17
  1362. # define SYS_CS_MI2_MASK (0x7 << SYS_CS_MI2_BIT)
  1363. # define SYS_CS_DI2 (1 << 16)
  1364. # define SYS_CS_CI2 (1 << 15)
  1365. #ifdef CONFIG_SOC_AU1100
  1366. # define SYS_CS_ML_BIT 7
  1367. # define SYS_CS_ML_MASK (0x7 << SYS_CS_ML_BIT)
  1368. # define SYS_CS_DL (1 << 6)
  1369. # define SYS_CS_CL (1 << 5)
  1370. #else
  1371. # define SYS_CS_MUH_BIT 12
  1372. # define SYS_CS_MUH_MASK (0x7 << SYS_CS_MUH_BIT)
  1373. # define SYS_CS_DUH (1 << 11)
  1374. # define SYS_CS_CUH (1 << 10)
  1375. # define SYS_CS_MUD_BIT 7
  1376. # define SYS_CS_MUD_MASK (0x7 << SYS_CS_MUD_BIT)
  1377. # define SYS_CS_DUD (1 << 6)
  1378. # define SYS_CS_CUD (1 << 5)
  1379. #endif
  1380. # define SYS_CS_MIR_BIT 2
  1381. # define SYS_CS_MIR_MASK (0x7 << SYS_CS_MIR_BIT)
  1382. # define SYS_CS_DIR (1 << 1)
  1383. # define SYS_CS_CIR (1 << 0)
  1384. # define SYS_CS_MUX_AUX 0x1
  1385. # define SYS_CS_MUX_FQ0 0x2
  1386. # define SYS_CS_MUX_FQ1 0x3
  1387. # define SYS_CS_MUX_FQ2 0x4
  1388. # define SYS_CS_MUX_FQ3 0x5
  1389. # define SYS_CS_MUX_FQ4 0x6
  1390. # define SYS_CS_MUX_FQ5 0x7
  1391. #define SYS_CPUPLL 0xB1900060
  1392. #define SYS_AUXPLL 0xB1900064
  1393. /* AC97 Controller */
  1394. #define AC97C_CONFIG 0xB0000000
  1395. # define AC97C_RECV_SLOTS_BIT 13
  1396. # define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT)
  1397. # define AC97C_XMIT_SLOTS_BIT 3
  1398. # define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT)
  1399. # define AC97C_SG (1 << 2)
  1400. # define AC97C_SYNC (1 << 1)
  1401. # define AC97C_RESET (1 << 0)
  1402. #define AC97C_STATUS 0xB0000004
  1403. # define AC97C_XU (1 << 11)
  1404. # define AC97C_XO (1 << 10)
  1405. # define AC97C_RU (1 << 9)
  1406. # define AC97C_RO (1 << 8)
  1407. # define AC97C_READY (1 << 7)
  1408. # define AC97C_CP (1 << 6)
  1409. # define AC97C_TR (1 << 5)
  1410. # define AC97C_TE (1 << 4)
  1411. # define AC97C_TF (1 << 3)
  1412. # define AC97C_RR (1 << 2)
  1413. # define AC97C_RE (1 << 1)
  1414. # define AC97C_RF (1 << 0)
  1415. #define AC97C_DATA 0xB0000008
  1416. #define AC97C_CMD 0xB000000C
  1417. # define AC97C_WD_BIT 16
  1418. # define AC97C_READ (1 << 7)
  1419. # define AC97C_INDEX_MASK 0x7f
  1420. #define AC97C_CNTRL 0xB0000010
  1421. # define AC97C_RS (1 << 1)
  1422. # define AC97C_CE (1 << 0)
  1423. /* Secure Digital (SD) Controller */
  1424. #define SD0_XMIT_FIFO 0xB0600000
  1425. #define SD0_RECV_FIFO 0xB0600004
  1426. #define SD1_XMIT_FIFO 0xB0680000
  1427. #define SD1_RECV_FIFO 0xB0680004
  1428. #if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
  1429. /* Au1500 PCI Controller */
  1430. #define Au1500_CFG_BASE 0xB4005000 /* virtual, KSEG1 addr */
  1431. #define Au1500_PCI_CMEM (Au1500_CFG_BASE + 0)
  1432. #define Au1500_PCI_CFG (Au1500_CFG_BASE + 4)
  1433. # define PCI_ERROR ((1 << 22) | (1 << 23) | (1 << 24) | \
  1434. (1 << 25) | (1 << 26) | (1 << 27))
  1435. #define Au1500_PCI_B2BMASK_CCH (Au1500_CFG_BASE + 8)
  1436. #define Au1500_PCI_B2B0_VID (Au1500_CFG_BASE + 0xC)
  1437. #define Au1500_PCI_B2B1_ID (Au1500_CFG_BASE + 0x10)
  1438. #define Au1500_PCI_MWMASK_DEV (Au1500_CFG_BASE + 0x14)
  1439. #define Au1500_PCI_MWBASE_REV_CCL (Au1500_CFG_BASE + 0x18)
  1440. #define Au1500_PCI_ERR_ADDR (Au1500_CFG_BASE + 0x1C)
  1441. #define Au1500_PCI_SPEC_INTACK (Au1500_CFG_BASE + 0x20)
  1442. #define Au1500_PCI_ID (Au1500_CFG_BASE + 0x100)
  1443. #define Au1500_PCI_STATCMD (Au1500_CFG_BASE + 0x104)
  1444. #define Au1500_PCI_CLASSREV (Au1500_CFG_BASE + 0x108)
  1445. #define Au1500_PCI_HDRTYPE (Au1500_CFG_BASE + 0x10C)
  1446. #define Au1500_PCI_MBAR (Au1500_CFG_BASE + 0x110)
  1447. #define Au1500_PCI_HDR 0xB4005100 /* virtual, KSEG1 addr */
  1448. /*
  1449. * All of our structures, like PCI resource, have 32-bit members.
  1450. * Drivers are expected to do an ioremap on the PCI MEM resource, but it's
  1451. * hard to store 0x4 0000 0000 in a 32-bit type. We require a small patch
  1452. * to __ioremap to check for addresses between (u32)Au1500_PCI_MEM_START and
  1453. * (u32)Au1500_PCI_MEM_END and change those to the full 36-bit PCI MEM
  1454. * addresses. For PCI I/O, it's simpler because we get to do the ioremap
  1455. * ourselves and then adjust the device's resources.
  1456. */
  1457. #define Au1500_EXT_CFG 0x600000000ULL
  1458. #define Au1500_EXT_CFG_TYPE1 0x680000000ULL
  1459. #define Au1500_PCI_IO_START 0x500000000ULL
  1460. #define Au1500_PCI_IO_END 0x5000FFFFFULL
  1461. #define Au1500_PCI_MEM_START 0x440000000ULL
  1462. #define Au1500_PCI_MEM_END 0x44FFFFFFFULL
  1463. #define PCI_IO_START 0x00001000
  1464. #define PCI_IO_END 0x000FFFFF
  1465. #define PCI_MEM_START 0x40000000
  1466. #define PCI_MEM_END 0x4FFFFFFF
  1467. #define PCI_FIRST_DEVFN (0 << 3)
  1468. #define PCI_LAST_DEVFN (19 << 3)
  1469. #define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */
  1470. #define IOPORT_RESOURCE_END 0xffffffff
  1471. #define IOMEM_RESOURCE_START 0x10000000
  1472. #define IOMEM_RESOURCE_END 0xfffffffffULL
  1473. #else /* Au1000 and Au1100 and Au1200 */
  1474. /* Don't allow any legacy ports probing */
  1475. #define IOPORT_RESOURCE_START 0x10000000
  1476. #define IOPORT_RESOURCE_END 0xffffffff
  1477. #define IOMEM_RESOURCE_START 0x10000000
  1478. #define IOMEM_RESOURCE_END 0xfffffffffULL
  1479. #define PCI_IO_START 0
  1480. #define PCI_IO_END 0
  1481. #define PCI_MEM_START 0
  1482. #define PCI_MEM_END 0
  1483. #define PCI_FIRST_DEVFN 0
  1484. #define PCI_LAST_DEVFN 0
  1485. #endif
  1486. #endif