au1000.h 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764
  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. /* arch/mips/au1000/common/clocks.c */
  79. extern void set_au1x00_speed(unsigned int new_freq);
  80. extern unsigned int get_au1x00_speed(void);
  81. extern void set_au1x00_uart_baud_base(unsigned long new_baud_base);
  82. extern unsigned long get_au1x00_uart_baud_base(void);
  83. extern void set_au1x00_lcd_clock(void);
  84. extern unsigned int get_au1x00_lcd_clock(void);
  85. /*
  86. * Every board describes its IRQ mapping with this table.
  87. */
  88. struct au1xxx_irqmap {
  89. int im_irq;
  90. int im_type;
  91. int im_request;
  92. };
  93. /* core calls this function to let boards initialize other IRQ sources */
  94. void board_init_irq(void);
  95. /* boards call this to register additional (GPIO) interrupts */
  96. void au1xxx_setup_irqmap(struct au1xxx_irqmap *map, int count);
  97. #endif /* !defined (_LANGUAGE_ASSEMBLY) */
  98. /*
  99. * SDRAM register offsets
  100. */
  101. #if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || \
  102. defined(CONFIG_SOC_AU1100)
  103. #define MEM_SDMODE0 0x0000
  104. #define MEM_SDMODE1 0x0004
  105. #define MEM_SDMODE2 0x0008
  106. #define MEM_SDADDR0 0x000C
  107. #define MEM_SDADDR1 0x0010
  108. #define MEM_SDADDR2 0x0014
  109. #define MEM_SDREFCFG 0x0018
  110. #define MEM_SDPRECMD 0x001C
  111. #define MEM_SDAUTOREF 0x0020
  112. #define MEM_SDWRMD0 0x0024
  113. #define MEM_SDWRMD1 0x0028
  114. #define MEM_SDWRMD2 0x002C
  115. #define MEM_SDSLEEP 0x0030
  116. #define MEM_SDSMCKE 0x0034
  117. /*
  118. * MEM_SDMODE register content definitions
  119. */
  120. #define MEM_SDMODE_F (1 << 22)
  121. #define MEM_SDMODE_SR (1 << 21)
  122. #define MEM_SDMODE_BS (1 << 20)
  123. #define MEM_SDMODE_RS (3 << 18)
  124. #define MEM_SDMODE_CS (7 << 15)
  125. #define MEM_SDMODE_TRAS (15 << 11)
  126. #define MEM_SDMODE_TMRD (3 << 9)
  127. #define MEM_SDMODE_TWR (3 << 7)
  128. #define MEM_SDMODE_TRP (3 << 5)
  129. #define MEM_SDMODE_TRCD (3 << 3)
  130. #define MEM_SDMODE_TCL (7 << 0)
  131. #define MEM_SDMODE_BS_2Bank (0 << 20)
  132. #define MEM_SDMODE_BS_4Bank (1 << 20)
  133. #define MEM_SDMODE_RS_11Row (0 << 18)
  134. #define MEM_SDMODE_RS_12Row (1 << 18)
  135. #define MEM_SDMODE_RS_13Row (2 << 18)
  136. #define MEM_SDMODE_RS_N(N) ((N) << 18)
  137. #define MEM_SDMODE_CS_7Col (0 << 15)
  138. #define MEM_SDMODE_CS_8Col (1 << 15)
  139. #define MEM_SDMODE_CS_9Col (2 << 15)
  140. #define MEM_SDMODE_CS_10Col (3 << 15)
  141. #define MEM_SDMODE_CS_11Col (4 << 15)
  142. #define MEM_SDMODE_CS_N(N) ((N) << 15)
  143. #define MEM_SDMODE_TRAS_N(N) ((N) << 11)
  144. #define MEM_SDMODE_TMRD_N(N) ((N) << 9)
  145. #define MEM_SDMODE_TWR_N(N) ((N) << 7)
  146. #define MEM_SDMODE_TRP_N(N) ((N) << 5)
  147. #define MEM_SDMODE_TRCD_N(N) ((N) << 3)
  148. #define MEM_SDMODE_TCL_N(N) ((N) << 0)
  149. /*
  150. * MEM_SDADDR register contents definitions
  151. */
  152. #define MEM_SDADDR_E (1 << 20)
  153. #define MEM_SDADDR_CSBA (0x03FF << 10)
  154. #define MEM_SDADDR_CSMASK (0x03FF << 0)
  155. #define MEM_SDADDR_CSBA_N(N) ((N) & (0x03FF << 22) >> 12)
  156. #define MEM_SDADDR_CSMASK_N(N) ((N)&(0x03FF << 22) >> 22)
  157. /*
  158. * MEM_SDREFCFG register content definitions
  159. */
  160. #define MEM_SDREFCFG_TRC (15 << 28)
  161. #define MEM_SDREFCFG_TRPM (3 << 26)
  162. #define MEM_SDREFCFG_E (1 << 25)
  163. #define MEM_SDREFCFG_RE (0x1ffffff << 0)
  164. #define MEM_SDREFCFG_TRC_N(N) ((N) << MEM_SDREFCFG_TRC)
  165. #define MEM_SDREFCFG_TRPM_N(N) ((N) << MEM_SDREFCFG_TRPM)
  166. #define MEM_SDREFCFG_REF_N(N) (N)
  167. #endif
  168. /***********************************************************************/
  169. /*
  170. * Au1550 SDRAM Register Offsets
  171. */
  172. /***********************************************************************/
  173. #if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
  174. #define MEM_SDMODE0 0x0800
  175. #define MEM_SDMODE1 0x0808
  176. #define MEM_SDMODE2 0x0810
  177. #define MEM_SDADDR0 0x0820
  178. #define MEM_SDADDR1 0x0828
  179. #define MEM_SDADDR2 0x0830
  180. #define MEM_SDCONFIGA 0x0840
  181. #define MEM_SDCONFIGB 0x0848
  182. #define MEM_SDSTAT 0x0850
  183. #define MEM_SDERRADDR 0x0858
  184. #define MEM_SDSTRIDE0 0x0860
  185. #define MEM_SDSTRIDE1 0x0868
  186. #define MEM_SDSTRIDE2 0x0870
  187. #define MEM_SDWRMD0 0x0880
  188. #define MEM_SDWRMD1 0x0888
  189. #define MEM_SDWRMD2 0x0890
  190. #define MEM_SDPRECMD 0x08C0
  191. #define MEM_SDAUTOREF 0x08C8
  192. #define MEM_SDSREF 0x08D0
  193. #define MEM_SDSLEEP MEM_SDSREF
  194. #endif
  195. /*
  196. * Physical base addresses for integrated peripherals
  197. */
  198. #ifdef CONFIG_SOC_AU1000
  199. #define MEM_PHYS_ADDR 0x14000000
  200. #define STATIC_MEM_PHYS_ADDR 0x14001000
  201. #define DMA0_PHYS_ADDR 0x14002000
  202. #define DMA1_PHYS_ADDR 0x14002100
  203. #define DMA2_PHYS_ADDR 0x14002200
  204. #define DMA3_PHYS_ADDR 0x14002300
  205. #define DMA4_PHYS_ADDR 0x14002400
  206. #define DMA5_PHYS_ADDR 0x14002500
  207. #define DMA6_PHYS_ADDR 0x14002600
  208. #define DMA7_PHYS_ADDR 0x14002700
  209. #define IC0_PHYS_ADDR 0x10400000
  210. #define IC1_PHYS_ADDR 0x11800000
  211. #define AC97_PHYS_ADDR 0x10000000
  212. #define USBH_PHYS_ADDR 0x10100000
  213. #define USBD_PHYS_ADDR 0x10200000
  214. #define IRDA_PHYS_ADDR 0x10300000
  215. #define MAC0_PHYS_ADDR 0x10500000
  216. #define MAC1_PHYS_ADDR 0x10510000
  217. #define MACEN_PHYS_ADDR 0x10520000
  218. #define MACDMA0_PHYS_ADDR 0x14004000
  219. #define MACDMA1_PHYS_ADDR 0x14004200
  220. #define I2S_PHYS_ADDR 0x11000000
  221. #define UART0_PHYS_ADDR 0x11100000
  222. #define UART1_PHYS_ADDR 0x11200000
  223. #define UART2_PHYS_ADDR 0x11300000
  224. #define UART3_PHYS_ADDR 0x11400000
  225. #define SSI0_PHYS_ADDR 0x11600000
  226. #define SSI1_PHYS_ADDR 0x11680000
  227. #define SYS_PHYS_ADDR 0x11900000
  228. #define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
  229. #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
  230. #define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
  231. #endif
  232. /********************************************************************/
  233. #ifdef CONFIG_SOC_AU1500
  234. #define MEM_PHYS_ADDR 0x14000000
  235. #define STATIC_MEM_PHYS_ADDR 0x14001000
  236. #define DMA0_PHYS_ADDR 0x14002000
  237. #define DMA1_PHYS_ADDR 0x14002100
  238. #define DMA2_PHYS_ADDR 0x14002200
  239. #define DMA3_PHYS_ADDR 0x14002300
  240. #define DMA4_PHYS_ADDR 0x14002400
  241. #define DMA5_PHYS_ADDR 0x14002500
  242. #define DMA6_PHYS_ADDR 0x14002600
  243. #define DMA7_PHYS_ADDR 0x14002700
  244. #define IC0_PHYS_ADDR 0x10400000
  245. #define IC1_PHYS_ADDR 0x11800000
  246. #define AC97_PHYS_ADDR 0x10000000
  247. #define USBH_PHYS_ADDR 0x10100000
  248. #define USBD_PHYS_ADDR 0x10200000
  249. #define PCI_PHYS_ADDR 0x14005000
  250. #define MAC0_PHYS_ADDR 0x11500000
  251. #define MAC1_PHYS_ADDR 0x11510000
  252. #define MACEN_PHYS_ADDR 0x11520000
  253. #define MACDMA0_PHYS_ADDR 0x14004000
  254. #define MACDMA1_PHYS_ADDR 0x14004200
  255. #define I2S_PHYS_ADDR 0x11000000
  256. #define UART0_PHYS_ADDR 0x11100000
  257. #define UART3_PHYS_ADDR 0x11400000
  258. #define GPIO2_PHYS_ADDR 0x11700000
  259. #define SYS_PHYS_ADDR 0x11900000
  260. #define PCI_MEM_PHYS_ADDR 0x400000000ULL
  261. #define PCI_IO_PHYS_ADDR 0x500000000ULL
  262. #define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
  263. #define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
  264. #define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
  265. #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
  266. #define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
  267. #endif
  268. /********************************************************************/
  269. #ifdef CONFIG_SOC_AU1100
  270. #define MEM_PHYS_ADDR 0x14000000
  271. #define STATIC_MEM_PHYS_ADDR 0x14001000
  272. #define DMA0_PHYS_ADDR 0x14002000
  273. #define DMA1_PHYS_ADDR 0x14002100
  274. #define DMA2_PHYS_ADDR 0x14002200
  275. #define DMA3_PHYS_ADDR 0x14002300
  276. #define DMA4_PHYS_ADDR 0x14002400
  277. #define DMA5_PHYS_ADDR 0x14002500
  278. #define DMA6_PHYS_ADDR 0x14002600
  279. #define DMA7_PHYS_ADDR 0x14002700
  280. #define IC0_PHYS_ADDR 0x10400000
  281. #define SD0_PHYS_ADDR 0x10600000
  282. #define SD1_PHYS_ADDR 0x10680000
  283. #define IC1_PHYS_ADDR 0x11800000
  284. #define AC97_PHYS_ADDR 0x10000000
  285. #define USBH_PHYS_ADDR 0x10100000
  286. #define USBD_PHYS_ADDR 0x10200000
  287. #define IRDA_PHYS_ADDR 0x10300000
  288. #define MAC0_PHYS_ADDR 0x10500000
  289. #define MACEN_PHYS_ADDR 0x10520000
  290. #define MACDMA0_PHYS_ADDR 0x14004000
  291. #define MACDMA1_PHYS_ADDR 0x14004200
  292. #define I2S_PHYS_ADDR 0x11000000
  293. #define UART0_PHYS_ADDR 0x11100000
  294. #define UART1_PHYS_ADDR 0x11200000
  295. #define UART3_PHYS_ADDR 0x11400000
  296. #define SSI0_PHYS_ADDR 0x11600000
  297. #define SSI1_PHYS_ADDR 0x11680000
  298. #define GPIO2_PHYS_ADDR 0x11700000
  299. #define SYS_PHYS_ADDR 0x11900000
  300. #define LCD_PHYS_ADDR 0x15000000
  301. #define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
  302. #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
  303. #define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
  304. #endif
  305. /***********************************************************************/
  306. #ifdef CONFIG_SOC_AU1550
  307. #define MEM_PHYS_ADDR 0x14000000
  308. #define STATIC_MEM_PHYS_ADDR 0x14001000
  309. #define IC0_PHYS_ADDR 0x10400000
  310. #define IC1_PHYS_ADDR 0x11800000
  311. #define USBH_PHYS_ADDR 0x14020000
  312. #define USBD_PHYS_ADDR 0x10200000
  313. #define PCI_PHYS_ADDR 0x14005000
  314. #define MAC0_PHYS_ADDR 0x10500000
  315. #define MAC1_PHYS_ADDR 0x10510000
  316. #define MACEN_PHYS_ADDR 0x10520000
  317. #define MACDMA0_PHYS_ADDR 0x14004000
  318. #define MACDMA1_PHYS_ADDR 0x14004200
  319. #define UART0_PHYS_ADDR 0x11100000
  320. #define UART1_PHYS_ADDR 0x11200000
  321. #define UART3_PHYS_ADDR 0x11400000
  322. #define GPIO2_PHYS_ADDR 0x11700000
  323. #define SYS_PHYS_ADDR 0x11900000
  324. #define DDMA_PHYS_ADDR 0x14002000
  325. #define PE_PHYS_ADDR 0x14008000
  326. #define PSC0_PHYS_ADDR 0x11A00000
  327. #define PSC1_PHYS_ADDR 0x11B00000
  328. #define PSC2_PHYS_ADDR 0x10A00000
  329. #define PSC3_PHYS_ADDR 0x10B00000
  330. #define PCI_MEM_PHYS_ADDR 0x400000000ULL
  331. #define PCI_IO_PHYS_ADDR 0x500000000ULL
  332. #define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
  333. #define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
  334. #define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
  335. #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
  336. #define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
  337. #endif
  338. /***********************************************************************/
  339. #ifdef CONFIG_SOC_AU1200
  340. #define MEM_PHYS_ADDR 0x14000000
  341. #define STATIC_MEM_PHYS_ADDR 0x14001000
  342. #define AES_PHYS_ADDR 0x10300000
  343. #define CIM_PHYS_ADDR 0x14004000
  344. #define IC0_PHYS_ADDR 0x10400000
  345. #define IC1_PHYS_ADDR 0x11800000
  346. #define USBM_PHYS_ADDR 0x14020000
  347. #define USBH_PHYS_ADDR 0x14020100
  348. #define UART0_PHYS_ADDR 0x11100000
  349. #define UART1_PHYS_ADDR 0x11200000
  350. #define GPIO2_PHYS_ADDR 0x11700000
  351. #define SYS_PHYS_ADDR 0x11900000
  352. #define DDMA_PHYS_ADDR 0x14002000
  353. #define PSC0_PHYS_ADDR 0x11A00000
  354. #define PSC1_PHYS_ADDR 0x11B00000
  355. #define SD0_PHYS_ADDR 0x10600000
  356. #define SD1_PHYS_ADDR 0x10680000
  357. #define LCD_PHYS_ADDR 0x15000000
  358. #define SWCNT_PHYS_ADDR 0x1110010C
  359. #define MAEFE_PHYS_ADDR 0x14012000
  360. #define MAEBE_PHYS_ADDR 0x14010000
  361. #define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
  362. #define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
  363. #define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
  364. #endif
  365. /* Static Bus Controller */
  366. #define MEM_STCFG0 0xB4001000
  367. #define MEM_STTIME0 0xB4001004
  368. #define MEM_STADDR0 0xB4001008
  369. #define MEM_STCFG1 0xB4001010
  370. #define MEM_STTIME1 0xB4001014
  371. #define MEM_STADDR1 0xB4001018
  372. #define MEM_STCFG2 0xB4001020
  373. #define MEM_STTIME2 0xB4001024
  374. #define MEM_STADDR2 0xB4001028
  375. #define MEM_STCFG3 0xB4001030
  376. #define MEM_STTIME3 0xB4001034
  377. #define MEM_STADDR3 0xB4001038
  378. #if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
  379. #define MEM_STNDCTL 0xB4001100
  380. #define MEM_STSTAT 0xB4001104
  381. #define MEM_STNAND_CMD 0x0
  382. #define MEM_STNAND_ADDR 0x4
  383. #define MEM_STNAND_DATA 0x20
  384. #endif
  385. /* Interrupt Controller 0 */
  386. #define IC0_CFG0RD 0xB0400040
  387. #define IC0_CFG0SET 0xB0400040
  388. #define IC0_CFG0CLR 0xB0400044
  389. #define IC0_CFG1RD 0xB0400048
  390. #define IC0_CFG1SET 0xB0400048
  391. #define IC0_CFG1CLR 0xB040004C
  392. #define IC0_CFG2RD 0xB0400050
  393. #define IC0_CFG2SET 0xB0400050
  394. #define IC0_CFG2CLR 0xB0400054
  395. #define IC0_REQ0INT 0xB0400054
  396. #define IC0_SRCRD 0xB0400058
  397. #define IC0_SRCSET 0xB0400058
  398. #define IC0_SRCCLR 0xB040005C
  399. #define IC0_REQ1INT 0xB040005C
  400. #define IC0_ASSIGNRD 0xB0400060
  401. #define IC0_ASSIGNSET 0xB0400060
  402. #define IC0_ASSIGNCLR 0xB0400064
  403. #define IC0_WAKERD 0xB0400068
  404. #define IC0_WAKESET 0xB0400068
  405. #define IC0_WAKECLR 0xB040006C
  406. #define IC0_MASKRD 0xB0400070
  407. #define IC0_MASKSET 0xB0400070
  408. #define IC0_MASKCLR 0xB0400074
  409. #define IC0_RISINGRD 0xB0400078
  410. #define IC0_RISINGCLR 0xB0400078
  411. #define IC0_FALLINGRD 0xB040007C
  412. #define IC0_FALLINGCLR 0xB040007C
  413. #define IC0_TESTBIT 0xB0400080
  414. /* Interrupt Controller 1 */
  415. #define IC1_CFG0RD 0xB1800040
  416. #define IC1_CFG0SET 0xB1800040
  417. #define IC1_CFG0CLR 0xB1800044
  418. #define IC1_CFG1RD 0xB1800048
  419. #define IC1_CFG1SET 0xB1800048
  420. #define IC1_CFG1CLR 0xB180004C
  421. #define IC1_CFG2RD 0xB1800050
  422. #define IC1_CFG2SET 0xB1800050
  423. #define IC1_CFG2CLR 0xB1800054
  424. #define IC1_REQ0INT 0xB1800054
  425. #define IC1_SRCRD 0xB1800058
  426. #define IC1_SRCSET 0xB1800058
  427. #define IC1_SRCCLR 0xB180005C
  428. #define IC1_REQ1INT 0xB180005C
  429. #define IC1_ASSIGNRD 0xB1800060
  430. #define IC1_ASSIGNSET 0xB1800060
  431. #define IC1_ASSIGNCLR 0xB1800064
  432. #define IC1_WAKERD 0xB1800068
  433. #define IC1_WAKESET 0xB1800068
  434. #define IC1_WAKECLR 0xB180006C
  435. #define IC1_MASKRD 0xB1800070
  436. #define IC1_MASKSET 0xB1800070
  437. #define IC1_MASKCLR 0xB1800074
  438. #define IC1_RISINGRD 0xB1800078
  439. #define IC1_RISINGCLR 0xB1800078
  440. #define IC1_FALLINGRD 0xB180007C
  441. #define IC1_FALLINGCLR 0xB180007C
  442. #define IC1_TESTBIT 0xB1800080
  443. /* Interrupt Numbers */
  444. /* Au1000 */
  445. #ifdef CONFIG_SOC_AU1000
  446. enum soc_au1000_ints {
  447. AU1000_FIRST_INT = MIPS_CPU_IRQ_BASE + 8,
  448. AU1000_UART0_INT = AU1000_FIRST_INT,
  449. AU1000_UART1_INT, /* au1000 */
  450. AU1000_UART2_INT, /* au1000 */
  451. AU1000_UART3_INT,
  452. AU1000_SSI0_INT, /* au1000 */
  453. AU1000_SSI1_INT, /* au1000 */
  454. AU1000_DMA_INT_BASE,
  455. AU1000_TOY_INT = AU1000_FIRST_INT + 14,
  456. AU1000_TOY_MATCH0_INT,
  457. AU1000_TOY_MATCH1_INT,
  458. AU1000_TOY_MATCH2_INT,
  459. AU1000_RTC_INT,
  460. AU1000_RTC_MATCH0_INT,
  461. AU1000_RTC_MATCH1_INT,
  462. AU1000_RTC_MATCH2_INT,
  463. AU1000_IRDA_TX_INT, /* au1000 */
  464. AU1000_IRDA_RX_INT, /* au1000 */
  465. AU1000_USB_DEV_REQ_INT,
  466. AU1000_USB_DEV_SUS_INT,
  467. AU1000_USB_HOST_INT,
  468. AU1000_ACSYNC_INT,
  469. AU1000_MAC0_DMA_INT,
  470. AU1000_MAC1_DMA_INT,
  471. AU1000_I2S_UO_INT, /* au1000 */
  472. AU1000_AC97C_INT,
  473. AU1000_GPIO_0,
  474. AU1000_GPIO_1,
  475. AU1000_GPIO_2,
  476. AU1000_GPIO_3,
  477. AU1000_GPIO_4,
  478. AU1000_GPIO_5,
  479. AU1000_GPIO_6,
  480. AU1000_GPIO_7,
  481. AU1000_GPIO_8,
  482. AU1000_GPIO_9,
  483. AU1000_GPIO_10,
  484. AU1000_GPIO_11,
  485. AU1000_GPIO_12,
  486. AU1000_GPIO_13,
  487. AU1000_GPIO_14,
  488. AU1000_GPIO_15,
  489. AU1000_GPIO_16,
  490. AU1000_GPIO_17,
  491. AU1000_GPIO_18,
  492. AU1000_GPIO_19,
  493. AU1000_GPIO_20,
  494. AU1000_GPIO_21,
  495. AU1000_GPIO_22,
  496. AU1000_GPIO_23,
  497. AU1000_GPIO_24,
  498. AU1000_GPIO_25,
  499. AU1000_GPIO_26,
  500. AU1000_GPIO_27,
  501. AU1000_GPIO_28,
  502. AU1000_GPIO_29,
  503. AU1000_GPIO_30,
  504. AU1000_GPIO_31,
  505. };
  506. #define UART0_ADDR 0xB1100000
  507. #define UART1_ADDR 0xB1200000
  508. #define UART2_ADDR 0xB1300000
  509. #define UART3_ADDR 0xB1400000
  510. #define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
  511. #define USB_HOST_CONFIG 0xB017FFFC
  512. #define AU1000_ETH0_BASE 0xB0500000
  513. #define AU1000_ETH1_BASE 0xB0510000
  514. #define AU1000_MAC0_ENABLE 0xB0520000
  515. #define AU1000_MAC1_ENABLE 0xB0520004
  516. #define NUM_ETH_INTERFACES 2
  517. #endif /* CONFIG_SOC_AU1000 */
  518. /* Au1500 */
  519. #ifdef CONFIG_SOC_AU1500
  520. enum soc_au1500_ints {
  521. AU1500_FIRST_INT = MIPS_CPU_IRQ_BASE + 8,
  522. AU1500_UART0_INT = AU1500_FIRST_INT,
  523. AU1000_PCI_INTA, /* au1500 */
  524. AU1000_PCI_INTB, /* au1500 */
  525. AU1500_UART3_INT,
  526. AU1000_PCI_INTC, /* au1500 */
  527. AU1000_PCI_INTD, /* au1500 */
  528. AU1000_DMA_INT_BASE,
  529. AU1000_TOY_INT = AU1500_FIRST_INT + 14,
  530. AU1000_TOY_MATCH0_INT,
  531. AU1000_TOY_MATCH1_INT,
  532. AU1000_TOY_MATCH2_INT,
  533. AU1000_RTC_INT,
  534. AU1000_RTC_MATCH0_INT,
  535. AU1000_RTC_MATCH1_INT,
  536. AU1000_RTC_MATCH2_INT,
  537. AU1500_PCI_ERR_INT,
  538. AU1500_RESERVED_INT,
  539. AU1000_USB_DEV_REQ_INT,
  540. AU1000_USB_DEV_SUS_INT,
  541. AU1000_USB_HOST_INT,
  542. AU1000_ACSYNC_INT,
  543. AU1500_MAC0_DMA_INT,
  544. AU1500_MAC1_DMA_INT,
  545. AU1000_AC97C_INT = AU1500_FIRST_INT + 31,
  546. AU1000_GPIO_0,
  547. AU1000_GPIO_1,
  548. AU1000_GPIO_2,
  549. AU1000_GPIO_3,
  550. AU1000_GPIO_4,
  551. AU1000_GPIO_5,
  552. AU1000_GPIO_6,
  553. AU1000_GPIO_7,
  554. AU1000_GPIO_8,
  555. AU1000_GPIO_9,
  556. AU1000_GPIO_10,
  557. AU1000_GPIO_11,
  558. AU1000_GPIO_12,
  559. AU1000_GPIO_13,
  560. AU1000_GPIO_14,
  561. AU1000_GPIO_15,
  562. AU1500_GPIO_200,
  563. AU1500_GPIO_201,
  564. AU1500_GPIO_202,
  565. AU1500_GPIO_203,
  566. AU1500_GPIO_20,
  567. AU1500_GPIO_204,
  568. AU1500_GPIO_205,
  569. AU1500_GPIO_23,
  570. AU1500_GPIO_24,
  571. AU1500_GPIO_25,
  572. AU1500_GPIO_26,
  573. AU1500_GPIO_27,
  574. AU1500_GPIO_28,
  575. AU1500_GPIO_206,
  576. AU1500_GPIO_207,
  577. AU1500_GPIO_208_215,
  578. };
  579. /* shortcuts */
  580. #define INTA AU1000_PCI_INTA
  581. #define INTB AU1000_PCI_INTB
  582. #define INTC AU1000_PCI_INTC
  583. #define INTD AU1000_PCI_INTD
  584. #define UART0_ADDR 0xB1100000
  585. #define UART3_ADDR 0xB1400000
  586. #define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
  587. #define USB_HOST_CONFIG 0xB017fffc
  588. #define AU1500_ETH0_BASE 0xB1500000
  589. #define AU1500_ETH1_BASE 0xB1510000
  590. #define AU1500_MAC0_ENABLE 0xB1520000
  591. #define AU1500_MAC1_ENABLE 0xB1520004
  592. #define NUM_ETH_INTERFACES 2
  593. #endif /* CONFIG_SOC_AU1500 */
  594. /* Au1100 */
  595. #ifdef CONFIG_SOC_AU1100
  596. enum soc_au1100_ints {
  597. AU1100_FIRST_INT = MIPS_CPU_IRQ_BASE + 8,
  598. AU1100_UART0_INT,
  599. AU1100_UART1_INT,
  600. AU1100_SD_INT,
  601. AU1100_UART3_INT,
  602. AU1000_SSI0_INT,
  603. AU1000_SSI1_INT,
  604. AU1000_DMA_INT_BASE,
  605. AU1000_TOY_INT = AU1100_FIRST_INT + 14,
  606. AU1000_TOY_MATCH0_INT,
  607. AU1000_TOY_MATCH1_INT,
  608. AU1000_TOY_MATCH2_INT,
  609. AU1000_RTC_INT,
  610. AU1000_RTC_MATCH0_INT,
  611. AU1000_RTC_MATCH1_INT,
  612. AU1000_RTC_MATCH2_INT,
  613. AU1000_IRDA_TX_INT,
  614. AU1000_IRDA_RX_INT,
  615. AU1000_USB_DEV_REQ_INT,
  616. AU1000_USB_DEV_SUS_INT,
  617. AU1000_USB_HOST_INT,
  618. AU1000_ACSYNC_INT,
  619. AU1100_MAC0_DMA_INT,
  620. AU1100_GPIO_208_215,
  621. AU1100_LCD_INT,
  622. AU1000_AC97C_INT,
  623. AU1000_GPIO_0,
  624. AU1000_GPIO_1,
  625. AU1000_GPIO_2,
  626. AU1000_GPIO_3,
  627. AU1000_GPIO_4,
  628. AU1000_GPIO_5,
  629. AU1000_GPIO_6,
  630. AU1000_GPIO_7,
  631. AU1000_GPIO_8,
  632. AU1000_GPIO_9,
  633. AU1000_GPIO_10,
  634. AU1000_GPIO_11,
  635. AU1000_GPIO_12,
  636. AU1000_GPIO_13,
  637. AU1000_GPIO_14,
  638. AU1000_GPIO_15,
  639. AU1000_GPIO_16,
  640. AU1000_GPIO_17,
  641. AU1000_GPIO_18,
  642. AU1000_GPIO_19,
  643. AU1000_GPIO_20,
  644. AU1000_GPIO_21,
  645. AU1000_GPIO_22,
  646. AU1000_GPIO_23,
  647. AU1000_GPIO_24,
  648. AU1000_GPIO_25,
  649. AU1000_GPIO_26,
  650. AU1000_GPIO_27,
  651. AU1000_GPIO_28,
  652. AU1000_GPIO_29,
  653. AU1000_GPIO_30,
  654. AU1000_GPIO_31,
  655. };
  656. #define UART0_ADDR 0xB1100000
  657. #define UART1_ADDR 0xB1200000
  658. #define UART3_ADDR 0xB1400000
  659. #define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
  660. #define USB_HOST_CONFIG 0xB017FFFC
  661. #define AU1100_ETH0_BASE 0xB0500000
  662. #define AU1100_MAC0_ENABLE 0xB0520000
  663. #define NUM_ETH_INTERFACES 1
  664. #endif /* CONFIG_SOC_AU1100 */
  665. #ifdef CONFIG_SOC_AU1550
  666. enum soc_au1550_ints {
  667. AU1550_FIRST_INT = MIPS_CPU_IRQ_BASE + 8,
  668. AU1550_UART0_INT = AU1550_FIRST_INT,
  669. AU1550_PCI_INTA,
  670. AU1550_PCI_INTB,
  671. AU1550_DDMA_INT,
  672. AU1550_CRYPTO_INT,
  673. AU1550_PCI_INTC,
  674. AU1550_PCI_INTD,
  675. AU1550_PCI_RST_INT,
  676. AU1550_UART1_INT,
  677. AU1550_UART3_INT,
  678. AU1550_PSC0_INT,
  679. AU1550_PSC1_INT,
  680. AU1550_PSC2_INT,
  681. AU1550_PSC3_INT,
  682. AU1000_TOY_INT,
  683. AU1000_TOY_MATCH0_INT,
  684. AU1000_TOY_MATCH1_INT,
  685. AU1000_TOY_MATCH2_INT,
  686. AU1000_RTC_INT,
  687. AU1000_RTC_MATCH0_INT,
  688. AU1000_RTC_MATCH1_INT,
  689. AU1000_RTC_MATCH2_INT,
  690. AU1550_NAND_INT = AU1550_FIRST_INT + 23,
  691. AU1550_USB_DEV_REQ_INT,
  692. AU1000_USB_DEV_REQ_INT = AU1550_USB_DEV_REQ_INT,
  693. AU1550_USB_DEV_SUS_INT,
  694. AU1000_USB_DEV_SUS_INT = AU1550_USB_DEV_SUS_INT,
  695. AU1550_USB_HOST_INT,
  696. AU1000_USB_HOST_INT = AU1550_USB_HOST_INT,
  697. AU1550_MAC0_DMA_INT,
  698. AU1550_MAC1_DMA_INT,
  699. AU1000_GPIO_0 = AU1550_FIRST_INT + 32,
  700. AU1000_GPIO_1,
  701. AU1000_GPIO_2,
  702. AU1000_GPIO_3,
  703. AU1000_GPIO_4,
  704. AU1000_GPIO_5,
  705. AU1000_GPIO_6,
  706. AU1000_GPIO_7,
  707. AU1000_GPIO_8,
  708. AU1000_GPIO_9,
  709. AU1000_GPIO_10,
  710. AU1000_GPIO_11,
  711. AU1000_GPIO_12,
  712. AU1000_GPIO_13,
  713. AU1000_GPIO_14,
  714. AU1000_GPIO_15,
  715. AU1550_GPIO_200,
  716. AU1500_GPIO_201_205, /* Logical or of GPIO201:205 */
  717. AU1500_GPIO_16,
  718. AU1500_GPIO_17,
  719. AU1500_GPIO_20,
  720. AU1500_GPIO_21,
  721. AU1500_GPIO_22,
  722. AU1500_GPIO_23,
  723. AU1500_GPIO_24,
  724. AU1500_GPIO_25,
  725. AU1500_GPIO_26,
  726. AU1500_GPIO_27,
  727. AU1500_GPIO_28,
  728. AU1500_GPIO_206,
  729. AU1500_GPIO_207,
  730. AU1500_GPIO_208_218, /* Logical or of GPIO208:218 */
  731. };
  732. /* shortcuts */
  733. #define INTA AU1550_PCI_INTA
  734. #define INTB AU1550_PCI_INTB
  735. #define INTC AU1550_PCI_INTC
  736. #define INTD AU1550_PCI_INTD
  737. #define UART0_ADDR 0xB1100000
  738. #define UART1_ADDR 0xB1200000
  739. #define UART3_ADDR 0xB1400000
  740. #define USB_OHCI_BASE 0x14020000 /* phys addr for ioremap */
  741. #define USB_OHCI_LEN 0x00060000
  742. #define USB_HOST_CONFIG 0xB4027ffc
  743. #define AU1550_ETH0_BASE 0xB0500000
  744. #define AU1550_ETH1_BASE 0xB0510000
  745. #define AU1550_MAC0_ENABLE 0xB0520000
  746. #define AU1550_MAC1_ENABLE 0xB0520004
  747. #define NUM_ETH_INTERFACES 2
  748. #endif /* CONFIG_SOC_AU1550 */
  749. #ifdef CONFIG_SOC_AU1200
  750. enum soc_au1200_ints {
  751. AU1200_FIRST_INT = MIPS_CPU_IRQ_BASE + 8,
  752. AU1200_UART0_INT = AU1200_FIRST_INT,
  753. AU1200_SWT_INT,
  754. AU1200_SD_INT,
  755. AU1200_DDMA_INT,
  756. AU1200_MAE_BE_INT,
  757. AU1200_GPIO_200,
  758. AU1200_GPIO_201,
  759. AU1200_GPIO_202,
  760. AU1200_UART1_INT,
  761. AU1200_MAE_FE_INT,
  762. AU1200_PSC0_INT,
  763. AU1200_PSC1_INT,
  764. AU1200_AES_INT,
  765. AU1200_CAMERA_INT,
  766. AU1000_TOY_INT,
  767. AU1000_TOY_MATCH0_INT,
  768. AU1000_TOY_MATCH1_INT,
  769. AU1000_TOY_MATCH2_INT,
  770. AU1000_RTC_INT,
  771. AU1000_RTC_MATCH0_INT,
  772. AU1000_RTC_MATCH1_INT,
  773. AU1000_RTC_MATCH2_INT,
  774. AU1200_NAND_INT = AU1200_FIRST_INT + 23,
  775. AU1200_GPIO_204,
  776. AU1200_GPIO_205,
  777. AU1200_GPIO_206,
  778. AU1200_GPIO_207,
  779. AU1200_GPIO_208_215, /* Logical OR of 208:215 */
  780. AU1200_USB_INT,
  781. AU1000_USB_HOST_INT = AU1200_USB_INT,
  782. AU1200_LCD_INT,
  783. AU1200_MAE_BOTH_INT,
  784. AU1000_GPIO_0,
  785. AU1000_GPIO_1,
  786. AU1000_GPIO_2,
  787. AU1000_GPIO_3,
  788. AU1000_GPIO_4,
  789. AU1000_GPIO_5,
  790. AU1000_GPIO_6,
  791. AU1000_GPIO_7,
  792. AU1000_GPIO_8,
  793. AU1000_GPIO_9,
  794. AU1000_GPIO_10,
  795. AU1000_GPIO_11,
  796. AU1000_GPIO_12,
  797. AU1000_GPIO_13,
  798. AU1000_GPIO_14,
  799. AU1000_GPIO_15,
  800. AU1000_GPIO_16,
  801. AU1000_GPIO_17,
  802. AU1000_GPIO_18,
  803. AU1000_GPIO_19,
  804. AU1000_GPIO_20,
  805. AU1000_GPIO_21,
  806. AU1000_GPIO_22,
  807. AU1000_GPIO_23,
  808. AU1000_GPIO_24,
  809. AU1000_GPIO_25,
  810. AU1000_GPIO_26,
  811. AU1000_GPIO_27,
  812. AU1000_GPIO_28,
  813. AU1000_GPIO_29,
  814. AU1000_GPIO_30,
  815. AU1000_GPIO_31,
  816. };
  817. #define UART0_ADDR 0xB1100000
  818. #define UART1_ADDR 0xB1200000
  819. #define USB_UOC_BASE 0x14020020
  820. #define USB_UOC_LEN 0x20
  821. #define USB_OHCI_BASE 0x14020100
  822. #define USB_OHCI_LEN 0x100
  823. #define USB_EHCI_BASE 0x14020200
  824. #define USB_EHCI_LEN 0x100
  825. #define USB_UDC_BASE 0x14022000
  826. #define USB_UDC_LEN 0x2000
  827. #define USB_MSR_BASE 0xB4020000
  828. #define USB_MSR_MCFG 4
  829. #define USBMSRMCFG_OMEMEN 0
  830. #define USBMSRMCFG_OBMEN 1
  831. #define USBMSRMCFG_EMEMEN 2
  832. #define USBMSRMCFG_EBMEN 3
  833. #define USBMSRMCFG_DMEMEN 4
  834. #define USBMSRMCFG_DBMEN 5
  835. #define USBMSRMCFG_GMEMEN 6
  836. #define USBMSRMCFG_OHCCLKEN 16
  837. #define USBMSRMCFG_EHCCLKEN 17
  838. #define USBMSRMCFG_UDCCLKEN 18
  839. #define USBMSRMCFG_PHYPLLEN 19
  840. #define USBMSRMCFG_RDCOMB 30
  841. #define USBMSRMCFG_PFEN 31
  842. #endif /* CONFIG_SOC_AU1200 */
  843. #define AU1000_INTC0_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
  844. #define AU1000_INTC0_INT_LAST (AU1000_INTC0_INT_BASE + 31)
  845. #define AU1000_INTC1_INT_BASE (AU1000_INTC0_INT_BASE + 32)
  846. #define AU1000_INTC1_INT_LAST (AU1000_INTC1_INT_BASE + 31)
  847. #define AU1000_MAX_INTR AU1000_INTC1_INT_LAST
  848. #define INTX 0xFF /* not valid */
  849. /* Programmable Counters 0 and 1 */
  850. #define SYS_BASE 0xB1900000
  851. #define SYS_COUNTER_CNTRL (SYS_BASE + 0x14)
  852. # define SYS_CNTRL_E1S (1 << 23)
  853. # define SYS_CNTRL_T1S (1 << 20)
  854. # define SYS_CNTRL_M21 (1 << 19)
  855. # define SYS_CNTRL_M11 (1 << 18)
  856. # define SYS_CNTRL_M01 (1 << 17)
  857. # define SYS_CNTRL_C1S (1 << 16)
  858. # define SYS_CNTRL_BP (1 << 14)
  859. # define SYS_CNTRL_EN1 (1 << 13)
  860. # define SYS_CNTRL_BT1 (1 << 12)
  861. # define SYS_CNTRL_EN0 (1 << 11)
  862. # define SYS_CNTRL_BT0 (1 << 10)
  863. # define SYS_CNTRL_E0 (1 << 8)
  864. # define SYS_CNTRL_E0S (1 << 7)
  865. # define SYS_CNTRL_32S (1 << 5)
  866. # define SYS_CNTRL_T0S (1 << 4)
  867. # define SYS_CNTRL_M20 (1 << 3)
  868. # define SYS_CNTRL_M10 (1 << 2)
  869. # define SYS_CNTRL_M00 (1 << 1)
  870. # define SYS_CNTRL_C0S (1 << 0)
  871. /* Programmable Counter 0 Registers */
  872. #define SYS_TOYTRIM (SYS_BASE + 0)
  873. #define SYS_TOYWRITE (SYS_BASE + 4)
  874. #define SYS_TOYMATCH0 (SYS_BASE + 8)
  875. #define SYS_TOYMATCH1 (SYS_BASE + 0xC)
  876. #define SYS_TOYMATCH2 (SYS_BASE + 0x10)
  877. #define SYS_TOYREAD (SYS_BASE + 0x40)
  878. /* Programmable Counter 1 Registers */
  879. #define SYS_RTCTRIM (SYS_BASE + 0x44)
  880. #define SYS_RTCWRITE (SYS_BASE + 0x48)
  881. #define SYS_RTCMATCH0 (SYS_BASE + 0x4C)
  882. #define SYS_RTCMATCH1 (SYS_BASE + 0x50)
  883. #define SYS_RTCMATCH2 (SYS_BASE + 0x54)
  884. #define SYS_RTCREAD (SYS_BASE + 0x58)
  885. /* I2S Controller */
  886. #define I2S_DATA 0xB1000000
  887. # define I2S_DATA_MASK 0xffffff
  888. #define I2S_CONFIG 0xB1000004
  889. # define I2S_CONFIG_XU (1 << 25)
  890. # define I2S_CONFIG_XO (1 << 24)
  891. # define I2S_CONFIG_RU (1 << 23)
  892. # define I2S_CONFIG_RO (1 << 22)
  893. # define I2S_CONFIG_TR (1 << 21)
  894. # define I2S_CONFIG_TE (1 << 20)
  895. # define I2S_CONFIG_TF (1 << 19)
  896. # define I2S_CONFIG_RR (1 << 18)
  897. # define I2S_CONFIG_RE (1 << 17)
  898. # define I2S_CONFIG_RF (1 << 16)
  899. # define I2S_CONFIG_PD (1 << 11)
  900. # define I2S_CONFIG_LB (1 << 10)
  901. # define I2S_CONFIG_IC (1 << 9)
  902. # define I2S_CONFIG_FM_BIT 7
  903. # define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT)
  904. # define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT)
  905. # define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT)
  906. # define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT)
  907. # define I2S_CONFIG_TN (1 << 6)
  908. # define I2S_CONFIG_RN (1 << 5)
  909. # define I2S_CONFIG_SZ_BIT 0
  910. # define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT)
  911. #define I2S_CONTROL 0xB1000008
  912. # define I2S_CONTROL_D (1 << 1)
  913. # define I2S_CONTROL_CE (1 << 0)
  914. /* USB Host Controller */
  915. #ifndef USB_OHCI_LEN
  916. #define USB_OHCI_LEN 0x00100000
  917. #endif
  918. #ifndef CONFIG_SOC_AU1200
  919. /* USB Device Controller */
  920. #define USBD_EP0RD 0xB0200000
  921. #define USBD_EP0WR 0xB0200004
  922. #define USBD_EP2WR 0xB0200008
  923. #define USBD_EP3WR 0xB020000C
  924. #define USBD_EP4RD 0xB0200010
  925. #define USBD_EP5RD 0xB0200014
  926. #define USBD_INTEN 0xB0200018
  927. #define USBD_INTSTAT 0xB020001C
  928. # define USBDEV_INT_SOF (1 << 12)
  929. # define USBDEV_INT_HF_BIT 6
  930. # define USBDEV_INT_HF_MASK (0x3f << USBDEV_INT_HF_BIT)
  931. # define USBDEV_INT_CMPLT_BIT 0
  932. # define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT)
  933. #define USBD_CONFIG 0xB0200020
  934. #define USBD_EP0CS 0xB0200024
  935. #define USBD_EP2CS 0xB0200028
  936. #define USBD_EP3CS 0xB020002C
  937. #define USBD_EP4CS 0xB0200030
  938. #define USBD_EP5CS 0xB0200034
  939. # define USBDEV_CS_SU (1 << 14)
  940. # define USBDEV_CS_NAK (1 << 13)
  941. # define USBDEV_CS_ACK (1 << 12)
  942. # define USBDEV_CS_BUSY (1 << 11)
  943. # define USBDEV_CS_TSIZE_BIT 1
  944. # define USBDEV_CS_TSIZE_MASK (0x3ff << USBDEV_CS_TSIZE_BIT)
  945. # define USBDEV_CS_STALL (1 << 0)
  946. #define USBD_EP0RDSTAT 0xB0200040
  947. #define USBD_EP0WRSTAT 0xB0200044
  948. #define USBD_EP2WRSTAT 0xB0200048
  949. #define USBD_EP3WRSTAT 0xB020004C
  950. #define USBD_EP4RDSTAT 0xB0200050
  951. #define USBD_EP5RDSTAT 0xB0200054
  952. # define USBDEV_FSTAT_FLUSH (1 << 6)
  953. # define USBDEV_FSTAT_UF (1 << 5)
  954. # define USBDEV_FSTAT_OF (1 << 4)
  955. # define USBDEV_FSTAT_FCNT_BIT 0
  956. # define USBDEV_FSTAT_FCNT_MASK (0x0f << USBDEV_FSTAT_FCNT_BIT)
  957. #define USBD_ENABLE 0xB0200058
  958. # define USBDEV_ENABLE (1 << 1)
  959. # define USBDEV_CE (1 << 0)
  960. #endif /* !CONFIG_SOC_AU1200 */
  961. /* Ethernet Controllers */
  962. /* 4 byte offsets from AU1000_ETH_BASE */
  963. #define MAC_CONTROL 0x0
  964. # define MAC_RX_ENABLE (1 << 2)
  965. # define MAC_TX_ENABLE (1 << 3)
  966. # define MAC_DEF_CHECK (1 << 5)
  967. # define MAC_SET_BL(X) (((X) & 0x3) << 6)
  968. # define MAC_AUTO_PAD (1 << 8)
  969. # define MAC_DISABLE_RETRY (1 << 10)
  970. # define MAC_DISABLE_BCAST (1 << 11)
  971. # define MAC_LATE_COL (1 << 12)
  972. # define MAC_HASH_MODE (1 << 13)
  973. # define MAC_HASH_ONLY (1 << 15)
  974. # define MAC_PASS_ALL (1 << 16)
  975. # define MAC_INVERSE_FILTER (1 << 17)
  976. # define MAC_PROMISCUOUS (1 << 18)
  977. # define MAC_PASS_ALL_MULTI (1 << 19)
  978. # define MAC_FULL_DUPLEX (1 << 20)
  979. # define MAC_NORMAL_MODE 0
  980. # define MAC_INT_LOOPBACK (1 << 21)
  981. # define MAC_EXT_LOOPBACK (1 << 22)
  982. # define MAC_DISABLE_RX_OWN (1 << 23)
  983. # define MAC_BIG_ENDIAN (1 << 30)
  984. # define MAC_RX_ALL (1 << 31)
  985. #define MAC_ADDRESS_HIGH 0x4
  986. #define MAC_ADDRESS_LOW 0x8
  987. #define MAC_MCAST_HIGH 0xC
  988. #define MAC_MCAST_LOW 0x10
  989. #define MAC_MII_CNTRL 0x14
  990. # define MAC_MII_BUSY (1 << 0)
  991. # define MAC_MII_READ 0
  992. # define MAC_MII_WRITE (1 << 1)
  993. # define MAC_SET_MII_SELECT_REG(X) (((X) & 0x1f) << 6)
  994. # define MAC_SET_MII_SELECT_PHY(X) (((X) & 0x1f) << 11)
  995. #define MAC_MII_DATA 0x18
  996. #define MAC_FLOW_CNTRL 0x1C
  997. # define MAC_FLOW_CNTRL_BUSY (1 << 0)
  998. # define MAC_FLOW_CNTRL_ENABLE (1 << 1)
  999. # define MAC_PASS_CONTROL (1 << 2)
  1000. # define MAC_SET_PAUSE(X) (((X) & 0xffff) << 16)
  1001. #define MAC_VLAN1_TAG 0x20
  1002. #define MAC_VLAN2_TAG 0x24
  1003. /* Ethernet Controller Enable */
  1004. # define MAC_EN_CLOCK_ENABLE (1 << 0)
  1005. # define MAC_EN_RESET0 (1 << 1)
  1006. # define MAC_EN_TOSS (0 << 2)
  1007. # define MAC_EN_CACHEABLE (1 << 3)
  1008. # define MAC_EN_RESET1 (1 << 4)
  1009. # define MAC_EN_RESET2 (1 << 5)
  1010. # define MAC_DMA_RESET (1 << 6)
  1011. /* Ethernet Controller DMA Channels */
  1012. #define MAC0_TX_DMA_ADDR 0xB4004000
  1013. #define MAC1_TX_DMA_ADDR 0xB4004200
  1014. /* offsets from MAC_TX_RING_ADDR address */
  1015. #define MAC_TX_BUFF0_STATUS 0x0
  1016. # define TX_FRAME_ABORTED (1 << 0)
  1017. # define TX_JAB_TIMEOUT (1 << 1)
  1018. # define TX_NO_CARRIER (1 << 2)
  1019. # define TX_LOSS_CARRIER (1 << 3)
  1020. # define TX_EXC_DEF (1 << 4)
  1021. # define TX_LATE_COLL_ABORT (1 << 5)
  1022. # define TX_EXC_COLL (1 << 6)
  1023. # define TX_UNDERRUN (1 << 7)
  1024. # define TX_DEFERRED (1 << 8)
  1025. # define TX_LATE_COLL (1 << 9)
  1026. # define TX_COLL_CNT_MASK (0xF << 10)
  1027. # define TX_PKT_RETRY (1 << 31)
  1028. #define MAC_TX_BUFF0_ADDR 0x4
  1029. # define TX_DMA_ENABLE (1 << 0)
  1030. # define TX_T_DONE (1 << 1)
  1031. # define TX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
  1032. #define MAC_TX_BUFF0_LEN 0x8
  1033. #define MAC_TX_BUFF1_STATUS 0x10
  1034. #define MAC_TX_BUFF1_ADDR 0x14
  1035. #define MAC_TX_BUFF1_LEN 0x18
  1036. #define MAC_TX_BUFF2_STATUS 0x20
  1037. #define MAC_TX_BUFF2_ADDR 0x24
  1038. #define MAC_TX_BUFF2_LEN 0x28
  1039. #define MAC_TX_BUFF3_STATUS 0x30
  1040. #define MAC_TX_BUFF3_ADDR 0x34
  1041. #define MAC_TX_BUFF3_LEN 0x38
  1042. #define MAC0_RX_DMA_ADDR 0xB4004100
  1043. #define MAC1_RX_DMA_ADDR 0xB4004300
  1044. /* offsets from MAC_RX_RING_ADDR */
  1045. #define MAC_RX_BUFF0_STATUS 0x0
  1046. # define RX_FRAME_LEN_MASK 0x3fff
  1047. # define RX_WDOG_TIMER (1 << 14)
  1048. # define RX_RUNT (1 << 15)
  1049. # define RX_OVERLEN (1 << 16)
  1050. # define RX_COLL (1 << 17)
  1051. # define RX_ETHER (1 << 18)
  1052. # define RX_MII_ERROR (1 << 19)
  1053. # define RX_DRIBBLING (1 << 20)
  1054. # define RX_CRC_ERROR (1 << 21)
  1055. # define RX_VLAN1 (1 << 22)
  1056. # define RX_VLAN2 (1 << 23)
  1057. # define RX_LEN_ERROR (1 << 24)
  1058. # define RX_CNTRL_FRAME (1 << 25)
  1059. # define RX_U_CNTRL_FRAME (1 << 26)
  1060. # define RX_MCAST_FRAME (1 << 27)
  1061. # define RX_BCAST_FRAME (1 << 28)
  1062. # define RX_FILTER_FAIL (1 << 29)
  1063. # define RX_PACKET_FILTER (1 << 30)
  1064. # define RX_MISSED_FRAME (1 << 31)
  1065. # define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \
  1066. RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \
  1067. RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME)
  1068. #define MAC_RX_BUFF0_ADDR 0x4
  1069. # define RX_DMA_ENABLE (1 << 0)
  1070. # define RX_T_DONE (1 << 1)
  1071. # define RX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
  1072. # define RX_SET_BUFF_ADDR(X) ((X) & 0xffffffc0)
  1073. #define MAC_RX_BUFF1_STATUS 0x10
  1074. #define MAC_RX_BUFF1_ADDR 0x14
  1075. #define MAC_RX_BUFF2_STATUS 0x20
  1076. #define MAC_RX_BUFF2_ADDR 0x24
  1077. #define MAC_RX_BUFF3_STATUS 0x30
  1078. #define MAC_RX_BUFF3_ADDR 0x34
  1079. /* UARTS 0-3 */
  1080. #define UART_BASE UART0_ADDR
  1081. #ifdef CONFIG_SOC_AU1200
  1082. #define UART_DEBUG_BASE UART1_ADDR
  1083. #else
  1084. #define UART_DEBUG_BASE UART3_ADDR
  1085. #endif
  1086. #define UART_RX 0 /* Receive buffer */
  1087. #define UART_TX 4 /* Transmit buffer */
  1088. #define UART_IER 8 /* Interrupt Enable Register */
  1089. #define UART_IIR 0xC /* Interrupt ID Register */
  1090. #define UART_FCR 0x10 /* FIFO Control Register */
  1091. #define UART_LCR 0x14 /* Line Control Register */
  1092. #define UART_MCR 0x18 /* Modem Control Register */
  1093. #define UART_LSR 0x1C /* Line Status Register */
  1094. #define UART_MSR 0x20 /* Modem Status Register */
  1095. #define UART_CLK 0x28 /* Baud Rate Clock Divider */
  1096. #define UART_MOD_CNTRL 0x100 /* Module Control */
  1097. #define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */
  1098. #define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */
  1099. #define UART_FCR_CLEAR_XMIT 0x04 /* Clear the XMIT FIFO */
  1100. #define UART_FCR_DMA_SELECT 0x08 /* For DMA applications */
  1101. #define UART_FCR_TRIGGER_MASK 0xF0 /* Mask for the FIFO trigger range */
  1102. #define UART_FCR_R_TRIGGER_1 0x00 /* Mask for receive trigger set at 1 */
  1103. #define UART_FCR_R_TRIGGER_4 0x40 /* Mask for receive trigger set at 4 */
  1104. #define UART_FCR_R_TRIGGER_8 0x80 /* Mask for receive trigger set at 8 */
  1105. #define UART_FCR_R_TRIGGER_14 0xA0 /* Mask for receive trigger set at 14 */
  1106. #define UART_FCR_T_TRIGGER_0 0x00 /* Mask for transmit trigger set at 0 */
  1107. #define UART_FCR_T_TRIGGER_4 0x10 /* Mask for transmit trigger set at 4 */
  1108. #define UART_FCR_T_TRIGGER_8 0x20 /* Mask for transmit trigger set at 8 */
  1109. #define UART_FCR_T_TRIGGER_12 0x30 /* Mask for transmit trigger set at 12 */
  1110. /*
  1111. * These are the definitions for the Line Control Register
  1112. */
  1113. #define UART_LCR_SBC 0x40 /* Set break control */
  1114. #define UART_LCR_SPAR 0x20 /* Stick parity (?) */
  1115. #define UART_LCR_EPAR 0x10 /* Even parity select */
  1116. #define UART_LCR_PARITY 0x08 /* Parity Enable */
  1117. #define UART_LCR_STOP 0x04 /* Stop bits: 0=1 stop bit, 1= 2 stop bits */
  1118. #define UART_LCR_WLEN5 0x00 /* Wordlength: 5 bits */
  1119. #define UART_LCR_WLEN6 0x01 /* Wordlength: 6 bits */
  1120. #define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */
  1121. #define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */
  1122. /*
  1123. * These are the definitions for the Line Status Register
  1124. */
  1125. #define UART_LSR_TEMT 0x40 /* Transmitter empty */
  1126. #define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */
  1127. #define UART_LSR_BI 0x10 /* Break interrupt indicator */
  1128. #define UART_LSR_FE 0x08 /* Frame error indicator */
  1129. #define UART_LSR_PE 0x04 /* Parity error indicator */
  1130. #define UART_LSR_OE 0x02 /* Overrun error indicator */
  1131. #define UART_LSR_DR 0x01 /* Receiver data ready */
  1132. /*
  1133. * These are the definitions for the Interrupt Identification Register
  1134. */
  1135. #define UART_IIR_NO_INT 0x01 /* No interrupts pending */
  1136. #define UART_IIR_ID 0x06 /* Mask for the interrupt ID */
  1137. #define UART_IIR_MSI 0x00 /* Modem status interrupt */
  1138. #define UART_IIR_THRI 0x02 /* Transmitter holding register empty */
  1139. #define UART_IIR_RDI 0x04 /* Receiver data interrupt */
  1140. #define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */
  1141. /*
  1142. * These are the definitions for the Interrupt Enable Register
  1143. */
  1144. #define UART_IER_MSI 0x08 /* Enable Modem status interrupt */
  1145. #define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */
  1146. #define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */
  1147. #define UART_IER_RDI 0x01 /* Enable receiver data interrupt */
  1148. /*
  1149. * These are the definitions for the Modem Control Register
  1150. */
  1151. #define UART_MCR_LOOP 0x10 /* Enable loopback test mode */
  1152. #define UART_MCR_OUT2 0x08 /* Out2 complement */
  1153. #define UART_MCR_OUT1 0x04 /* Out1 complement */
  1154. #define UART_MCR_RTS 0x02 /* RTS complement */
  1155. #define UART_MCR_DTR 0x01 /* DTR complement */
  1156. /*
  1157. * These are the definitions for the Modem Status Register
  1158. */
  1159. #define UART_MSR_DCD 0x80 /* Data Carrier Detect */
  1160. #define UART_MSR_RI 0x40 /* Ring Indicator */
  1161. #define UART_MSR_DSR 0x20 /* Data Set Ready */
  1162. #define UART_MSR_CTS 0x10 /* Clear to Send */
  1163. #define UART_MSR_DDCD 0x08 /* Delta DCD */
  1164. #define UART_MSR_TERI 0x04 /* Trailing edge ring indicator */
  1165. #define UART_MSR_DDSR 0x02 /* Delta DSR */
  1166. #define UART_MSR_DCTS 0x01 /* Delta CTS */
  1167. #define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */
  1168. /* SSIO */
  1169. #define SSI0_STATUS 0xB1600000
  1170. # define SSI_STATUS_BF (1 << 4)
  1171. # define SSI_STATUS_OF (1 << 3)
  1172. # define SSI_STATUS_UF (1 << 2)
  1173. # define SSI_STATUS_D (1 << 1)
  1174. # define SSI_STATUS_B (1 << 0)
  1175. #define SSI0_INT 0xB1600004
  1176. # define SSI_INT_OI (1 << 3)
  1177. # define SSI_INT_UI (1 << 2)
  1178. # define SSI_INT_DI (1 << 1)
  1179. #define SSI0_INT_ENABLE 0xB1600008
  1180. # define SSI_INTE_OIE (1 << 3)
  1181. # define SSI_INTE_UIE (1 << 2)
  1182. # define SSI_INTE_DIE (1 << 1)
  1183. #define SSI0_CONFIG 0xB1600020
  1184. # define SSI_CONFIG_AO (1 << 24)
  1185. # define SSI_CONFIG_DO (1 << 23)
  1186. # define SSI_CONFIG_ALEN_BIT 20
  1187. # define SSI_CONFIG_ALEN_MASK (0x7 << 20)
  1188. # define SSI_CONFIG_DLEN_BIT 16
  1189. # define SSI_CONFIG_DLEN_MASK (0x7 << 16)
  1190. # define SSI_CONFIG_DD (1 << 11)
  1191. # define SSI_CONFIG_AD (1 << 10)
  1192. # define SSI_CONFIG_BM_BIT 8
  1193. # define SSI_CONFIG_BM_MASK (0x3 << 8)
  1194. # define SSI_CONFIG_CE (1 << 7)
  1195. # define SSI_CONFIG_DP (1 << 6)
  1196. # define SSI_CONFIG_DL (1 << 5)
  1197. # define SSI_CONFIG_EP (1 << 4)
  1198. #define SSI0_ADATA 0xB1600024
  1199. # define SSI_AD_D (1 << 24)
  1200. # define SSI_AD_ADDR_BIT 16
  1201. # define SSI_AD_ADDR_MASK (0xff << 16)
  1202. # define SSI_AD_DATA_BIT 0
  1203. # define SSI_AD_DATA_MASK (0xfff << 0)
  1204. #define SSI0_CLKDIV 0xB1600028
  1205. #define SSI0_CONTROL 0xB1600100
  1206. # define SSI_CONTROL_CD (1 << 1)
  1207. # define SSI_CONTROL_E (1 << 0)
  1208. /* SSI1 */
  1209. #define SSI1_STATUS 0xB1680000
  1210. #define SSI1_INT 0xB1680004
  1211. #define SSI1_INT_ENABLE 0xB1680008
  1212. #define SSI1_CONFIG 0xB1680020
  1213. #define SSI1_ADATA 0xB1680024
  1214. #define SSI1_CLKDIV 0xB1680028
  1215. #define SSI1_ENABLE 0xB1680100
  1216. /*
  1217. * Register content definitions
  1218. */
  1219. #define SSI_STATUS_BF (1 << 4)
  1220. #define SSI_STATUS_OF (1 << 3)
  1221. #define SSI_STATUS_UF (1 << 2)
  1222. #define SSI_STATUS_D (1 << 1)
  1223. #define SSI_STATUS_B (1 << 0)
  1224. /* SSI_INT */
  1225. #define SSI_INT_OI (1 << 3)
  1226. #define SSI_INT_UI (1 << 2)
  1227. #define SSI_INT_DI (1 << 1)
  1228. /* SSI_INTEN */
  1229. #define SSI_INTEN_OIE (1 << 3)
  1230. #define SSI_INTEN_UIE (1 << 2)
  1231. #define SSI_INTEN_DIE (1 << 1)
  1232. #define SSI_CONFIG_AO (1 << 24)
  1233. #define SSI_CONFIG_DO (1 << 23)
  1234. #define SSI_CONFIG_ALEN (7 << 20)
  1235. #define SSI_CONFIG_DLEN (15 << 16)
  1236. #define SSI_CONFIG_DD (1 << 11)
  1237. #define SSI_CONFIG_AD (1 << 10)
  1238. #define SSI_CONFIG_BM (3 << 8)
  1239. #define SSI_CONFIG_CE (1 << 7)
  1240. #define SSI_CONFIG_DP (1 << 6)
  1241. #define SSI_CONFIG_DL (1 << 5)
  1242. #define SSI_CONFIG_EP (1 << 4)
  1243. #define SSI_CONFIG_ALEN_N(N) ((N-1) << 20)
  1244. #define SSI_CONFIG_DLEN_N(N) ((N-1) << 16)
  1245. #define SSI_CONFIG_BM_HI (0 << 8)
  1246. #define SSI_CONFIG_BM_LO (1 << 8)
  1247. #define SSI_CONFIG_BM_CY (2 << 8)
  1248. #define SSI_ADATA_D (1 << 24)
  1249. #define SSI_ADATA_ADDR (0xFF << 16)
  1250. #define SSI_ADATA_DATA 0x0FFF
  1251. #define SSI_ADATA_ADDR_N(N) (N << 16)
  1252. #define SSI_ENABLE_CD (1 << 1)
  1253. #define SSI_ENABLE_E (1 << 0)
  1254. /* IrDA Controller */
  1255. #define IRDA_BASE 0xB0300000
  1256. #define IR_RING_PTR_STATUS (IRDA_BASE + 0x00)
  1257. #define IR_RING_BASE_ADDR_H (IRDA_BASE + 0x04)
  1258. #define IR_RING_BASE_ADDR_L (IRDA_BASE + 0x08)
  1259. #define IR_RING_SIZE (IRDA_BASE + 0x0C)
  1260. #define IR_RING_PROMPT (IRDA_BASE + 0x10)
  1261. #define IR_RING_ADDR_CMPR (IRDA_BASE + 0x14)
  1262. #define IR_INT_CLEAR (IRDA_BASE + 0x18)
  1263. #define IR_CONFIG_1 (IRDA_BASE + 0x20)
  1264. # define IR_RX_INVERT_LED (1 << 0)
  1265. # define IR_TX_INVERT_LED (1 << 1)
  1266. # define IR_ST (1 << 2)
  1267. # define IR_SF (1 << 3)
  1268. # define IR_SIR (1 << 4)
  1269. # define IR_MIR (1 << 5)
  1270. # define IR_FIR (1 << 6)
  1271. # define IR_16CRC (1 << 7)
  1272. # define IR_TD (1 << 8)
  1273. # define IR_RX_ALL (1 << 9)
  1274. # define IR_DMA_ENABLE (1 << 10)
  1275. # define IR_RX_ENABLE (1 << 11)
  1276. # define IR_TX_ENABLE (1 << 12)
  1277. # define IR_LOOPBACK (1 << 14)
  1278. # define IR_SIR_MODE (IR_SIR | IR_DMA_ENABLE | \
  1279. IR_RX_ALL | IR_RX_ENABLE | IR_SF | IR_16CRC)
  1280. #define IR_SIR_FLAGS (IRDA_BASE + 0x24)
  1281. #define IR_ENABLE (IRDA_BASE + 0x28)
  1282. # define IR_RX_STATUS (1 << 9)
  1283. # define IR_TX_STATUS (1 << 10)
  1284. #define IR_READ_PHY_CONFIG (IRDA_BASE + 0x2C)
  1285. #define IR_WRITE_PHY_CONFIG (IRDA_BASE + 0x30)
  1286. #define IR_MAX_PKT_LEN (IRDA_BASE + 0x34)
  1287. #define IR_RX_BYTE_CNT (IRDA_BASE + 0x38)
  1288. #define IR_CONFIG_2 (IRDA_BASE + 0x3C)
  1289. # define IR_MODE_INV (1 << 0)
  1290. # define IR_ONE_PIN (1 << 1)
  1291. #define IR_INTERFACE_CONFIG (IRDA_BASE + 0x40)
  1292. /* GPIO */
  1293. #define SYS_PINFUNC 0xB190002C
  1294. # define SYS_PF_USB (1 << 15) /* 2nd USB device/host */
  1295. # define SYS_PF_U3 (1 << 14) /* GPIO23/U3TXD */
  1296. # define SYS_PF_U2 (1 << 13) /* GPIO22/U2TXD */
  1297. # define SYS_PF_U1 (1 << 12) /* GPIO21/U1TXD */
  1298. # define SYS_PF_SRC (1 << 11) /* GPIO6/SROMCKE */
  1299. # define SYS_PF_CK5 (1 << 10) /* GPIO3/CLK5 */
  1300. # define SYS_PF_CK4 (1 << 9) /* GPIO2/CLK4 */
  1301. # define SYS_PF_IRF (1 << 8) /* GPIO15/IRFIRSEL */
  1302. # define SYS_PF_UR3 (1 << 7) /* GPIO[14:9]/UART3 */
  1303. # define SYS_PF_I2D (1 << 6) /* GPIO8/I2SDI */
  1304. # define SYS_PF_I2S (1 << 5) /* I2S/GPIO[29:31] */
  1305. # define SYS_PF_NI2 (1 << 4) /* NI2/GPIO[24:28] */
  1306. # define SYS_PF_U0 (1 << 3) /* U0TXD/GPIO20 */
  1307. # define SYS_PF_RD (1 << 2) /* IRTXD/GPIO19 */
  1308. # define SYS_PF_A97 (1 << 1) /* AC97/SSL1 */
  1309. # define SYS_PF_S0 (1 << 0) /* SSI_0/GPIO[16:18] */
  1310. /* Au1100 only */
  1311. # define SYS_PF_PC (1 << 18) /* PCMCIA/GPIO[207:204] */
  1312. # define SYS_PF_LCD (1 << 17) /* extern lcd/GPIO[203:200] */
  1313. # define SYS_PF_CS (1 << 16) /* EXTCLK0/32KHz to gpio2 */
  1314. # define SYS_PF_EX0 (1 << 9) /* GPIO2/clock */
  1315. /* Au1550 only. Redefines lots of pins */
  1316. # define SYS_PF_PSC2_MASK (7 << 17)
  1317. # define SYS_PF_PSC2_AC97 0
  1318. # define SYS_PF_PSC2_SPI 0
  1319. # define SYS_PF_PSC2_I2S (1 << 17)
  1320. # define SYS_PF_PSC2_SMBUS (3 << 17)
  1321. # define SYS_PF_PSC2_GPIO (7 << 17)
  1322. # define SYS_PF_PSC3_MASK (7 << 20)
  1323. # define SYS_PF_PSC3_AC97 0
  1324. # define SYS_PF_PSC3_SPI 0
  1325. # define SYS_PF_PSC3_I2S (1 << 20)
  1326. # define SYS_PF_PSC3_SMBUS (3 << 20)
  1327. # define SYS_PF_PSC3_GPIO (7 << 20)
  1328. # define SYS_PF_PSC1_S1 (1 << 1)
  1329. # define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2))
  1330. /* Au1200 only */
  1331. #ifdef CONFIG_SOC_AU1200
  1332. #define SYS_PINFUNC_DMA (1 << 31)
  1333. #define SYS_PINFUNC_S0A (1 << 30)
  1334. #define SYS_PINFUNC_S1A (1 << 29)
  1335. #define SYS_PINFUNC_LP0 (1 << 28)
  1336. #define SYS_PINFUNC_LP1 (1 << 27)
  1337. #define SYS_PINFUNC_LD16 (1 << 26)
  1338. #define SYS_PINFUNC_LD8 (1 << 25)
  1339. #define SYS_PINFUNC_LD1 (1 << 24)
  1340. #define SYS_PINFUNC_LD0 (1 << 23)
  1341. #define SYS_PINFUNC_P1A (3 << 21)
  1342. #define SYS_PINFUNC_P1B (1 << 20)
  1343. #define SYS_PINFUNC_FS3 (1 << 19)
  1344. #define SYS_PINFUNC_P0A (3 << 17)
  1345. #define SYS_PINFUNC_CS (1 << 16)
  1346. #define SYS_PINFUNC_CIM (1 << 15)
  1347. #define SYS_PINFUNC_P1C (1 << 14)
  1348. #define SYS_PINFUNC_U1T (1 << 12)
  1349. #define SYS_PINFUNC_U1R (1 << 11)
  1350. #define SYS_PINFUNC_EX1 (1 << 10)
  1351. #define SYS_PINFUNC_EX0 (1 << 9)
  1352. #define SYS_PINFUNC_U0R (1 << 8)
  1353. #define SYS_PINFUNC_MC (1 << 7)
  1354. #define SYS_PINFUNC_S0B (1 << 6)
  1355. #define SYS_PINFUNC_S0C (1 << 5)
  1356. #define SYS_PINFUNC_P0B (1 << 4)
  1357. #define SYS_PINFUNC_U0T (1 << 3)
  1358. #define SYS_PINFUNC_S1B (1 << 2)
  1359. #endif
  1360. #define SYS_TRIOUTRD 0xB1900100
  1361. #define SYS_TRIOUTCLR 0xB1900100
  1362. #define SYS_OUTPUTRD 0xB1900108
  1363. #define SYS_OUTPUTSET 0xB1900108
  1364. #define SYS_OUTPUTCLR 0xB190010C
  1365. #define SYS_PINSTATERD 0xB1900110
  1366. #define SYS_PININPUTEN 0xB1900110
  1367. /* GPIO2, Au1500, Au1550 only */
  1368. #define GPIO2_BASE 0xB1700000
  1369. #define GPIO2_DIR (GPIO2_BASE + 0)
  1370. #define GPIO2_OUTPUT (GPIO2_BASE + 8)
  1371. #define GPIO2_PINSTATE (GPIO2_BASE + 0xC)
  1372. #define GPIO2_INTENABLE (GPIO2_BASE + 0x10)
  1373. #define GPIO2_ENABLE (GPIO2_BASE + 0x14)
  1374. /* Power Management */
  1375. #define SYS_SCRATCH0 0xB1900018
  1376. #define SYS_SCRATCH1 0xB190001C
  1377. #define SYS_WAKEMSK 0xB1900034
  1378. #define SYS_ENDIAN 0xB1900038
  1379. #define SYS_POWERCTRL 0xB190003C
  1380. #define SYS_WAKESRC 0xB190005C
  1381. #define SYS_SLPPWR 0xB1900078
  1382. #define SYS_SLEEP 0xB190007C
  1383. /* Clock Controller */
  1384. #define SYS_FREQCTRL0 0xB1900020
  1385. # define SYS_FC_FRDIV2_BIT 22
  1386. # define SYS_FC_FRDIV2_MASK (0xff << SYS_FC_FRDIV2_BIT)
  1387. # define SYS_FC_FE2 (1 << 21)
  1388. # define SYS_FC_FS2 (1 << 20)
  1389. # define SYS_FC_FRDIV1_BIT 12
  1390. # define SYS_FC_FRDIV1_MASK (0xff << SYS_FC_FRDIV1_BIT)
  1391. # define SYS_FC_FE1 (1 << 11)
  1392. # define SYS_FC_FS1 (1 << 10)
  1393. # define SYS_FC_FRDIV0_BIT 2
  1394. # define SYS_FC_FRDIV0_MASK (0xff << SYS_FC_FRDIV0_BIT)
  1395. # define SYS_FC_FE0 (1 << 1)
  1396. # define SYS_FC_FS0 (1 << 0)
  1397. #define SYS_FREQCTRL1 0xB1900024
  1398. # define SYS_FC_FRDIV5_BIT 22
  1399. # define SYS_FC_FRDIV5_MASK (0xff << SYS_FC_FRDIV5_BIT)
  1400. # define SYS_FC_FE5 (1 << 21)
  1401. # define SYS_FC_FS5 (1 << 20)
  1402. # define SYS_FC_FRDIV4_BIT 12
  1403. # define SYS_FC_FRDIV4_MASK (0xff << SYS_FC_FRDIV4_BIT)
  1404. # define SYS_FC_FE4 (1 << 11)
  1405. # define SYS_FC_FS4 (1 << 10)
  1406. # define SYS_FC_FRDIV3_BIT 2
  1407. # define SYS_FC_FRDIV3_MASK (0xff << SYS_FC_FRDIV3_BIT)
  1408. # define SYS_FC_FE3 (1 << 1)
  1409. # define SYS_FC_FS3 (1 << 0)
  1410. #define SYS_CLKSRC 0xB1900028
  1411. # define SYS_CS_ME1_BIT 27
  1412. # define SYS_CS_ME1_MASK (0x7 << SYS_CS_ME1_BIT)
  1413. # define SYS_CS_DE1 (1 << 26)
  1414. # define SYS_CS_CE1 (1 << 25)
  1415. # define SYS_CS_ME0_BIT 22
  1416. # define SYS_CS_ME0_MASK (0x7 << SYS_CS_ME0_BIT)
  1417. # define SYS_CS_DE0 (1 << 21)
  1418. # define SYS_CS_CE0 (1 << 20)
  1419. # define SYS_CS_MI2_BIT 17
  1420. # define SYS_CS_MI2_MASK (0x7 << SYS_CS_MI2_BIT)
  1421. # define SYS_CS_DI2 (1 << 16)
  1422. # define SYS_CS_CI2 (1 << 15)
  1423. #ifdef CONFIG_SOC_AU1100
  1424. # define SYS_CS_ML_BIT 7
  1425. # define SYS_CS_ML_MASK (0x7 << SYS_CS_ML_BIT)
  1426. # define SYS_CS_DL (1 << 6)
  1427. # define SYS_CS_CL (1 << 5)
  1428. #else
  1429. # define SYS_CS_MUH_BIT 12
  1430. # define SYS_CS_MUH_MASK (0x7 << SYS_CS_MUH_BIT)
  1431. # define SYS_CS_DUH (1 << 11)
  1432. # define SYS_CS_CUH (1 << 10)
  1433. # define SYS_CS_MUD_BIT 7
  1434. # define SYS_CS_MUD_MASK (0x7 << SYS_CS_MUD_BIT)
  1435. # define SYS_CS_DUD (1 << 6)
  1436. # define SYS_CS_CUD (1 << 5)
  1437. #endif
  1438. # define SYS_CS_MIR_BIT 2
  1439. # define SYS_CS_MIR_MASK (0x7 << SYS_CS_MIR_BIT)
  1440. # define SYS_CS_DIR (1 << 1)
  1441. # define SYS_CS_CIR (1 << 0)
  1442. # define SYS_CS_MUX_AUX 0x1
  1443. # define SYS_CS_MUX_FQ0 0x2
  1444. # define SYS_CS_MUX_FQ1 0x3
  1445. # define SYS_CS_MUX_FQ2 0x4
  1446. # define SYS_CS_MUX_FQ3 0x5
  1447. # define SYS_CS_MUX_FQ4 0x6
  1448. # define SYS_CS_MUX_FQ5 0x7
  1449. #define SYS_CPUPLL 0xB1900060
  1450. #define SYS_AUXPLL 0xB1900064
  1451. /* AC97 Controller */
  1452. #define AC97C_CONFIG 0xB0000000
  1453. # define AC97C_RECV_SLOTS_BIT 13
  1454. # define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT)
  1455. # define AC97C_XMIT_SLOTS_BIT 3
  1456. # define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT)
  1457. # define AC97C_SG (1 << 2)
  1458. # define AC97C_SYNC (1 << 1)
  1459. # define AC97C_RESET (1 << 0)
  1460. #define AC97C_STATUS 0xB0000004
  1461. # define AC97C_XU (1 << 11)
  1462. # define AC97C_XO (1 << 10)
  1463. # define AC97C_RU (1 << 9)
  1464. # define AC97C_RO (1 << 8)
  1465. # define AC97C_READY (1 << 7)
  1466. # define AC97C_CP (1 << 6)
  1467. # define AC97C_TR (1 << 5)
  1468. # define AC97C_TE (1 << 4)
  1469. # define AC97C_TF (1 << 3)
  1470. # define AC97C_RR (1 << 2)
  1471. # define AC97C_RE (1 << 1)
  1472. # define AC97C_RF (1 << 0)
  1473. #define AC97C_DATA 0xB0000008
  1474. #define AC97C_CMD 0xB000000C
  1475. # define AC97C_WD_BIT 16
  1476. # define AC97C_READ (1 << 7)
  1477. # define AC97C_INDEX_MASK 0x7f
  1478. #define AC97C_CNTRL 0xB0000010
  1479. # define AC97C_RS (1 << 1)
  1480. # define AC97C_CE (1 << 0)
  1481. /* Secure Digital (SD) Controller */
  1482. #define SD0_XMIT_FIFO 0xB0600000
  1483. #define SD0_RECV_FIFO 0xB0600004
  1484. #define SD1_XMIT_FIFO 0xB0680000
  1485. #define SD1_RECV_FIFO 0xB0680004
  1486. #if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
  1487. /* Au1500 PCI Controller */
  1488. #define Au1500_CFG_BASE 0xB4005000 /* virtual, KSEG1 addr */
  1489. #define Au1500_PCI_CMEM (Au1500_CFG_BASE + 0)
  1490. #define Au1500_PCI_CFG (Au1500_CFG_BASE + 4)
  1491. # define PCI_ERROR ((1 << 22) | (1 << 23) | (1 << 24) | \
  1492. (1 << 25) | (1 << 26) | (1 << 27))
  1493. #define Au1500_PCI_B2BMASK_CCH (Au1500_CFG_BASE + 8)
  1494. #define Au1500_PCI_B2B0_VID (Au1500_CFG_BASE + 0xC)
  1495. #define Au1500_PCI_B2B1_ID (Au1500_CFG_BASE + 0x10)
  1496. #define Au1500_PCI_MWMASK_DEV (Au1500_CFG_BASE + 0x14)
  1497. #define Au1500_PCI_MWBASE_REV_CCL (Au1500_CFG_BASE + 0x18)
  1498. #define Au1500_PCI_ERR_ADDR (Au1500_CFG_BASE + 0x1C)
  1499. #define Au1500_PCI_SPEC_INTACK (Au1500_CFG_BASE + 0x20)
  1500. #define Au1500_PCI_ID (Au1500_CFG_BASE + 0x100)
  1501. #define Au1500_PCI_STATCMD (Au1500_CFG_BASE + 0x104)
  1502. #define Au1500_PCI_CLASSREV (Au1500_CFG_BASE + 0x108)
  1503. #define Au1500_PCI_HDRTYPE (Au1500_CFG_BASE + 0x10C)
  1504. #define Au1500_PCI_MBAR (Au1500_CFG_BASE + 0x110)
  1505. #define Au1500_PCI_HDR 0xB4005100 /* virtual, KSEG1 addr */
  1506. /*
  1507. * All of our structures, like PCI resource, have 32-bit members.
  1508. * Drivers are expected to do an ioremap on the PCI MEM resource, but it's
  1509. * hard to store 0x4 0000 0000 in a 32-bit type. We require a small patch
  1510. * to __ioremap to check for addresses between (u32)Au1500_PCI_MEM_START and
  1511. * (u32)Au1500_PCI_MEM_END and change those to the full 36-bit PCI MEM
  1512. * addresses. For PCI I/O, it's simpler because we get to do the ioremap
  1513. * ourselves and then adjust the device's resources.
  1514. */
  1515. #define Au1500_EXT_CFG 0x600000000ULL
  1516. #define Au1500_EXT_CFG_TYPE1 0x680000000ULL
  1517. #define Au1500_PCI_IO_START 0x500000000ULL
  1518. #define Au1500_PCI_IO_END 0x5000FFFFFULL
  1519. #define Au1500_PCI_MEM_START 0x440000000ULL
  1520. #define Au1500_PCI_MEM_END 0x44FFFFFFFULL
  1521. #define PCI_IO_START 0x00001000
  1522. #define PCI_IO_END 0x000FFFFF
  1523. #define PCI_MEM_START 0x40000000
  1524. #define PCI_MEM_END 0x4FFFFFFF
  1525. #define PCI_FIRST_DEVFN (0 << 3)
  1526. #define PCI_LAST_DEVFN (19 << 3)
  1527. #define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */
  1528. #define IOPORT_RESOURCE_END 0xffffffff
  1529. #define IOMEM_RESOURCE_START 0x10000000
  1530. #define IOMEM_RESOURCE_END 0xffffffff
  1531. #else /* Au1000 and Au1100 and Au1200 */
  1532. /* Don't allow any legacy ports probing */
  1533. #define IOPORT_RESOURCE_START 0x10000000
  1534. #define IOPORT_RESOURCE_END 0xffffffff
  1535. #define IOMEM_RESOURCE_START 0x10000000
  1536. #define IOMEM_RESOURCE_END 0xffffffff
  1537. #define PCI_IO_START 0
  1538. #define PCI_IO_END 0
  1539. #define PCI_MEM_START 0
  1540. #define PCI_MEM_END 0
  1541. #define PCI_FIRST_DEVFN 0
  1542. #define PCI_LAST_DEVFN 0
  1543. #endif
  1544. #ifndef _LANGUAGE_ASSEMBLY
  1545. typedef volatile struct {
  1546. /* 0x0000 */ u32 toytrim;
  1547. /* 0x0004 */ u32 toywrite;
  1548. /* 0x0008 */ u32 toymatch0;
  1549. /* 0x000C */ u32 toymatch1;
  1550. /* 0x0010 */ u32 toymatch2;
  1551. /* 0x0014 */ u32 cntrctrl;
  1552. /* 0x0018 */ u32 scratch0;
  1553. /* 0x001C */ u32 scratch1;
  1554. /* 0x0020 */ u32 freqctrl0;
  1555. /* 0x0024 */ u32 freqctrl1;
  1556. /* 0x0028 */ u32 clksrc;
  1557. /* 0x002C */ u32 pinfunc;
  1558. /* 0x0030 */ u32 reserved0;
  1559. /* 0x0034 */ u32 wakemsk;
  1560. /* 0x0038 */ u32 endian;
  1561. /* 0x003C */ u32 powerctrl;
  1562. /* 0x0040 */ u32 toyread;
  1563. /* 0x0044 */ u32 rtctrim;
  1564. /* 0x0048 */ u32 rtcwrite;
  1565. /* 0x004C */ u32 rtcmatch0;
  1566. /* 0x0050 */ u32 rtcmatch1;
  1567. /* 0x0054 */ u32 rtcmatch2;
  1568. /* 0x0058 */ u32 rtcread;
  1569. /* 0x005C */ u32 wakesrc;
  1570. /* 0x0060 */ u32 cpupll;
  1571. /* 0x0064 */ u32 auxpll;
  1572. /* 0x0068 */ u32 reserved1;
  1573. /* 0x006C */ u32 reserved2;
  1574. /* 0x0070 */ u32 reserved3;
  1575. /* 0x0074 */ u32 reserved4;
  1576. /* 0x0078 */ u32 slppwr;
  1577. /* 0x007C */ u32 sleep;
  1578. /* 0x0080 */ u32 reserved5[32];
  1579. /* 0x0100 */ u32 trioutrd;
  1580. #define trioutclr trioutrd
  1581. /* 0x0104 */ u32 reserved6;
  1582. /* 0x0108 */ u32 outputrd;
  1583. #define outputset outputrd
  1584. /* 0x010C */ u32 outputclr;
  1585. /* 0x0110 */ u32 pinstaterd;
  1586. #define pininputen pinstaterd
  1587. } AU1X00_SYS;
  1588. static AU1X00_SYS * const sys = (AU1X00_SYS *)SYS_BASE;
  1589. #endif
  1590. /*
  1591. * Processor information based on PRID.
  1592. * Copied from PowerPC.
  1593. */
  1594. #ifndef _LANGUAGE_ASSEMBLY
  1595. struct cpu_spec {
  1596. /* CPU is matched via (PRID & prid_mask) == prid_value */
  1597. unsigned int prid_mask;
  1598. unsigned int prid_value;
  1599. char *cpu_name;
  1600. unsigned char cpu_od; /* Set Config[OD] */
  1601. unsigned char cpu_bclk; /* Enable BCLK switching */
  1602. unsigned char cpu_pll_wo; /* sys_cpupll reg. write-only */
  1603. };
  1604. extern struct cpu_spec cpu_specs[];
  1605. extern struct cpu_spec *cur_cpu_spec[];
  1606. #endif
  1607. #endif