Home | History | Annotate | Line # | Download | only in xscale
ixp425reg.h revision 1.7.2.2
      1  1.7.2.1   skrll /*	$NetBSD: ixp425reg.h,v 1.7.2.2 2004/09/18 14:32:47 skrll Exp $ */
      2      1.1  ichiro /*
      3      1.1  ichiro  * Copyright (c) 2003
      4      1.1  ichiro  *	Ichiro FUKUHARA <ichiro (at) ichiro.org>.
      5      1.1  ichiro  * All rights reserved.
      6      1.1  ichiro  *
      7      1.1  ichiro  * Redistribution and use in source and binary forms, with or without
      8      1.1  ichiro  * modification, are permitted provided that the following conditions
      9      1.1  ichiro  * are met:
     10      1.1  ichiro  * 1. Redistributions of source code must retain the above copyright
     11      1.1  ichiro  *    notice, this list of conditions and the following disclaimer.
     12      1.1  ichiro  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1  ichiro  *    notice, this list of conditions and the following disclaimer in the
     14      1.1  ichiro  *    documentation and/or other materials provided with the distribution.
     15      1.1  ichiro  * 3. All advertising materials mentioning features or use of this software
     16      1.1  ichiro  *    must display the following acknowledgement:
     17      1.1  ichiro  *	This product includes software developed by Ichiro FUKUHARA.
     18      1.1  ichiro  * 4. The name of the company nor the name of the author may be used to
     19      1.1  ichiro  *    endorse or promote products derived from this software without specific
     20      1.1  ichiro  *    prior written permission.
     21      1.1  ichiro  *
     22      1.1  ichiro  * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR
     23      1.1  ichiro  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24      1.1  ichiro  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25      1.1  ichiro  * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR
     26      1.1  ichiro  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27      1.1  ichiro  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28      1.1  ichiro  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29      1.1  ichiro  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30      1.1  ichiro  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31      1.1  ichiro  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32      1.1  ichiro  * SUCH DAMAGE.
     33      1.1  ichiro  */
     34      1.1  ichiro 
     35      1.1  ichiro #ifndef _IXP425REG_H_
     36      1.1  ichiro #define _IXP425REG_H_
     37      1.1  ichiro 
     38      1.1  ichiro /*
     39      1.1  ichiro  * Physical memory map for the Intel IXP425
     40      1.1  ichiro  */
     41      1.1  ichiro /*
     42      1.1  ichiro  * CC00 00FF ---------------------------
     43      1.1  ichiro  *           SDRAM Configuration Registers
     44      1.1  ichiro  * CC00 0000 ---------------------------
     45      1.1  ichiro  *
     46      1.1  ichiro  * C800 BFFF ---------------------------
     47      1.1  ichiro  *           System and Peripheral Registers
     48      1.1  ichiro  * C800 0000 ---------------------------
     49      1.1  ichiro  *           Expansion Bus Configuration Registers
     50      1.1  ichiro  * C400 0000 ---------------------------
     51      1.1  ichiro  *           PCI Configuration and Status Registers
     52      1.1  ichiro  * C000 0000 ---------------------------
     53      1.1  ichiro  *
     54      1.1  ichiro  * 6400 0000 ---------------------------
     55      1.1  ichiro  *           Queue manager
     56      1.1  ichiro  * 6000 0000 ---------------------------
     57      1.1  ichiro  *           Expansion Bus Data
     58      1.1  ichiro  * 5000 0000 ---------------------------
     59      1.1  ichiro  *           PCI Data
     60      1.1  ichiro  * 4800 0000 ---------------------------
     61      1.1  ichiro  *
     62      1.1  ichiro  * 4000 0000 ---------------------------
     63      1.1  ichiro  *           SDRAM
     64      1.1  ichiro  * 1000 0000 ---------------------------
     65      1.1  ichiro  */
     66      1.1  ichiro 
     67      1.1  ichiro /*
     68      1.1  ichiro  * Virtual memory map for the Intel IXP425 integrated devices
     69      1.1  ichiro  */
     70      1.1  ichiro /*
     71      1.1  ichiro  * FFFF FFFF ---------------------------
     72      1.1  ichiro  *
     73  1.7.2.1   skrll  * FC00 0000 ---------------------------
     74  1.7.2.1   skrll  *           PCI Data (memory space)
     75  1.7.2.1   skrll  * F800 0000 ---------------------------
     76  1.7.2.1   skrll  *
     77  1.7.2.1   skrll  * F020 1000 ---------------------------
     78  1.7.2.1   skrll  *           SDRAM Controller
     79  1.7.2.1   skrll  * F020 0000 ---------------------------
     80  1.7.2.1   skrll  *
     81      1.1  ichiro  * F001 2000 ---------------------------
     82      1.1  ichiro  *           PCI Configuration and Status Registers
     83      1.1  ichiro  * F001 1000 ---------------------------
     84      1.1  ichiro  *           Expansion bus Configuration Registers
     85      1.1  ichiro  * F001 0000 ---------------------------
     86      1.1  ichiro  *           System and Peripheral Registers
     87      1.1  ichiro  *            VA F000 0000 = PA C800 0000 (SIZE 0x10000)
     88      1.1  ichiro  * F000 0000 ---------------------------
     89      1.1  ichiro  *
     90      1.1  ichiro  * 0000 0000 ---------------------------
     91      1.1  ichiro  *
     92      1.1  ichiro  */
     93      1.1  ichiro 
     94      1.1  ichiro /* Physical/Virtual address for I/O space */
     95      1.1  ichiro 
     96      1.1  ichiro #define	IXP425_IO_VBASE		0xf0000000UL
     97      1.1  ichiro #define	IXP425_IO_HWBASE	0xc8000000UL
     98      1.1  ichiro #define	IXP425_IO_SIZE		0x00010000UL
     99      1.1  ichiro 
    100      1.1  ichiro /* Offset */
    101      1.1  ichiro 
    102      1.1  ichiro #define	IXP425_UART0_OFFSET	0x00000000UL
    103      1.1  ichiro #define	IXP425_UART1_OFFSET	0x00001000UL
    104      1.1  ichiro #define	IXP425_PMC_OFFSET	0x00002000UL
    105      1.1  ichiro #define	IXP425_INTR_OFFSET	0x00003000UL
    106      1.1  ichiro #define	IXP425_GPIO_OFFSET	0x00004000UL
    107      1.1  ichiro #define	IXP425_TIMER_OFFSET	0x00005000UL
    108      1.1  ichiro #define	IXP425_HSS_OFFSET	0x00006000UL	/* Not User Programmable */
    109      1.1  ichiro #define	IXP425_NPE_A_OFFSET	0x00007000UL	/* Not User Programmable */
    110      1.1  ichiro #define	IXP425_NPE_B_OFFSET	0x00008000UL	/* Not User Programmable */
    111      1.1  ichiro #define	IXP425_MAC_A_OFFSET	0x00009000UL
    112      1.1  ichiro #define	IXP425_MAC_B_OFFSET	0x0000a000UL
    113      1.1  ichiro #define	IXP425_USB_OFFSET	0x0000b000UL
    114      1.1  ichiro 
    115      1.1  ichiro #define	IXP425_REG_SIZE		0x1000
    116      1.1  ichiro 
    117      1.1  ichiro /*
    118      1.1  ichiro  * UART
    119      1.1  ichiro  * 	UART0 0xc8000000
    120      1.1  ichiro  * 	UART1 0xc8001000
    121      1.1  ichiro  *
    122      1.1  ichiro  */
    123      1.1  ichiro /* I/O space */
    124      1.1  ichiro #define	IXP425_UART0_HWBASE	(IXP425_IO_HWBASE + IXP425_UART0_OFFSET)
    125      1.1  ichiro #define	IXP425_UART1_HWBASE	(IXP425_IO_HWBASE + IXP425_UART1_OFFSET)
    126      1.1  ichiro 
    127      1.1  ichiro #define	IXP425_UART0_VBASE	(IXP425_IO_VBASE + IXP425_UART0_OFFSET)
    128      1.4  ichiro 						/* 0xf0000000 */
    129      1.1  ichiro #define	IXP425_UART1_VBASE	(IXP425_IO_VBASE + IXP425_UART1_OFFSET)
    130      1.4  ichiro 						/* 0xf0001000 */
    131      1.1  ichiro 
    132  1.7.2.1   skrll #define	IXP425_UART_FREQ	14745600
    133      1.1  ichiro 
    134  1.7.2.1   skrll /*#define	IXP4XX_COM_NPORTS	8*/
    135      1.1  ichiro 
    136      1.1  ichiro /*
    137      1.1  ichiro  * Timers
    138      1.1  ichiro  *
    139      1.1  ichiro  */
    140  1.7.2.1   skrll #define	IXP425_TIMER_HWBASE	(IXP425_IO_HWBASE + IXP425_TIMER_OFFSET)
    141  1.7.2.1   skrll #define	IXP425_TIMER_VBASE	(IXP425_IO_VBASE + IXP425_TIMER_OFFSET)
    142      1.1  ichiro 
    143  1.7.2.1   skrll #define	IXP425_OST_TS		0x0000
    144      1.1  ichiro #define	IXP425_OST_TIM0		0x0004
    145      1.1  ichiro #define	IXP425_OST_TIM1		0x000C
    146      1.1  ichiro 
    147      1.1  ichiro #define	IXP425_OST_TIM0_RELOAD	0x0008
    148      1.1  ichiro #define	IXP425_OST_TIM1_RELOAD	0x0010
    149      1.1  ichiro #define	TIMERRELOAD_MASK	0xFFFFFFFC
    150      1.1  ichiro #define	OST_ONESHOT_EN		(1U << 1)
    151      1.1  ichiro #define	OST_TIMER_EN		(1U << 0)
    152      1.1  ichiro 
    153      1.1  ichiro #define	IXP425_OST_STATUS	0x0020
    154      1.1  ichiro #define	OST_WARM_RESET		(1U << 4)
    155      1.1  ichiro #define	OST_WDOG_INT		(1U << 3)
    156      1.1  ichiro #define	OST_TS_INT		(1U << 2)
    157      1.1  ichiro #define	OST_TIM1_INT		(1U << 1)
    158      1.1  ichiro #define	OST_TIM0_INT		(1U << 0)
    159      1.1  ichiro 
    160  1.7.2.1   skrll #define	IXP425_OST_WDOG		0x0014
    161  1.7.2.1   skrll #define	IXP425_OST_WDOG_ENAB	0x0018
    162  1.7.2.1   skrll #define	IXP425_OST_WDOG_KEY	0x001c
    163  1.7.2.1   skrll #define	OST_WDOG_KEY_MAJICK	0x482e
    164  1.7.2.1   skrll #define	OST_WDOG_ENAB_RST_ENA	(1u << 0)
    165  1.7.2.1   skrll #define	OST_WDOG_ENAB_INT_ENA	(1u << 1)
    166  1.7.2.1   skrll #define	OST_WDOG_ENAB_CNT_ENA	(1u << 2)
    167  1.7.2.1   skrll 
    168      1.1  ichiro /*
    169      1.1  ichiro  * Interrupt Controller Unit.
    170      1.4  ichiro  *  PA 0xc8003000
    171      1.1  ichiro  */
    172      1.1  ichiro 
    173      1.1  ichiro #define	IXP425_IRQ_HWBASE	IXP425_IO_HWBASE + IXP425_INTR_OFFSET
    174      1.1  ichiro #define	IXP425_IRQ_VBASE	IXP425_IO_VBASE  + IXP425_INTR_OFFSET
    175      1.4  ichiro 						/* 0xf0003000 */
    176      1.1  ichiro #define	IXP425_IRQ_SIZE		0x00000020UL
    177      1.1  ichiro 
    178      1.1  ichiro #define	IXP425_INT_STATUS	(IXP425_IRQ_VBASE + 0x00)
    179      1.1  ichiro #define	IXP425_INT_ENABLE	(IXP425_IRQ_VBASE + 0x04)
    180      1.1  ichiro #define	IXP425_INT_SELECT	(IXP425_IRQ_VBASE + 0x08)
    181      1.1  ichiro #define	IXP425_IRQ_STATUS	(IXP425_IRQ_VBASE + 0x0C)
    182      1.1  ichiro #define	IXP425_FIQ_STATUS	(IXP425_IRQ_VBASE + 0x10)
    183      1.1  ichiro #define	IXP425_INT_PRTY		(IXP425_IRQ_VBASE + 0x14)
    184      1.1  ichiro #define	IXP425_IRQ_ENC		(IXP425_IRQ_VBASE + 0x18)
    185      1.1  ichiro #define	IXP425_FIQ_ENC		(IXP425_IRQ_VBASE + 0x1C)
    186      1.1  ichiro 
    187      1.1  ichiro #define	IXP425_INT_SW1		31	/* SW Interrupt 1 */
    188      1.1  ichiro #define	IXP425_INT_SW0		30	/* SW Interrupt 0 */
    189      1.1  ichiro #define	IXP425_INT_GPIO_12	29	/* GPIO 12 */
    190      1.1  ichiro #define	IXP425_INT_GPIO_11	28	/* GPIO 11 */
    191      1.1  ichiro #define	IXP425_INT_GPIO_10	27	/* GPIO 11 */
    192      1.1  ichiro #define	IXP425_INT_GPIO_9	26	/* GPIO 9 */
    193      1.1  ichiro #define	IXP425_INT_GPIO_8	25	/* GPIO 8 */
    194      1.1  ichiro #define	IXP425_INT_GPIO_7	24	/* GPIO 7 */
    195      1.1  ichiro #define	IXP425_INT_GPIO_6	23	/* GPIO 6 */
    196      1.1  ichiro #define	IXP425_INT_GPIO_5	22	/* GPIO 5 */
    197      1.1  ichiro #define	IXP425_INT_GPIO_4	21	/* GPIO 4 */
    198      1.1  ichiro #define	IXP425_INT_GPIO_3	20	/* GPIO 3 */
    199      1.1  ichiro #define	IXP425_INT_GPIO_2	19	/* GPIO 2 */
    200      1.5  ichiro #define	IXP425_INT_XSCALE_PMU	18	/* XScale PMU */
    201      1.5  ichiro #define	IXP425_INT_AHB_PMU	17	/* AHB PMU */
    202      1.1  ichiro #define	IXP425_INT_WDOG		16	/* Watchdog Timer */
    203      1.5  ichiro #define	IXP425_INT_UART0	15	/* HighSpeed UART */
    204      1.1  ichiro #define	IXP425_INT_STAMP	14	/* Timestamp Timer */
    205      1.5  ichiro #define	IXP425_INT_UART1	13	/* Console UART */
    206      1.1  ichiro #define	IXP425_INT_USB		12	/* USB */
    207      1.1  ichiro #define	IXP425_INT_TMR1		11	/* General-Purpose Timer1 */
    208      1.1  ichiro #define	IXP425_INT_PCIDMA2	10	/* PCI DMA Channel 2 */
    209      1.1  ichiro #define	IXP425_INT_PCIDMA1	 9	/* PCI DMA Channel 1 */
    210      1.1  ichiro #define	IXP425_INT_PCIINT	 8	/* PCI Interrupt */
    211      1.1  ichiro #define	IXP425_INT_GPIO_1	 7	/* GPIO 1 */
    212      1.1  ichiro #define	IXP425_INT_GPIO_0	 6	/* GPIO 0 */
    213      1.1  ichiro #define	IXP425_INT_TMR0		 5	/* General-Purpose Timer0 */
    214      1.1  ichiro #define	IXP425_INT_QUE33_64	 4	/* Queue Manager 33-64 */
    215      1.1  ichiro #define	IXP425_INT_QUE1_32	 3	/* Queue Manager  1-32 */
    216      1.1  ichiro #define	IXP425_INT_NPE_B	 2	/* Ethernet NPE B */
    217      1.1  ichiro #define	IXP425_INT_NPE_A	 1	/* Ethernet NPE A */
    218      1.1  ichiro #define	IXP425_INT_HSS		 0	/* WAN/HSS NPE */
    219      1.1  ichiro 
    220      1.1  ichiro /*
    221      1.1  ichiro  * software interrupt
    222      1.1  ichiro  */
    223      1.1  ichiro #define	IXP425_INT_bit31	31
    224      1.1  ichiro #define	IXP425_INT_bit30	30
    225  1.7.2.1   skrll #define	IXP425_INT_bit14	14
    226  1.7.2.1   skrll #define	IXP425_INT_bit11	11
    227      1.1  ichiro 
    228      1.1  ichiro #define	IXP425_INT_HWMASK	(0xffffffff & \
    229      1.1  ichiro 					~((1 << IXP425_INT_bit31) | \
    230      1.1  ichiro 					  (1 << IXP425_INT_bit30) | \
    231  1.7.2.1   skrll 					  (1 << IXP425_INT_bit14) | \
    232  1.7.2.1   skrll 					  (1 << IXP425_INT_bit11)))
    233  1.7.2.1   skrll #define	IXP425_INT_GPIOMASK	(0x3ff800c0u)
    234  1.7.2.1   skrll 
    235  1.7.2.1   skrll /*
    236  1.7.2.1   skrll  * GPIO
    237  1.7.2.1   skrll  */
    238  1.7.2.1   skrll #define	IXP425_GPIO_HWBASE	IXP425_IO_HWBASE + IXP425_GPIO_OFFSET
    239  1.7.2.1   skrll #define IXP425_GPIO_VBASE	IXP425_IO_VBASE  + IXP425_GPIO_OFFSET
    240  1.7.2.1   skrll 					/* 0xf0004000 */
    241  1.7.2.1   skrll #define IXP425_GPIO_SIZE	0x00000020UL
    242  1.7.2.1   skrll 
    243  1.7.2.1   skrll #define	IXP425_GPIO_GPOUTR	0x00
    244  1.7.2.1   skrll #define	IXP425_GPIO_GPOER	0x04
    245  1.7.2.1   skrll #define	IXP425_GPIO_GPINR	0x08
    246  1.7.2.1   skrll #define	IXP425_GPIO_GPISR	0x0c
    247  1.7.2.1   skrll #define	IXP425_GPIO_GPIT1R	0x10
    248  1.7.2.1   skrll #define	IXP425_GPIO_GPIT2R	0x14
    249  1.7.2.1   skrll #define	IXP425_GPIO_GPCLKR	0x18
    250  1.7.2.1   skrll # define GPCLKR_MUX14	(1U << 8)
    251  1.7.2.1   skrll # define GPCLKR_CLK0TC_SHIFT	4
    252  1.7.2.1   skrll # define GPCLKR_CLK0DC_SHIFT	0
    253  1.7.2.1   skrll 
    254  1.7.2.1   skrll /* GPIO Output */
    255  1.7.2.1   skrll #define	GPOUT_ON		0x1
    256  1.7.2.1   skrll #define	GPOUT_OFF		0x0
    257  1.7.2.1   skrll 
    258  1.7.2.1   skrll /* GPIO direction */
    259  1.7.2.1   skrll #define	GPOER_INPUT		0x1
    260  1.7.2.1   skrll #define	GPOER_OUTPUT		0x0
    261  1.7.2.1   skrll 
    262  1.7.2.1   skrll /* GPIO Type bits */
    263  1.7.2.1   skrll #define	GPIO_TYPE_ACT_HIGH	0x0
    264  1.7.2.1   skrll #define	GPIO_TYPE_ACT_LOW	0x1
    265  1.7.2.1   skrll #define	GPIO_TYPE_EDG_RISING	0x2
    266  1.7.2.1   skrll #define	GPIO_TYPE_EDG_FALLING	0x3
    267  1.7.2.1   skrll #define	GPIO_TYPE_TRANSITIONAL	0x4
    268  1.7.2.1   skrll #define	GPIO_TYPE_MASK		0x7
    269  1.7.2.1   skrll #define	GPIO_TYPE(b,v)		((v) << (((b) & 0x7) * 3))
    270  1.7.2.1   skrll #define	GPIO_TYPE_REG(b)	(((b)&8)?IXP425_GPIO_GPIT2R:IXP425_GPIO_GPIT1R)
    271      1.1  ichiro 
    272      1.1  ichiro /*
    273      1.1  ichiro  * Expansion Bus
    274      1.1  ichiro  */
    275      1.1  ichiro #define	IXP425_EXP_HWBASE	0xc4000000UL
    276      1.1  ichiro #define	IXP425_EXP_VBASE	(IXP425_IO_VBASE + IXP425_IO_SIZE)
    277      1.4  ichiro 						/* 0xf0010000 */
    278      1.4  ichiro #define	IXP425_EXP_SIZE		IXP425_REG_SIZE	/* 0x1000 */
    279      1.1  ichiro 
    280      1.1  ichiro /* offset */
    281      1.1  ichiro #define	EXP_TIMING_CS0_OFFSET		0x0000
    282      1.1  ichiro #define	EXP_TIMING_CS1_OFFSET		0x0004
    283      1.1  ichiro #define	EXP_TIMING_CS2_OFFSET		0x0008
    284      1.1  ichiro #define	EXP_TIMING_CS3_OFFSET		0x000c
    285      1.1  ichiro #define	EXP_TIMING_CS4_OFFSET		0x0010
    286      1.1  ichiro #define	EXP_TIMING_CS5_OFFSET		0x0014
    287      1.1  ichiro #define	EXP_TIMING_CS6_OFFSET		0x0018
    288      1.1  ichiro #define	EXP_TIMING_CS7_OFFSET		0x001c
    289  1.7.2.1   skrll #define EXP_CNFG0_OFFSET		0x0020
    290  1.7.2.1   skrll #define EXP_CNFG1_OFFSET		0x0024
    291      1.1  ichiro 
    292      1.1  ichiro #define IXP425_EXP_RECOVERY_SHIFT	16
    293      1.1  ichiro #define IXP425_EXP_HOLD_SHIFT		20
    294      1.1  ichiro #define IXP425_EXP_STROBE_SHIFT		22
    295      1.1  ichiro #define IXP425_EXP_SETUP_SHIFT		26
    296      1.1  ichiro #define IXP425_EXP_ADDR_SHIFT		28
    297      1.1  ichiro #define IXP425_EXP_CS_EN		(1U << 31)
    298      1.1  ichiro 
    299      1.1  ichiro #define IXP425_EXP_RECOVERY_T(x)	(((x) & 15) << IXP425_EXP_RECOVERY_SHIFT)
    300      1.1  ichiro #define IXP425_EXP_HOLD_T(x)		(((x) & 3)  << IXP425_EXP_HOLD_SHIFT)
    301      1.1  ichiro #define IXP425_EXP_STROBE_T(x)		(((x) & 15) << IXP425_EXP_STROBE_SHIFT)
    302      1.1  ichiro #define IXP425_EXP_SETUP_T(x)		(((x) & 3)  << IXP425_EXP_SETUP_SHIFT)
    303      1.3  ichiro #define IXP425_EXP_ADDR_T(x)		(((x) & 3)  << IXP425_EXP_ADDR_SHIFT)
    304      1.1  ichiro 
    305      1.1  ichiro // EXP_CSn bits
    306      1.1  ichiro #define EXP_BYTE_EN                (1 << 0)
    307      1.1  ichiro #define EXP_WR_EN                  (1 << 1)
    308      1.1  ichiro #define EXP_SPLT_EN                (1 << 3)
    309      1.1  ichiro #define EXP_MUX_EN                 (1 << 4)
    310      1.1  ichiro #define EXP_HRDY_POL               (1 << 5)
    311      1.1  ichiro #define EXP_BYTE_RD16              (1 << 6)
    312      1.1  ichiro #define EXP_SZ_512                 (0 << 10)
    313      1.1  ichiro #define EXP_SZ_1K                  (1 << 10)
    314      1.1  ichiro #define EXP_SZ_2K                  (2 << 10)
    315      1.1  ichiro #define EXP_SZ_4K                  (3 << 10)
    316      1.1  ichiro #define EXP_SZ_8K                  (4 << 10)
    317      1.1  ichiro #define EXP_SZ_16K                 (5 << 10)
    318      1.1  ichiro #define EXP_SZ_32K                 (6 << 10)
    319      1.1  ichiro #define EXP_SZ_64K                 (7 << 10)
    320      1.1  ichiro #define EXP_SZ_128K                (8 << 10)
    321      1.1  ichiro #define EXP_SZ_256K                (9 << 10)
    322      1.1  ichiro #define EXP_SZ_512K                (10 << 10)
    323      1.1  ichiro #define EXP_SZ_1M                  (11 << 10)
    324      1.1  ichiro #define EXP_SZ_2M                  (12 << 10)
    325      1.1  ichiro #define EXP_SZ_4M                  (13 << 10)
    326      1.1  ichiro #define EXP_SZ_8M                  (14 << 10)
    327      1.1  ichiro #define EXP_SZ_16M                 (15 << 10)
    328      1.1  ichiro #define EXP_CYC_INTEL              (0 << 14)
    329      1.1  ichiro #define EXP_CYC_MOTO               (1 << 14)
    330      1.1  ichiro #define EXP_CYC_HPI                (2 << 14)
    331      1.1  ichiro 
    332      1.1  ichiro // EXP_CNFG0 bits
    333      1.1  ichiro #define EXP_CNFG0_8BIT             (1 << 0)
    334      1.1  ichiro #define EXP_CNFG0_PCI_HOST         (1 << 1)
    335      1.1  ichiro #define EXP_CNFG0_PCI_ARB          (1 << 2)
    336      1.1  ichiro #define EXP_CNFG0_PCI_66MHZ        (1 << 4)
    337      1.1  ichiro #define EXP_CNFG0_MEM_MAP          (1 << 31)
    338      1.1  ichiro 
    339      1.1  ichiro // EXP_CNFG1 bits
    340      1.1  ichiro #define EXP_CNFG1_SW_INT0          (1 << 0)
    341      1.1  ichiro #define EXP_CNFG1_SW_INT1          (1 << 1)
    342      1.1  ichiro 
    343      1.1  ichiro /*
    344      1.1  ichiro  * PCI
    345      1.1  ichiro  */
    346      1.1  ichiro #define IXP425_PCI_HWBASE	0xc0000000
    347      1.1  ichiro #define IXP425_PCI_VBASE	(IXP425_EXP_VBASE + IXP425_EXP_SIZE)
    348      1.4  ichiro 							/* 0xf0011000 */
    349      1.1  ichiro #define	IXP425_PCI_SIZE		IXP425_REG_SIZE		/* 0x1000 */
    350      1.4  ichiro 
    351      1.4  ichiro /*
    352      1.4  ichiro  * Mapping registers of IXP425 PCI Configuration
    353      1.4  ichiro  */
    354      1.4  ichiro /* PCI_ID_REG			0x00 */
    355      1.4  ichiro /* PCI_COMMAND_STATUS_REG	0x04 */
    356      1.4  ichiro /* PCI_CLASS_REG		0x08 */
    357      1.4  ichiro /* PCI_BHLC_REG			0x0c */
    358      1.4  ichiro #define	PCI_MAPREG_BAR0		0x10	/* Base Address 0 */
    359      1.4  ichiro #define	PCI_MAPREG_BAR1		0x14	/* Base Address 1 */
    360      1.4  ichiro #define	PCI_MAPREG_BAR2		0x18	/* Base Address 2 */
    361      1.4  ichiro #define	PCI_MAPREG_BAR3		0x1c	/* Base Address 3 */
    362      1.4  ichiro #define	PCI_MAPREG_BAR4		0x20	/* Base Address 4 */
    363      1.4  ichiro #define	PCI_MAPREG_BAR5		0x24	/* Base Address 5 */
    364      1.4  ichiro /* PCI_SUBSYS_ID_REG		0x2c */
    365      1.4  ichiro /* PCI_INTERRUPT_REG		0x3c */
    366      1.4  ichiro #define	PCI_RTOTTO		0x40
    367      1.4  ichiro 
    368  1.7.2.1   skrll /* PCI Controller CSR Base Address */
    369  1.7.2.1   skrll #define	IXP425_PCI_CSR_BASE	IXP425_PCI_VBASE
    370  1.7.2.1   skrll 
    371  1.7.2.1   skrll /* PCI Memory Space */
    372  1.7.2.1   skrll #define	IXP425_PCI_MEM_HWBASE	0x48000000UL
    373  1.7.2.1   skrll #define	IXP425_PCI_MEM_VBASE	0xf8000000UL
    374  1.7.2.1   skrll #define	IXP425_PCI_MEM_SIZE	0x04000000UL	/* 64MB */
    375  1.7.2.1   skrll 
    376  1.7.2.1   skrll /* PCI I/O Space */
    377  1.7.2.1   skrll #define	IXP425_PCI_IO_HWBASE	0x00000000UL
    378  1.7.2.1   skrll #define	IXP425_PCI_IO_SIZE	0x00100000UL    /* 1Mbyte */
    379  1.7.2.1   skrll 
    380      1.4  ichiro /* PCI Controller Configuration Offset */
    381      1.4  ichiro #define	PCI_NP_AD		0x00
    382      1.4  ichiro #define	PCI_NP_CBE		0x04
    383  1.7.2.1   skrll # define NP_CBE_SHIFT		4
    384      1.4  ichiro #define	PCI_NP_WDATA		0x08
    385      1.4  ichiro #define	PCI_NP_RDATA		0x0c
    386      1.4  ichiro #define	PCI_CRP_AD_CBE		0x10
    387      1.4  ichiro #define	PCI_CRP_AD_WDATA	0x14
    388      1.4  ichiro #define	PCI_CRP_AD_RDATA	0x18
    389      1.4  ichiro #define	PCI_CSR			0x1c
    390  1.7.2.1   skrll # define CSR_PRST		(1U << 16)
    391  1.7.2.1   skrll # define CSR_IC			(1U << 15)
    392  1.7.2.1   skrll # define CSR_ABE		(1U << 4)
    393  1.7.2.1   skrll # define CSR_PDS		(1U << 3)
    394  1.7.2.1   skrll # define CSR_ADS		(1U << 2)
    395  1.7.2.1   skrll # define CSR_HOST		(1U << 0)
    396      1.4  ichiro #define	PCI_ISR			0x20
    397  1.7.2.1   skrll # define ISR_AHBE		(1U << 3)
    398  1.7.2.1   skrll # define ISR_PPE		(1U << 2)
    399  1.7.2.1   skrll # define ISR_PFE		(1U << 1)
    400  1.7.2.1   skrll # define ISR_PSE		(1U << 0)
    401      1.4  ichiro #define	PCI_INTEN		0x24
    402      1.4  ichiro #define	PCI_DMACTRL		0x28
    403      1.4  ichiro #define	PCI_AHBMEMBASE		0x2c
    404      1.4  ichiro #define	PCI_AHBIOBASE		0x30
    405      1.4  ichiro #define	PCI_PCIMEMBASE		0x34
    406      1.4  ichiro #define	PCI_AHBDOORBELL		0x38
    407      1.4  ichiro #define	PCI_PCIDOORBELL		0x3c
    408      1.4  ichiro #define	PCI_ATPDMA0_AHBADDR	0x40
    409      1.4  ichiro #define	PCI_ATPDMA0_PCIADDR	0x44
    410      1.4  ichiro #define	PCI_ATPDMA0_LENGTH	0x48
    411      1.4  ichiro #define	PCI_ATPDMA1_AHBADDR	0x4c
    412      1.4  ichiro #define	PCI_ATPDMA1_PCIADDR	0x50
    413      1.4  ichiro #define	PCI_ATPDMA1_LENGTH	0x54
    414      1.4  ichiro #define	PCI_PTADMA0_AHBADDR	0x58
    415      1.4  ichiro #define	PCI_PTADMA0_PCIADDR	0x5c
    416      1.4  ichiro #define	PCI_PTADMA0_LENGTH	0x60
    417      1.4  ichiro #define	PCI_PTADMA1_AHBADDR	0x64
    418      1.4  ichiro #define	PCI_PTADMA1_PCIADDR	0x68
    419      1.4  ichiro #define	PCI_PTADMA1_LENGTH	0x6c
    420      1.4  ichiro 
    421  1.7.2.1   skrll /* PCI target(T)/initiator(I) Interface Commands for PCI_NP_CBE register */
    422  1.7.2.1   skrll #define	COMMAND_NP_IA		0x0	/* Interrupt Acknowledge   (I)*/
    423  1.7.2.1   skrll #define	COMMAND_NP_SC		0x1	/* Special Cycle	   (I)*/
    424  1.7.2.1   skrll #define	COMMAND_NP_IO_READ	0x2	/* I/O Read		(T)(I) */
    425  1.7.2.1   skrll #define	COMMAND_NP_IO_WRITE	0x3	/* I/O Write		(T)(I) */
    426  1.7.2.1   skrll #define	COMMAND_NP_MEM_READ	0x6	/* Memory Read		(T)(I) */
    427  1.7.2.1   skrll #define	COMMAND_NP_MEM_WRITE	0x7	/* Memory Write		(T)(I) */
    428  1.7.2.1   skrll #define	COMMAND_NP_CONF_READ	0xa	/* Configuration Read	(T)(I) */
    429  1.7.2.1   skrll #define	COMMAND_NP_CONF_WRITE	0xb	/* Configuration Write	(T)(I) */
    430  1.7.2.1   skrll 
    431  1.7.2.1   skrll /* PCI byte enables */
    432  1.7.2.1   skrll #define	BE_8BIT(a)		((0x10u << ((a) & 0x03)) ^ 0xf0)
    433  1.7.2.1   skrll #define	BE_16BIT(a)		((0x30u << ((a) & 0x02)) ^ 0xf0)
    434  1.7.2.1   skrll #define	BE_32BIT(a)		0x00
    435  1.7.2.1   skrll 
    436  1.7.2.1   skrll /* PCI byte selects */
    437  1.7.2.1   skrll #define	READ_8BIT(v,a)		((u_int8_t)((v) >> (((a) & 3) * 8)))
    438  1.7.2.1   skrll #define	READ_16BIT(v,a)		((u_int16_t)((v) >> (((a) & 2) * 8)))
    439  1.7.2.1   skrll #define	WRITE_8BIT(v,a)		(((u_int32_t)(v)) << (((a) & 3) * 8))
    440  1.7.2.1   skrll #define	WRITE_16BIT(v,a)	(((u_int32_t)(v)) << (((a) & 2) * 8))
    441  1.7.2.1   skrll 
    442  1.7.2.1   skrll /* PCI Controller Configuration Commands for PCI_CRP_AD_CBE */
    443  1.7.2.1   skrll #define COMMAND_CRP_READ	0x00
    444  1.7.2.1   skrll #define COMMAND_CRP_WRITE	(1U << 16)
    445  1.7.2.1   skrll 
    446  1.7.2.1   skrll /*
    447  1.7.2.1   skrll  * SDRAM Configuration Register
    448  1.7.2.1   skrll  */
    449  1.7.2.1   skrll #define	IXP425_MCU_HWBASE	0xcc000000UL
    450  1.7.2.1   skrll #define IXP425_MCU_VBASE	0xf0200000UL
    451  1.7.2.1   skrll #define	IXP425_MCU_SIZE		0x1000		/* Actually only 256 bytes */
    452  1.7.2.1   skrll #define	MCU_SDR_CONFIG		0x00
    453  1.7.2.1   skrll #define  MCU_SDR_CONFIG_MCONF(x) ((x) & 0x7)
    454  1.7.2.1   skrll #define  MCU_SDR_CONFIG_64MBIT	(1u << 5)
    455  1.7.2.1   skrll #define	MCU_SDR_REFRESH		0x04
    456  1.7.2.1   skrll #define	MCU_SDR_IR		0x08
    457      1.2  ichiro 
    458      1.2  ichiro /*
    459      1.2  ichiro  * Performance Monitoring Unit          (CP14)
    460      1.2  ichiro  *
    461      1.2  ichiro  *      CP14.0.1	Performance Monitor Control Register(PMNC)
    462      1.2  ichiro  *      CP14.1.1	Clock Counter(CCNT)
    463      1.2  ichiro  *      CP14.4.1	Interrupt Enable Register(INTEN)
    464      1.2  ichiro  *      CP14.5.1	Overflow Flag Register(FLAG)
    465      1.2  ichiro  *      CP14.8.1	Event Selection Register(EVTSEL)
    466      1.2  ichiro  *      CP14.0.2	Performance Counter Register 0(PMN0)
    467      1.2  ichiro  *      CP14.1.2	Performance Counter Register 0(PMN1)
    468      1.2  ichiro  *      CP14.2.2	Performance Counter Register 0(PMN2)
    469      1.2  ichiro  *      CP14.3.2	Performance Counter Register 0(PMN3)
    470      1.2  ichiro  */
    471      1.2  ichiro 
    472      1.2  ichiro #define	PMNC_E		0x00000001	/* enable all counters */
    473      1.2  ichiro #define	PMNC_P		0x00000002	/* reset all PMNs to 0 */
    474      1.2  ichiro #define	PMNC_C		0x00000004	/* clock counter reset */
    475      1.2  ichiro #define	PMNC_D		0x00000008	/* clock counter / 64 */
    476      1.2  ichiro 
    477      1.2  ichiro #define INTEN_CC_IE	0x00000001	/* enable clock counter interrupt */
    478      1.2  ichiro #define	INTEN_PMN0_IE	0x00000002	/* enable PMN0 interrupt */
    479      1.2  ichiro #define	INTEN_PMN1_IE	0x00000004	/* enable PMN1 interrupt */
    480      1.2  ichiro #define	INTEN_PMN2_IE	0x00000008	/* enable PMN2 interrupt */
    481      1.2  ichiro #define	INTEN_PMN3_IE	0x00000010	/* enable PMN3 interrupt */
    482      1.2  ichiro 
    483      1.2  ichiro #define	FLAG_CC_IF	0x00000001	/* clock counter overflow */
    484      1.2  ichiro #define	FLAG_PMN0_IF	0x00000002	/* PMN0 overflow */
    485      1.2  ichiro #define	FLAG_PMN1_IF	0x00000004	/* PMN1 overflow */
    486      1.2  ichiro #define	FLAG_PMN2_IF	0x00000008	/* PMN2 overflow */
    487      1.2  ichiro #define	FLAG_PMN3_IF	0x00000010	/* PMN3 overflow */
    488      1.2  ichiro 
    489      1.2  ichiro #define EVTSEL_EVCNT_MASK 0x0000000ff	/* event to count for PMNs */
    490      1.2  ichiro #define PMNC_EVCNT0_SHIFT 0
    491      1.2  ichiro #define PMNC_EVCNT1_SHIFT 8
    492      1.2  ichiro #define PMNC_EVCNT2_SHIFT 16
    493      1.2  ichiro #define PMNC_EVCNT3_SHIFT 24
    494      1.1  ichiro 
    495      1.1  ichiro #endif /* _IXP425REG_H_ */
    496