Home | History | Annotate | Line # | Download | only in apbus
spifireg.h revision 1.1.60.1
      1  1.1.60.1    yamt /*	$NetBSD: spifireg.h,v 1.1.60.1 2006/09/03 15:23:26 yamt Exp $	*/
      2       1.1  tsubai 
      3       1.1  tsubai /*-
      4       1.1  tsubai  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
      5       1.1  tsubai  *
      6       1.1  tsubai  * Redistribution and use in source and binary forms, with or without
      7       1.1  tsubai  * modification, are permitted provided that the following conditions
      8       1.1  tsubai  * are met:
      9       1.1  tsubai  * 1. Redistributions of source code must retain the above copyright
     10       1.1  tsubai  *    notice, this list of conditions and the following disclaimer.
     11       1.1  tsubai  * 2. Redistributions in binary form must reproduce the above copyright
     12       1.1  tsubai  *    notice, this list of conditions and the following disclaimer in the
     13       1.1  tsubai  *    documentation and/or other materials provided with the distribution.
     14       1.1  tsubai  * 3. The name of the author may not be used to endorse or promote products
     15       1.1  tsubai  *    derived from this software without specific prior written permission.
     16       1.1  tsubai  *
     17       1.1  tsubai  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     18       1.1  tsubai  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     19       1.1  tsubai  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20       1.1  tsubai  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     21       1.1  tsubai  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     22       1.1  tsubai  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23       1.1  tsubai  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24       1.1  tsubai  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25       1.1  tsubai  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     26       1.1  tsubai  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27       1.1  tsubai  */
     28       1.1  tsubai 
     29       1.1  tsubai struct spifi_reg {
     30  1.1.60.1    yamt 	volatile uint32_t spstat;	/* RO: SPIFI state		*/
     31  1.1.60.1    yamt 	volatile uint32_t cmlen;	/* RW: Command/message length	*/
     32  1.1.60.1    yamt 	volatile uint32_t cmdpage;	/* RW: Command page		*/
     33  1.1.60.1    yamt 	volatile uint32_t count_hi;	/* RW: Data count (high)	*/
     34  1.1.60.1    yamt 	volatile uint32_t count_mid;	/* RW:            (mid)		*/
     35  1.1.60.1    yamt 	volatile uint32_t count_low;	/* RW:            (low)		*/
     36  1.1.60.1    yamt 	volatile uint32_t svptr_hi;	/* RO: Saved data pointer (high)*/
     37  1.1.60.1    yamt 	volatile uint32_t svptr_mid;	/* RO:                    (mid)	*/
     38  1.1.60.1    yamt 	volatile uint32_t svptr_low;	/* RO:                    (low) */
     39  1.1.60.1    yamt 	volatile uint32_t intr;		/* RW: Processor interrupt	*/
     40  1.1.60.1    yamt 	volatile uint32_t imask;	/* RW: Processor interrupt mask	*/
     41  1.1.60.1    yamt 	volatile uint32_t prctrl;	/* RW: Processor control	*/
     42  1.1.60.1    yamt 	volatile uint32_t prstat;	/* RO: Processor status		*/
     43  1.1.60.1    yamt 	volatile uint32_t init_status;	/* RO: Initiator status		*/
     44  1.1.60.1    yamt 	volatile uint32_t fifoctrl;	/* RW: FIFO control		*/
     45  1.1.60.1    yamt 	volatile uint32_t fifodata;	/* RW: FIFO data		*/
     46  1.1.60.1    yamt 	volatile uint32_t config;	/* RW: Configuration		*/
     47  1.1.60.1    yamt 	volatile uint32_t data_xfer;	/* RW: Data transfer		*/
     48  1.1.60.1    yamt 	volatile uint32_t autocmd;	/* RW: Auto command control	*/
     49  1.1.60.1    yamt 	volatile uint32_t autostat;	/* RW: Auto status control	*/
     50  1.1.60.1    yamt 	volatile uint32_t resel;	/* RW: Reselection		*/
     51  1.1.60.1    yamt 	volatile uint32_t select;	/* RW: Selection		*/
     52  1.1.60.1    yamt 	volatile uint32_t prcmd;	/* WO: Processor command	*/
     53  1.1.60.1    yamt 	volatile uint32_t auxctrl;	/* RW: Aux control		*/
     54  1.1.60.1    yamt 	volatile uint32_t autodata;	/* RW: Auto data control	*/
     55  1.1.60.1    yamt 	volatile uint32_t loopctrl;	/* RW: Loopback control		*/
     56  1.1.60.1    yamt 	volatile uint32_t loopdata;	/* RW: Loopback data		*/
     57  1.1.60.1    yamt 	volatile uint32_t identify;	/* WO: Identify (?)		*/
     58  1.1.60.1    yamt 	volatile uint32_t complete;	/* WO: Command complete (?)	*/
     59  1.1.60.1    yamt 	volatile uint32_t scsi_status;	/* WO: SCSI status (?)		*/
     60  1.1.60.1    yamt 	volatile uint32_t data;		/* RW: Data register (?)	*/
     61  1.1.60.1    yamt 	volatile uint32_t icond;	/* RO: Interrupt condition	*/
     62  1.1.60.1    yamt 	volatile uint32_t fastwide;	/* RW: Fast/wide enable		*/
     63  1.1.60.1    yamt 	volatile uint32_t exctrl;	/* RW: Extended control		*/
     64  1.1.60.1    yamt 	volatile uint32_t exstat;	/* RW: Extended status		*/
     65  1.1.60.1    yamt 	volatile uint32_t test;		/* RW: SPIFI test register	*/
     66  1.1.60.1    yamt 	volatile uint32_t quematch;	/* RW: Queue match		*/
     67  1.1.60.1    yamt 	volatile uint32_t quecode;	/* RW: Queue code		*/
     68  1.1.60.1    yamt 	volatile uint32_t quetag;	/* RW: Queue tag		*/
     69  1.1.60.1    yamt 	volatile uint32_t quepage;	/* RW: Queue page		*/
     70  1.1.60.1    yamt 	uint32_t image[88];		/* (image of the above)		*/
     71       1.1  tsubai 	struct {
     72  1.1.60.1    yamt 		volatile uint32_t cdb[12]; /* RW: Command descriptor block */
     73  1.1.60.1    yamt 		volatile uint32_t quecode; /* RW: Queue code		*/
     74  1.1.60.1    yamt 		volatile uint32_t quetag;  /* RW: Queue tag		*/
     75  1.1.60.1    yamt 		volatile uint32_t idmsg;   /* RW: Identify message     	*/
     76  1.1.60.1    yamt 		volatile uint32_t status;  /* RW: SCSI status		*/
     77       1.1  tsubai 	} cmbuf[8];
     78       1.1  tsubai };
     79       1.1  tsubai 
     80       1.1  tsubai /* spstat */
     81       1.1  tsubai #define SPS_IDLE	0x00
     82       1.1  tsubai #define SPS_SEL		0x01
     83       1.1  tsubai #define SPS_ARB		0x02
     84       1.1  tsubai #define SPS_RESEL	0x03
     85       1.1  tsubai #define SPS_MSGOUT	0x04
     86       1.1  tsubai #define SPS_COMMAND	0x05
     87       1.1  tsubai #define SPS_DISCON	0x06
     88       1.1  tsubai #define SPS_NXIN	0x07
     89       1.1  tsubai #define SPS_INTR	0x08
     90       1.1  tsubai #define SPS_NXOUT	0x09
     91       1.1  tsubai #define SPS_CCOMP	0x0a
     92       1.1  tsubai #define SPS_SVPTR	0x0b
     93       1.1  tsubai #define SPS_STATUS	0x0c
     94       1.1  tsubai #define SPS_MSGIN	0x0d
     95       1.1  tsubai #define SPS_DATAOUT	0x0e
     96       1.1  tsubai #define SPS_DATAIN	0x0f
     97       1.1  tsubai 
     98       1.1  tsubai /* cmlen */
     99       1.1  tsubai #define CML_LENMASK	0x0f
    100       1.1  tsubai #define CML_AMSG_EN	0x40
    101       1.1  tsubai #define CML_ACOM_EN	0x80
    102       1.1  tsubai 
    103       1.1  tsubai /* intr and imask */
    104       1.1  tsubai #define INTR_BSRQ	0x01
    105       1.1  tsubai #define INTR_COMRECV	0x02
    106       1.1  tsubai #define INTR_PERR	0x04
    107       1.1  tsubai #define INTR_TIMEO	0x08
    108       1.1  tsubai #define INTR_DERR	0x10
    109       1.1  tsubai #define INTR_TGSEL	0x20
    110       1.1  tsubai #define INTR_DISCON	0x40
    111       1.1  tsubai #define INTR_FCOMP	0x80
    112       1.1  tsubai 
    113       1.1  tsubai #define INTR_BITMASK \
    114       1.1  tsubai     "\20\10FCOMP\07DISCON\06TGSEL\05DERR\04TIMEO\03PERR\02COMRECV\01BSRQ"
    115       1.1  tsubai 
    116       1.1  tsubai /* prstat */
    117       1.1  tsubai #define PRS_IO		0x08
    118       1.1  tsubai #define PRS_CD		0x10
    119       1.1  tsubai #define PRS_MSG		0x20
    120       1.1  tsubai #define PRS_ATN		0x40
    121       1.1  tsubai #define PRS_Z		0x80
    122       1.1  tsubai #define PRS_PHASE	(PRS_MSG | PRS_CD | PRS_IO)
    123       1.1  tsubai 
    124       1.1  tsubai #define PRS_BITMASK "\20\10Z\07ATN\06MSG\05CD\04IO"
    125       1.1  tsubai 
    126       1.1  tsubai /* init_status */
    127       1.1  tsubai #define IST_ACK		0x40
    128       1.1  tsubai 
    129       1.1  tsubai /* fifoctrl */
    130       1.1  tsubai #define FIFOC_FSLOT	0x0f	/* Free slots in FIFO */
    131       1.1  tsubai #define FIFOC_SSTKACT	0x10	/* Synchronous stack active (?) */
    132       1.1  tsubai #define FIFOC_RQOVRN	0x20
    133       1.1  tsubai #define FIFOC_CLREVEN	0x00
    134       1.1  tsubai #define FIFOC_CLRODD	0x40
    135       1.1  tsubai #define FIFOC_FLUSH	0x80
    136       1.1  tsubai #define FIFOC_LOAD	0xc0
    137       1.1  tsubai 
    138       1.1  tsubai /* config */
    139       1.1  tsubai #define CONFIG_PGENEN	0x08	/* Parity generation enable */
    140       1.1  tsubai #define CONFIG_PCHKEN	0x10	/* Parity checking enable */
    141       1.1  tsubai #define CONFIG_WORDEN	0x20
    142       1.1  tsubai #define CONFIG_AUTOID	0x40
    143       1.1  tsubai #define CONFIG_DMABURST	0x80
    144       1.1  tsubai 
    145       1.1  tsubai /* select */
    146       1.1  tsubai #define SEL_SETATN	0x02
    147       1.1  tsubai #define SEL_IRESELEN	0x04
    148       1.1  tsubai #define SEL_ISTART	0x08
    149       1.1  tsubai #define SEL_WATN	0x80
    150       1.1  tsubai 
    151       1.1  tsubai /* prcmd */
    152       1.1  tsubai #define PRC_DATAOUT	0
    153       1.1  tsubai #define PRC_DATAIN	1
    154       1.1  tsubai #define PRC_COMMAND	2
    155       1.1  tsubai #define PRC_STATUS	3
    156       1.1  tsubai #define PRC_TRPAD	4
    157       1.1  tsubai #define PRC_MSGOUT	6
    158       1.1  tsubai #define PRC_MSGIN	7
    159       1.1  tsubai #define PRC_KILLREQ	0x08
    160       1.1  tsubai #define PRC_CLRACK	0x10
    161       1.1  tsubai #define PRC_NJMP	0x80
    162       1.1  tsubai 
    163       1.1  tsubai /* auxctrl */
    164       1.1  tsubai #define AUXCTRL_DMAEDGE	0x04
    165       1.1  tsubai #define AUXCTRL_SETRST	0x20	/* Bus reset (?) */
    166       1.1  tsubai #define AUXCTRL_CRST	0x40
    167       1.1  tsubai #define AUXCTRL_SRST	0x80
    168       1.1  tsubai 
    169       1.1  tsubai /* autodata */
    170       1.1  tsubai #define ADATA_IN	0x40
    171       1.1  tsubai #define ADATA_EN	0x80
    172       1.1  tsubai 
    173       1.1  tsubai /* icond */
    174       1.1  tsubai #define ICOND_ADATAOFF	0x02
    175       1.1  tsubai #define ICOND_AMSGOFF	0x06
    176       1.1  tsubai #define ICOND_ACMDOFF	0x0a
    177       1.1  tsubai #define ICOND_ASTATOFF	0x0e
    178       1.1  tsubai #define ICOND_SVPTEXP	0x10
    179       1.1  tsubai #define ICOND_ADATAMIS	0x20
    180       1.1  tsubai #define ICOND_CNTZERO	0x40
    181       1.1  tsubai #define ICOND_UXPHASEZ	0x80
    182       1.1  tsubai #define ICOND_UXPHASENZ	0x81
    183       1.1  tsubai #define ICOND_NXTREQ	0xa0
    184       1.1  tsubai #define ICOND_UKMSGZ	0xc0
    185       1.1  tsubai #define ICOND_UKMSGNZ	0xc1
    186       1.1  tsubai #define ICOND_UBF	0xe0	/* Unexpected bus free */
    187       1.1  tsubai 
    188       1.1  tsubai /* fastwide */
    189       1.1  tsubai #define FAST_FASTEN	0x01
    190       1.1  tsubai 
    191       1.1  tsubai /* exctrl */
    192       1.1  tsubai #define EXC_IPLOCK	0x04	/* Initiator page lock */
    193       1.1  tsubai 
    194       1.1  tsubai /* exstat */
    195       1.1  tsubai #define EXS_UBF		0x08	/* Unexpected bus free */
    196