Home | History | Annotate | Line # | Download | only in bonito
bonitoreg.h revision 1.2
      1 /*	$NetBSD: bonitoreg.h,v 1.2 2001/06/22 03:58:03 thorpej Exp $	*/
      2 
      3 /*
      4  * Bonito Register Map
      5  * Copyright (c) 1999 Algorithmics Ltd
      6  *
      7  * Algorithmics gives permission for anyone to use and modify this file
      8  * without any obligation or license condition except that you retain
      9  * this copyright message in any source redistribution in whole or part.
     10  *
     11  * Updated copies of this and other files can be found at
     12  * ftp://ftp.algor.co.uk/pub/bonito/
     13  *
     14  * Users of the Bonito controller are warmly recommended to contribute
     15  * any useful changes back to Algorithmics (mail to
     16  * bonito (at) algor.co.uk).
     17  */
     18 
     19 /* Revision 1.40 autogenerated on 08/14/99 17:37:43 */
     20 
     21 #ifndef _BONITO_H_
     22 
     23 #define BONITO(x)	(BONITO_REG_BASE + (x))
     24 
     25 #define	REGVAL(x)	*((__volatile u_int32_t *) MIPS_PHYS_TO_KSEG1(x))
     26 
     27 #define BONITO_BOOT_BASE		0x1fc00000
     28 #define BONITO_BOOT_SIZE		0x00100000
     29 #define BONITO_BOOT_TOP 		(BOOT_BASE+BOOT_SIZE-1)
     30 #define BONITO_FLASH_BASE		0x1c000000
     31 #define BONITO_FLASH_SIZE		0x03000000
     32 #define BONITO_FLASH_TOP		(FLASH_BASE+FLASH_SIZE-1)
     33 #define BONITO_SOCKET_BASE		0x1f800000
     34 #define BONITO_SOCKET_SIZE		0x00400000
     35 #define BONITO_SOCKET_TOP		(SOCKET_BASE+SOCKET_SIZE-1)
     36 #define BONITO_REG_BASE 		0x1fe00000
     37 #define BONITO_REG_SIZE 		0x00040000
     38 #define BONITO_REG_TOP			(REG_BASE+REG_SIZE-1)
     39 #define BONITO_DEV_BASE 		0x1ff00000
     40 #define BONITO_DEV_SIZE 		0x00100000
     41 #define BONITO_DEV_TOP			(DEV_BASE+DEV_SIZE-1)
     42 #define BONITO_PCILO_BASE		0x10000000
     43 #define BONITO_PCILO_SIZE		0x0c000000
     44 #define BONITO_PCILO_TOP		(PCILO_BASE+PCILO_SIZE-1)
     45 #define BONITO_PCIHI_BASE		0x20000000
     46 #define BONITO_PCIHI_SIZE		0x20000000
     47 #define BONITO_PCIHI_TOP		(PCIHI_BASE+PCIHI_SIZE-1)
     48 #define BONITO_PCIIO_BASE		0x1fd00000
     49 #define BONITO_PCIIO_SIZE		0x00100000
     50 #define BONITO_PCIIO_TOP		(PCIIO_BASE+PCIIO_SIZE-1)
     51 #define BONITO_PCICFG_BASE		0x1fe80000
     52 #define BONITO_PCICFG_SIZE		0x00080000
     53 #define BONITO_PCICFG_TOP		(PCICFG_BASE+PCICFG_SIZE-1)
     54 
     55 
     56 /* Bonito Register Bases */
     57 
     58 #define BONITO_PCICONFIGBASE		0x00
     59 #define BONITO_REGBASE			0x100
     60 
     61 
     62 /* PCI Configuration  Registers */
     63 
     64 #define BONITO_PCIDID			BONITO(BONITO_PCICONFIGBASE + 0x00)
     65 #define BONITO_PCICMD			BONITO(BONITO_PCICONFIGBASE + 0x04)
     66 #define BONITO_PCICLASS 		BONITO(BONITO_PCICONFIGBASE + 0x08)
     67 #define BONITO_PCILTIMER		BONITO(BONITO_PCICONFIGBASE + 0x0c)
     68 #define BONITO_PCIBASE0 		BONITO(BONITO_PCICONFIGBASE + 0x10)
     69 #define BONITO_PCIBASE1 		BONITO(BONITO_PCICONFIGBASE + 0x14)
     70 #define BONITO_PCIBASE2 		BONITO(BONITO_PCICONFIGBASE + 0x18)
     71 #define BONITO_PCIEXPRBASE		BONITO(BONITO_PCICONFIGBASE + 0x30)
     72 #define BONITO_PCIINT			BONITO(BONITO_PCICONFIGBASE + 0x3c)
     73 
     74 #define BONITO_PCICMD_PERR_CLR		0x80000000
     75 #define BONITO_PCICMD_SERR_CLR		0x40000000
     76 #define BONITO_PCICMD_MABORT_CLR	0x20000000
     77 #define BONITO_PCICMD_MTABORT_CLR	0x10000000
     78 #define BONITO_PCICMD_TABORT_CLR	0x08000000
     79 #define BONITO_PCICMD_MPERR_CLR 	0x01000000
     80 #define BONITO_PCICMD_PERRRESPEN	0x00000040
     81 #define BONITO_PCICMD_ASTEPEN		0x00000080
     82 #define BONITO_PCICMD_SERREN		0x00000100
     83 #define BONITO_PCILTIMER_BUSLATENCY	0x0000ff00
     84 #define BONITO_PCILTIMER_BUSLATENCY_SHIFT	8
     85 
     86 
     87 
     88 
     89 /* 1. Bonito h/w Configuration */
     90 /* Power on register */
     91 
     92 #define BONITO_BONPONCFG		BONITO(BONITO_REGBASE + 0x00)
     93 
     94 #define BONITO_BONPONCFG_SYSCONTROLLERRD	0x00040000
     95 #define BONITO_BONPONCFG_ROMCS1SAMP	0x00020000
     96 #define BONITO_BONPONCFG_ROMCS0SAMP	0x00010000
     97 #define BONITO_BONPONCFG_CPUBIGEND	0x00004000
     98 #define BONITO_BONPONCFG_CPUPARITY	0x00002000
     99 #define BONITO_BONPONCFG_CPUTYPE	0x00000007
    100 #define BONITO_BONPONCFG_CPUTYPE_SHIFT	0
    101 #define BONITO_BONPONCFG_PCIRESET_OUT	0x00000008
    102 #define BONITO_BONPONCFG_IS_ARBITER	0x00000010
    103 #define BONITO_BONPONCFG_ROMBOOT	0x000000c0
    104 #define BONITO_BONPONCFG_ROMBOOT_SHIFT	6
    105 
    106 #define BONITO_BONPONCFG_ROMBOOT_FLASH	(0x0<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
    107 #define BONITO_BONPONCFG_ROMBOOT_SOCKET (0x1<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
    108 #define BONITO_BONPONCFG_ROMBOOT_SDRAM	(0x2<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
    109 #define BONITO_BONPONCFG_ROMBOOT_CPURESET	(0x3<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
    110 
    111 #define BONITO_BONPONCFG_ROMCS0WIDTH	0x00000100
    112 #define BONITO_BONPONCFG_ROMCS1WIDTH	0x00000200
    113 #define BONITO_BONPONCFG_ROMCS0FAST	0x00000400
    114 #define BONITO_BONPONCFG_ROMCS1FAST	0x00000800
    115 #define BONITO_BONPONCFG_CONFIG_DIS	0x00000020
    116 
    117 
    118 /* Other Bonito configuration */
    119 
    120 #define BONITO_BONGENCFG		BONITO(BONITO_REGBASE + 0x04)
    121 
    122 #define BONITO_BONGENCFG_DEBUGMODE	0x00000001
    123 #define BONITO_BONGENCFG_SNOOPEN	0x00000002
    124 #define BONITO_BONGENCFG_CPUSELFRESET	0x00000004
    125 
    126 #define BONITO_BONGENCFG_FORCE_IRQA	0x00000008
    127 #define BONITO_BONGENCFG_IRQA_ISOUT	0x00000010
    128 #define BONITO_BONGENCFG_IRQA_FROM_INT1 0x00000020
    129 #define BONITO_BONGENCFG_BYTESWAP	0x00000040
    130 
    131 #define BONITO_BONGENCFG_UNCACHED	0x00000080
    132 #define BONITO_BONGENCFG_PREFETCHEN	0x00000100
    133 #define BONITO_BONGENCFG_WBEHINDEN	0x00000200
    134 #define BONITO_BONGENCFG_CACHEALG	0x00000c00
    135 #define BONITO_BONGENCFG_CACHEALG_SHIFT 10
    136 #define BONITO_BONGENCFG_PCIQUEUE	0x00001000
    137 #define BONITO_BONGENCFG_CACHESTOP	0x00002000
    138 #define BONITO_BONGENCFG_MSTRBYTESWAP	0x00004000
    139 #define BONITO_BONGENCFG_NOTIMEOUT	0x00008000
    140 #define BONITO_BONGENCFG_NORETRYTIMEOUT 0x00010000
    141 
    142 /* 2. IO & IDE configuration */
    143 
    144 #define BONITO_IODEVCFG 		BONITO(BONITO_REGBASE + 0x08)
    145 
    146 /* 3. IO & IDE configuration */
    147 
    148 #define BONITO_SDCFG			BONITO(BONITO_REGBASE + 0x0c)
    149 
    150 /* 4. PCI address map control */
    151 
    152 #define BONITO_PCIMAP			BONITO(BONITO_REGBASE + 0x10)
    153 #define BONITO_PCIMEMBASECFG		BONITO(BONITO_REGBASE + 0x14)
    154 #define BONITO_PCIMAP_CFG		BONITO(BONITO_REGBASE + 0x18)
    155 
    156 /* 5. ICU & GPIO regs */
    157 
    158 /* GPIO Regs - r/w */
    159 
    160 #define BONITO_GPIODATA 		BONITO(BONITO_REGBASE + 0x1c)
    161 #define BONITO_GPIOIE			BONITO(BONITO_REGBASE + 0x20)
    162 
    163 /* ICU Configuration Regs - r/w */
    164 
    165 #define BONITO_INTEDGE			BONITO(BONITO_REGBASE + 0x24)
    166 #define BONITO_INTSTEER 		BONITO(BONITO_REGBASE + 0x28)
    167 #define BONITO_INTPOL			BONITO(BONITO_REGBASE + 0x2c)
    168 
    169 /* ICU Enable Regs - IntEn & IntISR are r/o. */
    170 
    171 #define BONITO_INTENSET 		BONITO(BONITO_REGBASE + 0x30)
    172 #define BONITO_INTENCLR 		BONITO(BONITO_REGBASE + 0x34)
    173 #define BONITO_INTEN			BONITO(BONITO_REGBASE + 0x38)
    174 #define BONITO_INTISR			BONITO(BONITO_REGBASE + 0x3c)
    175 
    176 /* PCI mail boxes */
    177 
    178 #define BONITO_PCIMAIL0 		BONITO(BONITO_REGBASE + 0x40)
    179 #define BONITO_PCIMAIL1 		BONITO(BONITO_REGBASE + 0x44)
    180 #define BONITO_PCIMAIL2 		BONITO(BONITO_REGBASE + 0x48)
    181 #define BONITO_PCIMAIL3 		BONITO(BONITO_REGBASE + 0x4c)
    182 
    183 
    184 /* 6. PCI cache */
    185 
    186 #define BONITO_PCICACHECTRL		BONITO(BONITO_REGBASE + 0x50)
    187 #define BONITO_PCICACHETAG		BONITO(BONITO_REGBASE + 0x54)
    188 
    189 #define BONITO_PCIBADADDR		BONITO(BONITO_REGBASE + 0x58)
    190 #define BONITO_PCIMSTAT 		BONITO(BONITO_REGBASE + 0x5c)
    191 
    192 
    193 /*
    194 #define BONITO_PCIRDPOST		BONITO(BONITO_REGBASE + 0x60)
    195 #define BONITO_PCIDATA			BONITO(BONITO_REGBASE + 0x64)
    196 */
    197 
    198 /* 7. IDE DMA & Copier */
    199 
    200 #define BONITO_CONFIGBASE		0x000
    201 #define BONITO_BONITOBASE		0x100
    202 #define BONITO_LDMABASE 		0x200
    203 #define BONITO_COPBASE			0x300
    204 #define BONITO_REG_BLOCKMASK		0x300
    205 
    206 #define BONITO_LDMACTRL 		BONITO(BONITO_LDMABASE + 0x0)
    207 #define BONITO_LDMASTAT 		BONITO(BONITO_LDMABASE + 0x0)
    208 #define BONITO_LDMAADDR 		BONITO(BONITO_LDMABASE + 0x4)
    209 #define BONITO_LDMAGO			BONITO(BONITO_LDMABASE + 0x8)
    210 #define BONITO_LDMADATA 		BONITO(BONITO_LDMABASE + 0xc)
    211 
    212 #define BONITO_COPCTRL			BONITO(BONITO_COPBASE + 0x0)
    213 #define BONITO_COPSTAT			BONITO(BONITO_COPBASE + 0x0)
    214 #define BONITO_COPPADDR 		BONITO(BONITO_COPBASE + 0x4)
    215 #define BONITO_COPDADDR 		BONITO(BONITO_COPBASE + 0x8)
    216 #define BONITO_COPGO			BONITO(BONITO_COPBASE + 0xc)
    217 
    218 
    219 /* ###### Bit Definitions for individual Registers #### */
    220 
    221 /* Gen DMA. */
    222 
    223 #define BONITO_IDECOPDADDR_DMA_DADDR	0x0ffffffc
    224 #define BONITO_IDECOPDADDR_DMA_DADDR_SHIFT	2
    225 #define BONITO_IDECOPPADDR_DMA_PADDR	0xfffffffc
    226 #define BONITO_IDECOPPADDR_DMA_PADDR_SHIFT	2
    227 #define BONITO_IDECOPGO_DMA_SIZE	0x0000ffff
    228 #define BONITO_IDECOPGO_DMA_SIZE_SHIFT	0
    229 #define BONITO_IDECOPGO_DMA_WRITE	0x00010000
    230 
    231 #define BONITO_IDECOPCTRL_DMA_STARTBIT	0x80000000
    232 #define BONITO_IDECOPCTRL_DMA_RSTBIT	0x40000000
    233 
    234 /* DRAM - sdCfg */
    235 
    236 #define BONITO_SDCFG_AROWBITS		0x00000003
    237 #define BONITO_SDCFG_AROWBITS_SHIFT	0
    238 #define BONITO_SDCFG_ACOLBITS		0x0000000c
    239 #define BONITO_SDCFG_ACOLBITS_SHIFT	2
    240 #define BONITO_SDCFG_ABANKBIT		0x00000010
    241 #define BONITO_SDCFG_ASIDES		0x00000020
    242 #define BONITO_SDCFG_AABSENT		0x00000040
    243 #define BONITO_SDCFG_AWIDTH64		0x00000080
    244 
    245 #define BONITO_SDCFG_BROWBITS		0x00000300
    246 #define BONITO_SDCFG_BROWBITS_SHIFT	8
    247 #define BONITO_SDCFG_BCOLBITS		0x00000c00
    248 #define BONITO_SDCFG_BCOLBITS_SHIFT	10
    249 #define BONITO_SDCFG_BBANKBIT		0x00001000
    250 #define BONITO_SDCFG_BSIDES		0x00002000
    251 #define BONITO_SDCFG_BABSENT		0x00004000
    252 #define BONITO_SDCFG_BWIDTH64		0x00008000
    253 
    254 #define BONITO_SDCFG_EXTRDDATA		0x00010000
    255 #define BONITO_SDCFG_EXTRASCAS		0x00020000
    256 #define BONITO_SDCFG_EXTPRECH		0x00040000
    257 #define BONITO_SDCFG_EXTRASWIDTH	0x00180000
    258 #define BONITO_SDCFG_EXTRASWIDTH_SHIFT	19
    259 #define BONITO_SDCFG_DRAMRESET		0x00200000
    260 #define BONITO_SDCFG_DRAMEXTREGS	0x00400000
    261 #define BONITO_SDCFG_DRAMCSFLIP 	0x00800000
    262 
    263 /* PCI Cache - pciCacheCtrl */
    264 
    265 #define BONITO_PCICACHECTRL_CACHECMD	0x00000007
    266 #define BONITO_PCICACHECTRL_CACHECMD_SHIFT	0
    267 #define BONITO_PCICACHECTRL_CACHECMDLINE	0x00000018
    268 #define BONITO_PCICACHECTRL_CACHECMDLINE_SHIFT	3
    269 #define BONITO_PCICACHECTRL_CMDEXEC	0x00000020
    270 
    271 #define BONITO_IODEVCFG_BUFFBIT_CS0	0x00000001
    272 #define BONITO_IODEVCFG_SPEEDBIT_CS0	0x00000002
    273 #define BONITO_IODEVCFG_MOREABITS_CS0	0x00000004
    274 
    275 #define BONITO_IODEVCFG_BUFFBIT_CS1	0x00000008
    276 #define BONITO_IODEVCFG_SPEEDBIT_CS1	0x00000010
    277 #define BONITO_IODEVCFG_MOREABITS_CS1	0x00000020
    278 
    279 #define BONITO_IODEVCFG_BUFFBIT_CS2	0x00000040
    280 #define BONITO_IODEVCFG_SPEEDBIT_CS2	0x00000080
    281 #define BONITO_IODEVCFG_MOREABITS_CS2	0x00000100
    282 
    283 #define BONITO_IODEVCFG_BUFFBIT_CS3	0x00000200
    284 #define BONITO_IODEVCFG_SPEEDBIT_CS3	0x00000400
    285 #define BONITO_IODEVCFG_MOREABITS_CS3	0x00000800
    286 
    287 #define BONITO_IODEVCFG_BUFFBIT_IDE	0x00001000
    288 #define BONITO_IODEVCFG_SPEEDBIT_IDE	0x00002000
    289 #define BONITO_IODEVCFG_WORDSWAPBIT_IDE 0x00004000
    290 #define BONITO_IODEVCFG_MODEBIT_IDE	0x00008000
    291 #define BONITO_IODEVCFG_DMAON_IDE	0x001f0000
    292 #define BONITO_IODEVCFG_DMAON_IDE_SHIFT 16
    293 #define BONITO_IODEVCFG_DMAOFF_IDE	0x01e00000
    294 #define BONITO_IODEVCFG_DMAOFF_IDE_SHIFT	21
    295 
    296 /* gpio */
    297 #define BONITO_GPIO_GPIOW		0x000003ff
    298 #define BONITO_GPIO_GPIOW_SHIFT 	0
    299 #define BONITO_GPIO_GPIOR		0x01ff0000
    300 #define BONITO_GPIO_GPIOR_SHIFT 	16
    301 #define BONITO_GPIO_GPINR		0xfe000000
    302 #define BONITO_GPIO_GPINR_SHIFT 	25
    303 #define BONITO_GPIO_IOW(N)		(1<<(BONITO_GPIO_GPIOW_SHIFT+(N)))
    304 #define BONITO_GPIO_IOR(N)		(1<<(BONITO_GPIO_GPIOR_SHIFT+(N)))
    305 #define BONITO_GPIO_INR(N)		(1<<(BONITO_GPIO_GPINR_SHIFT+(N)))
    306 
    307 /* ICU */
    308 #define BONITO_ICU_MBOXES		0x0000000f
    309 #define BONITO_ICU_MBOXES_SHIFT 	0
    310 #define BONITO_ICU_DMARDY		0x00000010
    311 #define BONITO_ICU_DMAEMPTY		0x00000020
    312 #define BONITO_ICU_COPYRDY		0x00000040
    313 #define BONITO_ICU_COPYEMPTY		0x00000080
    314 #define BONITO_ICU_COPYERR		0x00000100
    315 #define BONITO_ICU_PCIIRQ		0x00000200
    316 #define BONITO_ICU_MASTERERR		0x00000400
    317 #define BONITO_ICU_SYSTEMERR		0x00000800
    318 #define BONITO_ICU_DRAMPERR		0x00001000
    319 #define BONITO_ICU_GPIOS		0x01ff0000
    320 #define BONITO_ICU_GPIOS_SHIFT		16
    321 #define BONITO_ICU_GPINS		0x7e000000
    322 #define BONITO_ICU_GPINS_SHIFT		25
    323 #define BONITO_ICU_MBOX(N)		(1<<(BONITO_ICU_MBOXES_SHIFT+(N)))
    324 #define BONITO_ICU_GPIO(N)		(1<<(BONITO_ICU_GPIOS_SHIFT+(N)))
    325 #define BONITO_ICU_GPIN(N)		(1<<(BONITO_ICU_GPINS_SHIFT+(N)))
    326 
    327 /* pcimap */
    328 
    329 #define BONITO_PCIMAP_PCIMAP_LO0	0x0000003f
    330 #define BONITO_PCIMAP_PCIMAP_LO0_SHIFT	0
    331 #define BONITO_PCIMAP_PCIMAP_LO1	0x00000fc0
    332 #define BONITO_PCIMAP_PCIMAP_LO1_SHIFT	6
    333 #define BONITO_PCIMAP_PCIMAP_LO2	0x0003f000
    334 #define BONITO_PCIMAP_PCIMAP_LO2_SHIFT	12
    335 #define BONITO_PCIMAP_PCIMAP_2		0x00040000
    336 #define BONITO_PCIMAP_WIN(WIN,ADDR)	((((ADDR)>>26) & BONITO_PCIMAP_PCIMAP_LO0) << (WIN)*6)
    337 
    338 /* pcimembaseCfg */
    339 
    340 #define BONITO_PCIMEMBASECFG_MEMBASE0_MASK	0x0000001f
    341 #define BONITO_PCIMEMBASECFG_MEMBASE0_MASK_SHIFT	0
    342 #define BONITO_PCIMEMBASECFG_MEMBASE0_TRANS	0x000003e0
    343 #define BONITO_PCIMEMBASECFG_MEMBASE0_TRANS_SHIFT	5
    344 #define BONITO_PCIMEMBASECFG_MEMBASE0_CACHED	0x00000400
    345 #define BONITO_PCIMEMBASECFG_MEMBASE0_IO	0x00000800
    346 
    347 #define BONITO_PCIMEMBASECFG_MEMBASE1_MASK	0x0001f000
    348 #define BONITO_PCIMEMBASECFG_MEMBASE1_MASK_SHIFT	12
    349 #define BONITO_PCIMEMBASECFG_MEMBASE1_TRANS	0x003e0000
    350 #define BONITO_PCIMEMBASECFG_MEMBASE1_TRANS_SHIFT	17
    351 #define BONITO_PCIMEMBASECFG_MEMBASE1_CACHED	0x00400000
    352 #define BONITO_PCIMEMBASECFG_MEMBASE1_IO	0x00800000
    353 
    354 #define BONITO_PCIMEMBASECFG_ASHIFT	23
    355 #define BONITO_PCIMEMBASECFGSIZE(WIN,SIZE)	(((~((SIZE)-1))>>(BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK)
    356 #define BONITO_PCIMEMBASECFGBASE(WIN,BASE)	(((BASE)>>(BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS)
    357 
    358 /* PCIMAP Cfg */
    359 
    360 #define	BONITO_PCIMAPCFG_TYPE1		0x00010000
    361 
    362 /* PCICmd */
    363 
    364 #define BONITO_PCICMD_MEMEN		0x00000002
    365 #define BONITO_PCICMD_MSTREN		0x00000004
    366 
    367 
    368 #endif /* _BONITO_H_ */
    369