au1000.h 46 KB

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