au1000.h 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212
  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. /* SOC Interrupt numbers */
  35. /* Au1000-style (IC0/1): 2 controllers with 32 sources each */
  36. #define AU1000_INTC0_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
  37. #define AU1000_INTC0_INT_LAST (AU1000_INTC0_INT_BASE + 31)
  38. #define AU1000_INTC1_INT_BASE (AU1000_INTC0_INT_LAST + 1)
  39. #define AU1000_INTC1_INT_LAST (AU1000_INTC1_INT_BASE + 31)
  40. #define AU1000_MAX_INTR AU1000_INTC1_INT_LAST
  41. /* Au1300-style (GPIC): 1 controller with up to 128 sources */
  42. #define ALCHEMY_GPIC_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
  43. #define ALCHEMY_GPIC_INT_NUM 128
  44. #define ALCHEMY_GPIC_INT_LAST (ALCHEMY_GPIC_INT_BASE + ALCHEMY_GPIC_INT_NUM - 1)
  45. /* common clock names, shared among all variants. AUXPLL2 is Au1300 */
  46. #define ALCHEMY_ROOT_CLK "root_clk"
  47. #define ALCHEMY_CPU_CLK "cpu_clk"
  48. #define ALCHEMY_AUXPLL_CLK "auxpll_clk"
  49. #define ALCHEMY_AUXPLL2_CLK "auxpll2_clk"
  50. #define ALCHEMY_SYSBUS_CLK "sysbus_clk"
  51. #define ALCHEMY_PERIPH_CLK "periph_clk"
  52. #define ALCHEMY_MEM_CLK "mem_clk"
  53. #define ALCHEMY_LR_CLK "lr_clk"
  54. #define ALCHEMY_FG0_CLK "fg0_clk"
  55. #define ALCHEMY_FG1_CLK "fg1_clk"
  56. #define ALCHEMY_FG2_CLK "fg2_clk"
  57. #define ALCHEMY_FG3_CLK "fg3_clk"
  58. #define ALCHEMY_FG4_CLK "fg4_clk"
  59. #define ALCHEMY_FG5_CLK "fg5_clk"
  60. /* Au1300 peripheral interrupt numbers */
  61. #define AU1300_FIRST_INT (ALCHEMY_GPIC_INT_BASE)
  62. #define AU1300_UART1_INT (AU1300_FIRST_INT + 17)
  63. #define AU1300_UART2_INT (AU1300_FIRST_INT + 25)
  64. #define AU1300_UART3_INT (AU1300_FIRST_INT + 27)
  65. #define AU1300_SD1_INT (AU1300_FIRST_INT + 32)
  66. #define AU1300_SD2_INT (AU1300_FIRST_INT + 38)
  67. #define AU1300_PSC0_INT (AU1300_FIRST_INT + 48)
  68. #define AU1300_PSC1_INT (AU1300_FIRST_INT + 52)
  69. #define AU1300_PSC2_INT (AU1300_FIRST_INT + 56)
  70. #define AU1300_PSC3_INT (AU1300_FIRST_INT + 60)
  71. #define AU1300_NAND_INT (AU1300_FIRST_INT + 62)
  72. #define AU1300_DDMA_INT (AU1300_FIRST_INT + 75)
  73. #define AU1300_MMU_INT (AU1300_FIRST_INT + 76)
  74. #define AU1300_MPU_INT (AU1300_FIRST_INT + 77)
  75. #define AU1300_GPU_INT (AU1300_FIRST_INT + 78)
  76. #define AU1300_UDMA_INT (AU1300_FIRST_INT + 79)
  77. #define AU1300_TOY_INT (AU1300_FIRST_INT + 80)
  78. #define AU1300_TOY_MATCH0_INT (AU1300_FIRST_INT + 81)
  79. #define AU1300_TOY_MATCH1_INT (AU1300_FIRST_INT + 82)
  80. #define AU1300_TOY_MATCH2_INT (AU1300_FIRST_INT + 83)
  81. #define AU1300_RTC_INT (AU1300_FIRST_INT + 84)
  82. #define AU1300_RTC_MATCH0_INT (AU1300_FIRST_INT + 85)
  83. #define AU1300_RTC_MATCH1_INT (AU1300_FIRST_INT + 86)
  84. #define AU1300_RTC_MATCH2_INT (AU1300_FIRST_INT + 87)
  85. #define AU1300_UART0_INT (AU1300_FIRST_INT + 88)
  86. #define AU1300_SD0_INT (AU1300_FIRST_INT + 89)
  87. #define AU1300_USB_INT (AU1300_FIRST_INT + 90)
  88. #define AU1300_LCD_INT (AU1300_FIRST_INT + 91)
  89. #define AU1300_BSA_INT (AU1300_FIRST_INT + 92)
  90. #define AU1300_MPE_INT (AU1300_FIRST_INT + 93)
  91. #define AU1300_ITE_INT (AU1300_FIRST_INT + 94)
  92. #define AU1300_AES_INT (AU1300_FIRST_INT + 95)
  93. #define AU1300_CIM_INT (AU1300_FIRST_INT + 96)
  94. /**********************************************************************/
  95. /*
  96. * Physical base addresses for integrated peripherals
  97. * 0..au1000 1..au1500 2..au1100 3..au1550 4..au1200 5..au1300
  98. */
  99. #define AU1000_AC97_PHYS_ADDR 0x10000000 /* 012 */
  100. #define AU1300_ROM_PHYS_ADDR 0x10000000 /* 5 */
  101. #define AU1300_OTP_PHYS_ADDR 0x10002000 /* 5 */
  102. #define AU1300_VSS_PHYS_ADDR 0x10003000 /* 5 */
  103. #define AU1300_UART0_PHYS_ADDR 0x10100000 /* 5 */
  104. #define AU1300_UART1_PHYS_ADDR 0x10101000 /* 5 */
  105. #define AU1300_UART2_PHYS_ADDR 0x10102000 /* 5 */
  106. #define AU1300_UART3_PHYS_ADDR 0x10103000 /* 5 */
  107. #define AU1000_USB_OHCI_PHYS_ADDR 0x10100000 /* 012 */
  108. #define AU1000_USB_UDC_PHYS_ADDR 0x10200000 /* 0123 */
  109. #define AU1300_GPIC_PHYS_ADDR 0x10200000 /* 5 */
  110. #define AU1000_IRDA_PHYS_ADDR 0x10300000 /* 02 */
  111. #define AU1200_AES_PHYS_ADDR 0x10300000 /* 45 */
  112. #define AU1000_IC0_PHYS_ADDR 0x10400000 /* 01234 */
  113. #define AU1300_GPU_PHYS_ADDR 0x10500000 /* 5 */
  114. #define AU1000_MAC0_PHYS_ADDR 0x10500000 /* 023 */
  115. #define AU1000_MAC1_PHYS_ADDR 0x10510000 /* 023 */
  116. #define AU1000_MACEN_PHYS_ADDR 0x10520000 /* 023 */
  117. #define AU1100_SD0_PHYS_ADDR 0x10600000 /* 245 */
  118. #define AU1300_SD1_PHYS_ADDR 0x10601000 /* 5 */
  119. #define AU1300_SD2_PHYS_ADDR 0x10602000 /* 5 */
  120. #define AU1100_SD1_PHYS_ADDR 0x10680000 /* 24 */
  121. #define AU1300_SYS_PHYS_ADDR 0x10900000 /* 5 */
  122. #define AU1550_PSC2_PHYS_ADDR 0x10A00000 /* 3 */
  123. #define AU1550_PSC3_PHYS_ADDR 0x10B00000 /* 3 */
  124. #define AU1300_PSC0_PHYS_ADDR 0x10A00000 /* 5 */
  125. #define AU1300_PSC1_PHYS_ADDR 0x10A01000 /* 5 */
  126. #define AU1300_PSC2_PHYS_ADDR 0x10A02000 /* 5 */
  127. #define AU1300_PSC3_PHYS_ADDR 0x10A03000 /* 5 */
  128. #define AU1000_I2S_PHYS_ADDR 0x11000000 /* 02 */
  129. #define AU1500_MAC0_PHYS_ADDR 0x11500000 /* 1 */
  130. #define AU1500_MAC1_PHYS_ADDR 0x11510000 /* 1 */
  131. #define AU1500_MACEN_PHYS_ADDR 0x11520000 /* 1 */
  132. #define AU1000_UART0_PHYS_ADDR 0x11100000 /* 01234 */
  133. #define AU1200_SWCNT_PHYS_ADDR 0x1110010C /* 4 */
  134. #define AU1000_UART1_PHYS_ADDR 0x11200000 /* 0234 */
  135. #define AU1000_UART2_PHYS_ADDR 0x11300000 /* 0 */
  136. #define AU1000_UART3_PHYS_ADDR 0x11400000 /* 0123 */
  137. #define AU1000_SSI0_PHYS_ADDR 0x11600000 /* 02 */
  138. #define AU1000_SSI1_PHYS_ADDR 0x11680000 /* 02 */
  139. #define AU1500_GPIO2_PHYS_ADDR 0x11700000 /* 1234 */
  140. #define AU1000_IC1_PHYS_ADDR 0x11800000 /* 01234 */
  141. #define AU1000_SYS_PHYS_ADDR 0x11900000 /* 012345 */
  142. #define AU1550_PSC0_PHYS_ADDR 0x11A00000 /* 34 */
  143. #define AU1550_PSC1_PHYS_ADDR 0x11B00000 /* 34 */
  144. #define AU1000_MEM_PHYS_ADDR 0x14000000 /* 01234 */
  145. #define AU1000_STATIC_MEM_PHYS_ADDR 0x14001000 /* 01234 */
  146. #define AU1300_UDMA_PHYS_ADDR 0x14001800 /* 5 */
  147. #define AU1000_DMA_PHYS_ADDR 0x14002000 /* 012 */
  148. #define AU1550_DBDMA_PHYS_ADDR 0x14002000 /* 345 */
  149. #define AU1550_DBDMA_CONF_PHYS_ADDR 0x14003000 /* 345 */
  150. #define AU1000_MACDMA0_PHYS_ADDR 0x14004000 /* 0123 */
  151. #define AU1000_MACDMA1_PHYS_ADDR 0x14004200 /* 0123 */
  152. #define AU1200_CIM_PHYS_ADDR 0x14004000 /* 45 */
  153. #define AU1500_PCI_PHYS_ADDR 0x14005000 /* 13 */
  154. #define AU1550_PE_PHYS_ADDR 0x14008000 /* 3 */
  155. #define AU1200_MAEBE_PHYS_ADDR 0x14010000 /* 4 */
  156. #define AU1200_MAEFE_PHYS_ADDR 0x14012000 /* 4 */
  157. #define AU1300_MAEITE_PHYS_ADDR 0x14010000 /* 5 */
  158. #define AU1300_MAEMPE_PHYS_ADDR 0x14014000 /* 5 */
  159. #define AU1550_USB_OHCI_PHYS_ADDR 0x14020000 /* 3 */
  160. #define AU1200_USB_CTL_PHYS_ADDR 0x14020000 /* 4 */
  161. #define AU1200_USB_OTG_PHYS_ADDR 0x14020020 /* 4 */
  162. #define AU1200_USB_OHCI_PHYS_ADDR 0x14020100 /* 4 */
  163. #define AU1200_USB_EHCI_PHYS_ADDR 0x14020200 /* 4 */
  164. #define AU1200_USB_UDC_PHYS_ADDR 0x14022000 /* 4 */
  165. #define AU1300_USB_EHCI_PHYS_ADDR 0x14020000 /* 5 */
  166. #define AU1300_USB_OHCI0_PHYS_ADDR 0x14020400 /* 5 */
  167. #define AU1300_USB_OHCI1_PHYS_ADDR 0x14020800 /* 5 */
  168. #define AU1300_USB_CTL_PHYS_ADDR 0x14021000 /* 5 */
  169. #define AU1300_USB_OTG_PHYS_ADDR 0x14022000 /* 5 */
  170. #define AU1300_MAEBSA_PHYS_ADDR 0x14030000 /* 5 */
  171. #define AU1100_LCD_PHYS_ADDR 0x15000000 /* 2 */
  172. #define AU1200_LCD_PHYS_ADDR 0x15000000 /* 45 */
  173. #define AU1500_PCI_MEM_PHYS_ADDR 0x400000000ULL /* 13 */
  174. #define AU1500_PCI_IO_PHYS_ADDR 0x500000000ULL /* 13 */
  175. #define AU1500_PCI_CONFIG0_PHYS_ADDR 0x600000000ULL /* 13 */
  176. #define AU1500_PCI_CONFIG1_PHYS_ADDR 0x680000000ULL /* 13 */
  177. #define AU1000_PCMCIA_IO_PHYS_ADDR 0xF00000000ULL /* 012345 */
  178. #define AU1000_PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL /* 012345 */
  179. #define AU1000_PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL /* 012345 */
  180. /**********************************************************************/
  181. /*
  182. * Au1300 GPIO+INT controller (GPIC) register offsets and bits
  183. * Registers are 128bits (0x10 bytes), divided into 4 "banks".
  184. */
  185. #define AU1300_GPIC_PINVAL 0x0000
  186. #define AU1300_GPIC_PINVALCLR 0x0010
  187. #define AU1300_GPIC_IPEND 0x0020
  188. #define AU1300_GPIC_PRIENC 0x0030
  189. #define AU1300_GPIC_IEN 0x0040 /* int_mask in manual */
  190. #define AU1300_GPIC_IDIS 0x0050 /* int_maskclr in manual */
  191. #define AU1300_GPIC_DMASEL 0x0060
  192. #define AU1300_GPIC_DEVSEL 0x0080
  193. #define AU1300_GPIC_DEVCLR 0x0090
  194. #define AU1300_GPIC_RSTVAL 0x00a0
  195. /* pin configuration space. one 32bit register for up to 128 IRQs */
  196. #define AU1300_GPIC_PINCFG 0x1000
  197. #define GPIC_GPIO_TO_BIT(gpio) \
  198. (1 << ((gpio) & 0x1f))
  199. #define GPIC_GPIO_BANKOFF(gpio) \
  200. (((gpio) >> 5) * 4)
  201. /* Pin Control bits: who owns the pin, what does it do */
  202. #define GPIC_CFG_PC_GPIN 0
  203. #define GPIC_CFG_PC_DEV 1
  204. #define GPIC_CFG_PC_GPOLOW 2
  205. #define GPIC_CFG_PC_GPOHIGH 3
  206. #define GPIC_CFG_PC_MASK 3
  207. /* assign pin to MIPS IRQ line */
  208. #define GPIC_CFG_IL_SET(x) (((x) & 3) << 2)
  209. #define GPIC_CFG_IL_MASK (3 << 2)
  210. /* pin interrupt type setup */
  211. #define GPIC_CFG_IC_OFF (0 << 4)
  212. #define GPIC_CFG_IC_LEVEL_LOW (1 << 4)
  213. #define GPIC_CFG_IC_LEVEL_HIGH (2 << 4)
  214. #define GPIC_CFG_IC_EDGE_FALL (5 << 4)
  215. #define GPIC_CFG_IC_EDGE_RISE (6 << 4)
  216. #define GPIC_CFG_IC_EDGE_BOTH (7 << 4)
  217. #define GPIC_CFG_IC_MASK (7 << 4)
  218. /* allow interrupt to wake cpu from 'wait' */
  219. #define GPIC_CFG_IDLEWAKE (1 << 7)
  220. /***********************************************************************/
  221. /* Au1000 SDRAM memory controller register offsets */
  222. #define AU1000_MEM_SDMODE0 0x0000
  223. #define AU1000_MEM_SDMODE1 0x0004
  224. #define AU1000_MEM_SDMODE2 0x0008
  225. #define AU1000_MEM_SDADDR0 0x000C
  226. #define AU1000_MEM_SDADDR1 0x0010
  227. #define AU1000_MEM_SDADDR2 0x0014
  228. #define AU1000_MEM_SDREFCFG 0x0018
  229. #define AU1000_MEM_SDPRECMD 0x001C
  230. #define AU1000_MEM_SDAUTOREF 0x0020
  231. #define AU1000_MEM_SDWRMD0 0x0024
  232. #define AU1000_MEM_SDWRMD1 0x0028
  233. #define AU1000_MEM_SDWRMD2 0x002C
  234. #define AU1000_MEM_SDSLEEP 0x0030
  235. #define AU1000_MEM_SDSMCKE 0x0034
  236. /* MEM_SDMODE register content definitions */
  237. #define MEM_SDMODE_F (1 << 22)
  238. #define MEM_SDMODE_SR (1 << 21)
  239. #define MEM_SDMODE_BS (1 << 20)
  240. #define MEM_SDMODE_RS (3 << 18)
  241. #define MEM_SDMODE_CS (7 << 15)
  242. #define MEM_SDMODE_TRAS (15 << 11)
  243. #define MEM_SDMODE_TMRD (3 << 9)
  244. #define MEM_SDMODE_TWR (3 << 7)
  245. #define MEM_SDMODE_TRP (3 << 5)
  246. #define MEM_SDMODE_TRCD (3 << 3)
  247. #define MEM_SDMODE_TCL (7 << 0)
  248. #define MEM_SDMODE_BS_2Bank (0 << 20)
  249. #define MEM_SDMODE_BS_4Bank (1 << 20)
  250. #define MEM_SDMODE_RS_11Row (0 << 18)
  251. #define MEM_SDMODE_RS_12Row (1 << 18)
  252. #define MEM_SDMODE_RS_13Row (2 << 18)
  253. #define MEM_SDMODE_RS_N(N) ((N) << 18)
  254. #define MEM_SDMODE_CS_7Col (0 << 15)
  255. #define MEM_SDMODE_CS_8Col (1 << 15)
  256. #define MEM_SDMODE_CS_9Col (2 << 15)
  257. #define MEM_SDMODE_CS_10Col (3 << 15)
  258. #define MEM_SDMODE_CS_11Col (4 << 15)
  259. #define MEM_SDMODE_CS_N(N) ((N) << 15)
  260. #define MEM_SDMODE_TRAS_N(N) ((N) << 11)
  261. #define MEM_SDMODE_TMRD_N(N) ((N) << 9)
  262. #define MEM_SDMODE_TWR_N(N) ((N) << 7)
  263. #define MEM_SDMODE_TRP_N(N) ((N) << 5)
  264. #define MEM_SDMODE_TRCD_N(N) ((N) << 3)
  265. #define MEM_SDMODE_TCL_N(N) ((N) << 0)
  266. /* MEM_SDADDR register contents definitions */
  267. #define MEM_SDADDR_E (1 << 20)
  268. #define MEM_SDADDR_CSBA (0x03FF << 10)
  269. #define MEM_SDADDR_CSMASK (0x03FF << 0)
  270. #define MEM_SDADDR_CSBA_N(N) ((N) & (0x03FF << 22) >> 12)
  271. #define MEM_SDADDR_CSMASK_N(N) ((N)&(0x03FF << 22) >> 22)
  272. /* MEM_SDREFCFG register content definitions */
  273. #define MEM_SDREFCFG_TRC (15 << 28)
  274. #define MEM_SDREFCFG_TRPM (3 << 26)
  275. #define MEM_SDREFCFG_E (1 << 25)
  276. #define MEM_SDREFCFG_RE (0x1ffffff << 0)
  277. #define MEM_SDREFCFG_TRC_N(N) ((N) << MEM_SDREFCFG_TRC)
  278. #define MEM_SDREFCFG_TRPM_N(N) ((N) << MEM_SDREFCFG_TRPM)
  279. #define MEM_SDREFCFG_REF_N(N) (N)
  280. /* Au1550 SDRAM Register Offsets */
  281. #define AU1550_MEM_SDMODE0 0x0800
  282. #define AU1550_MEM_SDMODE1 0x0808
  283. #define AU1550_MEM_SDMODE2 0x0810
  284. #define AU1550_MEM_SDADDR0 0x0820
  285. #define AU1550_MEM_SDADDR1 0x0828
  286. #define AU1550_MEM_SDADDR2 0x0830
  287. #define AU1550_MEM_SDCONFIGA 0x0840
  288. #define AU1550_MEM_SDCONFIGB 0x0848
  289. #define AU1550_MEM_SDSTAT 0x0850
  290. #define AU1550_MEM_SDERRADDR 0x0858
  291. #define AU1550_MEM_SDSTRIDE0 0x0860
  292. #define AU1550_MEM_SDSTRIDE1 0x0868
  293. #define AU1550_MEM_SDSTRIDE2 0x0870
  294. #define AU1550_MEM_SDWRMD0 0x0880
  295. #define AU1550_MEM_SDWRMD1 0x0888
  296. #define AU1550_MEM_SDWRMD2 0x0890
  297. #define AU1550_MEM_SDPRECMD 0x08C0
  298. #define AU1550_MEM_SDAUTOREF 0x08C8
  299. #define AU1550_MEM_SDSREF 0x08D0
  300. #define AU1550_MEM_SDSLEEP MEM_SDSREF
  301. /* Static Bus Controller register offsets */
  302. #define AU1000_MEM_STCFG0 0x000
  303. #define AU1000_MEM_STTIME0 0x004
  304. #define AU1000_MEM_STADDR0 0x008
  305. #define AU1000_MEM_STCFG1 0x010
  306. #define AU1000_MEM_STTIME1 0x014
  307. #define AU1000_MEM_STADDR1 0x018
  308. #define AU1000_MEM_STCFG2 0x020
  309. #define AU1000_MEM_STTIME2 0x024
  310. #define AU1000_MEM_STADDR2 0x028
  311. #define AU1000_MEM_STCFG3 0x030
  312. #define AU1000_MEM_STTIME3 0x034
  313. #define AU1000_MEM_STADDR3 0x038
  314. #define AU1000_MEM_STNDCTL 0x100
  315. #define AU1000_MEM_STSTAT 0x104
  316. #define MEM_STNAND_CMD 0x0
  317. #define MEM_STNAND_ADDR 0x4
  318. #define MEM_STNAND_DATA 0x20
  319. /* Programmable Counters 0 and 1 */
  320. #define AU1000_SYS_CNTRCTRL 0x14
  321. # define SYS_CNTRL_E1S (1 << 23)
  322. # define SYS_CNTRL_T1S (1 << 20)
  323. # define SYS_CNTRL_M21 (1 << 19)
  324. # define SYS_CNTRL_M11 (1 << 18)
  325. # define SYS_CNTRL_M01 (1 << 17)
  326. # define SYS_CNTRL_C1S (1 << 16)
  327. # define SYS_CNTRL_BP (1 << 14)
  328. # define SYS_CNTRL_EN1 (1 << 13)
  329. # define SYS_CNTRL_BT1 (1 << 12)
  330. # define SYS_CNTRL_EN0 (1 << 11)
  331. # define SYS_CNTRL_BT0 (1 << 10)
  332. # define SYS_CNTRL_E0 (1 << 8)
  333. # define SYS_CNTRL_E0S (1 << 7)
  334. # define SYS_CNTRL_32S (1 << 5)
  335. # define SYS_CNTRL_T0S (1 << 4)
  336. # define SYS_CNTRL_M20 (1 << 3)
  337. # define SYS_CNTRL_M10 (1 << 2)
  338. # define SYS_CNTRL_M00 (1 << 1)
  339. # define SYS_CNTRL_C0S (1 << 0)
  340. /* Programmable Counter 0 Registers */
  341. #define AU1000_SYS_TOYTRIM 0x00
  342. #define AU1000_SYS_TOYWRITE 0x04
  343. #define AU1000_SYS_TOYMATCH0 0x08
  344. #define AU1000_SYS_TOYMATCH1 0x0c
  345. #define AU1000_SYS_TOYMATCH2 0x10
  346. #define AU1000_SYS_TOYREAD 0x40
  347. /* Programmable Counter 1 Registers */
  348. #define AU1000_SYS_RTCTRIM 0x44
  349. #define AU1000_SYS_RTCWRITE 0x48
  350. #define AU1000_SYS_RTCMATCH0 0x4c
  351. #define AU1000_SYS_RTCMATCH1 0x50
  352. #define AU1000_SYS_RTCMATCH2 0x54
  353. #define AU1000_SYS_RTCREAD 0x58
  354. /* GPIO */
  355. #define AU1000_SYS_PINFUNC 0x2C
  356. # define SYS_PF_USB (1 << 15) /* 2nd USB device/host */
  357. # define SYS_PF_U3 (1 << 14) /* GPIO23/U3TXD */
  358. # define SYS_PF_U2 (1 << 13) /* GPIO22/U2TXD */
  359. # define SYS_PF_U1 (1 << 12) /* GPIO21/U1TXD */
  360. # define SYS_PF_SRC (1 << 11) /* GPIO6/SROMCKE */
  361. # define SYS_PF_CK5 (1 << 10) /* GPIO3/CLK5 */
  362. # define SYS_PF_CK4 (1 << 9) /* GPIO2/CLK4 */
  363. # define SYS_PF_IRF (1 << 8) /* GPIO15/IRFIRSEL */
  364. # define SYS_PF_UR3 (1 << 7) /* GPIO[14:9]/UART3 */
  365. # define SYS_PF_I2D (1 << 6) /* GPIO8/I2SDI */
  366. # define SYS_PF_I2S (1 << 5) /* I2S/GPIO[29:31] */
  367. # define SYS_PF_NI2 (1 << 4) /* NI2/GPIO[24:28] */
  368. # define SYS_PF_U0 (1 << 3) /* U0TXD/GPIO20 */
  369. # define SYS_PF_RD (1 << 2) /* IRTXD/GPIO19 */
  370. # define SYS_PF_A97 (1 << 1) /* AC97/SSL1 */
  371. # define SYS_PF_S0 (1 << 0) /* SSI_0/GPIO[16:18] */
  372. /* Au1100 only */
  373. # define SYS_PF_PC (1 << 18) /* PCMCIA/GPIO[207:204] */
  374. # define SYS_PF_LCD (1 << 17) /* extern lcd/GPIO[203:200] */
  375. # define SYS_PF_CS (1 << 16) /* EXTCLK0/32KHz to gpio2 */
  376. # define SYS_PF_EX0 (1 << 9) /* GPIO2/clock */
  377. /* Au1550 only. Redefines lots of pins */
  378. # define SYS_PF_PSC2_MASK (7 << 17)
  379. # define SYS_PF_PSC2_AC97 0
  380. # define SYS_PF_PSC2_SPI 0
  381. # define SYS_PF_PSC2_I2S (1 << 17)
  382. # define SYS_PF_PSC2_SMBUS (3 << 17)
  383. # define SYS_PF_PSC2_GPIO (7 << 17)
  384. # define SYS_PF_PSC3_MASK (7 << 20)
  385. # define SYS_PF_PSC3_AC97 0
  386. # define SYS_PF_PSC3_SPI 0
  387. # define SYS_PF_PSC3_I2S (1 << 20)
  388. # define SYS_PF_PSC3_SMBUS (3 << 20)
  389. # define SYS_PF_PSC3_GPIO (7 << 20)
  390. # define SYS_PF_PSC1_S1 (1 << 1)
  391. # define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2))
  392. /* Au1200 only */
  393. #define SYS_PINFUNC_DMA (1 << 31)
  394. #define SYS_PINFUNC_S0A (1 << 30)
  395. #define SYS_PINFUNC_S1A (1 << 29)
  396. #define SYS_PINFUNC_LP0 (1 << 28)
  397. #define SYS_PINFUNC_LP1 (1 << 27)
  398. #define SYS_PINFUNC_LD16 (1 << 26)
  399. #define SYS_PINFUNC_LD8 (1 << 25)
  400. #define SYS_PINFUNC_LD1 (1 << 24)
  401. #define SYS_PINFUNC_LD0 (1 << 23)
  402. #define SYS_PINFUNC_P1A (3 << 21)
  403. #define SYS_PINFUNC_P1B (1 << 20)
  404. #define SYS_PINFUNC_FS3 (1 << 19)
  405. #define SYS_PINFUNC_P0A (3 << 17)
  406. #define SYS_PINFUNC_CS (1 << 16)
  407. #define SYS_PINFUNC_CIM (1 << 15)
  408. #define SYS_PINFUNC_P1C (1 << 14)
  409. #define SYS_PINFUNC_U1T (1 << 12)
  410. #define SYS_PINFUNC_U1R (1 << 11)
  411. #define SYS_PINFUNC_EX1 (1 << 10)
  412. #define SYS_PINFUNC_EX0 (1 << 9)
  413. #define SYS_PINFUNC_U0R (1 << 8)
  414. #define SYS_PINFUNC_MC (1 << 7)
  415. #define SYS_PINFUNC_S0B (1 << 6)
  416. #define SYS_PINFUNC_S0C (1 << 5)
  417. #define SYS_PINFUNC_P0B (1 << 4)
  418. #define SYS_PINFUNC_U0T (1 << 3)
  419. #define SYS_PINFUNC_S1B (1 << 2)
  420. /* Power Management */
  421. #define AU1000_SYS_SCRATCH0 0x18
  422. #define AU1000_SYS_SCRATCH1 0x1c
  423. #define AU1000_SYS_WAKEMSK 0x34
  424. #define AU1000_SYS_ENDIAN 0x38
  425. #define AU1000_SYS_POWERCTRL 0x3c
  426. #define AU1000_SYS_WAKESRC 0x5c
  427. #define AU1000_SYS_SLPPWR 0x78
  428. #define AU1000_SYS_SLEEP 0x7c
  429. #define SYS_WAKEMSK_D2 (1 << 9)
  430. #define SYS_WAKEMSK_M2 (1 << 8)
  431. #define SYS_WAKEMSK_GPIO(x) (1 << (x))
  432. /* Clock Controller */
  433. #define AU1000_SYS_FREQCTRL0 0x20
  434. #define AU1000_SYS_FREQCTRL1 0x24
  435. #define AU1000_SYS_CLKSRC 0x28
  436. #define AU1000_SYS_CPUPLL 0x60
  437. #define AU1000_SYS_AUXPLL 0x64
  438. #define AU1300_SYS_AUXPLL2 0x68
  439. /**********************************************************************/
  440. /* The PCI chip selects are outside the 32bit space, and since we can't
  441. * just program the 36bit addresses into BARs, we have to take a chunk
  442. * out of the 32bit space and reserve it for PCI. When these addresses
  443. * are ioremap()ed, they'll be fixed up to the real 36bit address before
  444. * being passed to the real ioremap function.
  445. */
  446. #define ALCHEMY_PCI_MEMWIN_START (AU1500_PCI_MEM_PHYS_ADDR >> 4)
  447. #define ALCHEMY_PCI_MEMWIN_END (ALCHEMY_PCI_MEMWIN_START + 0x0FFFFFFF)
  448. /* for PCI IO it's simpler because we get to do the ioremap ourselves and then
  449. * adjust the device's resources.
  450. */
  451. #define ALCHEMY_PCI_IOWIN_START 0x00001000
  452. #define ALCHEMY_PCI_IOWIN_END 0x0000FFFF
  453. #ifdef CONFIG_PCI
  454. #define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */
  455. #define IOPORT_RESOURCE_END 0xffffffff
  456. #define IOMEM_RESOURCE_START 0x10000000
  457. #define IOMEM_RESOURCE_END 0xfffffffffULL
  458. #else
  459. /* Don't allow any legacy ports probing */
  460. #define IOPORT_RESOURCE_START 0x10000000
  461. #define IOPORT_RESOURCE_END 0xffffffff
  462. #define IOMEM_RESOURCE_START 0x10000000
  463. #define IOMEM_RESOURCE_END 0xfffffffffULL
  464. #endif
  465. /* PCI controller block register offsets */
  466. #define PCI_REG_CMEM 0x0000
  467. #define PCI_REG_CONFIG 0x0004
  468. #define PCI_REG_B2BMASK_CCH 0x0008
  469. #define PCI_REG_B2BBASE0_VID 0x000C
  470. #define PCI_REG_B2BBASE1_SID 0x0010
  471. #define PCI_REG_MWMASK_DEV 0x0014
  472. #define PCI_REG_MWBASE_REV_CCL 0x0018
  473. #define PCI_REG_ERR_ADDR 0x001C
  474. #define PCI_REG_SPEC_INTACK 0x0020
  475. #define PCI_REG_ID 0x0100
  476. #define PCI_REG_STATCMD 0x0104
  477. #define PCI_REG_CLASSREV 0x0108
  478. #define PCI_REG_PARAM 0x010C
  479. #define PCI_REG_MBAR 0x0110
  480. #define PCI_REG_TIMEOUT 0x0140
  481. /* PCI controller block register bits */
  482. #define PCI_CMEM_E (1 << 28) /* enable cacheable memory */
  483. #define PCI_CMEM_CMBASE(x) (((x) & 0x3fff) << 14)
  484. #define PCI_CMEM_CMMASK(x) ((x) & 0x3fff)
  485. #define PCI_CONFIG_ERD (1 << 27) /* pci error during R/W */
  486. #define PCI_CONFIG_ET (1 << 26) /* error in target mode */
  487. #define PCI_CONFIG_EF (1 << 25) /* fatal error */
  488. #define PCI_CONFIG_EP (1 << 24) /* parity error */
  489. #define PCI_CONFIG_EM (1 << 23) /* multiple errors */
  490. #define PCI_CONFIG_BM (1 << 22) /* bad master error */
  491. #define PCI_CONFIG_PD (1 << 20) /* PCI Disable */
  492. #define PCI_CONFIG_BME (1 << 19) /* Byte Mask Enable for reads */
  493. #define PCI_CONFIG_NC (1 << 16) /* mark mem access non-coherent */
  494. #define PCI_CONFIG_IA (1 << 15) /* INTA# enabled (target mode) */
  495. #define PCI_CONFIG_IP (1 << 13) /* int on PCI_PERR# */
  496. #define PCI_CONFIG_IS (1 << 12) /* int on PCI_SERR# */
  497. #define PCI_CONFIG_IMM (1 << 11) /* int on master abort */
  498. #define PCI_CONFIG_ITM (1 << 10) /* int on target abort (as master) */
  499. #define PCI_CONFIG_ITT (1 << 9) /* int on target abort (as target) */
  500. #define PCI_CONFIG_IPB (1 << 8) /* int on PERR# in bus master acc */
  501. #define PCI_CONFIG_SIC_NO (0 << 6) /* no byte mask changes */
  502. #define PCI_CONFIG_SIC_BA_ADR (1 << 6) /* on byte/hw acc, invert adr bits */
  503. #define PCI_CONFIG_SIC_HWA_DAT (2 << 6) /* on halfword acc, swap data */
  504. #define PCI_CONFIG_SIC_ALL (3 << 6) /* swap data bytes on all accesses */
  505. #define PCI_CONFIG_ST (1 << 5) /* swap data by target transactions */
  506. #define PCI_CONFIG_SM (1 << 4) /* swap data from PCI ctl */
  507. #define PCI_CONFIG_AEN (1 << 3) /* enable internal arbiter */
  508. #define PCI_CONFIG_R2H (1 << 2) /* REQ2# to hi-prio arbiter */
  509. #define PCI_CONFIG_R1H (1 << 1) /* REQ1# to hi-prio arbiter */
  510. #define PCI_CONFIG_CH (1 << 0) /* PCI ctl to hi-prio arbiter */
  511. #define PCI_B2BMASK_B2BMASK(x) (((x) & 0xffff) << 16)
  512. #define PCI_B2BMASK_CCH(x) ((x) & 0xffff) /* 16 upper bits of class code */
  513. #define PCI_B2BBASE0_VID_B0(x) (((x) & 0xffff) << 16)
  514. #define PCI_B2BBASE0_VID_SV(x) ((x) & 0xffff)
  515. #define PCI_B2BBASE1_SID_B1(x) (((x) & 0xffff) << 16)
  516. #define PCI_B2BBASE1_SID_SI(x) ((x) & 0xffff)
  517. #define PCI_MWMASKDEV_MWMASK(x) (((x) & 0xffff) << 16)
  518. #define PCI_MWMASKDEV_DEVID(x) ((x) & 0xffff)
  519. #define PCI_MWBASEREVCCL_BASE(x) (((x) & 0xffff) << 16)
  520. #define PCI_MWBASEREVCCL_REV(x) (((x) & 0xff) << 8)
  521. #define PCI_MWBASEREVCCL_CCL(x) ((x) & 0xff)
  522. #define PCI_ID_DID(x) (((x) & 0xffff) << 16)
  523. #define PCI_ID_VID(x) ((x) & 0xffff)
  524. #define PCI_STATCMD_STATUS(x) (((x) & 0xffff) << 16)
  525. #define PCI_STATCMD_CMD(x) ((x) & 0xffff)
  526. #define PCI_CLASSREV_CLASS(x) (((x) & 0x00ffffff) << 8)
  527. #define PCI_CLASSREV_REV(x) ((x) & 0xff)
  528. #define PCI_PARAM_BIST(x) (((x) & 0xff) << 24)
  529. #define PCI_PARAM_HT(x) (((x) & 0xff) << 16)
  530. #define PCI_PARAM_LT(x) (((x) & 0xff) << 8)
  531. #define PCI_PARAM_CLS(x) ((x) & 0xff)
  532. #define PCI_TIMEOUT_RETRIES(x) (((x) & 0xff) << 8) /* max retries */
  533. #define PCI_TIMEOUT_TO(x) ((x) & 0xff) /* target ready timeout */
  534. /**********************************************************************/
  535. #ifndef _LANGUAGE_ASSEMBLY
  536. #include <linux/delay.h>
  537. #include <linux/types.h>
  538. #include <linux/io.h>
  539. #include <linux/irq.h>
  540. #include <asm/cpu.h>
  541. /* helpers to access the SYS_* registers */
  542. static inline unsigned long alchemy_rdsys(int regofs)
  543. {
  544. void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_SYS_PHYS_ADDR);
  545. return __raw_readl(b + regofs);
  546. }
  547. static inline void alchemy_wrsys(unsigned long v, int regofs)
  548. {
  549. void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_SYS_PHYS_ADDR);
  550. __raw_writel(v, b + regofs);
  551. wmb(); /* drain writebuffer */
  552. }
  553. /* helpers to access static memctrl registers */
  554. static inline unsigned long alchemy_rdsmem(int regofs)
  555. {
  556. void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_STATIC_MEM_PHYS_ADDR);
  557. return __raw_readl(b + regofs);
  558. }
  559. static inline void alchemy_wrsmem(unsigned long v, int regofs)
  560. {
  561. void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_STATIC_MEM_PHYS_ADDR);
  562. __raw_writel(v, b + regofs);
  563. wmb(); /* drain writebuffer */
  564. }
  565. /* Early Au1000 have a write-only SYS_CPUPLL register. */
  566. static inline int au1xxx_cpu_has_pll_wo(void)
  567. {
  568. switch (read_c0_prid()) {
  569. case 0x00030100: /* Au1000 DA */
  570. case 0x00030201: /* Au1000 HA */
  571. case 0x00030202: /* Au1000 HB */
  572. return 1;
  573. }
  574. return 0;
  575. }
  576. /* does CPU need CONFIG[OD] set to fix tons of errata? */
  577. static inline int au1xxx_cpu_needs_config_od(void)
  578. {
  579. /*
  580. * c0_config.od (bit 19) was write only (and read as 0) on the
  581. * early revisions of Alchemy SOCs. It disables the bus trans-
  582. * action overlapping and needs to be set to fix various errata.
  583. */
  584. switch (read_c0_prid()) {
  585. case 0x00030100: /* Au1000 DA */
  586. case 0x00030201: /* Au1000 HA */
  587. case 0x00030202: /* Au1000 HB */
  588. case 0x01030200: /* Au1500 AB */
  589. /*
  590. * Au1100/Au1200 errata actually keep silence about this bit,
  591. * so we set it just in case for those revisions that require
  592. * it to be set according to the (now gone) cpu_table.
  593. */
  594. case 0x02030200: /* Au1100 AB */
  595. case 0x02030201: /* Au1100 BA */
  596. case 0x02030202: /* Au1100 BC */
  597. case 0x04030201: /* Au1200 AC */
  598. return 1;
  599. }
  600. return 0;
  601. }
  602. #define ALCHEMY_CPU_UNKNOWN -1
  603. #define ALCHEMY_CPU_AU1000 0
  604. #define ALCHEMY_CPU_AU1500 1
  605. #define ALCHEMY_CPU_AU1100 2
  606. #define ALCHEMY_CPU_AU1550 3
  607. #define ALCHEMY_CPU_AU1200 4
  608. #define ALCHEMY_CPU_AU1300 5
  609. static inline int alchemy_get_cputype(void)
  610. {
  611. switch (read_c0_prid() & (PRID_OPT_MASK | PRID_COMP_MASK)) {
  612. case 0x00030000:
  613. return ALCHEMY_CPU_AU1000;
  614. break;
  615. case 0x01030000:
  616. return ALCHEMY_CPU_AU1500;
  617. break;
  618. case 0x02030000:
  619. return ALCHEMY_CPU_AU1100;
  620. break;
  621. case 0x03030000:
  622. return ALCHEMY_CPU_AU1550;
  623. break;
  624. case 0x04030000:
  625. case 0x05030000:
  626. return ALCHEMY_CPU_AU1200;
  627. break;
  628. case 0x800c0000:
  629. return ALCHEMY_CPU_AU1300;
  630. break;
  631. }
  632. return ALCHEMY_CPU_UNKNOWN;
  633. }
  634. /* return number of uarts on a given cputype */
  635. static inline int alchemy_get_uarts(int type)
  636. {
  637. switch (type) {
  638. case ALCHEMY_CPU_AU1000:
  639. case ALCHEMY_CPU_AU1300:
  640. return 4;
  641. case ALCHEMY_CPU_AU1500:
  642. case ALCHEMY_CPU_AU1200:
  643. return 2;
  644. case ALCHEMY_CPU_AU1100:
  645. case ALCHEMY_CPU_AU1550:
  646. return 3;
  647. }
  648. return 0;
  649. }
  650. /* enable an UART block if it isn't already */
  651. static inline void alchemy_uart_enable(u32 uart_phys)
  652. {
  653. void __iomem *addr = (void __iomem *)KSEG1ADDR(uart_phys);
  654. /* reset, enable clock, deassert reset */
  655. if ((__raw_readl(addr + 0x100) & 3) != 3) {
  656. __raw_writel(0, addr + 0x100);
  657. wmb(); /* drain writebuffer */
  658. __raw_writel(1, addr + 0x100);
  659. wmb(); /* drain writebuffer */
  660. }
  661. __raw_writel(3, addr + 0x100);
  662. wmb(); /* drain writebuffer */
  663. }
  664. static inline void alchemy_uart_disable(u32 uart_phys)
  665. {
  666. void __iomem *addr = (void __iomem *)KSEG1ADDR(uart_phys);
  667. __raw_writel(0, addr + 0x100); /* UART_MOD_CNTRL */
  668. wmb(); /* drain writebuffer */
  669. }
  670. static inline void alchemy_uart_putchar(u32 uart_phys, u8 c)
  671. {
  672. void __iomem *base = (void __iomem *)KSEG1ADDR(uart_phys);
  673. int timeout, i;
  674. /* check LSR TX_EMPTY bit */
  675. timeout = 0xffffff;
  676. do {
  677. if (__raw_readl(base + 0x1c) & 0x20)
  678. break;
  679. /* slow down */
  680. for (i = 10000; i; i--)
  681. asm volatile ("nop");
  682. } while (--timeout);
  683. __raw_writel(c, base + 0x04); /* tx */
  684. wmb(); /* drain writebuffer */
  685. }
  686. /* return number of ethernet MACs on a given cputype */
  687. static inline int alchemy_get_macs(int type)
  688. {
  689. switch (type) {
  690. case ALCHEMY_CPU_AU1000:
  691. case ALCHEMY_CPU_AU1500:
  692. case ALCHEMY_CPU_AU1550:
  693. return 2;
  694. case ALCHEMY_CPU_AU1100:
  695. return 1;
  696. }
  697. return 0;
  698. }
  699. /* PM: arch/mips/alchemy/common/sleeper.S, power.c, irq.c */
  700. void alchemy_sleep_au1000(void);
  701. void alchemy_sleep_au1550(void);
  702. void alchemy_sleep_au1300(void);
  703. void au_sleep(void);
  704. /* USB: arch/mips/alchemy/common/usb.c */
  705. enum alchemy_usb_block {
  706. ALCHEMY_USB_OHCI0,
  707. ALCHEMY_USB_UDC0,
  708. ALCHEMY_USB_EHCI0,
  709. ALCHEMY_USB_OTG0,
  710. ALCHEMY_USB_OHCI1,
  711. };
  712. int alchemy_usb_control(int block, int enable);
  713. /* PCI controller platform data */
  714. struct alchemy_pci_platdata {
  715. int (*board_map_irq)(const struct pci_dev *d, u8 slot, u8 pin);
  716. int (*board_pci_idsel)(unsigned int devsel, int assert);
  717. /* bits to set/clear in PCI_CONFIG register */
  718. unsigned long pci_cfg_set;
  719. unsigned long pci_cfg_clr;
  720. };
  721. /* The IrDA peripheral has an IRFIRSEL pin, but on the DB/PB boards it's
  722. * not used to select FIR/SIR mode on the transceiver but as a GPIO.
  723. * Instead a CPLD has to be told about the mode. The driver calls the
  724. * set_phy_mode() function in addition to driving the IRFIRSEL pin.
  725. */
  726. #define AU1000_IRDA_PHY_MODE_OFF 0
  727. #define AU1000_IRDA_PHY_MODE_SIR 1
  728. #define AU1000_IRDA_PHY_MODE_FIR 2
  729. struct au1k_irda_platform_data {
  730. void (*set_phy_mode)(int mode);
  731. };
  732. /* Multifunction pins: Each of these pins can either be assigned to the
  733. * GPIO controller or a on-chip peripheral.
  734. * Call "au1300_pinfunc_to_dev()" or "au1300_pinfunc_to_gpio()" to
  735. * assign one of these to either the GPIO controller or the device.
  736. */
  737. enum au1300_multifunc_pins {
  738. /* wake-from-str pins 0-3 */
  739. AU1300_PIN_WAKE0 = 0, AU1300_PIN_WAKE1, AU1300_PIN_WAKE2,
  740. AU1300_PIN_WAKE3,
  741. /* external clock sources for PSCs: 4-5 */
  742. AU1300_PIN_EXTCLK0, AU1300_PIN_EXTCLK1,
  743. /* 8bit MMC interface on SD0: 6-9 */
  744. AU1300_PIN_SD0DAT4, AU1300_PIN_SD0DAT5, AU1300_PIN_SD0DAT6,
  745. AU1300_PIN_SD0DAT7,
  746. /* aux clk input for freqgen 3: 10 */
  747. AU1300_PIN_FG3AUX,
  748. /* UART1 pins: 11-18 */
  749. AU1300_PIN_U1RI, AU1300_PIN_U1DCD, AU1300_PIN_U1DSR,
  750. AU1300_PIN_U1CTS, AU1300_PIN_U1RTS, AU1300_PIN_U1DTR,
  751. AU1300_PIN_U1RX, AU1300_PIN_U1TX,
  752. /* UART0 pins: 19-24 */
  753. AU1300_PIN_U0RI, AU1300_PIN_U0DCD, AU1300_PIN_U0DSR,
  754. AU1300_PIN_U0CTS, AU1300_PIN_U0RTS, AU1300_PIN_U0DTR,
  755. /* UART2: 25-26 */
  756. AU1300_PIN_U2RX, AU1300_PIN_U2TX,
  757. /* UART3: 27-28 */
  758. AU1300_PIN_U3RX, AU1300_PIN_U3TX,
  759. /* LCD controller PWMs, ext pixclock: 29-31 */
  760. AU1300_PIN_LCDPWM0, AU1300_PIN_LCDPWM1, AU1300_PIN_LCDCLKIN,
  761. /* SD1 interface: 32-37 */
  762. AU1300_PIN_SD1DAT0, AU1300_PIN_SD1DAT1, AU1300_PIN_SD1DAT2,
  763. AU1300_PIN_SD1DAT3, AU1300_PIN_SD1CMD, AU1300_PIN_SD1CLK,
  764. /* SD2 interface: 38-43 */
  765. AU1300_PIN_SD2DAT0, AU1300_PIN_SD2DAT1, AU1300_PIN_SD2DAT2,
  766. AU1300_PIN_SD2DAT3, AU1300_PIN_SD2CMD, AU1300_PIN_SD2CLK,
  767. /* PSC0/1 clocks: 44-45 */
  768. AU1300_PIN_PSC0CLK, AU1300_PIN_PSC1CLK,
  769. /* PSCs: 46-49/50-53/54-57/58-61 */
  770. AU1300_PIN_PSC0SYNC0, AU1300_PIN_PSC0SYNC1, AU1300_PIN_PSC0D0,
  771. AU1300_PIN_PSC0D1,
  772. AU1300_PIN_PSC1SYNC0, AU1300_PIN_PSC1SYNC1, AU1300_PIN_PSC1D0,
  773. AU1300_PIN_PSC1D1,
  774. AU1300_PIN_PSC2SYNC0, AU1300_PIN_PSC2SYNC1, AU1300_PIN_PSC2D0,
  775. AU1300_PIN_PSC2D1,
  776. AU1300_PIN_PSC3SYNC0, AU1300_PIN_PSC3SYNC1, AU1300_PIN_PSC3D0,
  777. AU1300_PIN_PSC3D1,
  778. /* PCMCIA interface: 62-70 */
  779. AU1300_PIN_PCE2, AU1300_PIN_PCE1, AU1300_PIN_PIOS16,
  780. AU1300_PIN_PIOR, AU1300_PIN_PWE, AU1300_PIN_PWAIT,
  781. AU1300_PIN_PREG, AU1300_PIN_POE, AU1300_PIN_PIOW,
  782. /* camera interface H/V sync inputs: 71-72 */
  783. AU1300_PIN_CIMLS, AU1300_PIN_CIMFS,
  784. /* PSC2/3 clocks: 73-74 */
  785. AU1300_PIN_PSC2CLK, AU1300_PIN_PSC3CLK,
  786. };
  787. /* GPIC (Au1300) pin management: arch/mips/alchemy/common/gpioint.c */
  788. extern void au1300_pinfunc_to_gpio(enum au1300_multifunc_pins gpio);
  789. extern void au1300_pinfunc_to_dev(enum au1300_multifunc_pins gpio);
  790. extern void au1300_set_irq_priority(unsigned int irq, int p);
  791. extern void au1300_set_dbdma_gpio(int dchan, unsigned int gpio);
  792. /* Au1300 allows to disconnect certain blocks from internal power supply */
  793. enum au1300_vss_block {
  794. AU1300_VSS_MPE = 0,
  795. AU1300_VSS_BSA,
  796. AU1300_VSS_GPE,
  797. AU1300_VSS_MGP,
  798. };
  799. extern void au1300_vss_block_control(int block, int enable);
  800. enum soc_au1000_ints {
  801. AU1000_FIRST_INT = AU1000_INTC0_INT_BASE,
  802. AU1000_UART0_INT = AU1000_FIRST_INT,
  803. AU1000_UART1_INT,
  804. AU1000_UART2_INT,
  805. AU1000_UART3_INT,
  806. AU1000_SSI0_INT,
  807. AU1000_SSI1_INT,
  808. AU1000_DMA_INT_BASE,
  809. AU1000_TOY_INT = AU1000_FIRST_INT + 14,
  810. AU1000_TOY_MATCH0_INT,
  811. AU1000_TOY_MATCH1_INT,
  812. AU1000_TOY_MATCH2_INT,
  813. AU1000_RTC_INT,
  814. AU1000_RTC_MATCH0_INT,
  815. AU1000_RTC_MATCH1_INT,
  816. AU1000_RTC_MATCH2_INT,
  817. AU1000_IRDA_TX_INT,
  818. AU1000_IRDA_RX_INT,
  819. AU1000_USB_DEV_REQ_INT,
  820. AU1000_USB_DEV_SUS_INT,
  821. AU1000_USB_HOST_INT,
  822. AU1000_ACSYNC_INT,
  823. AU1000_MAC0_DMA_INT,
  824. AU1000_MAC1_DMA_INT,
  825. AU1000_I2S_UO_INT,
  826. AU1000_AC97C_INT,
  827. AU1000_GPIO0_INT,
  828. AU1000_GPIO1_INT,
  829. AU1000_GPIO2_INT,
  830. AU1000_GPIO3_INT,
  831. AU1000_GPIO4_INT,
  832. AU1000_GPIO5_INT,
  833. AU1000_GPIO6_INT,
  834. AU1000_GPIO7_INT,
  835. AU1000_GPIO8_INT,
  836. AU1000_GPIO9_INT,
  837. AU1000_GPIO10_INT,
  838. AU1000_GPIO11_INT,
  839. AU1000_GPIO12_INT,
  840. AU1000_GPIO13_INT,
  841. AU1000_GPIO14_INT,
  842. AU1000_GPIO15_INT,
  843. AU1000_GPIO16_INT,
  844. AU1000_GPIO17_INT,
  845. AU1000_GPIO18_INT,
  846. AU1000_GPIO19_INT,
  847. AU1000_GPIO20_INT,
  848. AU1000_GPIO21_INT,
  849. AU1000_GPIO22_INT,
  850. AU1000_GPIO23_INT,
  851. AU1000_GPIO24_INT,
  852. AU1000_GPIO25_INT,
  853. AU1000_GPIO26_INT,
  854. AU1000_GPIO27_INT,
  855. AU1000_GPIO28_INT,
  856. AU1000_GPIO29_INT,
  857. AU1000_GPIO30_INT,
  858. AU1000_GPIO31_INT,
  859. };
  860. enum soc_au1100_ints {
  861. AU1100_FIRST_INT = AU1000_INTC0_INT_BASE,
  862. AU1100_UART0_INT = AU1100_FIRST_INT,
  863. AU1100_UART1_INT,
  864. AU1100_SD_INT,
  865. AU1100_UART3_INT,
  866. AU1100_SSI0_INT,
  867. AU1100_SSI1_INT,
  868. AU1100_DMA_INT_BASE,
  869. AU1100_TOY_INT = AU1100_FIRST_INT + 14,
  870. AU1100_TOY_MATCH0_INT,
  871. AU1100_TOY_MATCH1_INT,
  872. AU1100_TOY_MATCH2_INT,
  873. AU1100_RTC_INT,
  874. AU1100_RTC_MATCH0_INT,
  875. AU1100_RTC_MATCH1_INT,
  876. AU1100_RTC_MATCH2_INT,
  877. AU1100_IRDA_TX_INT,
  878. AU1100_IRDA_RX_INT,
  879. AU1100_USB_DEV_REQ_INT,
  880. AU1100_USB_DEV_SUS_INT,
  881. AU1100_USB_HOST_INT,
  882. AU1100_ACSYNC_INT,
  883. AU1100_MAC0_DMA_INT,
  884. AU1100_GPIO208_215_INT,
  885. AU1100_LCD_INT,
  886. AU1100_AC97C_INT,
  887. AU1100_GPIO0_INT,
  888. AU1100_GPIO1_INT,
  889. AU1100_GPIO2_INT,
  890. AU1100_GPIO3_INT,
  891. AU1100_GPIO4_INT,
  892. AU1100_GPIO5_INT,
  893. AU1100_GPIO6_INT,
  894. AU1100_GPIO7_INT,
  895. AU1100_GPIO8_INT,
  896. AU1100_GPIO9_INT,
  897. AU1100_GPIO10_INT,
  898. AU1100_GPIO11_INT,
  899. AU1100_GPIO12_INT,
  900. AU1100_GPIO13_INT,
  901. AU1100_GPIO14_INT,
  902. AU1100_GPIO15_INT,
  903. AU1100_GPIO16_INT,
  904. AU1100_GPIO17_INT,
  905. AU1100_GPIO18_INT,
  906. AU1100_GPIO19_INT,
  907. AU1100_GPIO20_INT,
  908. AU1100_GPIO21_INT,
  909. AU1100_GPIO22_INT,
  910. AU1100_GPIO23_INT,
  911. AU1100_GPIO24_INT,
  912. AU1100_GPIO25_INT,
  913. AU1100_GPIO26_INT,
  914. AU1100_GPIO27_INT,
  915. AU1100_GPIO28_INT,
  916. AU1100_GPIO29_INT,
  917. AU1100_GPIO30_INT,
  918. AU1100_GPIO31_INT,
  919. };
  920. enum soc_au1500_ints {
  921. AU1500_FIRST_INT = AU1000_INTC0_INT_BASE,
  922. AU1500_UART0_INT = AU1500_FIRST_INT,
  923. AU1500_PCI_INTA,
  924. AU1500_PCI_INTB,
  925. AU1500_UART3_INT,
  926. AU1500_PCI_INTC,
  927. AU1500_PCI_INTD,
  928. AU1500_DMA_INT_BASE,
  929. AU1500_TOY_INT = AU1500_FIRST_INT + 14,
  930. AU1500_TOY_MATCH0_INT,
  931. AU1500_TOY_MATCH1_INT,
  932. AU1500_TOY_MATCH2_INT,
  933. AU1500_RTC_INT,
  934. AU1500_RTC_MATCH0_INT,
  935. AU1500_RTC_MATCH1_INT,
  936. AU1500_RTC_MATCH2_INT,
  937. AU1500_PCI_ERR_INT,
  938. AU1500_RESERVED_INT,
  939. AU1500_USB_DEV_REQ_INT,
  940. AU1500_USB_DEV_SUS_INT,
  941. AU1500_USB_HOST_INT,
  942. AU1500_ACSYNC_INT,
  943. AU1500_MAC0_DMA_INT,
  944. AU1500_MAC1_DMA_INT,
  945. AU1500_AC97C_INT = AU1500_FIRST_INT + 31,
  946. AU1500_GPIO0_INT,
  947. AU1500_GPIO1_INT,
  948. AU1500_GPIO2_INT,
  949. AU1500_GPIO3_INT,
  950. AU1500_GPIO4_INT,
  951. AU1500_GPIO5_INT,
  952. AU1500_GPIO6_INT,
  953. AU1500_GPIO7_INT,
  954. AU1500_GPIO8_INT,
  955. AU1500_GPIO9_INT,
  956. AU1500_GPIO10_INT,
  957. AU1500_GPIO11_INT,
  958. AU1500_GPIO12_INT,
  959. AU1500_GPIO13_INT,
  960. AU1500_GPIO14_INT,
  961. AU1500_GPIO15_INT,
  962. AU1500_GPIO200_INT,
  963. AU1500_GPIO201_INT,
  964. AU1500_GPIO202_INT,
  965. AU1500_GPIO203_INT,
  966. AU1500_GPIO20_INT,
  967. AU1500_GPIO204_INT,
  968. AU1500_GPIO205_INT,
  969. AU1500_GPIO23_INT,
  970. AU1500_GPIO24_INT,
  971. AU1500_GPIO25_INT,
  972. AU1500_GPIO26_INT,
  973. AU1500_GPIO27_INT,
  974. AU1500_GPIO28_INT,
  975. AU1500_GPIO206_INT,
  976. AU1500_GPIO207_INT,
  977. AU1500_GPIO208_215_INT,
  978. };
  979. enum soc_au1550_ints {
  980. AU1550_FIRST_INT = AU1000_INTC0_INT_BASE,
  981. AU1550_UART0_INT = AU1550_FIRST_INT,
  982. AU1550_PCI_INTA,
  983. AU1550_PCI_INTB,
  984. AU1550_DDMA_INT,
  985. AU1550_CRYPTO_INT,
  986. AU1550_PCI_INTC,
  987. AU1550_PCI_INTD,
  988. AU1550_PCI_RST_INT,
  989. AU1550_UART1_INT,
  990. AU1550_UART3_INT,
  991. AU1550_PSC0_INT,
  992. AU1550_PSC1_INT,
  993. AU1550_PSC2_INT,
  994. AU1550_PSC3_INT,
  995. AU1550_TOY_INT,
  996. AU1550_TOY_MATCH0_INT,
  997. AU1550_TOY_MATCH1_INT,
  998. AU1550_TOY_MATCH2_INT,
  999. AU1550_RTC_INT,
  1000. AU1550_RTC_MATCH0_INT,
  1001. AU1550_RTC_MATCH1_INT,
  1002. AU1550_RTC_MATCH2_INT,
  1003. AU1550_NAND_INT = AU1550_FIRST_INT + 23,
  1004. AU1550_USB_DEV_REQ_INT,
  1005. AU1550_USB_DEV_SUS_INT,
  1006. AU1550_USB_HOST_INT,
  1007. AU1550_MAC0_DMA_INT,
  1008. AU1550_MAC1_DMA_INT,
  1009. AU1550_GPIO0_INT = AU1550_FIRST_INT + 32,
  1010. AU1550_GPIO1_INT,
  1011. AU1550_GPIO2_INT,
  1012. AU1550_GPIO3_INT,
  1013. AU1550_GPIO4_INT,
  1014. AU1550_GPIO5_INT,
  1015. AU1550_GPIO6_INT,
  1016. AU1550_GPIO7_INT,
  1017. AU1550_GPIO8_INT,
  1018. AU1550_GPIO9_INT,
  1019. AU1550_GPIO10_INT,
  1020. AU1550_GPIO11_INT,
  1021. AU1550_GPIO12_INT,
  1022. AU1550_GPIO13_INT,
  1023. AU1550_GPIO14_INT,
  1024. AU1550_GPIO15_INT,
  1025. AU1550_GPIO200_INT,
  1026. AU1550_GPIO201_205_INT, /* Logical or of GPIO201:205 */
  1027. AU1550_GPIO16_INT,
  1028. AU1550_GPIO17_INT,
  1029. AU1550_GPIO20_INT,
  1030. AU1550_GPIO21_INT,
  1031. AU1550_GPIO22_INT,
  1032. AU1550_GPIO23_INT,
  1033. AU1550_GPIO24_INT,
  1034. AU1550_GPIO25_INT,
  1035. AU1550_GPIO26_INT,
  1036. AU1550_GPIO27_INT,
  1037. AU1550_GPIO28_INT,
  1038. AU1550_GPIO206_INT,
  1039. AU1550_GPIO207_INT,
  1040. AU1550_GPIO208_215_INT, /* Logical or of GPIO208:215 */
  1041. };
  1042. enum soc_au1200_ints {
  1043. AU1200_FIRST_INT = AU1000_INTC0_INT_BASE,
  1044. AU1200_UART0_INT = AU1200_FIRST_INT,
  1045. AU1200_SWT_INT,
  1046. AU1200_SD_INT,
  1047. AU1200_DDMA_INT,
  1048. AU1200_MAE_BE_INT,
  1049. AU1200_GPIO200_INT,
  1050. AU1200_GPIO201_INT,
  1051. AU1200_GPIO202_INT,
  1052. AU1200_UART1_INT,
  1053. AU1200_MAE_FE_INT,
  1054. AU1200_PSC0_INT,
  1055. AU1200_PSC1_INT,
  1056. AU1200_AES_INT,
  1057. AU1200_CAMERA_INT,
  1058. AU1200_TOY_INT,
  1059. AU1200_TOY_MATCH0_INT,
  1060. AU1200_TOY_MATCH1_INT,
  1061. AU1200_TOY_MATCH2_INT,
  1062. AU1200_RTC_INT,
  1063. AU1200_RTC_MATCH0_INT,
  1064. AU1200_RTC_MATCH1_INT,
  1065. AU1200_RTC_MATCH2_INT,
  1066. AU1200_GPIO203_INT,
  1067. AU1200_NAND_INT,
  1068. AU1200_GPIO204_INT,
  1069. AU1200_GPIO205_INT,
  1070. AU1200_GPIO206_INT,
  1071. AU1200_GPIO207_INT,
  1072. AU1200_GPIO208_215_INT, /* Logical OR of 208:215 */
  1073. AU1200_USB_INT,
  1074. AU1200_LCD_INT,
  1075. AU1200_MAE_BOTH_INT,
  1076. AU1200_GPIO0_INT,
  1077. AU1200_GPIO1_INT,
  1078. AU1200_GPIO2_INT,
  1079. AU1200_GPIO3_INT,
  1080. AU1200_GPIO4_INT,
  1081. AU1200_GPIO5_INT,
  1082. AU1200_GPIO6_INT,
  1083. AU1200_GPIO7_INT,
  1084. AU1200_GPIO8_INT,
  1085. AU1200_GPIO9_INT,
  1086. AU1200_GPIO10_INT,
  1087. AU1200_GPIO11_INT,
  1088. AU1200_GPIO12_INT,
  1089. AU1200_GPIO13_INT,
  1090. AU1200_GPIO14_INT,
  1091. AU1200_GPIO15_INT,
  1092. AU1200_GPIO16_INT,
  1093. AU1200_GPIO17_INT,
  1094. AU1200_GPIO18_INT,
  1095. AU1200_GPIO19_INT,
  1096. AU1200_GPIO20_INT,
  1097. AU1200_GPIO21_INT,
  1098. AU1200_GPIO22_INT,
  1099. AU1200_GPIO23_INT,
  1100. AU1200_GPIO24_INT,
  1101. AU1200_GPIO25_INT,
  1102. AU1200_GPIO26_INT,
  1103. AU1200_GPIO27_INT,
  1104. AU1200_GPIO28_INT,
  1105. AU1200_GPIO29_INT,
  1106. AU1200_GPIO30_INT,
  1107. AU1200_GPIO31_INT,
  1108. };
  1109. #endif /* !defined (_LANGUAGE_ASSEMBLY) */
  1110. #endif