au1000.h 48 KB

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