au1000.h 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572
  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. #define ALCHEMY_CPU_AU1300 5
  122. static inline int alchemy_get_cputype(void)
  123. {
  124. switch (read_c0_prid() & 0xffff0000) {
  125. case 0x00030000:
  126. return ALCHEMY_CPU_AU1000;
  127. break;
  128. case 0x01030000:
  129. return ALCHEMY_CPU_AU1500;
  130. break;
  131. case 0x02030000:
  132. return ALCHEMY_CPU_AU1100;
  133. break;
  134. case 0x03030000:
  135. return ALCHEMY_CPU_AU1550;
  136. break;
  137. case 0x04030000:
  138. case 0x05030000:
  139. return ALCHEMY_CPU_AU1200;
  140. break;
  141. case 0x800c0000:
  142. return ALCHEMY_CPU_AU1300;
  143. break;
  144. }
  145. return ALCHEMY_CPU_UNKNOWN;
  146. }
  147. /* return number of uarts on a given cputype */
  148. static inline int alchemy_get_uarts(int type)
  149. {
  150. switch (type) {
  151. case ALCHEMY_CPU_AU1000:
  152. case ALCHEMY_CPU_AU1300:
  153. return 4;
  154. case ALCHEMY_CPU_AU1500:
  155. case ALCHEMY_CPU_AU1200:
  156. return 2;
  157. case ALCHEMY_CPU_AU1100:
  158. case ALCHEMY_CPU_AU1550:
  159. return 3;
  160. }
  161. return 0;
  162. }
  163. /* enable an UART block if it isn't already */
  164. static inline void alchemy_uart_enable(u32 uart_phys)
  165. {
  166. void __iomem *addr = (void __iomem *)KSEG1ADDR(uart_phys);
  167. /* reset, enable clock, deassert reset */
  168. if ((__raw_readl(addr + 0x100) & 3) != 3) {
  169. __raw_writel(0, addr + 0x100);
  170. wmb();
  171. __raw_writel(1, addr + 0x100);
  172. wmb();
  173. }
  174. __raw_writel(3, addr + 0x100);
  175. wmb();
  176. }
  177. static inline void alchemy_uart_disable(u32 uart_phys)
  178. {
  179. void __iomem *addr = (void __iomem *)KSEG1ADDR(uart_phys);
  180. __raw_writel(0, addr + 0x100); /* UART_MOD_CNTRL */
  181. wmb();
  182. }
  183. static inline void alchemy_uart_putchar(u32 uart_phys, u8 c)
  184. {
  185. void __iomem *base = (void __iomem *)KSEG1ADDR(uart_phys);
  186. int timeout, i;
  187. /* check LSR TX_EMPTY bit */
  188. timeout = 0xffffff;
  189. do {
  190. if (__raw_readl(base + 0x1c) & 0x20)
  191. break;
  192. /* slow down */
  193. for (i = 10000; i; i--)
  194. asm volatile ("nop");
  195. } while (--timeout);
  196. __raw_writel(c, base + 0x04); /* tx */
  197. wmb();
  198. }
  199. /* return number of ethernet MACs on a given cputype */
  200. static inline int alchemy_get_macs(int type)
  201. {
  202. switch (type) {
  203. case ALCHEMY_CPU_AU1000:
  204. case ALCHEMY_CPU_AU1500:
  205. case ALCHEMY_CPU_AU1550:
  206. return 2;
  207. case ALCHEMY_CPU_AU1100:
  208. return 1;
  209. }
  210. return 0;
  211. }
  212. /* arch/mips/au1000/common/clocks.c */
  213. extern void set_au1x00_speed(unsigned int new_freq);
  214. extern unsigned int get_au1x00_speed(void);
  215. extern void set_au1x00_uart_baud_base(unsigned long new_baud_base);
  216. extern unsigned long get_au1x00_uart_baud_base(void);
  217. extern unsigned long au1xxx_calc_clock(void);
  218. /* PM: arch/mips/alchemy/common/sleeper.S, power.c, irq.c */
  219. void alchemy_sleep_au1000(void);
  220. void alchemy_sleep_au1550(void);
  221. void alchemy_sleep_au1300(void);
  222. void au_sleep(void);
  223. /* USB: drivers/usb/host/alchemy-common.c */
  224. enum alchemy_usb_block {
  225. ALCHEMY_USB_OHCI0,
  226. ALCHEMY_USB_UDC0,
  227. ALCHEMY_USB_EHCI0,
  228. ALCHEMY_USB_OTG0,
  229. ALCHEMY_USB_OHCI1,
  230. };
  231. int alchemy_usb_control(int block, int enable);
  232. /* PCI controller platform data */
  233. struct alchemy_pci_platdata {
  234. int (*board_map_irq)(const struct pci_dev *d, u8 slot, u8 pin);
  235. int (*board_pci_idsel)(unsigned int devsel, int assert);
  236. /* bits to set/clear in PCI_CONFIG register */
  237. unsigned long pci_cfg_set;
  238. unsigned long pci_cfg_clr;
  239. };
  240. /* Multifunction pins: Each of these pins can either be assigned to the
  241. * GPIO controller or a on-chip peripheral.
  242. * Call "au1300_pinfunc_to_dev()" or "au1300_pinfunc_to_gpio()" to
  243. * assign one of these to either the GPIO controller or the device.
  244. */
  245. enum au1300_multifunc_pins {
  246. /* wake-from-str pins 0-3 */
  247. AU1300_PIN_WAKE0 = 0, AU1300_PIN_WAKE1, AU1300_PIN_WAKE2,
  248. AU1300_PIN_WAKE3,
  249. /* external clock sources for PSCs: 4-5 */
  250. AU1300_PIN_EXTCLK0, AU1300_PIN_EXTCLK1,
  251. /* 8bit MMC interface on SD0: 6-9 */
  252. AU1300_PIN_SD0DAT4, AU1300_PIN_SD0DAT5, AU1300_PIN_SD0DAT6,
  253. AU1300_PIN_SD0DAT7,
  254. /* aux clk input for freqgen 3: 10 */
  255. AU1300_PIN_FG3AUX,
  256. /* UART1 pins: 11-18 */
  257. AU1300_PIN_U1RI, AU1300_PIN_U1DCD, AU1300_PIN_U1DSR,
  258. AU1300_PIN_U1CTS, AU1300_PIN_U1RTS, AU1300_PIN_U1DTR,
  259. AU1300_PIN_U1RX, AU1300_PIN_U1TX,
  260. /* UART0 pins: 19-24 */
  261. AU1300_PIN_U0RI, AU1300_PIN_U0DCD, AU1300_PIN_U0DSR,
  262. AU1300_PIN_U0CTS, AU1300_PIN_U0RTS, AU1300_PIN_U0DTR,
  263. /* UART2: 25-26 */
  264. AU1300_PIN_U2RX, AU1300_PIN_U2TX,
  265. /* UART3: 27-28 */
  266. AU1300_PIN_U3RX, AU1300_PIN_U3TX,
  267. /* LCD controller PWMs, ext pixclock: 29-31 */
  268. AU1300_PIN_LCDPWM0, AU1300_PIN_LCDPWM1, AU1300_PIN_LCDCLKIN,
  269. /* SD1 interface: 32-37 */
  270. AU1300_PIN_SD1DAT0, AU1300_PIN_SD1DAT1, AU1300_PIN_SD1DAT2,
  271. AU1300_PIN_SD1DAT3, AU1300_PIN_SD1CMD, AU1300_PIN_SD1CLK,
  272. /* SD2 interface: 38-43 */
  273. AU1300_PIN_SD2DAT0, AU1300_PIN_SD2DAT1, AU1300_PIN_SD2DAT2,
  274. AU1300_PIN_SD2DAT3, AU1300_PIN_SD2CMD, AU1300_PIN_SD2CLK,
  275. /* PSC0/1 clocks: 44-45 */
  276. AU1300_PIN_PSC0CLK, AU1300_PIN_PSC1CLK,
  277. /* PSCs: 46-49/50-53/54-57/58-61 */
  278. AU1300_PIN_PSC0SYNC0, AU1300_PIN_PSC0SYNC1, AU1300_PIN_PSC0D0,
  279. AU1300_PIN_PSC0D1,
  280. AU1300_PIN_PSC1SYNC0, AU1300_PIN_PSC1SYNC1, AU1300_PIN_PSC1D0,
  281. AU1300_PIN_PSC1D1,
  282. AU1300_PIN_PSC2SYNC0, AU1300_PIN_PSC2SYNC1, AU1300_PIN_PSC2D0,
  283. AU1300_PIN_PSC2D1,
  284. AU1300_PIN_PSC3SYNC0, AU1300_PIN_PSC3SYNC1, AU1300_PIN_PSC3D0,
  285. AU1300_PIN_PSC3D1,
  286. /* PCMCIA interface: 62-70 */
  287. AU1300_PIN_PCE2, AU1300_PIN_PCE1, AU1300_PIN_PIOS16,
  288. AU1300_PIN_PIOR, AU1300_PIN_PWE, AU1300_PIN_PWAIT,
  289. AU1300_PIN_PREG, AU1300_PIN_POE, AU1300_PIN_PIOW,
  290. /* camera interface H/V sync inputs: 71-72 */
  291. AU1300_PIN_CIMLS, AU1300_PIN_CIMFS,
  292. /* PSC2/3 clocks: 73-74 */
  293. AU1300_PIN_PSC2CLK, AU1300_PIN_PSC3CLK,
  294. };
  295. /* GPIC (Au1300) pin management: arch/mips/alchemy/common/gpioint.c */
  296. extern void au1300_pinfunc_to_gpio(enum au1300_multifunc_pins gpio);
  297. extern void au1300_pinfunc_to_dev(enum au1300_multifunc_pins gpio);
  298. extern void au1300_set_irq_priority(unsigned int irq, int p);
  299. extern void au1300_set_dbdma_gpio(int dchan, unsigned int gpio);
  300. /* Au1300 allows to disconnect certain blocks from internal power supply */
  301. enum au1300_vss_block {
  302. AU1300_VSS_MPE = 0,
  303. AU1300_VSS_BSA,
  304. AU1300_VSS_GPE,
  305. AU1300_VSS_MGP,
  306. };
  307. extern void au1300_vss_block_control(int block, int enable);
  308. /* SOC Interrupt numbers */
  309. /* Au1000-style (IC0/1): 2 controllers with 32 sources each */
  310. #define AU1000_INTC0_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
  311. #define AU1000_INTC0_INT_LAST (AU1000_INTC0_INT_BASE + 31)
  312. #define AU1000_INTC1_INT_BASE (AU1000_INTC0_INT_LAST + 1)
  313. #define AU1000_INTC1_INT_LAST (AU1000_INTC1_INT_BASE + 31)
  314. #define AU1000_MAX_INTR AU1000_INTC1_INT_LAST
  315. /* Au1300-style (GPIC): 1 controller with up to 128 sources */
  316. #define ALCHEMY_GPIC_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
  317. #define ALCHEMY_GPIC_INT_NUM 128
  318. #define ALCHEMY_GPIC_INT_LAST (ALCHEMY_GPIC_INT_BASE + ALCHEMY_GPIC_INT_NUM - 1)
  319. enum soc_au1000_ints {
  320. AU1000_FIRST_INT = AU1000_INTC0_INT_BASE,
  321. AU1000_UART0_INT = AU1000_FIRST_INT,
  322. AU1000_UART1_INT,
  323. AU1000_UART2_INT,
  324. AU1000_UART3_INT,
  325. AU1000_SSI0_INT,
  326. AU1000_SSI1_INT,
  327. AU1000_DMA_INT_BASE,
  328. AU1000_TOY_INT = AU1000_FIRST_INT + 14,
  329. AU1000_TOY_MATCH0_INT,
  330. AU1000_TOY_MATCH1_INT,
  331. AU1000_TOY_MATCH2_INT,
  332. AU1000_RTC_INT,
  333. AU1000_RTC_MATCH0_INT,
  334. AU1000_RTC_MATCH1_INT,
  335. AU1000_RTC_MATCH2_INT,
  336. AU1000_IRDA_TX_INT,
  337. AU1000_IRDA_RX_INT,
  338. AU1000_USB_DEV_REQ_INT,
  339. AU1000_USB_DEV_SUS_INT,
  340. AU1000_USB_HOST_INT,
  341. AU1000_ACSYNC_INT,
  342. AU1000_MAC0_DMA_INT,
  343. AU1000_MAC1_DMA_INT,
  344. AU1000_I2S_UO_INT,
  345. AU1000_AC97C_INT,
  346. AU1000_GPIO0_INT,
  347. AU1000_GPIO1_INT,
  348. AU1000_GPIO2_INT,
  349. AU1000_GPIO3_INT,
  350. AU1000_GPIO4_INT,
  351. AU1000_GPIO5_INT,
  352. AU1000_GPIO6_INT,
  353. AU1000_GPIO7_INT,
  354. AU1000_GPIO8_INT,
  355. AU1000_GPIO9_INT,
  356. AU1000_GPIO10_INT,
  357. AU1000_GPIO11_INT,
  358. AU1000_GPIO12_INT,
  359. AU1000_GPIO13_INT,
  360. AU1000_GPIO14_INT,
  361. AU1000_GPIO15_INT,
  362. AU1000_GPIO16_INT,
  363. AU1000_GPIO17_INT,
  364. AU1000_GPIO18_INT,
  365. AU1000_GPIO19_INT,
  366. AU1000_GPIO20_INT,
  367. AU1000_GPIO21_INT,
  368. AU1000_GPIO22_INT,
  369. AU1000_GPIO23_INT,
  370. AU1000_GPIO24_INT,
  371. AU1000_GPIO25_INT,
  372. AU1000_GPIO26_INT,
  373. AU1000_GPIO27_INT,
  374. AU1000_GPIO28_INT,
  375. AU1000_GPIO29_INT,
  376. AU1000_GPIO30_INT,
  377. AU1000_GPIO31_INT,
  378. };
  379. enum soc_au1100_ints {
  380. AU1100_FIRST_INT = AU1000_INTC0_INT_BASE,
  381. AU1100_UART0_INT = AU1100_FIRST_INT,
  382. AU1100_UART1_INT,
  383. AU1100_SD_INT,
  384. AU1100_UART3_INT,
  385. AU1100_SSI0_INT,
  386. AU1100_SSI1_INT,
  387. AU1100_DMA_INT_BASE,
  388. AU1100_TOY_INT = AU1100_FIRST_INT + 14,
  389. AU1100_TOY_MATCH0_INT,
  390. AU1100_TOY_MATCH1_INT,
  391. AU1100_TOY_MATCH2_INT,
  392. AU1100_RTC_INT,
  393. AU1100_RTC_MATCH0_INT,
  394. AU1100_RTC_MATCH1_INT,
  395. AU1100_RTC_MATCH2_INT,
  396. AU1100_IRDA_TX_INT,
  397. AU1100_IRDA_RX_INT,
  398. AU1100_USB_DEV_REQ_INT,
  399. AU1100_USB_DEV_SUS_INT,
  400. AU1100_USB_HOST_INT,
  401. AU1100_ACSYNC_INT,
  402. AU1100_MAC0_DMA_INT,
  403. AU1100_GPIO208_215_INT,
  404. AU1100_LCD_INT,
  405. AU1100_AC97C_INT,
  406. AU1100_GPIO0_INT,
  407. AU1100_GPIO1_INT,
  408. AU1100_GPIO2_INT,
  409. AU1100_GPIO3_INT,
  410. AU1100_GPIO4_INT,
  411. AU1100_GPIO5_INT,
  412. AU1100_GPIO6_INT,
  413. AU1100_GPIO7_INT,
  414. AU1100_GPIO8_INT,
  415. AU1100_GPIO9_INT,
  416. AU1100_GPIO10_INT,
  417. AU1100_GPIO11_INT,
  418. AU1100_GPIO12_INT,
  419. AU1100_GPIO13_INT,
  420. AU1100_GPIO14_INT,
  421. AU1100_GPIO15_INT,
  422. AU1100_GPIO16_INT,
  423. AU1100_GPIO17_INT,
  424. AU1100_GPIO18_INT,
  425. AU1100_GPIO19_INT,
  426. AU1100_GPIO20_INT,
  427. AU1100_GPIO21_INT,
  428. AU1100_GPIO22_INT,
  429. AU1100_GPIO23_INT,
  430. AU1100_GPIO24_INT,
  431. AU1100_GPIO25_INT,
  432. AU1100_GPIO26_INT,
  433. AU1100_GPIO27_INT,
  434. AU1100_GPIO28_INT,
  435. AU1100_GPIO29_INT,
  436. AU1100_GPIO30_INT,
  437. AU1100_GPIO31_INT,
  438. };
  439. enum soc_au1500_ints {
  440. AU1500_FIRST_INT = AU1000_INTC0_INT_BASE,
  441. AU1500_UART0_INT = AU1500_FIRST_INT,
  442. AU1500_PCI_INTA,
  443. AU1500_PCI_INTB,
  444. AU1500_UART3_INT,
  445. AU1500_PCI_INTC,
  446. AU1500_PCI_INTD,
  447. AU1500_DMA_INT_BASE,
  448. AU1500_TOY_INT = AU1500_FIRST_INT + 14,
  449. AU1500_TOY_MATCH0_INT,
  450. AU1500_TOY_MATCH1_INT,
  451. AU1500_TOY_MATCH2_INT,
  452. AU1500_RTC_INT,
  453. AU1500_RTC_MATCH0_INT,
  454. AU1500_RTC_MATCH1_INT,
  455. AU1500_RTC_MATCH2_INT,
  456. AU1500_PCI_ERR_INT,
  457. AU1500_RESERVED_INT,
  458. AU1500_USB_DEV_REQ_INT,
  459. AU1500_USB_DEV_SUS_INT,
  460. AU1500_USB_HOST_INT,
  461. AU1500_ACSYNC_INT,
  462. AU1500_MAC0_DMA_INT,
  463. AU1500_MAC1_DMA_INT,
  464. AU1500_AC97C_INT = AU1500_FIRST_INT + 31,
  465. AU1500_GPIO0_INT,
  466. AU1500_GPIO1_INT,
  467. AU1500_GPIO2_INT,
  468. AU1500_GPIO3_INT,
  469. AU1500_GPIO4_INT,
  470. AU1500_GPIO5_INT,
  471. AU1500_GPIO6_INT,
  472. AU1500_GPIO7_INT,
  473. AU1500_GPIO8_INT,
  474. AU1500_GPIO9_INT,
  475. AU1500_GPIO10_INT,
  476. AU1500_GPIO11_INT,
  477. AU1500_GPIO12_INT,
  478. AU1500_GPIO13_INT,
  479. AU1500_GPIO14_INT,
  480. AU1500_GPIO15_INT,
  481. AU1500_GPIO200_INT,
  482. AU1500_GPIO201_INT,
  483. AU1500_GPIO202_INT,
  484. AU1500_GPIO203_INT,
  485. AU1500_GPIO20_INT,
  486. AU1500_GPIO204_INT,
  487. AU1500_GPIO205_INT,
  488. AU1500_GPIO23_INT,
  489. AU1500_GPIO24_INT,
  490. AU1500_GPIO25_INT,
  491. AU1500_GPIO26_INT,
  492. AU1500_GPIO27_INT,
  493. AU1500_GPIO28_INT,
  494. AU1500_GPIO206_INT,
  495. AU1500_GPIO207_INT,
  496. AU1500_GPIO208_215_INT,
  497. };
  498. enum soc_au1550_ints {
  499. AU1550_FIRST_INT = AU1000_INTC0_INT_BASE,
  500. AU1550_UART0_INT = AU1550_FIRST_INT,
  501. AU1550_PCI_INTA,
  502. AU1550_PCI_INTB,
  503. AU1550_DDMA_INT,
  504. AU1550_CRYPTO_INT,
  505. AU1550_PCI_INTC,
  506. AU1550_PCI_INTD,
  507. AU1550_PCI_RST_INT,
  508. AU1550_UART1_INT,
  509. AU1550_UART3_INT,
  510. AU1550_PSC0_INT,
  511. AU1550_PSC1_INT,
  512. AU1550_PSC2_INT,
  513. AU1550_PSC3_INT,
  514. AU1550_TOY_INT,
  515. AU1550_TOY_MATCH0_INT,
  516. AU1550_TOY_MATCH1_INT,
  517. AU1550_TOY_MATCH2_INT,
  518. AU1550_RTC_INT,
  519. AU1550_RTC_MATCH0_INT,
  520. AU1550_RTC_MATCH1_INT,
  521. AU1550_RTC_MATCH2_INT,
  522. AU1550_NAND_INT = AU1550_FIRST_INT + 23,
  523. AU1550_USB_DEV_REQ_INT,
  524. AU1550_USB_DEV_SUS_INT,
  525. AU1550_USB_HOST_INT,
  526. AU1550_MAC0_DMA_INT,
  527. AU1550_MAC1_DMA_INT,
  528. AU1550_GPIO0_INT = AU1550_FIRST_INT + 32,
  529. AU1550_GPIO1_INT,
  530. AU1550_GPIO2_INT,
  531. AU1550_GPIO3_INT,
  532. AU1550_GPIO4_INT,
  533. AU1550_GPIO5_INT,
  534. AU1550_GPIO6_INT,
  535. AU1550_GPIO7_INT,
  536. AU1550_GPIO8_INT,
  537. AU1550_GPIO9_INT,
  538. AU1550_GPIO10_INT,
  539. AU1550_GPIO11_INT,
  540. AU1550_GPIO12_INT,
  541. AU1550_GPIO13_INT,
  542. AU1550_GPIO14_INT,
  543. AU1550_GPIO15_INT,
  544. AU1550_GPIO200_INT,
  545. AU1550_GPIO201_205_INT, /* Logical or of GPIO201:205 */
  546. AU1550_GPIO16_INT,
  547. AU1550_GPIO17_INT,
  548. AU1550_GPIO20_INT,
  549. AU1550_GPIO21_INT,
  550. AU1550_GPIO22_INT,
  551. AU1550_GPIO23_INT,
  552. AU1550_GPIO24_INT,
  553. AU1550_GPIO25_INT,
  554. AU1550_GPIO26_INT,
  555. AU1550_GPIO27_INT,
  556. AU1550_GPIO28_INT,
  557. AU1550_GPIO206_INT,
  558. AU1550_GPIO207_INT,
  559. AU1550_GPIO208_215_INT, /* Logical or of GPIO208:215 */
  560. };
  561. enum soc_au1200_ints {
  562. AU1200_FIRST_INT = AU1000_INTC0_INT_BASE,
  563. AU1200_UART0_INT = AU1200_FIRST_INT,
  564. AU1200_SWT_INT,
  565. AU1200_SD_INT,
  566. AU1200_DDMA_INT,
  567. AU1200_MAE_BE_INT,
  568. AU1200_GPIO200_INT,
  569. AU1200_GPIO201_INT,
  570. AU1200_GPIO202_INT,
  571. AU1200_UART1_INT,
  572. AU1200_MAE_FE_INT,
  573. AU1200_PSC0_INT,
  574. AU1200_PSC1_INT,
  575. AU1200_AES_INT,
  576. AU1200_CAMERA_INT,
  577. AU1200_TOY_INT,
  578. AU1200_TOY_MATCH0_INT,
  579. AU1200_TOY_MATCH1_INT,
  580. AU1200_TOY_MATCH2_INT,
  581. AU1200_RTC_INT,
  582. AU1200_RTC_MATCH0_INT,
  583. AU1200_RTC_MATCH1_INT,
  584. AU1200_RTC_MATCH2_INT,
  585. AU1200_GPIO203_INT,
  586. AU1200_NAND_INT,
  587. AU1200_GPIO204_INT,
  588. AU1200_GPIO205_INT,
  589. AU1200_GPIO206_INT,
  590. AU1200_GPIO207_INT,
  591. AU1200_GPIO208_215_INT, /* Logical OR of 208:215 */
  592. AU1200_USB_INT,
  593. AU1200_LCD_INT,
  594. AU1200_MAE_BOTH_INT,
  595. AU1200_GPIO0_INT,
  596. AU1200_GPIO1_INT,
  597. AU1200_GPIO2_INT,
  598. AU1200_GPIO3_INT,
  599. AU1200_GPIO4_INT,
  600. AU1200_GPIO5_INT,
  601. AU1200_GPIO6_INT,
  602. AU1200_GPIO7_INT,
  603. AU1200_GPIO8_INT,
  604. AU1200_GPIO9_INT,
  605. AU1200_GPIO10_INT,
  606. AU1200_GPIO11_INT,
  607. AU1200_GPIO12_INT,
  608. AU1200_GPIO13_INT,
  609. AU1200_GPIO14_INT,
  610. AU1200_GPIO15_INT,
  611. AU1200_GPIO16_INT,
  612. AU1200_GPIO17_INT,
  613. AU1200_GPIO18_INT,
  614. AU1200_GPIO19_INT,
  615. AU1200_GPIO20_INT,
  616. AU1200_GPIO21_INT,
  617. AU1200_GPIO22_INT,
  618. AU1200_GPIO23_INT,
  619. AU1200_GPIO24_INT,
  620. AU1200_GPIO25_INT,
  621. AU1200_GPIO26_INT,
  622. AU1200_GPIO27_INT,
  623. AU1200_GPIO28_INT,
  624. AU1200_GPIO29_INT,
  625. AU1200_GPIO30_INT,
  626. AU1200_GPIO31_INT,
  627. };
  628. #endif /* !defined (_LANGUAGE_ASSEMBLY) */
  629. /* Au1300 peripheral interrupt numbers */
  630. #define AU1300_FIRST_INT (ALCHEMY_GPIC_INT_BASE)
  631. #define AU1300_UART1_INT (AU1300_FIRST_INT + 17)
  632. #define AU1300_UART2_INT (AU1300_FIRST_INT + 25)
  633. #define AU1300_UART3_INT (AU1300_FIRST_INT + 27)
  634. #define AU1300_SD1_INT (AU1300_FIRST_INT + 32)
  635. #define AU1300_SD2_INT (AU1300_FIRST_INT + 38)
  636. #define AU1300_PSC0_INT (AU1300_FIRST_INT + 48)
  637. #define AU1300_PSC1_INT (AU1300_FIRST_INT + 52)
  638. #define AU1300_PSC2_INT (AU1300_FIRST_INT + 56)
  639. #define AU1300_PSC3_INT (AU1300_FIRST_INT + 60)
  640. #define AU1300_NAND_INT (AU1300_FIRST_INT + 62)
  641. #define AU1300_DDMA_INT (AU1300_FIRST_INT + 75)
  642. #define AU1300_MMU_INT (AU1300_FIRST_INT + 76)
  643. #define AU1300_MPU_INT (AU1300_FIRST_INT + 77)
  644. #define AU1300_GPU_INT (AU1300_FIRST_INT + 78)
  645. #define AU1300_UDMA_INT (AU1300_FIRST_INT + 79)
  646. #define AU1300_TOY_INT (AU1300_FIRST_INT + 80)
  647. #define AU1300_TOY_MATCH0_INT (AU1300_FIRST_INT + 81)
  648. #define AU1300_TOY_MATCH1_INT (AU1300_FIRST_INT + 82)
  649. #define AU1300_TOY_MATCH2_INT (AU1300_FIRST_INT + 83)
  650. #define AU1300_RTC_INT (AU1300_FIRST_INT + 84)
  651. #define AU1300_RTC_MATCH0_INT (AU1300_FIRST_INT + 85)
  652. #define AU1300_RTC_MATCH1_INT (AU1300_FIRST_INT + 86)
  653. #define AU1300_RTC_MATCH2_INT (AU1300_FIRST_INT + 87)
  654. #define AU1300_UART0_INT (AU1300_FIRST_INT + 88)
  655. #define AU1300_SD0_INT (AU1300_FIRST_INT + 89)
  656. #define AU1300_USB_INT (AU1300_FIRST_INT + 90)
  657. #define AU1300_LCD_INT (AU1300_FIRST_INT + 91)
  658. #define AU1300_BSA_INT (AU1300_FIRST_INT + 92)
  659. #define AU1300_MPE_INT (AU1300_FIRST_INT + 93)
  660. #define AU1300_ITE_INT (AU1300_FIRST_INT + 94)
  661. #define AU1300_AES_INT (AU1300_FIRST_INT + 95)
  662. #define AU1300_CIM_INT (AU1300_FIRST_INT + 96)
  663. /**********************************************************************/
  664. /*
  665. * Physical base addresses for integrated peripherals
  666. * 0..au1000 1..au1500 2..au1100 3..au1550 4..au1200 5..au1300
  667. */
  668. #define AU1000_AC97_PHYS_ADDR 0x10000000 /* 012 */
  669. #define AU1300_ROM_PHYS_ADDR 0x10000000 /* 5 */
  670. #define AU1300_OTP_PHYS_ADDR 0x10002000 /* 5 */
  671. #define AU1300_VSS_PHYS_ADDR 0x10003000 /* 5 */
  672. #define AU1300_UART0_PHYS_ADDR 0x10100000 /* 5 */
  673. #define AU1300_UART1_PHYS_ADDR 0x10101000 /* 5 */
  674. #define AU1300_UART2_PHYS_ADDR 0x10102000 /* 5 */
  675. #define AU1300_UART3_PHYS_ADDR 0x10103000 /* 5 */
  676. #define AU1000_USB_OHCI_PHYS_ADDR 0x10100000 /* 012 */
  677. #define AU1000_USB_UDC_PHYS_ADDR 0x10200000 /* 0123 */
  678. #define AU1300_GPIC_PHYS_ADDR 0x10200000 /* 5 */
  679. #define AU1000_IRDA_PHYS_ADDR 0x10300000 /* 02 */
  680. #define AU1200_AES_PHYS_ADDR 0x10300000 /* 45 */
  681. #define AU1000_IC0_PHYS_ADDR 0x10400000 /* 01234 */
  682. #define AU1300_GPU_PHYS_ADDR 0x10500000 /* 5 */
  683. #define AU1000_MAC0_PHYS_ADDR 0x10500000 /* 023 */
  684. #define AU1000_MAC1_PHYS_ADDR 0x10510000 /* 023 */
  685. #define AU1000_MACEN_PHYS_ADDR 0x10520000 /* 023 */
  686. #define AU1100_SD0_PHYS_ADDR 0x10600000 /* 245 */
  687. #define AU1300_SD1_PHYS_ADDR 0x10601000 /* 5 */
  688. #define AU1300_SD2_PHYS_ADDR 0x10602000 /* 5 */
  689. #define AU1100_SD1_PHYS_ADDR 0x10680000 /* 24 */
  690. #define AU1300_SYS_PHYS_ADDR 0x10900000 /* 5 */
  691. #define AU1550_PSC2_PHYS_ADDR 0x10A00000 /* 3 */
  692. #define AU1550_PSC3_PHYS_ADDR 0x10B00000 /* 3 */
  693. #define AU1300_PSC0_PHYS_ADDR 0x10A00000 /* 5 */
  694. #define AU1300_PSC1_PHYS_ADDR 0x10A01000 /* 5 */
  695. #define AU1300_PSC2_PHYS_ADDR 0x10A02000 /* 5 */
  696. #define AU1300_PSC3_PHYS_ADDR 0x10A03000 /* 5 */
  697. #define AU1000_I2S_PHYS_ADDR 0x11000000 /* 02 */
  698. #define AU1500_MAC0_PHYS_ADDR 0x11500000 /* 1 */
  699. #define AU1500_MAC1_PHYS_ADDR 0x11510000 /* 1 */
  700. #define AU1500_MACEN_PHYS_ADDR 0x11520000 /* 1 */
  701. #define AU1000_UART0_PHYS_ADDR 0x11100000 /* 01234 */
  702. #define AU1200_SWCNT_PHYS_ADDR 0x1110010C /* 4 */
  703. #define AU1000_UART1_PHYS_ADDR 0x11200000 /* 0234 */
  704. #define AU1000_UART2_PHYS_ADDR 0x11300000 /* 0 */
  705. #define AU1000_UART3_PHYS_ADDR 0x11400000 /* 0123 */
  706. #define AU1000_SSI0_PHYS_ADDR 0x11600000 /* 02 */
  707. #define AU1000_SSI1_PHYS_ADDR 0x11680000 /* 02 */
  708. #define AU1500_GPIO2_PHYS_ADDR 0x11700000 /* 1234 */
  709. #define AU1000_IC1_PHYS_ADDR 0x11800000 /* 01234 */
  710. #define AU1000_SYS_PHYS_ADDR 0x11900000 /* 012345 */
  711. #define AU1550_PSC0_PHYS_ADDR 0x11A00000 /* 34 */
  712. #define AU1550_PSC1_PHYS_ADDR 0x11B00000 /* 34 */
  713. #define AU1000_MEM_PHYS_ADDR 0x14000000 /* 01234 */
  714. #define AU1000_STATIC_MEM_PHYS_ADDR 0x14001000 /* 01234 */
  715. #define AU1300_UDMA_PHYS_ADDR 0x14001800 /* 5 */
  716. #define AU1000_DMA_PHYS_ADDR 0x14002000 /* 012 */
  717. #define AU1550_DBDMA_PHYS_ADDR 0x14002000 /* 345 */
  718. #define AU1550_DBDMA_CONF_PHYS_ADDR 0x14003000 /* 345 */
  719. #define AU1000_MACDMA0_PHYS_ADDR 0x14004000 /* 0123 */
  720. #define AU1000_MACDMA1_PHYS_ADDR 0x14004200 /* 0123 */
  721. #define AU1200_CIM_PHYS_ADDR 0x14004000 /* 45 */
  722. #define AU1500_PCI_PHYS_ADDR 0x14005000 /* 13 */
  723. #define AU1550_PE_PHYS_ADDR 0x14008000 /* 3 */
  724. #define AU1200_MAEBE_PHYS_ADDR 0x14010000 /* 4 */
  725. #define AU1200_MAEFE_PHYS_ADDR 0x14012000 /* 4 */
  726. #define AU1300_MAEITE_PHYS_ADDR 0x14010000 /* 5 */
  727. #define AU1300_MAEMPE_PHYS_ADDR 0x14014000 /* 5 */
  728. #define AU1550_USB_OHCI_PHYS_ADDR 0x14020000 /* 3 */
  729. #define AU1200_USB_CTL_PHYS_ADDR 0x14020000 /* 4 */
  730. #define AU1200_USB_OTG_PHYS_ADDR 0x14020020 /* 4 */
  731. #define AU1200_USB_OHCI_PHYS_ADDR 0x14020100 /* 4 */
  732. #define AU1200_USB_EHCI_PHYS_ADDR 0x14020200 /* 4 */
  733. #define AU1200_USB_UDC_PHYS_ADDR 0x14022000 /* 4 */
  734. #define AU1300_USB_EHCI_PHYS_ADDR 0x14020000 /* 5 */
  735. #define AU1300_USB_OHCI0_PHYS_ADDR 0x14020400 /* 5 */
  736. #define AU1300_USB_OHCI1_PHYS_ADDR 0x14020800 /* 5 */
  737. #define AU1300_USB_CTL_PHYS_ADDR 0x14021000 /* 5 */
  738. #define AU1300_USB_OTG_PHYS_ADDR 0x14022000 /* 5 */
  739. #define AU1300_MAEBSA_PHYS_ADDR 0x14030000 /* 5 */
  740. #define AU1100_LCD_PHYS_ADDR 0x15000000 /* 2 */
  741. #define AU1200_LCD_PHYS_ADDR 0x15000000 /* 45 */
  742. #define AU1500_PCI_MEM_PHYS_ADDR 0x400000000ULL /* 13 */
  743. #define AU1500_PCI_IO_PHYS_ADDR 0x500000000ULL /* 13 */
  744. #define AU1500_PCI_CONFIG0_PHYS_ADDR 0x600000000ULL /* 13 */
  745. #define AU1500_PCI_CONFIG1_PHYS_ADDR 0x680000000ULL /* 13 */
  746. #define AU1000_PCMCIA_IO_PHYS_ADDR 0xF00000000ULL /* 012345 */
  747. #define AU1000_PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL /* 012345 */
  748. #define AU1000_PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL /* 012345 */
  749. /**********************************************************************/
  750. /*
  751. * Au1300 GPIO+INT controller (GPIC) register offsets and bits
  752. * Registers are 128bits (0x10 bytes), divided into 4 "banks".
  753. */
  754. #define AU1300_GPIC_PINVAL 0x0000
  755. #define AU1300_GPIC_PINVALCLR 0x0010
  756. #define AU1300_GPIC_IPEND 0x0020
  757. #define AU1300_GPIC_PRIENC 0x0030
  758. #define AU1300_GPIC_IEN 0x0040 /* int_mask in manual */
  759. #define AU1300_GPIC_IDIS 0x0050 /* int_maskclr in manual */
  760. #define AU1300_GPIC_DMASEL 0x0060
  761. #define AU1300_GPIC_DEVSEL 0x0080
  762. #define AU1300_GPIC_DEVCLR 0x0090
  763. #define AU1300_GPIC_RSTVAL 0x00a0
  764. /* pin configuration space. one 32bit register for up to 128 IRQs */
  765. #define AU1300_GPIC_PINCFG 0x1000
  766. #define GPIC_GPIO_TO_BIT(gpio) \
  767. (1 << ((gpio) & 0x1f))
  768. #define GPIC_GPIO_BANKOFF(gpio) \
  769. (((gpio) >> 5) * 4)
  770. /* Pin Control bits: who owns the pin, what does it do */
  771. #define GPIC_CFG_PC_GPIN 0
  772. #define GPIC_CFG_PC_DEV 1
  773. #define GPIC_CFG_PC_GPOLOW 2
  774. #define GPIC_CFG_PC_GPOHIGH 3
  775. #define GPIC_CFG_PC_MASK 3
  776. /* assign pin to MIPS IRQ line */
  777. #define GPIC_CFG_IL_SET(x) (((x) & 3) << 2)
  778. #define GPIC_CFG_IL_MASK (3 << 2)
  779. /* pin interrupt type setup */
  780. #define GPIC_CFG_IC_OFF (0 << 4)
  781. #define GPIC_CFG_IC_LEVEL_LOW (1 << 4)
  782. #define GPIC_CFG_IC_LEVEL_HIGH (2 << 4)
  783. #define GPIC_CFG_IC_EDGE_FALL (5 << 4)
  784. #define GPIC_CFG_IC_EDGE_RISE (6 << 4)
  785. #define GPIC_CFG_IC_EDGE_BOTH (7 << 4)
  786. #define GPIC_CFG_IC_MASK (7 << 4)
  787. /* allow interrupt to wake cpu from 'wait' */
  788. #define GPIC_CFG_IDLEWAKE (1 << 7)
  789. /***********************************************************************/
  790. /* Au1000 SDRAM memory controller register offsets */
  791. #define AU1000_MEM_SDMODE0 0x0000
  792. #define AU1000_MEM_SDMODE1 0x0004
  793. #define AU1000_MEM_SDMODE2 0x0008
  794. #define AU1000_MEM_SDADDR0 0x000C
  795. #define AU1000_MEM_SDADDR1 0x0010
  796. #define AU1000_MEM_SDADDR2 0x0014
  797. #define AU1000_MEM_SDREFCFG 0x0018
  798. #define AU1000_MEM_SDPRECMD 0x001C
  799. #define AU1000_MEM_SDAUTOREF 0x0020
  800. #define AU1000_MEM_SDWRMD0 0x0024
  801. #define AU1000_MEM_SDWRMD1 0x0028
  802. #define AU1000_MEM_SDWRMD2 0x002C
  803. #define AU1000_MEM_SDSLEEP 0x0030
  804. #define AU1000_MEM_SDSMCKE 0x0034
  805. /* MEM_SDMODE register content definitions */
  806. #define MEM_SDMODE_F (1 << 22)
  807. #define MEM_SDMODE_SR (1 << 21)
  808. #define MEM_SDMODE_BS (1 << 20)
  809. #define MEM_SDMODE_RS (3 << 18)
  810. #define MEM_SDMODE_CS (7 << 15)
  811. #define MEM_SDMODE_TRAS (15 << 11)
  812. #define MEM_SDMODE_TMRD (3 << 9)
  813. #define MEM_SDMODE_TWR (3 << 7)
  814. #define MEM_SDMODE_TRP (3 << 5)
  815. #define MEM_SDMODE_TRCD (3 << 3)
  816. #define MEM_SDMODE_TCL (7 << 0)
  817. #define MEM_SDMODE_BS_2Bank (0 << 20)
  818. #define MEM_SDMODE_BS_4Bank (1 << 20)
  819. #define MEM_SDMODE_RS_11Row (0 << 18)
  820. #define MEM_SDMODE_RS_12Row (1 << 18)
  821. #define MEM_SDMODE_RS_13Row (2 << 18)
  822. #define MEM_SDMODE_RS_N(N) ((N) << 18)
  823. #define MEM_SDMODE_CS_7Col (0 << 15)
  824. #define MEM_SDMODE_CS_8Col (1 << 15)
  825. #define MEM_SDMODE_CS_9Col (2 << 15)
  826. #define MEM_SDMODE_CS_10Col (3 << 15)
  827. #define MEM_SDMODE_CS_11Col (4 << 15)
  828. #define MEM_SDMODE_CS_N(N) ((N) << 15)
  829. #define MEM_SDMODE_TRAS_N(N) ((N) << 11)
  830. #define MEM_SDMODE_TMRD_N(N) ((N) << 9)
  831. #define MEM_SDMODE_TWR_N(N) ((N) << 7)
  832. #define MEM_SDMODE_TRP_N(N) ((N) << 5)
  833. #define MEM_SDMODE_TRCD_N(N) ((N) << 3)
  834. #define MEM_SDMODE_TCL_N(N) ((N) << 0)
  835. /* MEM_SDADDR register contents definitions */
  836. #define MEM_SDADDR_E (1 << 20)
  837. #define MEM_SDADDR_CSBA (0x03FF << 10)
  838. #define MEM_SDADDR_CSMASK (0x03FF << 0)
  839. #define MEM_SDADDR_CSBA_N(N) ((N) & (0x03FF << 22) >> 12)
  840. #define MEM_SDADDR_CSMASK_N(N) ((N)&(0x03FF << 22) >> 22)
  841. /* MEM_SDREFCFG register content definitions */
  842. #define MEM_SDREFCFG_TRC (15 << 28)
  843. #define MEM_SDREFCFG_TRPM (3 << 26)
  844. #define MEM_SDREFCFG_E (1 << 25)
  845. #define MEM_SDREFCFG_RE (0x1ffffff << 0)
  846. #define MEM_SDREFCFG_TRC_N(N) ((N) << MEM_SDREFCFG_TRC)
  847. #define MEM_SDREFCFG_TRPM_N(N) ((N) << MEM_SDREFCFG_TRPM)
  848. #define MEM_SDREFCFG_REF_N(N) (N)
  849. /* Au1550 SDRAM Register Offsets */
  850. #define AU1550_MEM_SDMODE0 0x0800
  851. #define AU1550_MEM_SDMODE1 0x0808
  852. #define AU1550_MEM_SDMODE2 0x0810
  853. #define AU1550_MEM_SDADDR0 0x0820
  854. #define AU1550_MEM_SDADDR1 0x0828
  855. #define AU1550_MEM_SDADDR2 0x0830
  856. #define AU1550_MEM_SDCONFIGA 0x0840
  857. #define AU1550_MEM_SDCONFIGB 0x0848
  858. #define AU1550_MEM_SDSTAT 0x0850
  859. #define AU1550_MEM_SDERRADDR 0x0858
  860. #define AU1550_MEM_SDSTRIDE0 0x0860
  861. #define AU1550_MEM_SDSTRIDE1 0x0868
  862. #define AU1550_MEM_SDSTRIDE2 0x0870
  863. #define AU1550_MEM_SDWRMD0 0x0880
  864. #define AU1550_MEM_SDWRMD1 0x0888
  865. #define AU1550_MEM_SDWRMD2 0x0890
  866. #define AU1550_MEM_SDPRECMD 0x08C0
  867. #define AU1550_MEM_SDAUTOREF 0x08C8
  868. #define AU1550_MEM_SDSREF 0x08D0
  869. #define AU1550_MEM_SDSLEEP MEM_SDSREF
  870. /* Static Bus Controller */
  871. #define MEM_STCFG0 0xB4001000
  872. #define MEM_STTIME0 0xB4001004
  873. #define MEM_STADDR0 0xB4001008
  874. #define MEM_STCFG1 0xB4001010
  875. #define MEM_STTIME1 0xB4001014
  876. #define MEM_STADDR1 0xB4001018
  877. #define MEM_STCFG2 0xB4001020
  878. #define MEM_STTIME2 0xB4001024
  879. #define MEM_STADDR2 0xB4001028
  880. #define MEM_STCFG3 0xB4001030
  881. #define MEM_STTIME3 0xB4001034
  882. #define MEM_STADDR3 0xB4001038
  883. #define MEM_STNDCTL 0xB4001100
  884. #define MEM_STSTAT 0xB4001104
  885. #define MEM_STNAND_CMD 0x0
  886. #define MEM_STNAND_ADDR 0x4
  887. #define MEM_STNAND_DATA 0x20
  888. /* Programmable Counters 0 and 1 */
  889. #define SYS_BASE 0xB1900000
  890. #define SYS_COUNTER_CNTRL (SYS_BASE + 0x14)
  891. # define SYS_CNTRL_E1S (1 << 23)
  892. # define SYS_CNTRL_T1S (1 << 20)
  893. # define SYS_CNTRL_M21 (1 << 19)
  894. # define SYS_CNTRL_M11 (1 << 18)
  895. # define SYS_CNTRL_M01 (1 << 17)
  896. # define SYS_CNTRL_C1S (1 << 16)
  897. # define SYS_CNTRL_BP (1 << 14)
  898. # define SYS_CNTRL_EN1 (1 << 13)
  899. # define SYS_CNTRL_BT1 (1 << 12)
  900. # define SYS_CNTRL_EN0 (1 << 11)
  901. # define SYS_CNTRL_BT0 (1 << 10)
  902. # define SYS_CNTRL_E0 (1 << 8)
  903. # define SYS_CNTRL_E0S (1 << 7)
  904. # define SYS_CNTRL_32S (1 << 5)
  905. # define SYS_CNTRL_T0S (1 << 4)
  906. # define SYS_CNTRL_M20 (1 << 3)
  907. # define SYS_CNTRL_M10 (1 << 2)
  908. # define SYS_CNTRL_M00 (1 << 1)
  909. # define SYS_CNTRL_C0S (1 << 0)
  910. /* Programmable Counter 0 Registers */
  911. #define SYS_TOYTRIM (SYS_BASE + 0)
  912. #define SYS_TOYWRITE (SYS_BASE + 4)
  913. #define SYS_TOYMATCH0 (SYS_BASE + 8)
  914. #define SYS_TOYMATCH1 (SYS_BASE + 0xC)
  915. #define SYS_TOYMATCH2 (SYS_BASE + 0x10)
  916. #define SYS_TOYREAD (SYS_BASE + 0x40)
  917. /* Programmable Counter 1 Registers */
  918. #define SYS_RTCTRIM (SYS_BASE + 0x44)
  919. #define SYS_RTCWRITE (SYS_BASE + 0x48)
  920. #define SYS_RTCMATCH0 (SYS_BASE + 0x4C)
  921. #define SYS_RTCMATCH1 (SYS_BASE + 0x50)
  922. #define SYS_RTCMATCH2 (SYS_BASE + 0x54)
  923. #define SYS_RTCREAD (SYS_BASE + 0x58)
  924. /* I2S Controller */
  925. #define I2S_DATA 0xB1000000
  926. # define I2S_DATA_MASK 0xffffff
  927. #define I2S_CONFIG 0xB1000004
  928. # define I2S_CONFIG_XU (1 << 25)
  929. # define I2S_CONFIG_XO (1 << 24)
  930. # define I2S_CONFIG_RU (1 << 23)
  931. # define I2S_CONFIG_RO (1 << 22)
  932. # define I2S_CONFIG_TR (1 << 21)
  933. # define I2S_CONFIG_TE (1 << 20)
  934. # define I2S_CONFIG_TF (1 << 19)
  935. # define I2S_CONFIG_RR (1 << 18)
  936. # define I2S_CONFIG_RE (1 << 17)
  937. # define I2S_CONFIG_RF (1 << 16)
  938. # define I2S_CONFIG_PD (1 << 11)
  939. # define I2S_CONFIG_LB (1 << 10)
  940. # define I2S_CONFIG_IC (1 << 9)
  941. # define I2S_CONFIG_FM_BIT 7
  942. # define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT)
  943. # define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT)
  944. # define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT)
  945. # define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT)
  946. # define I2S_CONFIG_TN (1 << 6)
  947. # define I2S_CONFIG_RN (1 << 5)
  948. # define I2S_CONFIG_SZ_BIT 0
  949. # define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT)
  950. #define I2S_CONTROL 0xB1000008
  951. # define I2S_CONTROL_D (1 << 1)
  952. # define I2S_CONTROL_CE (1 << 0)
  953. /* Ethernet Controllers */
  954. /* 4 byte offsets from AU1000_ETH_BASE */
  955. #define MAC_CONTROL 0x0
  956. # define MAC_RX_ENABLE (1 << 2)
  957. # define MAC_TX_ENABLE (1 << 3)
  958. # define MAC_DEF_CHECK (1 << 5)
  959. # define MAC_SET_BL(X) (((X) & 0x3) << 6)
  960. # define MAC_AUTO_PAD (1 << 8)
  961. # define MAC_DISABLE_RETRY (1 << 10)
  962. # define MAC_DISABLE_BCAST (1 << 11)
  963. # define MAC_LATE_COL (1 << 12)
  964. # define MAC_HASH_MODE (1 << 13)
  965. # define MAC_HASH_ONLY (1 << 15)
  966. # define MAC_PASS_ALL (1 << 16)
  967. # define MAC_INVERSE_FILTER (1 << 17)
  968. # define MAC_PROMISCUOUS (1 << 18)
  969. # define MAC_PASS_ALL_MULTI (1 << 19)
  970. # define MAC_FULL_DUPLEX (1 << 20)
  971. # define MAC_NORMAL_MODE 0
  972. # define MAC_INT_LOOPBACK (1 << 21)
  973. # define MAC_EXT_LOOPBACK (1 << 22)
  974. # define MAC_DISABLE_RX_OWN (1 << 23)
  975. # define MAC_BIG_ENDIAN (1 << 30)
  976. # define MAC_RX_ALL (1 << 31)
  977. #define MAC_ADDRESS_HIGH 0x4
  978. #define MAC_ADDRESS_LOW 0x8
  979. #define MAC_MCAST_HIGH 0xC
  980. #define MAC_MCAST_LOW 0x10
  981. #define MAC_MII_CNTRL 0x14
  982. # define MAC_MII_BUSY (1 << 0)
  983. # define MAC_MII_READ 0
  984. # define MAC_MII_WRITE (1 << 1)
  985. # define MAC_SET_MII_SELECT_REG(X) (((X) & 0x1f) << 6)
  986. # define MAC_SET_MII_SELECT_PHY(X) (((X) & 0x1f) << 11)
  987. #define MAC_MII_DATA 0x18
  988. #define MAC_FLOW_CNTRL 0x1C
  989. # define MAC_FLOW_CNTRL_BUSY (1 << 0)
  990. # define MAC_FLOW_CNTRL_ENABLE (1 << 1)
  991. # define MAC_PASS_CONTROL (1 << 2)
  992. # define MAC_SET_PAUSE(X) (((X) & 0xffff) << 16)
  993. #define MAC_VLAN1_TAG 0x20
  994. #define MAC_VLAN2_TAG 0x24
  995. /* Ethernet Controller Enable */
  996. # define MAC_EN_CLOCK_ENABLE (1 << 0)
  997. # define MAC_EN_RESET0 (1 << 1)
  998. # define MAC_EN_TOSS (0 << 2)
  999. # define MAC_EN_CACHEABLE (1 << 3)
  1000. # define MAC_EN_RESET1 (1 << 4)
  1001. # define MAC_EN_RESET2 (1 << 5)
  1002. # define MAC_DMA_RESET (1 << 6)
  1003. /* Ethernet Controller DMA Channels */
  1004. #define MAC0_TX_DMA_ADDR 0xB4004000
  1005. #define MAC1_TX_DMA_ADDR 0xB4004200
  1006. /* offsets from MAC_TX_RING_ADDR address */
  1007. #define MAC_TX_BUFF0_STATUS 0x0
  1008. # define TX_FRAME_ABORTED (1 << 0)
  1009. # define TX_JAB_TIMEOUT (1 << 1)
  1010. # define TX_NO_CARRIER (1 << 2)
  1011. # define TX_LOSS_CARRIER (1 << 3)
  1012. # define TX_EXC_DEF (1 << 4)
  1013. # define TX_LATE_COLL_ABORT (1 << 5)
  1014. # define TX_EXC_COLL (1 << 6)
  1015. # define TX_UNDERRUN (1 << 7)
  1016. # define TX_DEFERRED (1 << 8)
  1017. # define TX_LATE_COLL (1 << 9)
  1018. # define TX_COLL_CNT_MASK (0xF << 10)
  1019. # define TX_PKT_RETRY (1 << 31)
  1020. #define MAC_TX_BUFF0_ADDR 0x4
  1021. # define TX_DMA_ENABLE (1 << 0)
  1022. # define TX_T_DONE (1 << 1)
  1023. # define TX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
  1024. #define MAC_TX_BUFF0_LEN 0x8
  1025. #define MAC_TX_BUFF1_STATUS 0x10
  1026. #define MAC_TX_BUFF1_ADDR 0x14
  1027. #define MAC_TX_BUFF1_LEN 0x18
  1028. #define MAC_TX_BUFF2_STATUS 0x20
  1029. #define MAC_TX_BUFF2_ADDR 0x24
  1030. #define MAC_TX_BUFF2_LEN 0x28
  1031. #define MAC_TX_BUFF3_STATUS 0x30
  1032. #define MAC_TX_BUFF3_ADDR 0x34
  1033. #define MAC_TX_BUFF3_LEN 0x38
  1034. #define MAC0_RX_DMA_ADDR 0xB4004100
  1035. #define MAC1_RX_DMA_ADDR 0xB4004300
  1036. /* offsets from MAC_RX_RING_ADDR */
  1037. #define MAC_RX_BUFF0_STATUS 0x0
  1038. # define RX_FRAME_LEN_MASK 0x3fff
  1039. # define RX_WDOG_TIMER (1 << 14)
  1040. # define RX_RUNT (1 << 15)
  1041. # define RX_OVERLEN (1 << 16)
  1042. # define RX_COLL (1 << 17)
  1043. # define RX_ETHER (1 << 18)
  1044. # define RX_MII_ERROR (1 << 19)
  1045. # define RX_DRIBBLING (1 << 20)
  1046. # define RX_CRC_ERROR (1 << 21)
  1047. # define RX_VLAN1 (1 << 22)
  1048. # define RX_VLAN2 (1 << 23)
  1049. # define RX_LEN_ERROR (1 << 24)
  1050. # define RX_CNTRL_FRAME (1 << 25)
  1051. # define RX_U_CNTRL_FRAME (1 << 26)
  1052. # define RX_MCAST_FRAME (1 << 27)
  1053. # define RX_BCAST_FRAME (1 << 28)
  1054. # define RX_FILTER_FAIL (1 << 29)
  1055. # define RX_PACKET_FILTER (1 << 30)
  1056. # define RX_MISSED_FRAME (1 << 31)
  1057. # define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \
  1058. RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \
  1059. RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME)
  1060. #define MAC_RX_BUFF0_ADDR 0x4
  1061. # define RX_DMA_ENABLE (1 << 0)
  1062. # define RX_T_DONE (1 << 1)
  1063. # define RX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
  1064. # define RX_SET_BUFF_ADDR(X) ((X) & 0xffffffc0)
  1065. #define MAC_RX_BUFF1_STATUS 0x10
  1066. #define MAC_RX_BUFF1_ADDR 0x14
  1067. #define MAC_RX_BUFF2_STATUS 0x20
  1068. #define MAC_RX_BUFF2_ADDR 0x24
  1069. #define MAC_RX_BUFF3_STATUS 0x30
  1070. #define MAC_RX_BUFF3_ADDR 0x34
  1071. #define UART_RX 0 /* Receive buffer */
  1072. #define UART_TX 4 /* Transmit buffer */
  1073. #define UART_IER 8 /* Interrupt Enable Register */
  1074. #define UART_IIR 0xC /* Interrupt ID Register */
  1075. #define UART_FCR 0x10 /* FIFO Control Register */
  1076. #define UART_LCR 0x14 /* Line Control Register */
  1077. #define UART_MCR 0x18 /* Modem Control Register */
  1078. #define UART_LSR 0x1C /* Line Status Register */
  1079. #define UART_MSR 0x20 /* Modem Status Register */
  1080. #define UART_CLK 0x28 /* Baud Rate Clock Divider */
  1081. #define UART_MOD_CNTRL 0x100 /* Module Control */
  1082. /* SSIO */
  1083. #define SSI0_STATUS 0xB1600000
  1084. # define SSI_STATUS_BF (1 << 4)
  1085. # define SSI_STATUS_OF (1 << 3)
  1086. # define SSI_STATUS_UF (1 << 2)
  1087. # define SSI_STATUS_D (1 << 1)
  1088. # define SSI_STATUS_B (1 << 0)
  1089. #define SSI0_INT 0xB1600004
  1090. # define SSI_INT_OI (1 << 3)
  1091. # define SSI_INT_UI (1 << 2)
  1092. # define SSI_INT_DI (1 << 1)
  1093. #define SSI0_INT_ENABLE 0xB1600008
  1094. # define SSI_INTE_OIE (1 << 3)
  1095. # define SSI_INTE_UIE (1 << 2)
  1096. # define SSI_INTE_DIE (1 << 1)
  1097. #define SSI0_CONFIG 0xB1600020
  1098. # define SSI_CONFIG_AO (1 << 24)
  1099. # define SSI_CONFIG_DO (1 << 23)
  1100. # define SSI_CONFIG_ALEN_BIT 20
  1101. # define SSI_CONFIG_ALEN_MASK (0x7 << 20)
  1102. # define SSI_CONFIG_DLEN_BIT 16
  1103. # define SSI_CONFIG_DLEN_MASK (0x7 << 16)
  1104. # define SSI_CONFIG_DD (1 << 11)
  1105. # define SSI_CONFIG_AD (1 << 10)
  1106. # define SSI_CONFIG_BM_BIT 8
  1107. # define SSI_CONFIG_BM_MASK (0x3 << 8)
  1108. # define SSI_CONFIG_CE (1 << 7)
  1109. # define SSI_CONFIG_DP (1 << 6)
  1110. # define SSI_CONFIG_DL (1 << 5)
  1111. # define SSI_CONFIG_EP (1 << 4)
  1112. #define SSI0_ADATA 0xB1600024
  1113. # define SSI_AD_D (1 << 24)
  1114. # define SSI_AD_ADDR_BIT 16
  1115. # define SSI_AD_ADDR_MASK (0xff << 16)
  1116. # define SSI_AD_DATA_BIT 0
  1117. # define SSI_AD_DATA_MASK (0xfff << 0)
  1118. #define SSI0_CLKDIV 0xB1600028
  1119. #define SSI0_CONTROL 0xB1600100
  1120. # define SSI_CONTROL_CD (1 << 1)
  1121. # define SSI_CONTROL_E (1 << 0)
  1122. /* SSI1 */
  1123. #define SSI1_STATUS 0xB1680000
  1124. #define SSI1_INT 0xB1680004
  1125. #define SSI1_INT_ENABLE 0xB1680008
  1126. #define SSI1_CONFIG 0xB1680020
  1127. #define SSI1_ADATA 0xB1680024
  1128. #define SSI1_CLKDIV 0xB1680028
  1129. #define SSI1_ENABLE 0xB1680100
  1130. /*
  1131. * Register content definitions
  1132. */
  1133. #define SSI_STATUS_BF (1 << 4)
  1134. #define SSI_STATUS_OF (1 << 3)
  1135. #define SSI_STATUS_UF (1 << 2)
  1136. #define SSI_STATUS_D (1 << 1)
  1137. #define SSI_STATUS_B (1 << 0)
  1138. /* SSI_INT */
  1139. #define SSI_INT_OI (1 << 3)
  1140. #define SSI_INT_UI (1 << 2)
  1141. #define SSI_INT_DI (1 << 1)
  1142. /* SSI_INTEN */
  1143. #define SSI_INTEN_OIE (1 << 3)
  1144. #define SSI_INTEN_UIE (1 << 2)
  1145. #define SSI_INTEN_DIE (1 << 1)
  1146. #define SSI_CONFIG_AO (1 << 24)
  1147. #define SSI_CONFIG_DO (1 << 23)
  1148. #define SSI_CONFIG_ALEN (7 << 20)
  1149. #define SSI_CONFIG_DLEN (15 << 16)
  1150. #define SSI_CONFIG_DD (1 << 11)
  1151. #define SSI_CONFIG_AD (1 << 10)
  1152. #define SSI_CONFIG_BM (3 << 8)
  1153. #define SSI_CONFIG_CE (1 << 7)
  1154. #define SSI_CONFIG_DP (1 << 6)
  1155. #define SSI_CONFIG_DL (1 << 5)
  1156. #define SSI_CONFIG_EP (1 << 4)
  1157. #define SSI_CONFIG_ALEN_N(N) ((N-1) << 20)
  1158. #define SSI_CONFIG_DLEN_N(N) ((N-1) << 16)
  1159. #define SSI_CONFIG_BM_HI (0 << 8)
  1160. #define SSI_CONFIG_BM_LO (1 << 8)
  1161. #define SSI_CONFIG_BM_CY (2 << 8)
  1162. #define SSI_ADATA_D (1 << 24)
  1163. #define SSI_ADATA_ADDR (0xFF << 16)
  1164. #define SSI_ADATA_DATA 0x0FFF
  1165. #define SSI_ADATA_ADDR_N(N) (N << 16)
  1166. #define SSI_ENABLE_CD (1 << 1)
  1167. #define SSI_ENABLE_E (1 << 0)
  1168. /*
  1169. * The IrDA peripheral has an IRFIRSEL pin, but on the DB/PB boards it's not
  1170. * used to select FIR/SIR mode on the transceiver but as a GPIO. Instead a
  1171. * CPLD has to be told about the mode.
  1172. */
  1173. #define AU1000_IRDA_PHY_MODE_OFF 0
  1174. #define AU1000_IRDA_PHY_MODE_SIR 1
  1175. #define AU1000_IRDA_PHY_MODE_FIR 2
  1176. struct au1k_irda_platform_data {
  1177. void(*set_phy_mode)(int mode);
  1178. };
  1179. /* GPIO */
  1180. #define SYS_PINFUNC 0xB190002C
  1181. # define SYS_PF_USB (1 << 15) /* 2nd USB device/host */
  1182. # define SYS_PF_U3 (1 << 14) /* GPIO23/U3TXD */
  1183. # define SYS_PF_U2 (1 << 13) /* GPIO22/U2TXD */
  1184. # define SYS_PF_U1 (1 << 12) /* GPIO21/U1TXD */
  1185. # define SYS_PF_SRC (1 << 11) /* GPIO6/SROMCKE */
  1186. # define SYS_PF_CK5 (1 << 10) /* GPIO3/CLK5 */
  1187. # define SYS_PF_CK4 (1 << 9) /* GPIO2/CLK4 */
  1188. # define SYS_PF_IRF (1 << 8) /* GPIO15/IRFIRSEL */
  1189. # define SYS_PF_UR3 (1 << 7) /* GPIO[14:9]/UART3 */
  1190. # define SYS_PF_I2D (1 << 6) /* GPIO8/I2SDI */
  1191. # define SYS_PF_I2S (1 << 5) /* I2S/GPIO[29:31] */
  1192. # define SYS_PF_NI2 (1 << 4) /* NI2/GPIO[24:28] */
  1193. # define SYS_PF_U0 (1 << 3) /* U0TXD/GPIO20 */
  1194. # define SYS_PF_RD (1 << 2) /* IRTXD/GPIO19 */
  1195. # define SYS_PF_A97 (1 << 1) /* AC97/SSL1 */
  1196. # define SYS_PF_S0 (1 << 0) /* SSI_0/GPIO[16:18] */
  1197. /* Au1100 only */
  1198. # define SYS_PF_PC (1 << 18) /* PCMCIA/GPIO[207:204] */
  1199. # define SYS_PF_LCD (1 << 17) /* extern lcd/GPIO[203:200] */
  1200. # define SYS_PF_CS (1 << 16) /* EXTCLK0/32KHz to gpio2 */
  1201. # define SYS_PF_EX0 (1 << 9) /* GPIO2/clock */
  1202. /* Au1550 only. Redefines lots of pins */
  1203. # define SYS_PF_PSC2_MASK (7 << 17)
  1204. # define SYS_PF_PSC2_AC97 0
  1205. # define SYS_PF_PSC2_SPI 0
  1206. # define SYS_PF_PSC2_I2S (1 << 17)
  1207. # define SYS_PF_PSC2_SMBUS (3 << 17)
  1208. # define SYS_PF_PSC2_GPIO (7 << 17)
  1209. # define SYS_PF_PSC3_MASK (7 << 20)
  1210. # define SYS_PF_PSC3_AC97 0
  1211. # define SYS_PF_PSC3_SPI 0
  1212. # define SYS_PF_PSC3_I2S (1 << 20)
  1213. # define SYS_PF_PSC3_SMBUS (3 << 20)
  1214. # define SYS_PF_PSC3_GPIO (7 << 20)
  1215. # define SYS_PF_PSC1_S1 (1 << 1)
  1216. # define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2))
  1217. /* Au1200 only */
  1218. #define SYS_PINFUNC_DMA (1 << 31)
  1219. #define SYS_PINFUNC_S0A (1 << 30)
  1220. #define SYS_PINFUNC_S1A (1 << 29)
  1221. #define SYS_PINFUNC_LP0 (1 << 28)
  1222. #define SYS_PINFUNC_LP1 (1 << 27)
  1223. #define SYS_PINFUNC_LD16 (1 << 26)
  1224. #define SYS_PINFUNC_LD8 (1 << 25)
  1225. #define SYS_PINFUNC_LD1 (1 << 24)
  1226. #define SYS_PINFUNC_LD0 (1 << 23)
  1227. #define SYS_PINFUNC_P1A (3 << 21)
  1228. #define SYS_PINFUNC_P1B (1 << 20)
  1229. #define SYS_PINFUNC_FS3 (1 << 19)
  1230. #define SYS_PINFUNC_P0A (3 << 17)
  1231. #define SYS_PINFUNC_CS (1 << 16)
  1232. #define SYS_PINFUNC_CIM (1 << 15)
  1233. #define SYS_PINFUNC_P1C (1 << 14)
  1234. #define SYS_PINFUNC_U1T (1 << 12)
  1235. #define SYS_PINFUNC_U1R (1 << 11)
  1236. #define SYS_PINFUNC_EX1 (1 << 10)
  1237. #define SYS_PINFUNC_EX0 (1 << 9)
  1238. #define SYS_PINFUNC_U0R (1 << 8)
  1239. #define SYS_PINFUNC_MC (1 << 7)
  1240. #define SYS_PINFUNC_S0B (1 << 6)
  1241. #define SYS_PINFUNC_S0C (1 << 5)
  1242. #define SYS_PINFUNC_P0B (1 << 4)
  1243. #define SYS_PINFUNC_U0T (1 << 3)
  1244. #define SYS_PINFUNC_S1B (1 << 2)
  1245. /* Power Management */
  1246. #define SYS_SCRATCH0 0xB1900018
  1247. #define SYS_SCRATCH1 0xB190001C
  1248. #define SYS_WAKEMSK 0xB1900034
  1249. #define SYS_ENDIAN 0xB1900038
  1250. #define SYS_POWERCTRL 0xB190003C
  1251. #define SYS_WAKESRC 0xB190005C
  1252. #define SYS_SLPPWR 0xB1900078
  1253. #define SYS_SLEEP 0xB190007C
  1254. #define SYS_WAKEMSK_D2 (1 << 9)
  1255. #define SYS_WAKEMSK_M2 (1 << 8)
  1256. #define SYS_WAKEMSK_GPIO(x) (1 << (x))
  1257. /* Clock Controller */
  1258. #define SYS_FREQCTRL0 0xB1900020
  1259. # define SYS_FC_FRDIV2_BIT 22
  1260. # define SYS_FC_FRDIV2_MASK (0xff << SYS_FC_FRDIV2_BIT)
  1261. # define SYS_FC_FE2 (1 << 21)
  1262. # define SYS_FC_FS2 (1 << 20)
  1263. # define SYS_FC_FRDIV1_BIT 12
  1264. # define SYS_FC_FRDIV1_MASK (0xff << SYS_FC_FRDIV1_BIT)
  1265. # define SYS_FC_FE1 (1 << 11)
  1266. # define SYS_FC_FS1 (1 << 10)
  1267. # define SYS_FC_FRDIV0_BIT 2
  1268. # define SYS_FC_FRDIV0_MASK (0xff << SYS_FC_FRDIV0_BIT)
  1269. # define SYS_FC_FE0 (1 << 1)
  1270. # define SYS_FC_FS0 (1 << 0)
  1271. #define SYS_FREQCTRL1 0xB1900024
  1272. # define SYS_FC_FRDIV5_BIT 22
  1273. # define SYS_FC_FRDIV5_MASK (0xff << SYS_FC_FRDIV5_BIT)
  1274. # define SYS_FC_FE5 (1 << 21)
  1275. # define SYS_FC_FS5 (1 << 20)
  1276. # define SYS_FC_FRDIV4_BIT 12
  1277. # define SYS_FC_FRDIV4_MASK (0xff << SYS_FC_FRDIV4_BIT)
  1278. # define SYS_FC_FE4 (1 << 11)
  1279. # define SYS_FC_FS4 (1 << 10)
  1280. # define SYS_FC_FRDIV3_BIT 2
  1281. # define SYS_FC_FRDIV3_MASK (0xff << SYS_FC_FRDIV3_BIT)
  1282. # define SYS_FC_FE3 (1 << 1)
  1283. # define SYS_FC_FS3 (1 << 0)
  1284. #define SYS_CLKSRC 0xB1900028
  1285. # define SYS_CS_ME1_BIT 27
  1286. # define SYS_CS_ME1_MASK (0x7 << SYS_CS_ME1_BIT)
  1287. # define SYS_CS_DE1 (1 << 26)
  1288. # define SYS_CS_CE1 (1 << 25)
  1289. # define SYS_CS_ME0_BIT 22
  1290. # define SYS_CS_ME0_MASK (0x7 << SYS_CS_ME0_BIT)
  1291. # define SYS_CS_DE0 (1 << 21)
  1292. # define SYS_CS_CE0 (1 << 20)
  1293. # define SYS_CS_MI2_BIT 17
  1294. # define SYS_CS_MI2_MASK (0x7 << SYS_CS_MI2_BIT)
  1295. # define SYS_CS_DI2 (1 << 16)
  1296. # define SYS_CS_CI2 (1 << 15)
  1297. # define SYS_CS_ML_BIT 7
  1298. # define SYS_CS_ML_MASK (0x7 << SYS_CS_ML_BIT)
  1299. # define SYS_CS_DL (1 << 6)
  1300. # define SYS_CS_CL (1 << 5)
  1301. # define SYS_CS_MUH_BIT 12
  1302. # define SYS_CS_MUH_MASK (0x7 << SYS_CS_MUH_BIT)
  1303. # define SYS_CS_DUH (1 << 11)
  1304. # define SYS_CS_CUH (1 << 10)
  1305. # define SYS_CS_MUD_BIT 7
  1306. # define SYS_CS_MUD_MASK (0x7 << SYS_CS_MUD_BIT)
  1307. # define SYS_CS_DUD (1 << 6)
  1308. # define SYS_CS_CUD (1 << 5)
  1309. # define SYS_CS_MIR_BIT 2
  1310. # define SYS_CS_MIR_MASK (0x7 << SYS_CS_MIR_BIT)
  1311. # define SYS_CS_DIR (1 << 1)
  1312. # define SYS_CS_CIR (1 << 0)
  1313. # define SYS_CS_MUX_AUX 0x1
  1314. # define SYS_CS_MUX_FQ0 0x2
  1315. # define SYS_CS_MUX_FQ1 0x3
  1316. # define SYS_CS_MUX_FQ2 0x4
  1317. # define SYS_CS_MUX_FQ3 0x5
  1318. # define SYS_CS_MUX_FQ4 0x6
  1319. # define SYS_CS_MUX_FQ5 0x7
  1320. #define SYS_CPUPLL 0xB1900060
  1321. #define SYS_AUXPLL 0xB1900064
  1322. /* AC97 Controller */
  1323. #define AC97C_CONFIG 0xB0000000
  1324. # define AC97C_RECV_SLOTS_BIT 13
  1325. # define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT)
  1326. # define AC97C_XMIT_SLOTS_BIT 3
  1327. # define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT)
  1328. # define AC97C_SG (1 << 2)
  1329. # define AC97C_SYNC (1 << 1)
  1330. # define AC97C_RESET (1 << 0)
  1331. #define AC97C_STATUS 0xB0000004
  1332. # define AC97C_XU (1 << 11)
  1333. # define AC97C_XO (1 << 10)
  1334. # define AC97C_RU (1 << 9)
  1335. # define AC97C_RO (1 << 8)
  1336. # define AC97C_READY (1 << 7)
  1337. # define AC97C_CP (1 << 6)
  1338. # define AC97C_TR (1 << 5)
  1339. # define AC97C_TE (1 << 4)
  1340. # define AC97C_TF (1 << 3)
  1341. # define AC97C_RR (1 << 2)
  1342. # define AC97C_RE (1 << 1)
  1343. # define AC97C_RF (1 << 0)
  1344. #define AC97C_DATA 0xB0000008
  1345. #define AC97C_CMD 0xB000000C
  1346. # define AC97C_WD_BIT 16
  1347. # define AC97C_READ (1 << 7)
  1348. # define AC97C_INDEX_MASK 0x7f
  1349. #define AC97C_CNTRL 0xB0000010
  1350. # define AC97C_RS (1 << 1)
  1351. # define AC97C_CE (1 << 0)
  1352. /* The PCI chip selects are outside the 32bit space, and since we can't
  1353. * just program the 36bit addresses into BARs, we have to take a chunk
  1354. * out of the 32bit space and reserve it for PCI. When these addresses
  1355. * are ioremap()ed, they'll be fixed up to the real 36bit address before
  1356. * being passed to the real ioremap function.
  1357. */
  1358. #define ALCHEMY_PCI_MEMWIN_START (AU1500_PCI_MEM_PHYS_ADDR >> 4)
  1359. #define ALCHEMY_PCI_MEMWIN_END (ALCHEMY_PCI_MEMWIN_START + 0x0FFFFFFF)
  1360. /* for PCI IO it's simpler because we get to do the ioremap ourselves and then
  1361. * adjust the device's resources.
  1362. */
  1363. #define ALCHEMY_PCI_IOWIN_START 0x00001000
  1364. #define ALCHEMY_PCI_IOWIN_END 0x0000FFFF
  1365. #ifdef CONFIG_PCI
  1366. #define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */
  1367. #define IOPORT_RESOURCE_END 0xffffffff
  1368. #define IOMEM_RESOURCE_START 0x10000000
  1369. #define IOMEM_RESOURCE_END 0xfffffffffULL
  1370. #else
  1371. /* Don't allow any legacy ports probing */
  1372. #define IOPORT_RESOURCE_START 0x10000000
  1373. #define IOPORT_RESOURCE_END 0xffffffff
  1374. #define IOMEM_RESOURCE_START 0x10000000
  1375. #define IOMEM_RESOURCE_END 0xfffffffffULL
  1376. #endif
  1377. /* PCI controller block register offsets */
  1378. #define PCI_REG_CMEM 0x0000
  1379. #define PCI_REG_CONFIG 0x0004
  1380. #define PCI_REG_B2BMASK_CCH 0x0008
  1381. #define PCI_REG_B2BBASE0_VID 0x000C
  1382. #define PCI_REG_B2BBASE1_SID 0x0010
  1383. #define PCI_REG_MWMASK_DEV 0x0014
  1384. #define PCI_REG_MWBASE_REV_CCL 0x0018
  1385. #define PCI_REG_ERR_ADDR 0x001C
  1386. #define PCI_REG_SPEC_INTACK 0x0020
  1387. #define PCI_REG_ID 0x0100
  1388. #define PCI_REG_STATCMD 0x0104
  1389. #define PCI_REG_CLASSREV 0x0108
  1390. #define PCI_REG_PARAM 0x010C
  1391. #define PCI_REG_MBAR 0x0110
  1392. #define PCI_REG_TIMEOUT 0x0140
  1393. /* PCI controller block register bits */
  1394. #define PCI_CMEM_E (1 << 28) /* enable cacheable memory */
  1395. #define PCI_CMEM_CMBASE(x) (((x) & 0x3fff) << 14)
  1396. #define PCI_CMEM_CMMASK(x) ((x) & 0x3fff)
  1397. #define PCI_CONFIG_ERD (1 << 27) /* pci error during R/W */
  1398. #define PCI_CONFIG_ET (1 << 26) /* error in target mode */
  1399. #define PCI_CONFIG_EF (1 << 25) /* fatal error */
  1400. #define PCI_CONFIG_EP (1 << 24) /* parity error */
  1401. #define PCI_CONFIG_EM (1 << 23) /* multiple errors */
  1402. #define PCI_CONFIG_BM (1 << 22) /* bad master error */
  1403. #define PCI_CONFIG_PD (1 << 20) /* PCI Disable */
  1404. #define PCI_CONFIG_BME (1 << 19) /* Byte Mask Enable for reads */
  1405. #define PCI_CONFIG_NC (1 << 16) /* mark mem access non-coherent */
  1406. #define PCI_CONFIG_IA (1 << 15) /* INTA# enabled (target mode) */
  1407. #define PCI_CONFIG_IP (1 << 13) /* int on PCI_PERR# */
  1408. #define PCI_CONFIG_IS (1 << 12) /* int on PCI_SERR# */
  1409. #define PCI_CONFIG_IMM (1 << 11) /* int on master abort */
  1410. #define PCI_CONFIG_ITM (1 << 10) /* int on target abort (as master) */
  1411. #define PCI_CONFIG_ITT (1 << 9) /* int on target abort (as target) */
  1412. #define PCI_CONFIG_IPB (1 << 8) /* int on PERR# in bus master acc */
  1413. #define PCI_CONFIG_SIC_NO (0 << 6) /* no byte mask changes */
  1414. #define PCI_CONFIG_SIC_BA_ADR (1 << 6) /* on byte/hw acc, invert adr bits */
  1415. #define PCI_CONFIG_SIC_HWA_DAT (2 << 6) /* on halfword acc, swap data */
  1416. #define PCI_CONFIG_SIC_ALL (3 << 6) /* swap data bytes on all accesses */
  1417. #define PCI_CONFIG_ST (1 << 5) /* swap data by target transactions */
  1418. #define PCI_CONFIG_SM (1 << 4) /* swap data from PCI ctl */
  1419. #define PCI_CONFIG_AEN (1 << 3) /* enable internal arbiter */
  1420. #define PCI_CONFIG_R2H (1 << 2) /* REQ2# to hi-prio arbiter */
  1421. #define PCI_CONFIG_R1H (1 << 1) /* REQ1# to hi-prio arbiter */
  1422. #define PCI_CONFIG_CH (1 << 0) /* PCI ctl to hi-prio arbiter */
  1423. #define PCI_B2BMASK_B2BMASK(x) (((x) & 0xffff) << 16)
  1424. #define PCI_B2BMASK_CCH(x) ((x) & 0xffff) /* 16 upper bits of class code */
  1425. #define PCI_B2BBASE0_VID_B0(x) (((x) & 0xffff) << 16)
  1426. #define PCI_B2BBASE0_VID_SV(x) ((x) & 0xffff)
  1427. #define PCI_B2BBASE1_SID_B1(x) (((x) & 0xffff) << 16)
  1428. #define PCI_B2BBASE1_SID_SI(x) ((x) & 0xffff)
  1429. #define PCI_MWMASKDEV_MWMASK(x) (((x) & 0xffff) << 16)
  1430. #define PCI_MWMASKDEV_DEVID(x) ((x) & 0xffff)
  1431. #define PCI_MWBASEREVCCL_BASE(x) (((x) & 0xffff) << 16)
  1432. #define PCI_MWBASEREVCCL_REV(x) (((x) & 0xff) << 8)
  1433. #define PCI_MWBASEREVCCL_CCL(x) ((x) & 0xff)
  1434. #define PCI_ID_DID(x) (((x) & 0xffff) << 16)
  1435. #define PCI_ID_VID(x) ((x) & 0xffff)
  1436. #define PCI_STATCMD_STATUS(x) (((x) & 0xffff) << 16)
  1437. #define PCI_STATCMD_CMD(x) ((x) & 0xffff)
  1438. #define PCI_CLASSREV_CLASS(x) (((x) & 0x00ffffff) << 8)
  1439. #define PCI_CLASSREV_REV(x) ((x) & 0xff)
  1440. #define PCI_PARAM_BIST(x) (((x) & 0xff) << 24)
  1441. #define PCI_PARAM_HT(x) (((x) & 0xff) << 16)
  1442. #define PCI_PARAM_LT(x) (((x) & 0xff) << 8)
  1443. #define PCI_PARAM_CLS(x) ((x) & 0xff)
  1444. #define PCI_TIMEOUT_RETRIES(x) (((x) & 0xff) << 8) /* max retries */
  1445. #define PCI_TIMEOUT_TO(x) ((x) & 0xff) /* target ready timeout */
  1446. #endif