au1000.h 42 KB

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