18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci * for more details.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * hpc3.h: Definitions for SGI HPC3 controller
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Copyright (C) 1996 David S. Miller
98c2ecf20Sopenharmony_ci * Copyright (C) 1998 Ralf Baechle
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#ifndef _SGI_HPC3_H
138c2ecf20Sopenharmony_ci#define _SGI_HPC3_H
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include <linux/types.h>
168c2ecf20Sopenharmony_ci#include <asm/page.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* An HPC DMA descriptor. */
198c2ecf20Sopenharmony_cistruct hpc_dma_desc {
208c2ecf20Sopenharmony_ci	u32 pbuf;	/* physical address of data buffer */
218c2ecf20Sopenharmony_ci	u32 cntinfo;	/* counter and info bits */
228c2ecf20Sopenharmony_ci#define HPCDMA_EOX	0x80000000 /* last desc in chain for tx */
238c2ecf20Sopenharmony_ci#define HPCDMA_EOR	0x80000000 /* last desc in chain for rx */
248c2ecf20Sopenharmony_ci#define HPCDMA_EOXP	0x40000000 /* end of packet for tx */
258c2ecf20Sopenharmony_ci#define HPCDMA_EORP	0x40000000 /* end of packet for rx */
268c2ecf20Sopenharmony_ci#define HPCDMA_XIE	0x20000000 /* irq generated when at end of this desc */
278c2ecf20Sopenharmony_ci#define HPCDMA_XIU	0x01000000 /* Tx buffer in use by CPU. */
288c2ecf20Sopenharmony_ci#define HPCDMA_EIPC	0x00ff0000 /* SEEQ ethernet special xternal bytecount */
298c2ecf20Sopenharmony_ci#define HPCDMA_ETXD	0x00008000 /* set to one by HPC when packet tx'd */
308c2ecf20Sopenharmony_ci#define HPCDMA_OWN	0x00004000 /* Denotes ring buffer ownership on rx */
318c2ecf20Sopenharmony_ci#define HPCDMA_BCNT	0x00003fff /* size in bytes of this dma buffer */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci	u32 pnext;	/* paddr of next hpc_dma_desc if any */
348c2ecf20Sopenharmony_ci};
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* The set of regs for each HPC3 PBUS DMA channel. */
378c2ecf20Sopenharmony_cistruct hpc3_pbus_dmacregs {
388c2ecf20Sopenharmony_ci	volatile u32 pbdma_bptr;	/* pbus dma channel buffer ptr */
398c2ecf20Sopenharmony_ci	volatile u32 pbdma_dptr;	/* pbus dma channel desc ptr */
408c2ecf20Sopenharmony_ci	u32 _unused0[0x1000/4 - 2];	/* padding */
418c2ecf20Sopenharmony_ci	volatile u32 pbdma_ctrl;	/* pbus dma channel control register has
428c2ecf20Sopenharmony_ci					 * completely different meaning for read
438c2ecf20Sopenharmony_ci					 * compared with write */
448c2ecf20Sopenharmony_ci	/* read */
458c2ecf20Sopenharmony_ci#define HPC3_PDMACTRL_INT	0x00000001 /* interrupt (cleared after read) */
468c2ecf20Sopenharmony_ci#define HPC3_PDMACTRL_ISACT	0x00000002 /* channel active */
478c2ecf20Sopenharmony_ci	/* write */
488c2ecf20Sopenharmony_ci#define HPC3_PDMACTRL_SEL	0x00000002 /* little endian transfer */
498c2ecf20Sopenharmony_ci#define HPC3_PDMACTRL_RCV	0x00000004 /* direction is receive */
508c2ecf20Sopenharmony_ci#define HPC3_PDMACTRL_FLSH	0x00000008 /* enable flush for receive DMA */
518c2ecf20Sopenharmony_ci#define HPC3_PDMACTRL_ACT	0x00000010 /* start dma transfer */
528c2ecf20Sopenharmony_ci#define HPC3_PDMACTRL_LD	0x00000020 /* load enable for ACT */
538c2ecf20Sopenharmony_ci#define HPC3_PDMACTRL_RT	0x00000040 /* Use realtime GIO bus servicing */
548c2ecf20Sopenharmony_ci#define HPC3_PDMACTRL_HW	0x0000ff00 /* DMA High-water mark */
558c2ecf20Sopenharmony_ci#define HPC3_PDMACTRL_FB	0x003f0000 /* Ptr to beginning of fifo */
568c2ecf20Sopenharmony_ci#define HPC3_PDMACTRL_FE	0x3f000000 /* Ptr to end of fifo */
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci	u32 _unused1[0x1000/4 - 1];	/* padding */
598c2ecf20Sopenharmony_ci};
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci/* The HPC3 SCSI registers, this does not include external ones. */
628c2ecf20Sopenharmony_cistruct hpc3_scsiregs {
638c2ecf20Sopenharmony_ci	volatile u32 cbptr;	/* current dma buffer ptr, diagnostic use only */
648c2ecf20Sopenharmony_ci	volatile u32 ndptr;	/* next dma descriptor ptr */
658c2ecf20Sopenharmony_ci	u32 _unused0[0x1000/4 - 2];	/* padding */
668c2ecf20Sopenharmony_ci	volatile u32 bcd;	/* byte count info */
678c2ecf20Sopenharmony_ci#define HPC3_SBCD_BCNTMSK 0x00003fff /* bytes to transfer from/to memory */
688c2ecf20Sopenharmony_ci#define HPC3_SBCD_XIE	  0x00004000 /* Send IRQ when done with cur buf */
698c2ecf20Sopenharmony_ci#define HPC3_SBCD_EOX	  0x00008000 /* Indicates this is last buf in chain */
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci	volatile u32 ctrl;    /* control register */
728c2ecf20Sopenharmony_ci#define HPC3_SCTRL_IRQ	  0x01 /* IRQ asserted, either dma done or parity */
738c2ecf20Sopenharmony_ci#define HPC3_SCTRL_ENDIAN 0x02 /* DMA endian mode, 0=big 1=little */
748c2ecf20Sopenharmony_ci#define HPC3_SCTRL_DIR	  0x04 /* DMA direction, 1=dev2mem 0=mem2dev */
758c2ecf20Sopenharmony_ci#define HPC3_SCTRL_FLUSH  0x08 /* Tells HPC3 to flush scsi fifos */
768c2ecf20Sopenharmony_ci#define HPC3_SCTRL_ACTIVE 0x10 /* SCSI DMA channel is active */
778c2ecf20Sopenharmony_ci#define HPC3_SCTRL_AMASK  0x20 /* DMA active inhibits PIO */
788c2ecf20Sopenharmony_ci#define HPC3_SCTRL_CRESET 0x40 /* Resets dma channel and external controller */
798c2ecf20Sopenharmony_ci#define HPC3_SCTRL_PERR	  0x80 /* Bad parity on HPC3 iface to scsi controller */
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci	volatile u32 gfptr;	/* current GIO fifo ptr */
828c2ecf20Sopenharmony_ci	volatile u32 dfptr;	/* current device fifo ptr */
838c2ecf20Sopenharmony_ci	volatile u32 dconfig;	/* DMA configuration register */
848c2ecf20Sopenharmony_ci#define HPC3_SDCFG_HCLK 0x00001 /* Enable DMA half clock mode */
858c2ecf20Sopenharmony_ci#define HPC3_SDCFG_D1	0x00006 /* Cycles to spend in D1 state */
868c2ecf20Sopenharmony_ci#define HPC3_SDCFG_D2	0x00038 /* Cycles to spend in D2 state */
878c2ecf20Sopenharmony_ci#define HPC3_SDCFG_D3	0x001c0 /* Cycles to spend in D3 state */
888c2ecf20Sopenharmony_ci#define HPC3_SDCFG_HWAT 0x00e00 /* DMA high water mark */
898c2ecf20Sopenharmony_ci#define HPC3_SDCFG_HW	0x01000 /* Enable 16-bit halfword DMA accesses to scsi */
908c2ecf20Sopenharmony_ci#define HPC3_SDCFG_SWAP 0x02000 /* Byte swap all DMA accesses */
918c2ecf20Sopenharmony_ci#define HPC3_SDCFG_EPAR 0x04000 /* Enable parity checking for DMA */
928c2ecf20Sopenharmony_ci#define HPC3_SDCFG_POLL 0x08000 /* hd_dreq polarity control */
938c2ecf20Sopenharmony_ci#define HPC3_SDCFG_ERLY 0x30000 /* hd_dreq behavior control bits */
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci	volatile u32 pconfig;	/* PIO configuration register */
968c2ecf20Sopenharmony_ci#define HPC3_SPCFG_P3	0x0003 /* Cycles to spend in P3 state */
978c2ecf20Sopenharmony_ci#define HPC3_SPCFG_P2W	0x001c /* Cycles to spend in P2 state for writes */
988c2ecf20Sopenharmony_ci#define HPC3_SPCFG_P2R	0x01e0 /* Cycles to spend in P2 state for reads */
998c2ecf20Sopenharmony_ci#define HPC3_SPCFG_P1	0x0e00 /* Cycles to spend in P1 state */
1008c2ecf20Sopenharmony_ci#define HPC3_SPCFG_HW	0x1000 /* Enable 16-bit halfword PIO accesses to scsi */
1018c2ecf20Sopenharmony_ci#define HPC3_SPCFG_SWAP 0x2000 /* Byte swap all PIO accesses */
1028c2ecf20Sopenharmony_ci#define HPC3_SPCFG_EPAR 0x4000 /* Enable parity checking for PIO */
1038c2ecf20Sopenharmony_ci#define HPC3_SPCFG_FUJI 0x8000 /* Fujitsu scsi controller mode for faster dma/pio */
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci	u32 _unused1[0x1000/4 - 6];	/* padding */
1068c2ecf20Sopenharmony_ci};
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/* SEEQ ethernet HPC3 registers, only one seeq per HPC3. */
1098c2ecf20Sopenharmony_cistruct hpc3_ethregs {
1108c2ecf20Sopenharmony_ci	/* Receiver registers. */
1118c2ecf20Sopenharmony_ci	volatile u32 rx_cbptr;	 /* current dma buffer ptr, diagnostic use only */
1128c2ecf20Sopenharmony_ci	volatile u32 rx_ndptr;	 /* next dma descriptor ptr */
1138c2ecf20Sopenharmony_ci	u32 _unused0[0x1000/4 - 2];	/* padding */
1148c2ecf20Sopenharmony_ci	volatile u32 rx_bcd;	/* byte count info */
1158c2ecf20Sopenharmony_ci#define HPC3_ERXBCD_BCNTMSK 0x00003fff /* bytes to be sent to memory */
1168c2ecf20Sopenharmony_ci#define HPC3_ERXBCD_XIE	    0x20000000 /* HPC3 interrupts cpu at end of this buf */
1178c2ecf20Sopenharmony_ci#define HPC3_ERXBCD_EOX	    0x80000000 /* flags this as end of descriptor chain */
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci	volatile u32 rx_ctrl;	/* control register */
1208c2ecf20Sopenharmony_ci#define HPC3_ERXCTRL_STAT50 0x0000003f /* Receive status reg bits of Seeq8003 */
1218c2ecf20Sopenharmony_ci#define HPC3_ERXCTRL_STAT6  0x00000040 /* Rdonly irq status */
1228c2ecf20Sopenharmony_ci#define HPC3_ERXCTRL_STAT7  0x00000080 /* Rdonlt old/new status bit from Seeq */
1238c2ecf20Sopenharmony_ci#define HPC3_ERXCTRL_ENDIAN 0x00000100 /* Endian for dma channel, little=1 big=0 */
1248c2ecf20Sopenharmony_ci#define HPC3_ERXCTRL_ACTIVE 0x00000200 /* Tells if DMA transfer is in progress */
1258c2ecf20Sopenharmony_ci#define HPC3_ERXCTRL_AMASK  0x00000400 /* Tells if ACTIVE inhibits PIO's to hpc3 */
1268c2ecf20Sopenharmony_ci#define HPC3_ERXCTRL_RBO    0x00000800 /* Receive buffer overflow if set to 1 */
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci	volatile u32 rx_gfptr;	/* current GIO fifo ptr */
1298c2ecf20Sopenharmony_ci	volatile u32 rx_dfptr;	/* current device fifo ptr */
1308c2ecf20Sopenharmony_ci	u32 _unused1;		/* padding */
1318c2ecf20Sopenharmony_ci	volatile u32 reset;	/* reset register */
1328c2ecf20Sopenharmony_ci#define HPC3_ERST_CRESET 0x1	/* Reset dma channel and external controller */
1338c2ecf20Sopenharmony_ci#define HPC3_ERST_CLRIRQ 0x2	/* Clear channel interrupt */
1348c2ecf20Sopenharmony_ci#define HPC3_ERST_LBACK	 0x4	/* Enable diagnostic loopback mode of Seeq8003 */
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci	volatile u32 dconfig;	 /* DMA configuration register */
1378c2ecf20Sopenharmony_ci#define HPC3_EDCFG_D1	 0x0000f /* Cycles to spend in D1 state for PIO */
1388c2ecf20Sopenharmony_ci#define HPC3_EDCFG_D2	 0x000f0 /* Cycles to spend in D2 state for PIO */
1398c2ecf20Sopenharmony_ci#define HPC3_EDCFG_D3	 0x00f00 /* Cycles to spend in D3 state for PIO */
1408c2ecf20Sopenharmony_ci#define HPC3_EDCFG_WCTRL 0x01000 /* Enable writes of desc into ex ctrl port */
1418c2ecf20Sopenharmony_ci#define HPC3_EDCFG_FRXDC 0x02000 /* Clear eop stat bits upon rxdc, hw seeq fix */
1428c2ecf20Sopenharmony_ci#define HPC3_EDCFG_FEOP	 0x04000 /* Bad packet marker timeout enable */
1438c2ecf20Sopenharmony_ci#define HPC3_EDCFG_FIRQ	 0x08000 /* Another bad packet timeout enable */
1448c2ecf20Sopenharmony_ci#define HPC3_EDCFG_PTO	 0x30000 /* Programmed timeout value for above two */
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci	volatile u32 pconfig;	/* PIO configuration register */
1478c2ecf20Sopenharmony_ci#define HPC3_EPCFG_P1	 0x000f /* Cycles to spend in P1 state for PIO */
1488c2ecf20Sopenharmony_ci#define HPC3_EPCFG_P2	 0x00f0 /* Cycles to spend in P2 state for PIO */
1498c2ecf20Sopenharmony_ci#define HPC3_EPCFG_P3	 0x0f00 /* Cycles to spend in P3 state for PIO */
1508c2ecf20Sopenharmony_ci#define HPC3_EPCFG_TST	 0x1000 /* Diagnostic ram test feature bit */
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci	u32 _unused2[0x1000/4 - 8];	/* padding */
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci	/* Transmitter registers. */
1558c2ecf20Sopenharmony_ci	volatile u32 tx_cbptr;	/* current dma buffer ptr, diagnostic use only */
1568c2ecf20Sopenharmony_ci	volatile u32 tx_ndptr;	/* next dma descriptor ptr */
1578c2ecf20Sopenharmony_ci	u32 _unused3[0x1000/4 - 2];	/* padding */
1588c2ecf20Sopenharmony_ci	volatile u32 tx_bcd;		/* byte count info */
1598c2ecf20Sopenharmony_ci#define HPC3_ETXBCD_BCNTMSK 0x00003fff	/* bytes to be read from memory */
1608c2ecf20Sopenharmony_ci#define HPC3_ETXBCD_ESAMP   0x10000000	/* if set, too late to add descriptor */
1618c2ecf20Sopenharmony_ci#define HPC3_ETXBCD_XIE	    0x20000000	/* Interrupt cpu at end of cur desc */
1628c2ecf20Sopenharmony_ci#define HPC3_ETXBCD_EOP	    0x40000000	/* Last byte of cur buf is end of packet */
1638c2ecf20Sopenharmony_ci#define HPC3_ETXBCD_EOX	    0x80000000	/* This buf is the end of desc chain */
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci	volatile u32 tx_ctrl;		/* control register */
1668c2ecf20Sopenharmony_ci#define HPC3_ETXCTRL_STAT30 0x0000000f	/* Rdonly copy of seeq tx stat reg */
1678c2ecf20Sopenharmony_ci#define HPC3_ETXCTRL_STAT4  0x00000010	/* Indicate late collision occurred */
1688c2ecf20Sopenharmony_ci#define HPC3_ETXCTRL_STAT75 0x000000e0	/* Rdonly irq status from seeq */
1698c2ecf20Sopenharmony_ci#define HPC3_ETXCTRL_ENDIAN 0x00000100	/* DMA channel endian mode, 1=little 0=big */
1708c2ecf20Sopenharmony_ci#define HPC3_ETXCTRL_ACTIVE 0x00000200	/* DMA tx channel is active */
1718c2ecf20Sopenharmony_ci#define HPC3_ETXCTRL_AMASK  0x00000400	/* Indicates ACTIVE inhibits PIO's */
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci	volatile u32 tx_gfptr;		/* current GIO fifo ptr */
1748c2ecf20Sopenharmony_ci	volatile u32 tx_dfptr;		/* current device fifo ptr */
1758c2ecf20Sopenharmony_ci	u32 _unused4[0x1000/4 - 4];	/* padding */
1768c2ecf20Sopenharmony_ci};
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_cistruct hpc3_regs {
1798c2ecf20Sopenharmony_ci	/* First regs for the PBUS 8 dma channels. */
1808c2ecf20Sopenharmony_ci	struct hpc3_pbus_dmacregs pbdma[8];
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci	/* Now the HPC scsi registers, we get two scsi reg sets. */
1838c2ecf20Sopenharmony_ci	struct hpc3_scsiregs scsi_chan0, scsi_chan1;
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci	/* The SEEQ hpc3 ethernet dma/control registers. */
1868c2ecf20Sopenharmony_ci	struct hpc3_ethregs ethregs;
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci	/* Here are where the hpc3 fifo's can be directly accessed
1898c2ecf20Sopenharmony_ci	 * via PIO accesses.  Under normal operation we never stick
1908c2ecf20Sopenharmony_ci	 * our grubby paws in here so it's just padding. */
1918c2ecf20Sopenharmony_ci	u32 _unused0[0x18000/4];
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci	/* HPC3 irq status regs.  Due to a peculiar bug you need to
1948c2ecf20Sopenharmony_ci	 * look at two different register addresses to get at all of
1958c2ecf20Sopenharmony_ci	 * the status bits.  The first reg can only reliably report
1968c2ecf20Sopenharmony_ci	 * bits 4:0 of the status, and the second reg can only
1978c2ecf20Sopenharmony_ci	 * reliably report bits 9:5 of the hpc3 irq status.  I told
1988c2ecf20Sopenharmony_ci	 * you it was a peculiar bug. ;-)
1998c2ecf20Sopenharmony_ci	 */
2008c2ecf20Sopenharmony_ci	volatile u32 istat0;		/* Irq status, only bits <4:0> reliable. */
2018c2ecf20Sopenharmony_ci#define HPC3_ISTAT_PBIMASK	0x0ff	/* irq bits for pbus devs 0 --> 7 */
2028c2ecf20Sopenharmony_ci#define HPC3_ISTAT_SC0MASK	0x100	/* irq bit for scsi channel 0 */
2038c2ecf20Sopenharmony_ci#define HPC3_ISTAT_SC1MASK	0x200	/* irq bit for scsi channel 1 */
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci	volatile u32 gio_misc;		/* GIO misc control bits. */
2068c2ecf20Sopenharmony_ci#define HPC3_GIOMISC_ERTIME	0x1	/* Enable external timer real time. */
2078c2ecf20Sopenharmony_ci#define HPC3_GIOMISC_DENDIAN	0x2	/* dma descriptor endian, 1=lit 0=big */
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci	u32 eeprom;			/* EEPROM data reg. */
2108c2ecf20Sopenharmony_ci#define HPC3_EEPROM_EPROT	0x01	/* Protect register enable */
2118c2ecf20Sopenharmony_ci#define HPC3_EEPROM_CSEL	0x02	/* Chip select */
2128c2ecf20Sopenharmony_ci#define HPC3_EEPROM_ECLK	0x04	/* EEPROM clock */
2138c2ecf20Sopenharmony_ci#define HPC3_EEPROM_DATO	0x08	/* Data out */
2148c2ecf20Sopenharmony_ci#define HPC3_EEPROM_DATI	0x10	/* Data in */
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci	volatile u32 istat1;		/* Irq status, only bits <9:5> reliable. */
2178c2ecf20Sopenharmony_ci	volatile u32 bestat;		/* Bus error interrupt status reg. */
2188c2ecf20Sopenharmony_ci#define HPC3_BESTAT_BLMASK	0x000ff /* Bus lane where bad parity occurred */
2198c2ecf20Sopenharmony_ci#define HPC3_BESTAT_CTYPE	0x00100 /* Bus cycle type, 0=PIO 1=DMA */
2208c2ecf20Sopenharmony_ci#define HPC3_BESTAT_PIDSHIFT	9
2218c2ecf20Sopenharmony_ci#define HPC3_BESTAT_PIDMASK	0x3f700 /* DMA channel parity identifier */
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci	u32 _unused1[0x14000/4 - 5];	/* padding */
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci	/* Now direct PIO per-HPC3 peripheral access to external regs. */
2268c2ecf20Sopenharmony_ci	volatile u32 scsi0_ext[256];	/* SCSI channel 0 external regs */
2278c2ecf20Sopenharmony_ci	u32 _unused2[0x7c00/4];
2288c2ecf20Sopenharmony_ci	volatile u32 scsi1_ext[256];	/* SCSI channel 1 external regs */
2298c2ecf20Sopenharmony_ci	u32 _unused3[0x7c00/4];
2308c2ecf20Sopenharmony_ci	volatile u32 eth_ext[320];	/* Ethernet external registers */
2318c2ecf20Sopenharmony_ci	u32 _unused4[0x3b00/4];
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci	/* Per-peripheral device external registers and DMA/PIO control. */
2348c2ecf20Sopenharmony_ci	volatile u32 pbus_extregs[16][256];
2358c2ecf20Sopenharmony_ci	volatile u32 pbus_dmacfg[8][128];
2368c2ecf20Sopenharmony_ci	/* Cycles to spend in D3 for reads */
2378c2ecf20Sopenharmony_ci#define HPC3_DMACFG_D3R_MASK		0x00000001
2388c2ecf20Sopenharmony_ci#define HPC3_DMACFG_D3R_SHIFT		0
2398c2ecf20Sopenharmony_ci	/* Cycles to spend in D4 for reads */
2408c2ecf20Sopenharmony_ci#define HPC3_DMACFG_D4R_MASK		0x0000001e
2418c2ecf20Sopenharmony_ci#define HPC3_DMACFG_D4R_SHIFT		1
2428c2ecf20Sopenharmony_ci	/* Cycles to spend in D5 for reads */
2438c2ecf20Sopenharmony_ci#define HPC3_DMACFG_D5R_MASK		0x000001e0
2448c2ecf20Sopenharmony_ci#define HPC3_DMACFG_D5R_SHIFT		5
2458c2ecf20Sopenharmony_ci	/* Cycles to spend in D3 for writes */
2468c2ecf20Sopenharmony_ci#define HPC3_DMACFG_D3W_MASK		0x00000200
2478c2ecf20Sopenharmony_ci#define HPC3_DMACFG_D3W_SHIFT		9
2488c2ecf20Sopenharmony_ci	/* Cycles to spend in D4 for writes */
2498c2ecf20Sopenharmony_ci#define HPC3_DMACFG_D4W_MASK		0x00003c00
2508c2ecf20Sopenharmony_ci#define HPC3_DMACFG_D4W_SHIFT		10
2518c2ecf20Sopenharmony_ci	/* Cycles to spend in D5 for writes */
2528c2ecf20Sopenharmony_ci#define HPC3_DMACFG_D5W_MASK		0x0003c000
2538c2ecf20Sopenharmony_ci#define HPC3_DMACFG_D5W_SHIFT		14
2548c2ecf20Sopenharmony_ci	/* Enable 16-bit DMA access mode */
2558c2ecf20Sopenharmony_ci#define HPC3_DMACFG_DS16		0x00040000
2568c2ecf20Sopenharmony_ci	/* Places halfwords on high 16 bits of bus */
2578c2ecf20Sopenharmony_ci#define HPC3_DMACFG_EVENHI		0x00080000
2588c2ecf20Sopenharmony_ci	/* Make this device real time */
2598c2ecf20Sopenharmony_ci#define HPC3_DMACFG_RTIME		0x00200000
2608c2ecf20Sopenharmony_ci	/* 5 bit burst count for DMA device */
2618c2ecf20Sopenharmony_ci#define HPC3_DMACFG_BURST_MASK		0x07c00000
2628c2ecf20Sopenharmony_ci#define HPC3_DMACFG_BURST_SHIFT 22
2638c2ecf20Sopenharmony_ci	/* Use live pbus_dreq unsynchronized signal */
2648c2ecf20Sopenharmony_ci#define HPC3_DMACFG_DRQLIVE		0x08000000
2658c2ecf20Sopenharmony_ci	volatile u32 pbus_piocfg[16][64];
2668c2ecf20Sopenharmony_ci	/* Cycles to spend in P2 state for reads */
2678c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_P2R_MASK		0x00001
2688c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_P2R_SHIFT		0
2698c2ecf20Sopenharmony_ci	/* Cycles to spend in P3 state for reads */
2708c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_P3R_MASK		0x0001e
2718c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_P3R_SHIFT		1
2728c2ecf20Sopenharmony_ci	/* Cycles to spend in P4 state for reads */
2738c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_P4R_MASK		0x001e0
2748c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_P4R_SHIFT		5
2758c2ecf20Sopenharmony_ci	/* Cycles to spend in P2 state for writes */
2768c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_P2W_MASK		0x00200
2778c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_P2W_SHIFT		9
2788c2ecf20Sopenharmony_ci	/* Cycles to spend in P3 state for writes */
2798c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_P3W_MASK		0x03c00
2808c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_P3W_SHIFT		10
2818c2ecf20Sopenharmony_ci	/* Cycles to spend in P4 state for writes */
2828c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_P4W_MASK		0x3c000
2838c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_P4W_SHIFT		14
2848c2ecf20Sopenharmony_ci	/* Enable 16-bit PIO accesses */
2858c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_DS16		0x40000
2868c2ecf20Sopenharmony_ci	/* Place even address bits in bits <15:8> */
2878c2ecf20Sopenharmony_ci#define HPC3_PIOCFG_EVENHI		0x80000
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci	/* PBUS PROM control regs. */
2908c2ecf20Sopenharmony_ci	volatile u32 pbus_promwe;	/* PROM write enable register */
2918c2ecf20Sopenharmony_ci#define HPC3_PROM_WENAB 0x1	/* Enable writes to the PROM */
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci	u32 _unused5[0x0800/4 - 1];
2948c2ecf20Sopenharmony_ci	volatile u32 pbus_promswap;	/* Chip select swap reg */
2958c2ecf20Sopenharmony_ci#define HPC3_PROM_SWAP	0x1	/* invert GIO addr bit to select prom0 or prom1 */
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci	u32 _unused6[0x0800/4 - 1];
2988c2ecf20Sopenharmony_ci	volatile u32 pbus_gout; /* PROM general purpose output reg */
2998c2ecf20Sopenharmony_ci#define HPC3_PROM_STAT	0x1	/* General purpose status bit in gout */
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci	u32 _unused7[0x1000/4 - 1];
3028c2ecf20Sopenharmony_ci	volatile u32 rtcregs[14];	/* Dallas clock registers */
3038c2ecf20Sopenharmony_ci	u32 _unused8[50];
3048c2ecf20Sopenharmony_ci	volatile u32 bbram[8192-50-14]; /* Battery backed ram */
3058c2ecf20Sopenharmony_ci};
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci/*
3088c2ecf20Sopenharmony_ci * It is possible to have two HPC3's within the address space on
3098c2ecf20Sopenharmony_ci * one machine, though only having one is more likely on an Indy.
3108c2ecf20Sopenharmony_ci */
3118c2ecf20Sopenharmony_ciextern struct hpc3_regs *hpc3c0, *hpc3c1;
3128c2ecf20Sopenharmony_ci#define HPC3_CHIP0_BASE		0x1fb80000	/* physical */
3138c2ecf20Sopenharmony_ci#define HPC3_CHIP1_BASE		0x1fb00000	/* physical */
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ciextern void sgihpc_init(void);
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci#endif /* _SGI_HPC3_H */
318