Home | History | Annotate | Line # | Download | only in gemini
gemini_reg.h revision 1.7
      1  1.7   matt /*	$NetBSD: gemini_reg.h,v 1.7 2008/12/14 01:57:02 matt Exp $	*/
      2  1.1   matt 
      3  1.1   matt #ifndef _ARM_GEMINI_REG_H_
      4  1.1   matt #define _ARM_GEMINI_REG_H_
      5  1.1   matt 
      6  1.1   matt /*
      7  1.1   matt  * Register definitions for Gemini SOC
      8  1.1   matt  */
      9  1.1   matt 
     10  1.1   matt #include "opt_gemini.h"
     11  1.1   matt #include <machine/endian.h>
     12  1.1   matt #include <sys/cdefs.h>
     13  1.1   matt 
     14  1.1   matt #if defined(SL3516)
     15  1.1   matt /*
     16  1.1   matt  * Gemini SL3516 memory map
     17  1.1   matt  */
     18  1.1   matt #define GEMINI_SRAM_BASE	0x00000000	/* Internal SRAM  */
     19  1.2  cliff 						/* NOTE: use the SHADOW to avoid conflict w/ DRAM */
     20  1.1   matt #define GEMINI_SRAM_SIZE	0x10000000 	/* 128 MB */
     21  1.2  cliff #define GEMINI_DRAM_BASE	0x00000000 	/* DRAM (via DDR Control Module) */
     22  1.2  cliff 						/* NOTE: this is a shadow of 0x10000000 */
     23  1.1   matt #define GEMINI_DRAM_SIZE	0x20000000	/* 512 MB */
     24  1.2  cliff 						/* NOTE: size of addr space, not necessarily populated */
     25  1.1   matt #define GEMINI_FLASH_BASE	0x30000000 	/* DRAM (via DDR Control Module) */
     26  1.1   matt #define GEMINI_FLASH_SIZE	0x10000000	/* 128 MB */
     27  1.1   matt 
     28  1.1   matt /*
     29  1.1   matt  * Gemini SL3516 device map
     30  1.1   matt  */
     31  1.1   matt #define GEMINI_GLOBAL_BASE	0x40000000 	/* Global registers */
     32  1.1   matt #define GEMINI_WATCHDOG_BASE	0x41000000 	/* Watch dog timer module */
     33  1.1   matt #define GEMINI_UART_BASE	0x42000000 	/* UART control module */
     34  1.1   matt #define GEMINI_UART_SIZE	0x20
     35  1.1   matt #define GEMINI_TIMER_BASE	0x43000000 	/* Timer module */
     36  1.1   matt #define GEMINI_LCD_BASE		0x44000000 	/* LCD Interface module */
     37  1.1   matt #define GEMINI_RTC_BASE		0x45000000 	/* Real Time Clock module */
     38  1.1   matt #define GEMINI_SATA_BASE	0x46000000 	/* Serial ATA module */
     39  1.1   matt #define GEMINI_LPCHC_BASE	0x47000000 	/* LPC Hosr Controller module */
     40  1.4  cliff #define GEMINI_LPCIO_BASE	0x47800000 	/* LPC Peripherals IO space */
     41  1.1   matt #define GEMINI_IC0_BASE		0x48000000 	/* Interrupt Control module #0 */
     42  1.1   matt #define GEMINI_IC1_BASE		0x49000000 	/* Interrupt Control module #1 */
     43  1.1   matt #define GEMINI_SSPC_BASE	0x4a000000 	/* Synchronous Serial Port Control module */
     44  1.1   matt #define GEMINI_PWRC_BASE	0x4b000000 	/* Power Control module */
     45  1.1   matt #define GEMINI_CIR_BASE		0x4c000000 	/* CIR Control module */
     46  1.1   matt #define GEMINI_GPIO0_BASE	0x4d000000 	/* GPIO module #0 */
     47  1.1   matt #define GEMINI_GPIO1_BASE	0x4e000000 	/* GPIO module #1 */
     48  1.1   matt #define GEMINI_GPIO2_BASE	0x4f000000 	/* GPIO module #2 */
     49  1.1   matt #define GEMINI_PCICFG_BASE	0x50000000 	/* PCI IO, configuration and control space */
     50  1.1   matt #define GEMINI_PCIIO_BASE	0x50001000 	/* PCI IO     space      */
     51  1.1   matt #define GEMINI_PCIIO_SIZE	0x0007f000 	/* PCI IO     space size */
     52  1.1   matt #define GEMINI_PCIMEM_BASE	0x58000000 	/* PCI Memory space      */
     53  1.1   matt #define GEMINI_PCIMEM_SIZE	0x08000000 	/* PCI Memory space size */
     54  1.7   matt #define GEMINI_GMAC_BASE	0x60000000 	/* NetEngine & GMAC Configuration registers */
     55  1.7   matt #define GEMINI_GMAC_SIZE	0x00010000 	/* NetEngine & GMAC Configuration size */
     56  1.1   matt #define GEMINI_SDC_BASE		0x62000000 	/* Security DMA and Configure registers */
     57  1.1   matt #define GEMINI_MIDE_BASE	0x63000000 	/* Multi IDE registers */
     58  1.1   matt #define GEMINI_RXDC_BASE	0x64000000 	/* RAID XOR DMA Configuration registers */
     59  1.1   matt #define GEMINI_FLASHC_BASE	0x65000000 	/* Flash Controller registers */
     60  1.1   matt #define GEMINI_DRAMC_BASE	0x66000000 	/* DRAM (DDR/SDR) Controller registers */
     61  1.1   matt #define GEMINI_GDMA_BASE	0x67000000 	/* General DMA registers */
     62  1.1   matt #define GEMINI_USB0_BASE	0x68000000 	/* USB #0 registers */
     63  1.1   matt #define GEMINI_USB1_BASE	0x69000000 	/* USB #1 registers */
     64  1.1   matt #define GEMINI_TVE_BASE		0x6a000000 	/* TVE registers */
     65  1.1   matt #define GEMINI_SRAM_SHADOW_BASE	0x70000000 	/* Shadow of internal SRAM */
     66  1.1   matt 
     67  1.1   matt /*
     68  1.3  cliff  * Gemini SL3516 Global register offsets and bits
     69  1.3  cliff  */
     70  1.3  cliff #define GEMINI_GLOBAL_WORD_ID	0x0		/* Global Word ID */			/* ro */
     71  1.3  cliff #define  GLOBAL_ID_CHIP_ID	__BITS(31,8)
     72  1.3  cliff #define  GLOBAL_ID_CHIP_REV	__BITS(7,0)
     73  1.3  cliff #define GEMINI_GLOBAL_RESET_CTL	0xc		/* Global Soft Reset Control */		/* rw */
     74  1.4  cliff #define GLOBAL_RESET_GLOBAL	__BIT(31)	/* Global Soft Reset */
     75  1.4  cliff #define GLOBAL_RESET_CPU1	__BIT(30)	/* CPU#1 reset hold */
     76  1.4  cliff #define GEMINI_GLOBAL_MISC_CTL	0x30		/* Miscellaneous Control */		/* rw */
     77  1.5  cliff #define GEMINI_GLOBAL_CPU0	0x38		/* CPU #0 Status and Control */		/* rw */
     78  1.5  cliff #define  GLOBAL_CPU0_IPICPU1	__BIT(31)	/* IPI to CPU#1 */
     79  1.5  cliff #define GEMINI_GLOBAL_CPU1	0x3c		/* CPU #1 Status and Control */		/* rw */
     80  1.5  cliff #define  GLOBAL_CPU1_IPICPU0	__BIT(31)	/* IPI to CPU#0 */
     81  1.3  cliff 
     82  1.3  cliff /*
     83  1.1   matt  * Gemini SL3516 Watchdog device register offsets and bits
     84  1.1   matt  */
     85  1.1   matt #define GEMINI_WDT_WDCOUNTER	0x0		/* Watchdog Timer Counter */		/* ro */
     86  1.1   matt #define GEMINI_WDT_WDLOAD	0x4		/* Watchdog Timer Load */		/* rw */
     87  1.1   matt #define  WDT_WDLOAD_DFLT	0x3EF1480	/* default Load reg val */
     88  1.1   matt #define GEMINI_WDT_WDRESTART	0x8		/* Watchdog Timer Restart */		/* wo */
     89  1.1   matt #define  WDT_WDRESTART_Resv	__BITS(31,16)
     90  1.1   matt #define  WDT_WDRESTART_RST	__BITS(15,0)
     91  1.1   matt #define   WDT_WDRESTART_MAGIC	0x5ab9
     92  1.1   matt #define GEMINI_WDT_WDCR		0xc		/* Watchdog Timer Control */		/* rw */
     93  1.1   matt #define  WDT_WDCR_Resv		__BITS(31,5)
     94  1.1   matt #define  WDT_WDCR_CLKSRC	__BIT(4)	/* Timer Clock Source: 5 MHz clock */
     95  1.1   matt #define   WDCR_CLKSRC_PCLK	(0 << 4)	/* Timer Clock Source: PCLK (APB CLK) */
     96  1.1   matt #define   WDCR_CLKSRC_5MHZ	(1 << 4)	/* Timer Clock Source: 5 MHz clock */
     97  1.1   matt #define  WDT_WDCR_EXTSIG_ENB	__BIT(3)	/* Timer External Signal Enable */
     98  1.1   matt #define  WDT_WDCR_INTR_ENB	__BIT(2)	/* Timer System Interrupt Enable */
     99  1.1   matt #define  WDT_WDCR_RESET_ENB	__BIT(1)	/* Timer System Reset Enable */
    100  1.1   matt #define  WDT_WDCR_ENB		__BIT(0)	/* Timer Enable */
    101  1.1   matt #define GEMINI_WDT_WDSTATUS	0x10		/* Watchdog Timer Status */		/* ro */
    102  1.1   matt #define  WDT_WDSTATUS_Resv	__BITS(31,1)
    103  1.1   matt #define  WDT_WDSTATUS_ZERO	__BIT(0)	/* non-zero if timer counted down to zero! */
    104  1.1   matt #define GEMINI_WDT_WDCLEAR	0x14		/* Watchdog Timer Clear */		/* wo */
    105  1.1   matt #define  WDT_WDCLEAR_Resv	__BITS(31,1)
    106  1.1   matt #define  WDT_WDCLEAR_CLEAR	__BIT(0)	/* write this bit to clear Status */
    107  1.1   matt #define GEMINI_WDT_WDINTERLEN	0x18		/* Watchdog Timer Interrupt Length */	/* rw */
    108  1.1   matt 						/*  duration of signal assertion,  */
    109  1.1   matt 						/*  in units of clock cycles       */
    110  1.1   matt #define  WDT_WDINTERLEN_DFLT	0xff		/*  default is 256 cycles          */
    111  1.1   matt 
    112  1.1   matt 
    113  1.1   matt /*
    114  1.1   matt  * Gemini SL3516 Timer device register offsets and bits
    115  1.1   matt  *
    116  1.1   matt  * have 3 timers, here indexed 1<=(n)<=3 as in the doc
    117  1.1   matt  * each has 4 sequential 32bit rw regs
    118  1.1   matt  */
    119  1.1   matt #define GEMINI_NTIMERS			3
    120  1.1   matt #define GEMINI_TIMERn_REG(n, o)		((((n) - 1) * 0x10) + (o))
    121  1.1   matt #define GEMINI_TIMERn_COUNTER(n)	GEMINI_TIMERn_REG((n), 0x0)			/* rw */
    122  1.1   matt #define GEMINI_TIMERn_LOAD(n)		GEMINI_TIMERn_REG((n), 0x4)			/* rw */
    123  1.1   matt #define GEMINI_TIMERn_MATCH1(n)		GEMINI_TIMERn_REG((n), 0x08)			/* rw */
    124  1.1   matt #define GEMINI_TIMERn_MATCH2(n) 	GEMINI_TIMERn_REG((n), 0x0C)			/* rw */
    125  1.1   matt #define GEMINI_TIMER_TMCR		0x30						/* rw */
    126  1.1   matt #define  TIMER_TMCR_Resv		__BITS(31,12)
    127  1.1   matt #define  TIMER_TMCR_TMnUPDOWN(n)	__BIT(9 + (n) - 1)
    128  1.1   matt #define  TIMER_TMCR_TMnOFENABLE(n)	__BIT((((n) - 1) * 3) + 2)
    129  1.1   matt #define  TIMER_TMCR_TMnCLOCK(n)		__BIT((((n) - 1) * 3) + 1)
    130  1.1   matt #define  TIMER_TMCR_TMnENABLE(n)	__BIT((((n) - 1) * 3) + 0)
    131  1.1   matt #define  GEMINI_TIMER_TMnCR_MASK(n) 		\
    132  1.1   matt 		( TIMER_TMCR_TMnUPDOWN(n)	\
    133  1.1   matt 		| TIMER_TMCR_TMnOFENABLE(n)	\
    134  1.1   matt 		| TIMER_TMCR_TMnCLOCK(n)	\
    135  1.1   matt 		| TIMER_TMCR_TMnENABLE(n) )
    136  1.1   matt #define GEMINI_TIMER_INTRSTATE		0x34						/* rw */
    137  1.1   matt #define  TIMER_INTRSTATE_Resv		__BITS(31,9)
    138  1.1   matt #define  TIMER_INTRSTATE_TMnOVFLOW(n)	__BIT((((n) -1) * 3) + 2)
    139  1.1   matt #define  TIMER_INTRSTATE_TMnMATCH2(n)	__BIT((((n) -1) * 3) + 1)
    140  1.1   matt #define  TIMER_INTRSTATE_TMnMATCH1(n)	__BIT((((n) -1) * 3) + 0)
    141  1.1   matt #define GEMINI_TIMER_INTRMASK		0x38						/* rw */
    142  1.1   matt #define  TIMER_INTRMASK_Resv		__BITS(31,9)
    143  1.1   matt #define  TIMER_INTRMASK_TMnOVFLOW(n)	__BIT((((n) -1) * 3) + 2)
    144  1.1   matt #define  TIMER_INTRMASK_TMnMATCH2(n)	__BIT((((n) -1) * 3) + 1)
    145  1.1   matt #define  TIMER_INTRMASK_TMnMATCH1(n)	__BIT((((n) -1) * 3) + 0)
    146  1.1   matt #define GEMINI_TIMERn_INTRMASK(n) \
    147  1.1   matt 		( TIMER_INTRMASK_TMnOVFLOW(n)	\
    148  1.1   matt 		| TIMER_INTRMASK_TMnMATCH2(n)	\
    149  1.1   matt 		| TIMER_INTRMASK_TMnMATCH1(n) )
    150  1.1   matt 
    151  1.1   matt /*
    152  1.1   matt  * Gemini SL3516 Interrupt Controller device register offsets and bits
    153  1.1   matt  */
    154  1.1   matt #define GEMINI_ICU_IRQ_SOURCE		0x0						/* ro */
    155  1.1   matt #define GEMINI_ICU_IRQ_ENABLE		0x4						/* rw */
    156  1.1   matt #define GEMINI_ICU_IRQ_CLEAR		0x8						/* wo */
    157  1.1   matt #define GEMINI_ICU_IRQ_TRIGMODE		0xc						/* rw */
    158  1.1   matt #define  ICU_IRQ_TRIGMODE_EDGE		1		/* edge triggered */
    159  1.1   matt #define  ICU_IRQ_TRIGMODE_LEVEL		0		/* level triggered */
    160  1.1   matt #define GEMINI_ICU_IRQ_TRIGLEVEL	0x10						/* rw */
    161  1.1   matt #define  ICU_IRQ_TRIGLEVEL_LO		1		/* active low or falling edge */
    162  1.1   matt #define  ICU_IRQ_TRIGLEVEL_HI		0		/* active high or rising edge */
    163  1.1   matt #define GEMINI_ICU_IRQ_STATUS		0x14						/* ro */
    164  1.1   matt 
    165  1.1   matt #define GEMINI_ICU_FIQ_SOURCE		0x20						/* ro */
    166  1.1   matt #define GEMINI_ICU_FIQ_ENABLE		0x24						/* rw */
    167  1.1   matt #define GEMINI_ICU_FIQ_CLEAR		0x28						/* wo */
    168  1.1   matt #define GEMINI_ICU_FIQ_TRIGMODE		0x2c						/* rw */
    169  1.1   matt #define GEMINI_ICU_FIQ_TRIGLEVEL	0x30						/* rw */
    170  1.1   matt #define GEMINI_ICU_FIQ_STATUS		0x34						/* ro */
    171  1.1   matt 
    172  1.1   matt #define GEMINI_ICU_REVISION		0x50						/* ro */
    173  1.1   matt #define GEMINI_ICU_INPUT_NUM		0x54						/* ro */
    174  1.1   matt #define  ICU_INPUT_NUM_RESV		__BITS(31,16)
    175  1.1   matt #define  ICU_INPUT_NUM_IRQ		__BITS(15,8)
    176  1.1   matt #define  ICU_INPUT_NUM_FIQ		__BITS(7,0)
    177  1.1   matt #define GEMINI_ICU_IRQ_DEBOUNCE		0x58						/* ro */
    178  1.1   matt #define GEMINI_ICU_FIQ_DEBOUNCE		0x5c						/* ro */
    179  1.1   matt 
    180  1.1   matt 
    181  1.1   matt /*
    182  1.4  cliff  * Gemini LPC controller register offsets and bits
    183  1.4  cliff  */
    184  1.4  cliff #define GEMINI_LPCHC_ID			0x00						/* ro */
    185  1.4  cliff # define LPCHC_ID_DEVICE		__BITS(31,8)	/* Device ID */
    186  1.4  cliff # define LPCHC_ID_REV			__BITS(7,0)	/* Revision */
    187  1.4  cliff # define _LPCHC_ID_DEVICE(r)		((typeof(r))(((r) & LPCHC_ID_DEVICE) >> 8))
    188  1.4  cliff # define _LPCHC_ID_REV(r)		((typeof(r))(((r) & LPCHC_ID_REV) >> 0))
    189  1.4  cliff #define GEMINI_LPCHC_CSR		0x04						/* rw */
    190  1.4  cliff # define LPCHC_CSR_RESa			__BITS(31,24)
    191  1.4  cliff # define LPCHC_CSR_STO			__BIT(23)	/* Sync Time Out */
    192  1.4  cliff # define LPCHC_CSR_SERR			__BIT(22)	/* Sync Error */
    193  1.4  cliff # define LPCHC_CSR_RESb			__BITS(21,8)
    194  1.4  cliff # define LPCHC_CSR_STOE			__BIT(7)	/* Sync Time Out Enable */
    195  1.4  cliff # define LPCHC_CSR_SERRE		__BIT(6)	/* Sync Error Enable */
    196  1.4  cliff # define LPCHC_CSR_RESc			__BITS(5,1)
    197  1.4  cliff # define LPCHC_CSR_BEN			__BIT(0)	/* Bridge Enable */
    198  1.4  cliff #define GEMINI_LPCHC_IRQCTL		0x08						/* rw */
    199  1.4  cliff # define LPCHC_IRQCTL_RESV		__BITS(31,8)
    200  1.4  cliff # define LPCHC_IRQCTL_SIRQEN		__BIT(7)	/* Serial IRQ Enable */
    201  1.4  cliff # define LPCHC_IRQCTL_SIRQMS		__BIT(6)	/* Serial IRQ Mode Select */
    202  1.4  cliff # define LPCHC_IRQCTL_SIRQFN		__BITS(5,2)	/* Serial IRQ Frame Number */
    203  1.4  cliff # define LPCHC_IRQCTL_SIRQFW		__BITS(1,0)	/* Serial IRQ Frame Width */
    204  1.4  cliff #  define IRQCTL_SIRQFW_4		0
    205  1.4  cliff #  define IRQCTL_SIRQFW_6		1
    206  1.4  cliff #  define IRQCTL_SIRQFW_8		2
    207  1.4  cliff #  define IRQCTL_SIRQFW_RESV		3
    208  1.4  cliff #define GEMINI_LPCHC_SERIRQSTS		0x0c						/* rwc */
    209  1.4  cliff # define LPCHC_SERIRQSTS_RESV		__BITS(31,17)
    210  1.4  cliff #define GEMINI_LPCHC_SERIRQTYP		0x10						/* rw */
    211  1.4  cliff # define LPCHC_SERIRQTYP_RESV		__BITS(31,17)
    212  1.4  cliff #  define SERIRQTYP_EDGE		1
    213  1.4  cliff #  define SERIRQTYP_LEVEL		0
    214  1.4  cliff #define GEMINI_LPCHC_SERIRQPOLARITY	0x14						/* rw */
    215  1.4  cliff # define LPCHC_SERIRQPOLARITY_RESV	__BITS(31,17)
    216  1.4  cliff #  define SERIRQPOLARITY_HI		1
    217  1.4  cliff #  define SERIRQPOLARITY_LO		0
    218  1.4  cliff #define GEMINI_LPCHC_SIZE		(GEMINI_LPCHC_SERIRQPOLARITY + 4)
    219  1.4  cliff #define GEMINI_LPCHC_NSERIRQ		17
    220  1.4  cliff 
    221  1.4  cliff /*
    222  1.6  cliff  * Gemini GPIO controller register offsets and bits
    223  1.6  cliff  */
    224  1.6  cliff #define GEMINI_GPIO_DATAOUT		0x00		/* Data Out */			/* rw */
    225  1.6  cliff #define GEMINI_GPIO_DATAIN		0x04		/* Data Out */			/* ro */
    226  1.6  cliff #define GEMINI_GPIO_PINDIR		0x08		/* Pin Direction */		/* rw */
    227  1.6  cliff #define  GPIO_PINDIR_INPUT		0
    228  1.6  cliff #define  GPIO_PINDIR_OUTPUT		1
    229  1.6  cliff #define GEMINI_GPIO_PINBYPASS		0x0c		/* Pin Bypass */		/* rw */
    230  1.6  cliff #define GEMINI_GPIO_DATASET		0x10		/* Data Set */			/* wo */
    231  1.6  cliff #define GEMINI_GPIO_DATACLR		0x14		/* Data Clear */		/* wo */
    232  1.6  cliff #define GEMINI_GPIO_PULLENB		0x18		/* Pullup Enable */		/* rw */
    233  1.6  cliff #define GEMINI_GPIO_PULLTYPE		0x1c		/* Pullup Type */		/* rw */
    234  1.6  cliff #define  GPIO_PULLTYPE_LOW		0
    235  1.6  cliff #define  GPIO_PULLTYPE_HIGH		1
    236  1.6  cliff #define GEMINI_GPIO_INTRENB		0x20		/* Interrupt Enable */		/* rw */
    237  1.6  cliff #define GEMINI_GPIO_INTRRAWSTATE	0x24		/* Interrupt Raw State */	/* ro */
    238  1.6  cliff #define GEMINI_GPIO_INTRMSKSTATE	0x28		/* Interrupt Masked State */	/* ro */
    239  1.6  cliff #define GEMINI_GPIO_INTRMASK		0x2c		/* Interrupt Mask */		/* rw */
    240  1.6  cliff #define GEMINI_GPIO_INTRCLR		0x30		/* Interrupt Clear */		/* wo */
    241  1.6  cliff #define GEMINI_GPIO_INTRTRIG		0x34		/* Interrupt Trigger Method */	/* rw */
    242  1.6  cliff #define  GPIO_INTRTRIG_EDGE		0
    243  1.6  cliff #define  GPIO_INTRTRIG_LEVEL		1
    244  1.6  cliff #define GEMINI_GPIO_INTREDGEBOTH	0x38		/* Both edges trigger Intr. */	/* rw */
    245  1.6  cliff #define GEMINI_GPIO_INTRDIR		0x3c		/* edge/level direction */	/* rw */
    246  1.6  cliff #define  GPIO_INTRDIR_EDGE_RISING	0
    247  1.6  cliff #define  GPIO_INTRDIR_EDGE_FALLING	1
    248  1.6  cliff #define  GPIO_INTRDIR_LEVEL_HIGH	0
    249  1.6  cliff #define  GPIO_INTRDIR_LEVEL_LOW		1
    250  1.6  cliff #define GEMINI_GPIO_BOUNCEENB		0x40		/* Bounce Enable */		/* rw */
    251  1.6  cliff #define GEMINI_GPIO_BOUNCESCALE		0x44		/* Bounce Pre-Scale */		/* rw */
    252  1.6  cliff #define  GPIO_BOUNCESCALE_RESV		__BITS(31,16)
    253  1.6  cliff #define  GPIO_BOUNCESCALE_VAL		__BITS(15,0)	/* NOTE:
    254  1.6  cliff 							 * if bounce is enabled, and bounce pre-scale == 0
    255  1.6  cliff 							 * then the the pin will not detect any interrupt
    256  1.6  cliff 							 */
    257  1.6  cliff #define GEMINI_GPIO_SIZE		(GEMINI_GPIO_BOUNCESCALE + 4)
    258  1.6  cliff 
    259  1.6  cliff /*
    260  1.1   matt  * Gemini PCI controller register offsets and bits
    261  1.1   matt  */
    262  1.1   matt #define GEMINI_PCI_IOSIZE		0x00		/* I/O Space Size */		/* rw */
    263  1.1   matt #define GEMINI_PCI_PROT			0x04		/* AHB Protection */		/* rw */
    264  1.1   matt #define GEMINI_PCI_PCICTRL		0x08		/* PCI Control Signal */	/* rw */
    265  1.1   matt #define GEMINI_PCI_ERREN		0x0c		/* Soft Reset Counter and
    266  1.1   matt 							 * Response Error Enable */	/* rw */
    267  1.1   matt #define GEMINI_PCI_SOFTRST		0x10		/* Soft Reset */
    268  1.1   matt #define GEMINI_PCI_CFG_CMD		0x28		/* PCI Configuration Command */	/* rw */
    269  1.1   matt #define  PCI_CFG_CMD_ENB		__BIT(31)	/*  Enable */
    270  1.1   matt #define  PCI_CFG_CMD_RESa		__BITS(30,24)
    271  1.1   matt #define  PCI_CFG_CMD_BUSNO		__BITS(23,16)	/*  Bus      Number */
    272  1.1   matt #define  PCI_CFG_CMD_BUSn(n)		(((n) << 16) & PCI_CFG_CMD_BUSNO)
    273  1.1   matt #define  PCI_CFG_CMD_DEVNO		__BITS(15,11)	/*  Device   Number */
    274  1.1   matt #define  PCI_CFG_CMD_DEVn(n)		(((n) << 11) & PCI_CFG_CMD_DEVNO)
    275  1.1   matt #define  PCI_CFG_CMD_FUNCNO		__BITS(10,8)	/*  Function Number */
    276  1.1   matt #define  PCI_CFG_CMD_FUNCn(n)		(((n) << 8) & PCI_CFG_CMD_FUNCNO)
    277  1.1   matt #define  PCI_CFG_CMD_REGNO		__BITS(7,2)	/*  Register Number */
    278  1.1   matt #define  PCI_CFG_CMD_REGn(n)		(((n) << 0) & PCI_CFG_CMD_REGNO)
    279  1.1   matt #define  PCI_CFG_CMD_RESb		__BITS(1,0)
    280  1.1   matt #define  PCI_CFG_CMD_RESV	\
    281  1.1   matt 		(PCI_CFG_CMD_RESa | PCI_CFG_CMD_RESb)
    282  1.1   matt #define GEMINI_PCI_CFG_DATA		0x2c		/* PCI Configuration Data */	/* rw */
    283  1.1   matt 
    284  1.1   matt /*
    285  1.1   matt  * Gemini machine dependent PCI config registers
    286  1.1   matt  */
    287  1.1   matt #define	GEMINI_PCI_CFG_REG_PMR1		0x40		/* Power Management 1 */	/* rw */
    288  1.1   matt #define	GEMINI_PCI_CFG_REG_PMR2		0x44		/* Power Management 2 */	/* rw */
    289  1.1   matt #define	GEMINI_PCI_CFG_REG_CTL1		0x48		/* Control 1 */			/* rw */
    290  1.1   matt #define	GEMINI_PCI_CFG_REG_CTL2		0x4c		/* Control 2 */			/* rw */
    291  1.1   matt #define	 PCI_CFG_REG_CTL2_INTSTS	__BITS(31,28)
    292  1.1   matt #define	  CFG_REG_CTL2_INTSTS_INTD	__BIT(28 + 3)
    293  1.1   matt #define	  CFG_REG_CTL2_INTSTS_INTC	__BIT(28 + 2)
    294  1.1   matt #define	  CFG_REG_CTL2_INTSTS_INTB	__BIT(28 + 1)
    295  1.1   matt #define	  CFG_REG_CTL2_INTSTS_INTA	__BIT(28 + 0)
    296  1.1   matt #define	 PCI_CFG_REG_CTL2_INTMASK	__BITS(27,16)
    297  1.1   matt #define	  CFG_REG_CTL2_INTMASK_CMDERR	__BIT(16 + 11)
    298  1.1   matt #define	  CFG_REG_CTL2_INTMASK_PARERR	__BIT(16 + 10)
    299  1.1   matt #define	  CFG_REG_CTL2_INTMASK_INTD	__BIT(16 + 9)
    300  1.1   matt #define	  CFG_REG_CTL2_INTMASK_INTC	__BIT(16 + 8)
    301  1.1   matt #define	  CFG_REG_CTL2_INTMASK_INTB	__BIT(16 + 7)
    302  1.1   matt #define	  CFG_REG_CTL2_INTMASK_INTA	__BIT(16 + 6)
    303  1.1   matt #define	  CFG_REG_CTL2_INTMASK_INT_ABCD	__BITS(16+9,16+6)
    304  1.1   matt #define	  CFG_REG_CTL2_INTMASK_MABRT_RX	__BIT(16 + 5)
    305  1.1   matt #define	  CFG_REG_CTL2_INTMASK_TABRT_RX	__BIT(16 + 4)
    306  1.1   matt #define	  CFG_REG_CTL2_INTMASK_TABRT_TX	__BIT(16 + 3)
    307  1.1   matt #define	  CFG_REG_CTL2_INTMASK_RETRY4	__BIT(16 + 2)
    308  1.1   matt #define	  CFG_REG_CTL2_INTMASK_SERR_RX	__BIT(16 + 1)
    309  1.1   matt #define	  CFG_REG_CTL2_INTMASK_PERR_RX	__BIT(16 + 0)
    310  1.1   matt #define	 PCI_CFG_REG_CTL2_RESa		__BIT(15)
    311  1.1   matt #define	 PCI_CFG_REG_CTL2_MSTPRI	__BITS(14,8)
    312  1.1   matt #define	  CFG_REG_CTL2_MSTPRI_REQn(n)	__BIT(8 + (n))
    313  1.1   matt #define	 PCI_CFG_REG_CTL2_RESb		__BITS(7,4)
    314  1.1   matt #define	 PCI_CFG_REG_CTL2_TRDYW		__BITS(3,0)
    315  1.1   matt #define	 PCI_CFG_REG_CTL2_RESV	\
    316  1.1   matt 		(PCI_CFG_REG_CTL2_RESa | PCI_CFG_REG_CTL2_RESb)
    317  1.1   matt #define	GEMINI_PCI_CFG_REG_MEM1		0x50		/* Memory 1 Base */		/* rw */
    318  1.1   matt #define	GEMINI_PCI_CFG_REG_MEM2		0x54		/* Memory 2 Base */		/* rw */
    319  1.1   matt #define	GEMINI_PCI_CFG_REG_MEM3		0x58		/* Memory 3 Base */		/* rw */
    320  1.1   matt #define	 PCI_CFG_REG_MEM_BASE_MASK	__BITS(31,20)
    321  1.1   matt #define	 PCI_CFG_REG_MEM_BASE(base)	((base) & PCI_CFG_REG_MEM_BASE_MASK)
    322  1.1   matt #define	 PCI_CFG_REG_MEM_SIZE_MASK	__BITS(19,16)
    323  1.1   matt #define	 PCI_CFG_REG_MEM_SIZE_1MB	(0x0 << 16)
    324  1.1   matt #define	 PCI_CFG_REG_MEM_SIZE_2MB	(0x1 << 16)
    325  1.1   matt #define	 PCI_CFG_REG_MEM_SIZE_4MB	(0x2 << 16)
    326  1.1   matt #define	 PCI_CFG_REG_MEM_SIZE_8MB	(0x3 << 16)
    327  1.1   matt #define	 PCI_CFG_REG_MEM_SIZE_16MB	(0x4 << 16)
    328  1.1   matt #define	 PCI_CFG_REG_MEM_SIZE_32MB	(0x5 << 16)
    329  1.1   matt #define	 PCI_CFG_REG_MEM_SIZE_64MB	(0x6 << 16)
    330  1.1   matt #define	 PCI_CFG_REG_MEM_SIZE_128MB	(0x7 << 16)
    331  1.1   matt #define	 PCI_CFG_REG_MEM_SIZE_256MB	(0x8 << 16)
    332  1.1   matt #define	 PCI_CFG_REG_MEM_SIZE_512MB	(0x9 << 16)
    333  1.1   matt #define	 PCI_CFG_REG_MEM_SIZE_1GB	(0xa << 16)
    334  1.1   matt #define	 PCI_CFG_REG_MEM_SIZE_2GB	(0xb << 16)
    335  1.1   matt #define	 PCI_CFG_REG_MEM_RESV		__BITS(19,16)
    336  1.1   matt 
    337  1.1   matt #ifndef _LOCORE
    338  1.1   matt static inline unsigned int
    339  1.1   matt gemini_pci_cfg_reg_mem_size(size_t sz)
    340  1.1   matt {
    341  1.1   matt 	switch (sz) {
    342  1.1   matt 	case (1 << 20):
    343  1.1   matt 		return PCI_CFG_REG_MEM_SIZE_1MB;
    344  1.1   matt 	case (2 << 20):
    345  1.1   matt 		return PCI_CFG_REG_MEM_SIZE_2MB;
    346  1.1   matt 	case (4 << 20):
    347  1.1   matt 		return PCI_CFG_REG_MEM_SIZE_4MB;
    348  1.1   matt 	case (8 << 20):
    349  1.1   matt 		return PCI_CFG_REG_MEM_SIZE_8MB;
    350  1.1   matt 	case (16 << 20):
    351  1.1   matt 		return PCI_CFG_REG_MEM_SIZE_16MB;
    352  1.1   matt 	case (32 << 20):
    353  1.1   matt 		return PCI_CFG_REG_MEM_SIZE_32MB;
    354  1.1   matt 	case (64 << 20):
    355  1.1   matt 		return PCI_CFG_REG_MEM_SIZE_64MB;
    356  1.1   matt 	case (128 << 20):
    357  1.1   matt 		return PCI_CFG_REG_MEM_SIZE_128MB;
    358  1.1   matt 	case (256 << 20):
    359  1.1   matt 		return PCI_CFG_REG_MEM_SIZE_256MB;
    360  1.1   matt 	case (512 << 20):
    361  1.1   matt 		return PCI_CFG_REG_MEM_SIZE_512MB;
    362  1.1   matt 	case (1024 << 20):
    363  1.1   matt 		return PCI_CFG_REG_MEM_SIZE_1GB;
    364  1.1   matt 	case (2048 << 20):
    365  1.1   matt 		return PCI_CFG_REG_MEM_SIZE_2GB;
    366  1.1   matt 	default:
    367  1.1   matt 		panic("gemini_pci_cfg_reg_mem_size: bad size %#lx\n", sz);
    368  1.1   matt 	}
    369  1.1   matt 	/* NOTREACHED */
    370  1.1   matt }
    371  1.1   matt #endif	/* _LOCORE */
    372  1.1   matt 
    373  1.4  cliff /*
    374  1.4  cliff  * Gemini SL3516 IDE device register offsets, &etc.
    375  1.4  cliff  */
    376  1.4  cliff #define GEMINI_MIDE_NCHAN		2
    377  1.4  cliff #define GEMINI_MIDE_OFFSET(chan)	((chan == 0) ? 0x0 : 0x400000)
    378  1.4  cliff #define GEMINI_MIDE_BASEn(chan)		(GEMINI_MIDE_BASE + GEMINI_MIDE_OFFSET(chan))
    379  1.4  cliff #define GEMINI_MIDE_CMDBLK		0x20
    380  1.4  cliff #define GEMINI_MIDE_CTLBLK		0x36
    381  1.4  cliff #define GEMINI_MIDE_SIZE		0x40
    382  1.4  cliff 
    383  1.4  cliff 
    384  1.5  cliff /*
    385  1.5  cliff  * Gemini DRAM Controller register offsets, &etc.
    386  1.5  cliff  */
    387  1.5  cliff #define GEMINI_DRAMC_RMCR		0x40		/* CPU Remap Control */				/* rw */
    388  1.5  cliff #define  DRAMC_RMCR_RESa		__BITS(31,29)
    389  1.5  cliff #define  DRAMC_RMCR_RMBAR		__BITS(28,20)	/* Remap Base Address */
    390  1.5  cliff #define  DRAMC_RMCR_RMBAR_SHFT		20
    391  1.5  cliff #define  DRAMC_RMCR_RESb		__BITS(19,9)
    392  1.5  cliff #define  DRAMC_RMCR_RMSZR		__BITS(8,0)	/* Remap Size Address */
    393  1.5  cliff #define  DRAMC_RMCR_RMSZR_SHFT		0
    394  1.5  cliff 
    395  1.1   matt #else
    396  1.1   matt # error unknown gemini cpu type
    397  1.1   matt #endif
    398  1.1   matt 
    399  1.1   matt #endif	/* _ARM_GEMINI_REG_H_ */
    400