Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  *
0003  * BRIEF MODULE DESCRIPTION
0004  *  Include file for Alchemy Semiconductor's Au1k CPU.
0005  *
0006  * Copyright 2000-2001, 2006-2008 MontaVista Software Inc.
0007  * Author: MontaVista Software, Inc. <source@mvista.com>
0008  *
0009  *  This program is free software; you can redistribute  it and/or modify it
0010  *  under  the terms of  the GNU General  Public License as published by the
0011  *  Free Software Foundation;  either version 2 of the  License, or (at your
0012  *  option) any later version.
0013  *
0014  *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
0015  *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
0016  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
0017  *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
0018  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0019  *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
0020  *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
0021  *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
0022  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
0023  *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0024  *
0025  *  You should have received a copy of the  GNU General Public License along
0026  *  with this program; if not, write  to the Free Software Foundation, Inc.,
0027  *  675 Mass Ave, Cambridge, MA 02139, USA.
0028  */
0029 
0030  /*
0031   * some definitions add by takuzo@sm.sony.co.jp and sato@sm.sony.co.jp
0032   */
0033 
0034 #ifndef _AU1000_H_
0035 #define _AU1000_H_
0036 
0037 /* SOC Interrupt numbers */
0038 /* Au1000-style (IC0/1): 2 controllers with 32 sources each */
0039 #define AU1000_INTC0_INT_BASE   (MIPS_CPU_IRQ_BASE + 8)
0040 #define AU1000_INTC0_INT_LAST   (AU1000_INTC0_INT_BASE + 31)
0041 #define AU1000_INTC1_INT_BASE   (AU1000_INTC0_INT_LAST + 1)
0042 #define AU1000_INTC1_INT_LAST   (AU1000_INTC1_INT_BASE + 31)
0043 #define AU1000_MAX_INTR     AU1000_INTC1_INT_LAST
0044 
0045 /* Au1300-style (GPIC): 1 controller with up to 128 sources */
0046 #define ALCHEMY_GPIC_INT_BASE   (MIPS_CPU_IRQ_BASE + 8)
0047 #define ALCHEMY_GPIC_INT_NUM    128
0048 #define ALCHEMY_GPIC_INT_LAST   (ALCHEMY_GPIC_INT_BASE + ALCHEMY_GPIC_INT_NUM - 1)
0049 
0050 /* common clock names, shared among all variants. AUXPLL2 is Au1300 */
0051 #define ALCHEMY_ROOT_CLK        "root_clk"
0052 #define ALCHEMY_CPU_CLK         "cpu_clk"
0053 #define ALCHEMY_AUXPLL_CLK      "auxpll_clk"
0054 #define ALCHEMY_AUXPLL2_CLK     "auxpll2_clk"
0055 #define ALCHEMY_SYSBUS_CLK      "sysbus_clk"
0056 #define ALCHEMY_PERIPH_CLK      "periph_clk"
0057 #define ALCHEMY_MEM_CLK         "mem_clk"
0058 #define ALCHEMY_LR_CLK          "lr_clk"
0059 #define ALCHEMY_FG0_CLK         "fg0_clk"
0060 #define ALCHEMY_FG1_CLK         "fg1_clk"
0061 #define ALCHEMY_FG2_CLK         "fg2_clk"
0062 #define ALCHEMY_FG3_CLK         "fg3_clk"
0063 #define ALCHEMY_FG4_CLK         "fg4_clk"
0064 #define ALCHEMY_FG5_CLK         "fg5_clk"
0065 
0066 /* Au1300 peripheral interrupt numbers */
0067 #define AU1300_FIRST_INT    (ALCHEMY_GPIC_INT_BASE)
0068 #define AU1300_UART1_INT    (AU1300_FIRST_INT + 17)
0069 #define AU1300_UART2_INT    (AU1300_FIRST_INT + 25)
0070 #define AU1300_UART3_INT    (AU1300_FIRST_INT + 27)
0071 #define AU1300_SD1_INT      (AU1300_FIRST_INT + 32)
0072 #define AU1300_SD2_INT      (AU1300_FIRST_INT + 38)
0073 #define AU1300_PSC0_INT     (AU1300_FIRST_INT + 48)
0074 #define AU1300_PSC1_INT     (AU1300_FIRST_INT + 52)
0075 #define AU1300_PSC2_INT     (AU1300_FIRST_INT + 56)
0076 #define AU1300_PSC3_INT     (AU1300_FIRST_INT + 60)
0077 #define AU1300_NAND_INT     (AU1300_FIRST_INT + 62)
0078 #define AU1300_DDMA_INT     (AU1300_FIRST_INT + 75)
0079 #define AU1300_MMU_INT      (AU1300_FIRST_INT + 76)
0080 #define AU1300_MPU_INT      (AU1300_FIRST_INT + 77)
0081 #define AU1300_GPU_INT      (AU1300_FIRST_INT + 78)
0082 #define AU1300_UDMA_INT     (AU1300_FIRST_INT + 79)
0083 #define AU1300_TOY_INT      (AU1300_FIRST_INT + 80)
0084 #define AU1300_TOY_MATCH0_INT   (AU1300_FIRST_INT + 81)
0085 #define AU1300_TOY_MATCH1_INT   (AU1300_FIRST_INT + 82)
0086 #define AU1300_TOY_MATCH2_INT   (AU1300_FIRST_INT + 83)
0087 #define AU1300_RTC_INT      (AU1300_FIRST_INT + 84)
0088 #define AU1300_RTC_MATCH0_INT   (AU1300_FIRST_INT + 85)
0089 #define AU1300_RTC_MATCH1_INT   (AU1300_FIRST_INT + 86)
0090 #define AU1300_RTC_MATCH2_INT   (AU1300_FIRST_INT + 87)
0091 #define AU1300_UART0_INT    (AU1300_FIRST_INT + 88)
0092 #define AU1300_SD0_INT      (AU1300_FIRST_INT + 89)
0093 #define AU1300_USB_INT      (AU1300_FIRST_INT + 90)
0094 #define AU1300_LCD_INT      (AU1300_FIRST_INT + 91)
0095 #define AU1300_BSA_INT      (AU1300_FIRST_INT + 92)
0096 #define AU1300_MPE_INT      (AU1300_FIRST_INT + 93)
0097 #define AU1300_ITE_INT      (AU1300_FIRST_INT + 94)
0098 #define AU1300_AES_INT      (AU1300_FIRST_INT + 95)
0099 #define AU1300_CIM_INT      (AU1300_FIRST_INT + 96)
0100 
0101 /**********************************************************************/
0102 
0103 /*
0104  * Physical base addresses for integrated peripherals
0105  * 0..au1000 1..au1500 2..au1100 3..au1550 4..au1200 5..au1300
0106  */
0107 
0108 #define AU1000_AC97_PHYS_ADDR       0x10000000 /* 012 */
0109 #define AU1300_ROM_PHYS_ADDR        0x10000000 /* 5 */
0110 #define AU1300_OTP_PHYS_ADDR        0x10002000 /* 5 */
0111 #define AU1300_VSS_PHYS_ADDR        0x10003000 /* 5 */
0112 #define AU1300_UART0_PHYS_ADDR      0x10100000 /* 5 */
0113 #define AU1300_UART1_PHYS_ADDR      0x10101000 /* 5 */
0114 #define AU1300_UART2_PHYS_ADDR      0x10102000 /* 5 */
0115 #define AU1300_UART3_PHYS_ADDR      0x10103000 /* 5 */
0116 #define AU1000_USB_OHCI_PHYS_ADDR   0x10100000 /* 012 */
0117 #define AU1000_USB_UDC_PHYS_ADDR    0x10200000 /* 0123 */
0118 #define AU1300_GPIC_PHYS_ADDR       0x10200000 /* 5 */
0119 #define AU1000_IRDA_PHYS_ADDR       0x10300000 /* 02 */
0120 #define AU1200_AES_PHYS_ADDR        0x10300000 /* 45 */
0121 #define AU1000_IC0_PHYS_ADDR        0x10400000 /* 01234 */
0122 #define AU1300_GPU_PHYS_ADDR        0x10500000 /* 5 */
0123 #define AU1000_MAC0_PHYS_ADDR       0x10500000 /* 023 */
0124 #define AU1000_MAC1_PHYS_ADDR       0x10510000 /* 023 */
0125 #define AU1000_MACEN_PHYS_ADDR      0x10520000 /* 023 */
0126 #define AU1100_SD0_PHYS_ADDR        0x10600000 /* 245 */
0127 #define AU1300_SD1_PHYS_ADDR        0x10601000 /* 5 */
0128 #define AU1300_SD2_PHYS_ADDR        0x10602000 /* 5 */
0129 #define AU1100_SD1_PHYS_ADDR        0x10680000 /* 24 */
0130 #define AU1300_SYS_PHYS_ADDR        0x10900000 /* 5 */
0131 #define AU1550_PSC2_PHYS_ADDR       0x10A00000 /* 3 */
0132 #define AU1550_PSC3_PHYS_ADDR       0x10B00000 /* 3 */
0133 #define AU1300_PSC0_PHYS_ADDR       0x10A00000 /* 5 */
0134 #define AU1300_PSC1_PHYS_ADDR       0x10A01000 /* 5 */
0135 #define AU1300_PSC2_PHYS_ADDR       0x10A02000 /* 5 */
0136 #define AU1300_PSC3_PHYS_ADDR       0x10A03000 /* 5 */
0137 #define AU1000_I2S_PHYS_ADDR        0x11000000 /* 02 */
0138 #define AU1500_MAC0_PHYS_ADDR       0x11500000 /* 1 */
0139 #define AU1500_MAC1_PHYS_ADDR       0x11510000 /* 1 */
0140 #define AU1500_MACEN_PHYS_ADDR      0x11520000 /* 1 */
0141 #define AU1000_UART0_PHYS_ADDR      0x11100000 /* 01234 */
0142 #define AU1200_SWCNT_PHYS_ADDR      0x1110010C /* 4 */
0143 #define AU1000_UART1_PHYS_ADDR      0x11200000 /* 0234 */
0144 #define AU1000_UART2_PHYS_ADDR      0x11300000 /* 0 */
0145 #define AU1000_UART3_PHYS_ADDR      0x11400000 /* 0123 */
0146 #define AU1000_SSI0_PHYS_ADDR       0x11600000 /* 02 */
0147 #define AU1000_SSI1_PHYS_ADDR       0x11680000 /* 02 */
0148 #define AU1500_GPIO2_PHYS_ADDR      0x11700000 /* 1234 */
0149 #define AU1000_IC1_PHYS_ADDR        0x11800000 /* 01234 */
0150 #define AU1000_SYS_PHYS_ADDR        0x11900000 /* 012345 */
0151 #define AU1550_PSC0_PHYS_ADDR       0x11A00000 /* 34 */
0152 #define AU1550_PSC1_PHYS_ADDR       0x11B00000 /* 34 */
0153 #define AU1000_MEM_PHYS_ADDR        0x14000000 /* 01234 */
0154 #define AU1000_STATIC_MEM_PHYS_ADDR 0x14001000 /* 01234 */
0155 #define AU1300_UDMA_PHYS_ADDR       0x14001800 /* 5 */
0156 #define AU1000_DMA_PHYS_ADDR        0x14002000 /* 012 */
0157 #define AU1550_DBDMA_PHYS_ADDR      0x14002000 /* 345 */
0158 #define AU1550_DBDMA_CONF_PHYS_ADDR 0x14003000 /* 345 */
0159 #define AU1000_MACDMA0_PHYS_ADDR    0x14004000 /* 0123 */
0160 #define AU1000_MACDMA1_PHYS_ADDR    0x14004200 /* 0123 */
0161 #define AU1200_CIM_PHYS_ADDR        0x14004000 /* 45 */
0162 #define AU1500_PCI_PHYS_ADDR        0x14005000 /* 13 */
0163 #define AU1550_PE_PHYS_ADDR     0x14008000 /* 3 */
0164 #define AU1200_MAEBE_PHYS_ADDR      0x14010000 /* 4 */
0165 #define AU1200_MAEFE_PHYS_ADDR      0x14012000 /* 4 */
0166 #define AU1300_MAEITE_PHYS_ADDR     0x14010000 /* 5 */
0167 #define AU1300_MAEMPE_PHYS_ADDR     0x14014000 /* 5 */
0168 #define AU1550_USB_OHCI_PHYS_ADDR   0x14020000 /* 3 */
0169 #define AU1200_USB_CTL_PHYS_ADDR    0x14020000 /* 4 */
0170 #define AU1200_USB_OTG_PHYS_ADDR    0x14020020 /* 4 */
0171 #define AU1200_USB_OHCI_PHYS_ADDR   0x14020100 /* 4 */
0172 #define AU1200_USB_EHCI_PHYS_ADDR   0x14020200 /* 4 */
0173 #define AU1200_USB_UDC_PHYS_ADDR    0x14022000 /* 4 */
0174 #define AU1300_USB_EHCI_PHYS_ADDR   0x14020000 /* 5 */
0175 #define AU1300_USB_OHCI0_PHYS_ADDR  0x14020400 /* 5 */
0176 #define AU1300_USB_OHCI1_PHYS_ADDR  0x14020800 /* 5 */
0177 #define AU1300_USB_CTL_PHYS_ADDR    0x14021000 /* 5 */
0178 #define AU1300_USB_OTG_PHYS_ADDR    0x14022000 /* 5 */
0179 #define AU1300_MAEBSA_PHYS_ADDR     0x14030000 /* 5 */
0180 #define AU1100_LCD_PHYS_ADDR        0x15000000 /* 2 */
0181 #define AU1200_LCD_PHYS_ADDR        0x15000000 /* 45 */
0182 #define AU1500_PCI_MEM_PHYS_ADDR    0x400000000ULL /* 13 */
0183 #define AU1500_PCI_IO_PHYS_ADDR     0x500000000ULL /* 13 */
0184 #define AU1500_PCI_CONFIG0_PHYS_ADDR    0x600000000ULL /* 13 */
0185 #define AU1500_PCI_CONFIG1_PHYS_ADDR    0x680000000ULL /* 13 */
0186 #define AU1000_PCMCIA_IO_PHYS_ADDR  0xF00000000ULL /* 012345 */
0187 #define AU1000_PCMCIA_ATTR_PHYS_ADDR    0xF40000000ULL /* 012345 */
0188 #define AU1000_PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL /* 012345 */
0189 
0190 /**********************************************************************/
0191 
0192 
0193 /*
0194  * Au1300 GPIO+INT controller (GPIC) register offsets and bits
0195  * Registers are 128bits (0x10 bytes), divided into 4 "banks".
0196  */
0197 #define AU1300_GPIC_PINVAL  0x0000
0198 #define AU1300_GPIC_PINVALCLR   0x0010
0199 #define AU1300_GPIC_IPEND   0x0020
0200 #define AU1300_GPIC_PRIENC  0x0030
0201 #define AU1300_GPIC_IEN     0x0040  /* int_mask in manual */
0202 #define AU1300_GPIC_IDIS    0x0050  /* int_maskclr in manual */
0203 #define AU1300_GPIC_DMASEL  0x0060
0204 #define AU1300_GPIC_DEVSEL  0x0080
0205 #define AU1300_GPIC_DEVCLR  0x0090
0206 #define AU1300_GPIC_RSTVAL  0x00a0
0207 /* pin configuration space. one 32bit register for up to 128 IRQs */
0208 #define AU1300_GPIC_PINCFG  0x1000
0209 
0210 #define GPIC_GPIO_TO_BIT(gpio)  \
0211     (1 << ((gpio) & 0x1f))
0212 
0213 #define GPIC_GPIO_BANKOFF(gpio) \
0214     (((gpio) >> 5) * 4)
0215 
0216 /* Pin Control bits: who owns the pin, what does it do */
0217 #define GPIC_CFG_PC_GPIN        0
0218 #define GPIC_CFG_PC_DEV         1
0219 #define GPIC_CFG_PC_GPOLOW      2
0220 #define GPIC_CFG_PC_GPOHIGH     3
0221 #define GPIC_CFG_PC_MASK        3
0222 
0223 /* assign pin to MIPS IRQ line */
0224 #define GPIC_CFG_IL_SET(x)  (((x) & 3) << 2)
0225 #define GPIC_CFG_IL_MASK    (3 << 2)
0226 
0227 /* pin interrupt type setup */
0228 #define GPIC_CFG_IC_OFF     (0 << 4)
0229 #define GPIC_CFG_IC_LEVEL_LOW   (1 << 4)
0230 #define GPIC_CFG_IC_LEVEL_HIGH  (2 << 4)
0231 #define GPIC_CFG_IC_EDGE_FALL   (5 << 4)
0232 #define GPIC_CFG_IC_EDGE_RISE   (6 << 4)
0233 #define GPIC_CFG_IC_EDGE_BOTH   (7 << 4)
0234 #define GPIC_CFG_IC_MASK    (7 << 4)
0235 
0236 /* allow interrupt to wake cpu from 'wait' */
0237 #define GPIC_CFG_IDLEWAKE   (1 << 7)
0238 
0239 /***********************************************************************/
0240 
0241 /* Au1000 SDRAM memory controller register offsets */
0242 #define AU1000_MEM_SDMODE0      0x0000
0243 #define AU1000_MEM_SDMODE1      0x0004
0244 #define AU1000_MEM_SDMODE2      0x0008
0245 #define AU1000_MEM_SDADDR0      0x000C
0246 #define AU1000_MEM_SDADDR1      0x0010
0247 #define AU1000_MEM_SDADDR2      0x0014
0248 #define AU1000_MEM_SDREFCFG     0x0018
0249 #define AU1000_MEM_SDPRECMD     0x001C
0250 #define AU1000_MEM_SDAUTOREF        0x0020
0251 #define AU1000_MEM_SDWRMD0      0x0024
0252 #define AU1000_MEM_SDWRMD1      0x0028
0253 #define AU1000_MEM_SDWRMD2      0x002C
0254 #define AU1000_MEM_SDSLEEP      0x0030
0255 #define AU1000_MEM_SDSMCKE      0x0034
0256 
0257 /* MEM_SDMODE register content definitions */
0258 #define MEM_SDMODE_F        (1 << 22)
0259 #define MEM_SDMODE_SR       (1 << 21)
0260 #define MEM_SDMODE_BS       (1 << 20)
0261 #define MEM_SDMODE_RS       (3 << 18)
0262 #define MEM_SDMODE_CS       (7 << 15)
0263 #define MEM_SDMODE_TRAS     (15 << 11)
0264 #define MEM_SDMODE_TMRD     (3 << 9)
0265 #define MEM_SDMODE_TWR      (3 << 7)
0266 #define MEM_SDMODE_TRP      (3 << 5)
0267 #define MEM_SDMODE_TRCD     (3 << 3)
0268 #define MEM_SDMODE_TCL      (7 << 0)
0269 
0270 #define MEM_SDMODE_BS_2Bank (0 << 20)
0271 #define MEM_SDMODE_BS_4Bank (1 << 20)
0272 #define MEM_SDMODE_RS_11Row (0 << 18)
0273 #define MEM_SDMODE_RS_12Row (1 << 18)
0274 #define MEM_SDMODE_RS_13Row (2 << 18)
0275 #define MEM_SDMODE_RS_N(N)  ((N) << 18)
0276 #define MEM_SDMODE_CS_7Col  (0 << 15)
0277 #define MEM_SDMODE_CS_8Col  (1 << 15)
0278 #define MEM_SDMODE_CS_9Col  (2 << 15)
0279 #define MEM_SDMODE_CS_10Col (3 << 15)
0280 #define MEM_SDMODE_CS_11Col (4 << 15)
0281 #define MEM_SDMODE_CS_N(N)  ((N) << 15)
0282 #define MEM_SDMODE_TRAS_N(N)    ((N) << 11)
0283 #define MEM_SDMODE_TMRD_N(N)    ((N) << 9)
0284 #define MEM_SDMODE_TWR_N(N) ((N) << 7)
0285 #define MEM_SDMODE_TRP_N(N) ((N) << 5)
0286 #define MEM_SDMODE_TRCD_N(N)    ((N) << 3)
0287 #define MEM_SDMODE_TCL_N(N) ((N) << 0)
0288 
0289 /* MEM_SDADDR register contents definitions */
0290 #define MEM_SDADDR_E        (1 << 20)
0291 #define MEM_SDADDR_CSBA     (0x03FF << 10)
0292 #define MEM_SDADDR_CSMASK   (0x03FF << 0)
0293 #define MEM_SDADDR_CSBA_N(N)    ((N) & (0x03FF << 22) >> 12)
0294 #define MEM_SDADDR_CSMASK_N(N)  ((N)&(0x03FF << 22) >> 22)
0295 
0296 /* MEM_SDREFCFG register content definitions */
0297 #define MEM_SDREFCFG_TRC    (15 << 28)
0298 #define MEM_SDREFCFG_TRPM   (3 << 26)
0299 #define MEM_SDREFCFG_E      (1 << 25)
0300 #define MEM_SDREFCFG_RE     (0x1ffffff << 0)
0301 #define MEM_SDREFCFG_TRC_N(N)   ((N) << MEM_SDREFCFG_TRC)
0302 #define MEM_SDREFCFG_TRPM_N(N)  ((N) << MEM_SDREFCFG_TRPM)
0303 #define MEM_SDREFCFG_REF_N(N)   (N)
0304 
0305 /* Au1550 SDRAM Register Offsets */
0306 #define AU1550_MEM_SDMODE0      0x0800
0307 #define AU1550_MEM_SDMODE1      0x0808
0308 #define AU1550_MEM_SDMODE2      0x0810
0309 #define AU1550_MEM_SDADDR0      0x0820
0310 #define AU1550_MEM_SDADDR1      0x0828
0311 #define AU1550_MEM_SDADDR2      0x0830
0312 #define AU1550_MEM_SDCONFIGA        0x0840
0313 #define AU1550_MEM_SDCONFIGB        0x0848
0314 #define AU1550_MEM_SDSTAT       0x0850
0315 #define AU1550_MEM_SDERRADDR        0x0858
0316 #define AU1550_MEM_SDSTRIDE0        0x0860
0317 #define AU1550_MEM_SDSTRIDE1        0x0868
0318 #define AU1550_MEM_SDSTRIDE2        0x0870
0319 #define AU1550_MEM_SDWRMD0      0x0880
0320 #define AU1550_MEM_SDWRMD1      0x0888
0321 #define AU1550_MEM_SDWRMD2      0x0890
0322 #define AU1550_MEM_SDPRECMD     0x08C0
0323 #define AU1550_MEM_SDAUTOREF        0x08C8
0324 #define AU1550_MEM_SDSREF       0x08D0
0325 #define AU1550_MEM_SDSLEEP      MEM_SDSREF
0326 
0327 /* Static Bus Controller register offsets */
0328 #define AU1000_MEM_STCFG0   0x000
0329 #define AU1000_MEM_STTIME0  0x004
0330 #define AU1000_MEM_STADDR0  0x008
0331 #define AU1000_MEM_STCFG1   0x010
0332 #define AU1000_MEM_STTIME1  0x014
0333 #define AU1000_MEM_STADDR1  0x018
0334 #define AU1000_MEM_STCFG2   0x020
0335 #define AU1000_MEM_STTIME2  0x024
0336 #define AU1000_MEM_STADDR2  0x028
0337 #define AU1000_MEM_STCFG3   0x030
0338 #define AU1000_MEM_STTIME3  0x034
0339 #define AU1000_MEM_STADDR3  0x038
0340 #define AU1000_MEM_STNDCTL  0x100
0341 #define AU1000_MEM_STSTAT   0x104
0342 
0343 #define MEM_STNAND_CMD      0x0
0344 #define MEM_STNAND_ADDR     0x4
0345 #define MEM_STNAND_DATA     0x20
0346 
0347 
0348 /* Programmable Counters 0 and 1 */
0349 #define AU1000_SYS_CNTRCTRL 0x14
0350 #  define SYS_CNTRL_E1S     (1 << 23)
0351 #  define SYS_CNTRL_T1S     (1 << 20)
0352 #  define SYS_CNTRL_M21     (1 << 19)
0353 #  define SYS_CNTRL_M11     (1 << 18)
0354 #  define SYS_CNTRL_M01     (1 << 17)
0355 #  define SYS_CNTRL_C1S     (1 << 16)
0356 #  define SYS_CNTRL_BP      (1 << 14)
0357 #  define SYS_CNTRL_EN1     (1 << 13)
0358 #  define SYS_CNTRL_BT1     (1 << 12)
0359 #  define SYS_CNTRL_EN0     (1 << 11)
0360 #  define SYS_CNTRL_BT0     (1 << 10)
0361 #  define SYS_CNTRL_E0      (1 << 8)
0362 #  define SYS_CNTRL_E0S     (1 << 7)
0363 #  define SYS_CNTRL_32S     (1 << 5)
0364 #  define SYS_CNTRL_T0S     (1 << 4)
0365 #  define SYS_CNTRL_M20     (1 << 3)
0366 #  define SYS_CNTRL_M10     (1 << 2)
0367 #  define SYS_CNTRL_M00     (1 << 1)
0368 #  define SYS_CNTRL_C0S     (1 << 0)
0369 
0370 /* Programmable Counter 0 Registers */
0371 #define AU1000_SYS_TOYTRIM  0x00
0372 #define AU1000_SYS_TOYWRITE 0x04
0373 #define AU1000_SYS_TOYMATCH0    0x08
0374 #define AU1000_SYS_TOYMATCH1    0x0c
0375 #define AU1000_SYS_TOYMATCH2    0x10
0376 #define AU1000_SYS_TOYREAD  0x40
0377 
0378 /* Programmable Counter 1 Registers */
0379 #define AU1000_SYS_RTCTRIM  0x44
0380 #define AU1000_SYS_RTCWRITE 0x48
0381 #define AU1000_SYS_RTCMATCH0    0x4c
0382 #define AU1000_SYS_RTCMATCH1    0x50
0383 #define AU1000_SYS_RTCMATCH2    0x54
0384 #define AU1000_SYS_RTCREAD  0x58
0385 
0386 
0387 /* GPIO */
0388 #define AU1000_SYS_PINFUNC  0x2C
0389 #  define SYS_PF_USB        (1 << 15)   /* 2nd USB device/host */
0390 #  define SYS_PF_U3     (1 << 14)   /* GPIO23/U3TXD */
0391 #  define SYS_PF_U2     (1 << 13)   /* GPIO22/U2TXD */
0392 #  define SYS_PF_U1     (1 << 12)   /* GPIO21/U1TXD */
0393 #  define SYS_PF_SRC        (1 << 11)   /* GPIO6/SROMCKE */
0394 #  define SYS_PF_CK5        (1 << 10)   /* GPIO3/CLK5 */
0395 #  define SYS_PF_CK4        (1 << 9)    /* GPIO2/CLK4 */
0396 #  define SYS_PF_IRF        (1 << 8)    /* GPIO15/IRFIRSEL */
0397 #  define SYS_PF_UR3        (1 << 7)    /* GPIO[14:9]/UART3 */
0398 #  define SYS_PF_I2D        (1 << 6)    /* GPIO8/I2SDI */
0399 #  define SYS_PF_I2S        (1 << 5)    /* I2S/GPIO[29:31] */
0400 #  define SYS_PF_NI2        (1 << 4)    /* NI2/GPIO[24:28] */
0401 #  define SYS_PF_U0     (1 << 3)    /* U0TXD/GPIO20 */
0402 #  define SYS_PF_RD     (1 << 2)    /* IRTXD/GPIO19 */
0403 #  define SYS_PF_A97        (1 << 1)    /* AC97/SSL1 */
0404 #  define SYS_PF_S0     (1 << 0)    /* SSI_0/GPIO[16:18] */
0405 
0406 /* Au1100 only */
0407 #  define SYS_PF_PC     (1 << 18)   /* PCMCIA/GPIO[207:204] */
0408 #  define SYS_PF_LCD        (1 << 17)   /* extern lcd/GPIO[203:200] */
0409 #  define SYS_PF_CS     (1 << 16)   /* EXTCLK0/32KHz to gpio2 */
0410 #  define SYS_PF_EX0        (1 << 9)    /* GPIO2/clock */
0411 
0412 /* Au1550 only.  Redefines lots of pins */
0413 #  define SYS_PF_PSC2_MASK  (7 << 17)
0414 #  define SYS_PF_PSC2_AC97  0
0415 #  define SYS_PF_PSC2_SPI   0
0416 #  define SYS_PF_PSC2_I2S   (1 << 17)
0417 #  define SYS_PF_PSC2_SMBUS (3 << 17)
0418 #  define SYS_PF_PSC2_GPIO  (7 << 17)
0419 #  define SYS_PF_PSC3_MASK  (7 << 20)
0420 #  define SYS_PF_PSC3_AC97  0
0421 #  define SYS_PF_PSC3_SPI   0
0422 #  define SYS_PF_PSC3_I2S   (1 << 20)
0423 #  define SYS_PF_PSC3_SMBUS (3 << 20)
0424 #  define SYS_PF_PSC3_GPIO  (7 << 20)
0425 #  define SYS_PF_PSC1_S1    (1 << 1)
0426 #  define SYS_PF_MUST_BE_SET    ((1 << 5) | (1 << 2))
0427 
0428 /* Au1200 only */
0429 #define SYS_PINFUNC_DMA     (1 << 31)
0430 #define SYS_PINFUNC_S0A     (1 << 30)
0431 #define SYS_PINFUNC_S1A     (1 << 29)
0432 #define SYS_PINFUNC_LP0     (1 << 28)
0433 #define SYS_PINFUNC_LP1     (1 << 27)
0434 #define SYS_PINFUNC_LD16    (1 << 26)
0435 #define SYS_PINFUNC_LD8     (1 << 25)
0436 #define SYS_PINFUNC_LD1     (1 << 24)
0437 #define SYS_PINFUNC_LD0     (1 << 23)
0438 #define SYS_PINFUNC_P1A     (3 << 21)
0439 #define SYS_PINFUNC_P1B     (1 << 20)
0440 #define SYS_PINFUNC_FS3     (1 << 19)
0441 #define SYS_PINFUNC_P0A     (3 << 17)
0442 #define SYS_PINFUNC_CS      (1 << 16)
0443 #define SYS_PINFUNC_CIM     (1 << 15)
0444 #define SYS_PINFUNC_P1C     (1 << 14)
0445 #define SYS_PINFUNC_U1T     (1 << 12)
0446 #define SYS_PINFUNC_U1R     (1 << 11)
0447 #define SYS_PINFUNC_EX1     (1 << 10)
0448 #define SYS_PINFUNC_EX0     (1 << 9)
0449 #define SYS_PINFUNC_U0R     (1 << 8)
0450 #define SYS_PINFUNC_MC      (1 << 7)
0451 #define SYS_PINFUNC_S0B     (1 << 6)
0452 #define SYS_PINFUNC_S0C     (1 << 5)
0453 #define SYS_PINFUNC_P0B     (1 << 4)
0454 #define SYS_PINFUNC_U0T     (1 << 3)
0455 #define SYS_PINFUNC_S1B     (1 << 2)
0456 
0457 /* Power Management */
0458 #define AU1000_SYS_SCRATCH0 0x18
0459 #define AU1000_SYS_SCRATCH1 0x1c
0460 #define AU1000_SYS_WAKEMSK  0x34
0461 #define AU1000_SYS_ENDIAN   0x38
0462 #define AU1000_SYS_POWERCTRL    0x3c
0463 #define AU1000_SYS_WAKESRC  0x5c
0464 #define AU1000_SYS_SLPPWR   0x78
0465 #define AU1000_SYS_SLEEP    0x7c
0466 
0467 #define SYS_WAKEMSK_D2      (1 << 9)
0468 #define SYS_WAKEMSK_M2      (1 << 8)
0469 #define SYS_WAKEMSK_GPIO(x) (1 << (x))
0470 
0471 /* Clock Controller */
0472 #define AU1000_SYS_FREQCTRL0    0x20
0473 #define AU1000_SYS_FREQCTRL1    0x24
0474 #define AU1000_SYS_CLKSRC   0x28
0475 #define AU1000_SYS_CPUPLL   0x60
0476 #define AU1000_SYS_AUXPLL   0x64
0477 #define AU1300_SYS_AUXPLL2  0x68
0478 
0479 
0480 /**********************************************************************/
0481 
0482 
0483 /* The PCI chip selects are outside the 32bit space, and since we can't
0484  * just program the 36bit addresses into BARs, we have to take a chunk
0485  * out of the 32bit space and reserve it for PCI.  When these addresses
0486  * are ioremap()ed, they'll be fixed up to the real 36bit address before
0487  * being passed to the real ioremap function.
0488  */
0489 #define ALCHEMY_PCI_MEMWIN_START    (AU1500_PCI_MEM_PHYS_ADDR >> 4)
0490 #define ALCHEMY_PCI_MEMWIN_END      (ALCHEMY_PCI_MEMWIN_START + 0x0FFFFFFF)
0491 
0492 /* for PCI IO it's simpler because we get to do the ioremap ourselves and then
0493  * adjust the device's resources.
0494  */
0495 #define ALCHEMY_PCI_IOWIN_START     0x00001000
0496 #define ALCHEMY_PCI_IOWIN_END       0x0000FFFF
0497 
0498 #ifdef CONFIG_PCI
0499 
0500 #define IOPORT_RESOURCE_START   0x00001000  /* skip legacy probing */
0501 #define IOPORT_RESOURCE_END 0xffffffff
0502 #define IOMEM_RESOURCE_START    0x10000000
0503 #define IOMEM_RESOURCE_END  0xfffffffffULL
0504 
0505 #else
0506 
0507 /* Don't allow any legacy ports probing */
0508 #define IOPORT_RESOURCE_START   0x10000000
0509 #define IOPORT_RESOURCE_END 0xffffffff
0510 #define IOMEM_RESOURCE_START    0x10000000
0511 #define IOMEM_RESOURCE_END  0xfffffffffULL
0512 
0513 #endif
0514 
0515 /* PCI controller block register offsets */
0516 #define PCI_REG_CMEM        0x0000
0517 #define PCI_REG_CONFIG      0x0004
0518 #define PCI_REG_B2BMASK_CCH 0x0008
0519 #define PCI_REG_B2BBASE0_VID    0x000C
0520 #define PCI_REG_B2BBASE1_SID    0x0010
0521 #define PCI_REG_MWMASK_DEV  0x0014
0522 #define PCI_REG_MWBASE_REV_CCL  0x0018
0523 #define PCI_REG_ERR_ADDR    0x001C
0524 #define PCI_REG_SPEC_INTACK 0x0020
0525 #define PCI_REG_ID      0x0100
0526 #define PCI_REG_STATCMD     0x0104
0527 #define PCI_REG_CLASSREV    0x0108
0528 #define PCI_REG_PARAM       0x010C
0529 #define PCI_REG_MBAR        0x0110
0530 #define PCI_REG_TIMEOUT     0x0140
0531 
0532 /* PCI controller block register bits */
0533 #define PCI_CMEM_E      (1 << 28)   /* enable cacheable memory */
0534 #define PCI_CMEM_CMBASE(x)  (((x) & 0x3fff) << 14)
0535 #define PCI_CMEM_CMMASK(x)  ((x) & 0x3fff)
0536 #define PCI_CONFIG_ERD      (1 << 27) /* pci error during R/W */
0537 #define PCI_CONFIG_ET       (1 << 26) /* error in target mode */
0538 #define PCI_CONFIG_EF       (1 << 25) /* fatal error */
0539 #define PCI_CONFIG_EP       (1 << 24) /* parity error */
0540 #define PCI_CONFIG_EM       (1 << 23) /* multiple errors */
0541 #define PCI_CONFIG_BM       (1 << 22) /* bad master error */
0542 #define PCI_CONFIG_PD       (1 << 20) /* PCI Disable */
0543 #define PCI_CONFIG_BME      (1 << 19) /* Byte Mask Enable for reads */
0544 #define PCI_CONFIG_NC       (1 << 16) /* mark mem access non-coherent */
0545 #define PCI_CONFIG_IA       (1 << 15) /* INTA# enabled (target mode) */
0546 #define PCI_CONFIG_IP       (1 << 13) /* int on PCI_PERR# */
0547 #define PCI_CONFIG_IS       (1 << 12) /* int on PCI_SERR# */
0548 #define PCI_CONFIG_IMM      (1 << 11) /* int on master abort */
0549 #define PCI_CONFIG_ITM      (1 << 10) /* int on target abort (as master) */
0550 #define PCI_CONFIG_ITT      (1 << 9)  /* int on target abort (as target) */
0551 #define PCI_CONFIG_IPB      (1 << 8)  /* int on PERR# in bus master acc */
0552 #define PCI_CONFIG_SIC_NO   (0 << 6)  /* no byte mask changes */
0553 #define PCI_CONFIG_SIC_BA_ADR   (1 << 6)  /* on byte/hw acc, invert adr bits */
0554 #define PCI_CONFIG_SIC_HWA_DAT  (2 << 6)  /* on halfword acc, swap data */
0555 #define PCI_CONFIG_SIC_ALL  (3 << 6)  /* swap data bytes on all accesses */
0556 #define PCI_CONFIG_ST       (1 << 5)  /* swap data by target transactions */
0557 #define PCI_CONFIG_SM       (1 << 4)  /* swap data from PCI ctl */
0558 #define PCI_CONFIG_AEN      (1 << 3)  /* enable internal arbiter */
0559 #define PCI_CONFIG_R2H      (1 << 2)  /* REQ2# to hi-prio arbiter */
0560 #define PCI_CONFIG_R1H      (1 << 1)  /* REQ1# to hi-prio arbiter */
0561 #define PCI_CONFIG_CH       (1 << 0)  /* PCI ctl to hi-prio arbiter */
0562 #define PCI_B2BMASK_B2BMASK(x)  (((x) & 0xffff) << 16)
0563 #define PCI_B2BMASK_CCH(x)  ((x) & 0xffff) /* 16 upper bits of class code */
0564 #define PCI_B2BBASE0_VID_B0(x)  (((x) & 0xffff) << 16)
0565 #define PCI_B2BBASE0_VID_SV(x)  ((x) & 0xffff)
0566 #define PCI_B2BBASE1_SID_B1(x)  (((x) & 0xffff) << 16)
0567 #define PCI_B2BBASE1_SID_SI(x)  ((x) & 0xffff)
0568 #define PCI_MWMASKDEV_MWMASK(x) (((x) & 0xffff) << 16)
0569 #define PCI_MWMASKDEV_DEVID(x)  ((x) & 0xffff)
0570 #define PCI_MWBASEREVCCL_BASE(x) (((x) & 0xffff) << 16)
0571 #define PCI_MWBASEREVCCL_REV(x)  (((x) & 0xff) << 8)
0572 #define PCI_MWBASEREVCCL_CCL(x)  ((x) & 0xff)
0573 #define PCI_ID_DID(x)       (((x) & 0xffff) << 16)
0574 #define PCI_ID_VID(x)       ((x) & 0xffff)
0575 #define PCI_STATCMD_STATUS(x)   (((x) & 0xffff) << 16)
0576 #define PCI_STATCMD_CMD(x)  ((x) & 0xffff)
0577 #define PCI_CLASSREV_CLASS(x)   (((x) & 0x00ffffff) << 8)
0578 #define PCI_CLASSREV_REV(x) ((x) & 0xff)
0579 #define PCI_PARAM_BIST(x)   (((x) & 0xff) << 24)
0580 #define PCI_PARAM_HT(x)     (((x) & 0xff) << 16)
0581 #define PCI_PARAM_LT(x)     (((x) & 0xff) << 8)
0582 #define PCI_PARAM_CLS(x)    ((x) & 0xff)
0583 #define PCI_TIMEOUT_RETRIES(x)  (((x) & 0xff) << 8) /* max retries */
0584 #define PCI_TIMEOUT_TO(x)   ((x) & 0xff)    /* target ready timeout */
0585 
0586 
0587 /**********************************************************************/
0588 
0589 
0590 #ifndef _LANGUAGE_ASSEMBLY
0591 
0592 #include <linux/delay.h>
0593 #include <linux/types.h>
0594 
0595 #include <linux/io.h>
0596 #include <linux/irq.h>
0597 
0598 #include <asm/cpu.h>
0599 
0600 /* helpers to access the SYS_* registers */
0601 static inline unsigned long alchemy_rdsys(int regofs)
0602 {
0603     void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_SYS_PHYS_ADDR);
0604 
0605     return __raw_readl(b + regofs);
0606 }
0607 
0608 static inline void alchemy_wrsys(unsigned long v, int regofs)
0609 {
0610     void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_SYS_PHYS_ADDR);
0611 
0612     __raw_writel(v, b + regofs);
0613     wmb(); /* drain writebuffer */
0614 }
0615 
0616 /* helpers to access static memctrl registers */
0617 static inline unsigned long alchemy_rdsmem(int regofs)
0618 {
0619     void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_STATIC_MEM_PHYS_ADDR);
0620 
0621     return __raw_readl(b + regofs);
0622 }
0623 
0624 static inline void alchemy_wrsmem(unsigned long v, int regofs)
0625 {
0626     void __iomem *b = (void __iomem *)KSEG1ADDR(AU1000_STATIC_MEM_PHYS_ADDR);
0627 
0628     __raw_writel(v, b + regofs);
0629     wmb(); /* drain writebuffer */
0630 }
0631 
0632 /* Early Au1000 have a write-only SYS_CPUPLL register. */
0633 static inline int au1xxx_cpu_has_pll_wo(void)
0634 {
0635     switch (read_c0_prid()) {
0636     case 0x00030100:    /* Au1000 DA */
0637     case 0x00030201:    /* Au1000 HA */
0638     case 0x00030202:    /* Au1000 HB */
0639         return 1;
0640     }
0641     return 0;
0642 }
0643 
0644 /* does CPU need CONFIG[OD] set to fix tons of errata? */
0645 static inline int au1xxx_cpu_needs_config_od(void)
0646 {
0647     /*
0648      * c0_config.od (bit 19) was write only (and read as 0) on the
0649      * early revisions of Alchemy SOCs.  It disables the bus trans-
0650      * action overlapping and needs to be set to fix various errata.
0651      */
0652     switch (read_c0_prid()) {
0653     case 0x00030100: /* Au1000 DA */
0654     case 0x00030201: /* Au1000 HA */
0655     case 0x00030202: /* Au1000 HB */
0656     case 0x01030200: /* Au1500 AB */
0657     /*
0658      * Au1100/Au1200 errata actually keep silence about this bit,
0659      * so we set it just in case for those revisions that require
0660      * it to be set according to the (now gone) cpu_table.
0661      */
0662     case 0x02030200: /* Au1100 AB */
0663     case 0x02030201: /* Au1100 BA */
0664     case 0x02030202: /* Au1100 BC */
0665     case 0x04030201: /* Au1200 AC */
0666         return 1;
0667     }
0668     return 0;
0669 }
0670 
0671 #define ALCHEMY_CPU_UNKNOWN -1
0672 #define ALCHEMY_CPU_AU1000  0
0673 #define ALCHEMY_CPU_AU1500  1
0674 #define ALCHEMY_CPU_AU1100  2
0675 #define ALCHEMY_CPU_AU1550  3
0676 #define ALCHEMY_CPU_AU1200  4
0677 #define ALCHEMY_CPU_AU1300  5
0678 
0679 static inline int alchemy_get_cputype(void)
0680 {
0681     switch (read_c0_prid() & (PRID_OPT_MASK | PRID_COMP_MASK)) {
0682     case 0x00030000:
0683         return ALCHEMY_CPU_AU1000;
0684         break;
0685     case 0x01030000:
0686         return ALCHEMY_CPU_AU1500;
0687         break;
0688     case 0x02030000:
0689         return ALCHEMY_CPU_AU1100;
0690         break;
0691     case 0x03030000:
0692         return ALCHEMY_CPU_AU1550;
0693         break;
0694     case 0x04030000:
0695     case 0x05030000:
0696         return ALCHEMY_CPU_AU1200;
0697         break;
0698     case 0x800c0000:
0699         return ALCHEMY_CPU_AU1300;
0700         break;
0701     }
0702 
0703     return ALCHEMY_CPU_UNKNOWN;
0704 }
0705 
0706 /* return number of uarts on a given cputype */
0707 static inline int alchemy_get_uarts(int type)
0708 {
0709     switch (type) {
0710     case ALCHEMY_CPU_AU1000:
0711     case ALCHEMY_CPU_AU1300:
0712         return 4;
0713     case ALCHEMY_CPU_AU1500:
0714     case ALCHEMY_CPU_AU1200:
0715         return 2;
0716     case ALCHEMY_CPU_AU1100:
0717     case ALCHEMY_CPU_AU1550:
0718         return 3;
0719     }
0720     return 0;
0721 }
0722 
0723 /* enable an UART block if it isn't already */
0724 static inline void alchemy_uart_enable(u32 uart_phys)
0725 {
0726     void __iomem *addr = (void __iomem *)KSEG1ADDR(uart_phys);
0727 
0728     /* reset, enable clock, deassert reset */
0729     if ((__raw_readl(addr + 0x100) & 3) != 3) {
0730         __raw_writel(0, addr + 0x100);
0731         wmb(); /* drain writebuffer */
0732         __raw_writel(1, addr + 0x100);
0733         wmb(); /* drain writebuffer */
0734     }
0735     __raw_writel(3, addr + 0x100);
0736     wmb(); /* drain writebuffer */
0737 }
0738 
0739 static inline void alchemy_uart_disable(u32 uart_phys)
0740 {
0741     void __iomem *addr = (void __iomem *)KSEG1ADDR(uart_phys);
0742 
0743     __raw_writel(0, addr + 0x100);  /* UART_MOD_CNTRL */
0744     wmb(); /* drain writebuffer */
0745 }
0746 
0747 static inline void alchemy_uart_putchar(u32 uart_phys, u8 c)
0748 {
0749     void __iomem *base = (void __iomem *)KSEG1ADDR(uart_phys);
0750     int timeout, i;
0751 
0752     /* check LSR TX_EMPTY bit */
0753     timeout = 0xffffff;
0754     do {
0755         if (__raw_readl(base + 0x1c) & 0x20)
0756             break;
0757         /* slow down */
0758         for (i = 10000; i; i--)
0759             asm volatile ("nop");
0760     } while (--timeout);
0761 
0762     __raw_writel(c, base + 0x04);   /* tx */
0763     wmb(); /* drain writebuffer */
0764 }
0765 
0766 /* return number of ethernet MACs on a given cputype */
0767 static inline int alchemy_get_macs(int type)
0768 {
0769     switch (type) {
0770     case ALCHEMY_CPU_AU1000:
0771     case ALCHEMY_CPU_AU1500:
0772     case ALCHEMY_CPU_AU1550:
0773         return 2;
0774     case ALCHEMY_CPU_AU1100:
0775         return 1;
0776     }
0777     return 0;
0778 }
0779 
0780 /* PM: arch/mips/alchemy/common/sleeper.S, power.c, irq.c */
0781 void alchemy_sleep_au1000(void);
0782 void alchemy_sleep_au1550(void);
0783 void alchemy_sleep_au1300(void);
0784 void au_sleep(void);
0785 
0786 /* USB: arch/mips/alchemy/common/usb.c */
0787 enum alchemy_usb_block {
0788     ALCHEMY_USB_OHCI0,
0789     ALCHEMY_USB_UDC0,
0790     ALCHEMY_USB_EHCI0,
0791     ALCHEMY_USB_OTG0,
0792     ALCHEMY_USB_OHCI1,
0793 };
0794 int alchemy_usb_control(int block, int enable);
0795 
0796 /* PCI controller platform data */
0797 struct alchemy_pci_platdata {
0798     int (*board_map_irq)(const struct pci_dev *d, u8 slot, u8 pin);
0799     int (*board_pci_idsel)(unsigned int devsel, int assert);
0800     /* bits to set/clear in PCI_CONFIG register */
0801     unsigned long pci_cfg_set;
0802     unsigned long pci_cfg_clr;
0803 };
0804 
0805 /* The IrDA peripheral has an IRFIRSEL pin, but on the DB/PB boards it's
0806  * not used to select FIR/SIR mode on the transceiver but as a GPIO.
0807  * Instead a CPLD has to be told about the mode.  The driver calls the
0808  * set_phy_mode() function in addition to driving the IRFIRSEL pin.
0809  */
0810 #define AU1000_IRDA_PHY_MODE_OFF    0
0811 #define AU1000_IRDA_PHY_MODE_SIR    1
0812 #define AU1000_IRDA_PHY_MODE_FIR    2
0813 
0814 struct au1k_irda_platform_data {
0815     void (*set_phy_mode)(int mode);
0816 };
0817 
0818 
0819 /* Multifunction pins: Each of these pins can either be assigned to the
0820  * GPIO controller or a on-chip peripheral.
0821  * Call "au1300_pinfunc_to_dev()" or "au1300_pinfunc_to_gpio()" to
0822  * assign one of these to either the GPIO controller or the device.
0823  */
0824 enum au1300_multifunc_pins {
0825     /* wake-from-str pins 0-3 */
0826     AU1300_PIN_WAKE0 = 0, AU1300_PIN_WAKE1, AU1300_PIN_WAKE2,
0827     AU1300_PIN_WAKE3,
0828     /* external clock sources for PSCs: 4-5 */
0829     AU1300_PIN_EXTCLK0, AU1300_PIN_EXTCLK1,
0830     /* 8bit MMC interface on SD0: 6-9 */
0831     AU1300_PIN_SD0DAT4, AU1300_PIN_SD0DAT5, AU1300_PIN_SD0DAT6,
0832     AU1300_PIN_SD0DAT7,
0833     /* aux clk input for freqgen 3: 10 */
0834     AU1300_PIN_FG3AUX,
0835     /* UART1 pins: 11-18 */
0836     AU1300_PIN_U1RI, AU1300_PIN_U1DCD, AU1300_PIN_U1DSR,
0837     AU1300_PIN_U1CTS, AU1300_PIN_U1RTS, AU1300_PIN_U1DTR,
0838     AU1300_PIN_U1RX, AU1300_PIN_U1TX,
0839     /* UART0 pins: 19-24 */
0840     AU1300_PIN_U0RI, AU1300_PIN_U0DCD, AU1300_PIN_U0DSR,
0841     AU1300_PIN_U0CTS, AU1300_PIN_U0RTS, AU1300_PIN_U0DTR,
0842     /* UART2: 25-26 */
0843     AU1300_PIN_U2RX, AU1300_PIN_U2TX,
0844     /* UART3: 27-28 */
0845     AU1300_PIN_U3RX, AU1300_PIN_U3TX,
0846     /* LCD controller PWMs, ext pixclock: 29-31 */
0847     AU1300_PIN_LCDPWM0, AU1300_PIN_LCDPWM1, AU1300_PIN_LCDCLKIN,
0848     /* SD1 interface: 32-37 */
0849     AU1300_PIN_SD1DAT0, AU1300_PIN_SD1DAT1, AU1300_PIN_SD1DAT2,
0850     AU1300_PIN_SD1DAT3, AU1300_PIN_SD1CMD, AU1300_PIN_SD1CLK,
0851     /* SD2 interface: 38-43 */
0852     AU1300_PIN_SD2DAT0, AU1300_PIN_SD2DAT1, AU1300_PIN_SD2DAT2,
0853     AU1300_PIN_SD2DAT3, AU1300_PIN_SD2CMD, AU1300_PIN_SD2CLK,
0854     /* PSC0/1 clocks: 44-45 */
0855     AU1300_PIN_PSC0CLK, AU1300_PIN_PSC1CLK,
0856     /* PSCs: 46-49/50-53/54-57/58-61 */
0857     AU1300_PIN_PSC0SYNC0, AU1300_PIN_PSC0SYNC1, AU1300_PIN_PSC0D0,
0858     AU1300_PIN_PSC0D1,
0859     AU1300_PIN_PSC1SYNC0, AU1300_PIN_PSC1SYNC1, AU1300_PIN_PSC1D0,
0860     AU1300_PIN_PSC1D1,
0861     AU1300_PIN_PSC2SYNC0, AU1300_PIN_PSC2SYNC1, AU1300_PIN_PSC2D0,
0862     AU1300_PIN_PSC2D1,
0863     AU1300_PIN_PSC3SYNC0, AU1300_PIN_PSC3SYNC1, AU1300_PIN_PSC3D0,
0864     AU1300_PIN_PSC3D1,
0865     /* PCMCIA interface: 62-70 */
0866     AU1300_PIN_PCE2, AU1300_PIN_PCE1, AU1300_PIN_PIOS16,
0867     AU1300_PIN_PIOR, AU1300_PIN_PWE, AU1300_PIN_PWAIT,
0868     AU1300_PIN_PREG, AU1300_PIN_POE, AU1300_PIN_PIOW,
0869     /* camera interface H/V sync inputs: 71-72 */
0870     AU1300_PIN_CIMLS, AU1300_PIN_CIMFS,
0871     /* PSC2/3 clocks: 73-74 */
0872     AU1300_PIN_PSC2CLK, AU1300_PIN_PSC3CLK,
0873 };
0874 
0875 /* GPIC (Au1300) pin management: arch/mips/alchemy/common/gpioint.c */
0876 extern void au1300_pinfunc_to_gpio(enum au1300_multifunc_pins gpio);
0877 extern void au1300_pinfunc_to_dev(enum au1300_multifunc_pins gpio);
0878 extern void au1300_set_irq_priority(unsigned int irq, int p);
0879 extern void au1300_set_dbdma_gpio(int dchan, unsigned int gpio);
0880 
0881 /* Au1300 allows to disconnect certain blocks from internal power supply */
0882 enum au1300_vss_block {
0883     AU1300_VSS_MPE = 0,
0884     AU1300_VSS_BSA,
0885     AU1300_VSS_GPE,
0886     AU1300_VSS_MGP,
0887 };
0888 
0889 extern void au1300_vss_block_control(int block, int enable);
0890 
0891 enum soc_au1000_ints {
0892     AU1000_FIRST_INT    = AU1000_INTC0_INT_BASE,
0893     AU1000_UART0_INT    = AU1000_FIRST_INT,
0894     AU1000_UART1_INT,
0895     AU1000_UART2_INT,
0896     AU1000_UART3_INT,
0897     AU1000_SSI0_INT,
0898     AU1000_SSI1_INT,
0899     AU1000_DMA_INT_BASE,
0900 
0901     AU1000_TOY_INT      = AU1000_FIRST_INT + 14,
0902     AU1000_TOY_MATCH0_INT,
0903     AU1000_TOY_MATCH1_INT,
0904     AU1000_TOY_MATCH2_INT,
0905     AU1000_RTC_INT,
0906     AU1000_RTC_MATCH0_INT,
0907     AU1000_RTC_MATCH1_INT,
0908     AU1000_RTC_MATCH2_INT,
0909     AU1000_IRDA_TX_INT,
0910     AU1000_IRDA_RX_INT,
0911     AU1000_USB_DEV_REQ_INT,
0912     AU1000_USB_DEV_SUS_INT,
0913     AU1000_USB_HOST_INT,
0914     AU1000_ACSYNC_INT,
0915     AU1000_MAC0_DMA_INT,
0916     AU1000_MAC1_DMA_INT,
0917     AU1000_I2S_UO_INT,
0918     AU1000_AC97C_INT,
0919     AU1000_GPIO0_INT,
0920     AU1000_GPIO1_INT,
0921     AU1000_GPIO2_INT,
0922     AU1000_GPIO3_INT,
0923     AU1000_GPIO4_INT,
0924     AU1000_GPIO5_INT,
0925     AU1000_GPIO6_INT,
0926     AU1000_GPIO7_INT,
0927     AU1000_GPIO8_INT,
0928     AU1000_GPIO9_INT,
0929     AU1000_GPIO10_INT,
0930     AU1000_GPIO11_INT,
0931     AU1000_GPIO12_INT,
0932     AU1000_GPIO13_INT,
0933     AU1000_GPIO14_INT,
0934     AU1000_GPIO15_INT,
0935     AU1000_GPIO16_INT,
0936     AU1000_GPIO17_INT,
0937     AU1000_GPIO18_INT,
0938     AU1000_GPIO19_INT,
0939     AU1000_GPIO20_INT,
0940     AU1000_GPIO21_INT,
0941     AU1000_GPIO22_INT,
0942     AU1000_GPIO23_INT,
0943     AU1000_GPIO24_INT,
0944     AU1000_GPIO25_INT,
0945     AU1000_GPIO26_INT,
0946     AU1000_GPIO27_INT,
0947     AU1000_GPIO28_INT,
0948     AU1000_GPIO29_INT,
0949     AU1000_GPIO30_INT,
0950     AU1000_GPIO31_INT,
0951 };
0952 
0953 enum soc_au1100_ints {
0954     AU1100_FIRST_INT    = AU1000_INTC0_INT_BASE,
0955     AU1100_UART0_INT    = AU1100_FIRST_INT,
0956     AU1100_UART1_INT,
0957     AU1100_SD_INT,
0958     AU1100_UART3_INT,
0959     AU1100_SSI0_INT,
0960     AU1100_SSI1_INT,
0961     AU1100_DMA_INT_BASE,
0962 
0963     AU1100_TOY_INT      = AU1100_FIRST_INT + 14,
0964     AU1100_TOY_MATCH0_INT,
0965     AU1100_TOY_MATCH1_INT,
0966     AU1100_TOY_MATCH2_INT,
0967     AU1100_RTC_INT,
0968     AU1100_RTC_MATCH0_INT,
0969     AU1100_RTC_MATCH1_INT,
0970     AU1100_RTC_MATCH2_INT,
0971     AU1100_IRDA_TX_INT,
0972     AU1100_IRDA_RX_INT,
0973     AU1100_USB_DEV_REQ_INT,
0974     AU1100_USB_DEV_SUS_INT,
0975     AU1100_USB_HOST_INT,
0976     AU1100_ACSYNC_INT,
0977     AU1100_MAC0_DMA_INT,
0978     AU1100_GPIO208_215_INT,
0979     AU1100_LCD_INT,
0980     AU1100_AC97C_INT,
0981     AU1100_GPIO0_INT,
0982     AU1100_GPIO1_INT,
0983     AU1100_GPIO2_INT,
0984     AU1100_GPIO3_INT,
0985     AU1100_GPIO4_INT,
0986     AU1100_GPIO5_INT,
0987     AU1100_GPIO6_INT,
0988     AU1100_GPIO7_INT,
0989     AU1100_GPIO8_INT,
0990     AU1100_GPIO9_INT,
0991     AU1100_GPIO10_INT,
0992     AU1100_GPIO11_INT,
0993     AU1100_GPIO12_INT,
0994     AU1100_GPIO13_INT,
0995     AU1100_GPIO14_INT,
0996     AU1100_GPIO15_INT,
0997     AU1100_GPIO16_INT,
0998     AU1100_GPIO17_INT,
0999     AU1100_GPIO18_INT,
1000     AU1100_GPIO19_INT,
1001     AU1100_GPIO20_INT,
1002     AU1100_GPIO21_INT,
1003     AU1100_GPIO22_INT,
1004     AU1100_GPIO23_INT,
1005     AU1100_GPIO24_INT,
1006     AU1100_GPIO25_INT,
1007     AU1100_GPIO26_INT,
1008     AU1100_GPIO27_INT,
1009     AU1100_GPIO28_INT,
1010     AU1100_GPIO29_INT,
1011     AU1100_GPIO30_INT,
1012     AU1100_GPIO31_INT,
1013 };
1014 
1015 enum soc_au1500_ints {
1016     AU1500_FIRST_INT    = AU1000_INTC0_INT_BASE,
1017     AU1500_UART0_INT    = AU1500_FIRST_INT,
1018     AU1500_PCI_INTA,
1019     AU1500_PCI_INTB,
1020     AU1500_UART3_INT,
1021     AU1500_PCI_INTC,
1022     AU1500_PCI_INTD,
1023     AU1500_DMA_INT_BASE,
1024 
1025     AU1500_TOY_INT      = AU1500_FIRST_INT + 14,
1026     AU1500_TOY_MATCH0_INT,
1027     AU1500_TOY_MATCH1_INT,
1028     AU1500_TOY_MATCH2_INT,
1029     AU1500_RTC_INT,
1030     AU1500_RTC_MATCH0_INT,
1031     AU1500_RTC_MATCH1_INT,
1032     AU1500_RTC_MATCH2_INT,
1033     AU1500_PCI_ERR_INT,
1034     AU1500_RESERVED_INT,
1035     AU1500_USB_DEV_REQ_INT,
1036     AU1500_USB_DEV_SUS_INT,
1037     AU1500_USB_HOST_INT,
1038     AU1500_ACSYNC_INT,
1039     AU1500_MAC0_DMA_INT,
1040     AU1500_MAC1_DMA_INT,
1041     AU1500_AC97C_INT    = AU1500_FIRST_INT + 31,
1042     AU1500_GPIO0_INT,
1043     AU1500_GPIO1_INT,
1044     AU1500_GPIO2_INT,
1045     AU1500_GPIO3_INT,
1046     AU1500_GPIO4_INT,
1047     AU1500_GPIO5_INT,
1048     AU1500_GPIO6_INT,
1049     AU1500_GPIO7_INT,
1050     AU1500_GPIO8_INT,
1051     AU1500_GPIO9_INT,
1052     AU1500_GPIO10_INT,
1053     AU1500_GPIO11_INT,
1054     AU1500_GPIO12_INT,
1055     AU1500_GPIO13_INT,
1056     AU1500_GPIO14_INT,
1057     AU1500_GPIO15_INT,
1058     AU1500_GPIO200_INT,
1059     AU1500_GPIO201_INT,
1060     AU1500_GPIO202_INT,
1061     AU1500_GPIO203_INT,
1062     AU1500_GPIO20_INT,
1063     AU1500_GPIO204_INT,
1064     AU1500_GPIO205_INT,
1065     AU1500_GPIO23_INT,
1066     AU1500_GPIO24_INT,
1067     AU1500_GPIO25_INT,
1068     AU1500_GPIO26_INT,
1069     AU1500_GPIO27_INT,
1070     AU1500_GPIO28_INT,
1071     AU1500_GPIO206_INT,
1072     AU1500_GPIO207_INT,
1073     AU1500_GPIO208_215_INT,
1074 };
1075 
1076 enum soc_au1550_ints {
1077     AU1550_FIRST_INT    = AU1000_INTC0_INT_BASE,
1078     AU1550_UART0_INT    = AU1550_FIRST_INT,
1079     AU1550_PCI_INTA,
1080     AU1550_PCI_INTB,
1081     AU1550_DDMA_INT,
1082     AU1550_CRYPTO_INT,
1083     AU1550_PCI_INTC,
1084     AU1550_PCI_INTD,
1085     AU1550_PCI_RST_INT,
1086     AU1550_UART1_INT,
1087     AU1550_UART3_INT,
1088     AU1550_PSC0_INT,
1089     AU1550_PSC1_INT,
1090     AU1550_PSC2_INT,
1091     AU1550_PSC3_INT,
1092     AU1550_TOY_INT,
1093     AU1550_TOY_MATCH0_INT,
1094     AU1550_TOY_MATCH1_INT,
1095     AU1550_TOY_MATCH2_INT,
1096     AU1550_RTC_INT,
1097     AU1550_RTC_MATCH0_INT,
1098     AU1550_RTC_MATCH1_INT,
1099     AU1550_RTC_MATCH2_INT,
1100 
1101     AU1550_NAND_INT     = AU1550_FIRST_INT + 23,
1102     AU1550_USB_DEV_REQ_INT,
1103     AU1550_USB_DEV_SUS_INT,
1104     AU1550_USB_HOST_INT,
1105     AU1550_MAC0_DMA_INT,
1106     AU1550_MAC1_DMA_INT,
1107     AU1550_GPIO0_INT    = AU1550_FIRST_INT + 32,
1108     AU1550_GPIO1_INT,
1109     AU1550_GPIO2_INT,
1110     AU1550_GPIO3_INT,
1111     AU1550_GPIO4_INT,
1112     AU1550_GPIO5_INT,
1113     AU1550_GPIO6_INT,
1114     AU1550_GPIO7_INT,
1115     AU1550_GPIO8_INT,
1116     AU1550_GPIO9_INT,
1117     AU1550_GPIO10_INT,
1118     AU1550_GPIO11_INT,
1119     AU1550_GPIO12_INT,
1120     AU1550_GPIO13_INT,
1121     AU1550_GPIO14_INT,
1122     AU1550_GPIO15_INT,
1123     AU1550_GPIO200_INT,
1124     AU1550_GPIO201_205_INT, /* Logical or of GPIO201:205 */
1125     AU1550_GPIO16_INT,
1126     AU1550_GPIO17_INT,
1127     AU1550_GPIO20_INT,
1128     AU1550_GPIO21_INT,
1129     AU1550_GPIO22_INT,
1130     AU1550_GPIO23_INT,
1131     AU1550_GPIO24_INT,
1132     AU1550_GPIO25_INT,
1133     AU1550_GPIO26_INT,
1134     AU1550_GPIO27_INT,
1135     AU1550_GPIO28_INT,
1136     AU1550_GPIO206_INT,
1137     AU1550_GPIO207_INT,
1138     AU1550_GPIO208_215_INT, /* Logical or of GPIO208:215 */
1139 };
1140 
1141 enum soc_au1200_ints {
1142     AU1200_FIRST_INT    = AU1000_INTC0_INT_BASE,
1143     AU1200_UART0_INT    = AU1200_FIRST_INT,
1144     AU1200_SWT_INT,
1145     AU1200_SD_INT,
1146     AU1200_DDMA_INT,
1147     AU1200_MAE_BE_INT,
1148     AU1200_GPIO200_INT,
1149     AU1200_GPIO201_INT,
1150     AU1200_GPIO202_INT,
1151     AU1200_UART1_INT,
1152     AU1200_MAE_FE_INT,
1153     AU1200_PSC0_INT,
1154     AU1200_PSC1_INT,
1155     AU1200_AES_INT,
1156     AU1200_CAMERA_INT,
1157     AU1200_TOY_INT,
1158     AU1200_TOY_MATCH0_INT,
1159     AU1200_TOY_MATCH1_INT,
1160     AU1200_TOY_MATCH2_INT,
1161     AU1200_RTC_INT,
1162     AU1200_RTC_MATCH0_INT,
1163     AU1200_RTC_MATCH1_INT,
1164     AU1200_RTC_MATCH2_INT,
1165     AU1200_GPIO203_INT,
1166     AU1200_NAND_INT,
1167     AU1200_GPIO204_INT,
1168     AU1200_GPIO205_INT,
1169     AU1200_GPIO206_INT,
1170     AU1200_GPIO207_INT,
1171     AU1200_GPIO208_215_INT, /* Logical OR of 208:215 */
1172     AU1200_USB_INT,
1173     AU1200_LCD_INT,
1174     AU1200_MAE_BOTH_INT,
1175     AU1200_GPIO0_INT,
1176     AU1200_GPIO1_INT,
1177     AU1200_GPIO2_INT,
1178     AU1200_GPIO3_INT,
1179     AU1200_GPIO4_INT,
1180     AU1200_GPIO5_INT,
1181     AU1200_GPIO6_INT,
1182     AU1200_GPIO7_INT,
1183     AU1200_GPIO8_INT,
1184     AU1200_GPIO9_INT,
1185     AU1200_GPIO10_INT,
1186     AU1200_GPIO11_INT,
1187     AU1200_GPIO12_INT,
1188     AU1200_GPIO13_INT,
1189     AU1200_GPIO14_INT,
1190     AU1200_GPIO15_INT,
1191     AU1200_GPIO16_INT,
1192     AU1200_GPIO17_INT,
1193     AU1200_GPIO18_INT,
1194     AU1200_GPIO19_INT,
1195     AU1200_GPIO20_INT,
1196     AU1200_GPIO21_INT,
1197     AU1200_GPIO22_INT,
1198     AU1200_GPIO23_INT,
1199     AU1200_GPIO24_INT,
1200     AU1200_GPIO25_INT,
1201     AU1200_GPIO26_INT,
1202     AU1200_GPIO27_INT,
1203     AU1200_GPIO28_INT,
1204     AU1200_GPIO29_INT,
1205     AU1200_GPIO30_INT,
1206     AU1200_GPIO31_INT,
1207 };
1208 
1209 #endif /* !defined (_LANGUAGE_ASSEMBLY) */
1210 
1211 #endif