xref: /netbsd-src/sys/arch/mips/alchemy/dev/auspireg.h (revision bcad08160c061e64201ae8009c2855065c35042b)
1*bcad0816Sgdamore /* $NetBSD: auspireg.h,v 1.1 2006/10/02 08:00:07 gdamore Exp $ */
2*bcad0816Sgdamore 
3*bcad0816Sgdamore /*-
4*bcad0816Sgdamore  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
5*bcad0816Sgdamore  * Copyright (c) 2006 Garrett D'Amore.
6*bcad0816Sgdamore  * All rights reserved.
7*bcad0816Sgdamore  *
8*bcad0816Sgdamore  * Portions of this code were written by Garrett D'Amore for the
9*bcad0816Sgdamore  * Champaign-Urbana Community Wireless Network Project.
10*bcad0816Sgdamore  *
11*bcad0816Sgdamore  * Redistribution and use in source and binary forms, with or
12*bcad0816Sgdamore  * without modification, are permitted provided that the following
13*bcad0816Sgdamore  * conditions are met:
14*bcad0816Sgdamore  * 1. Redistributions of source code must retain the above copyright
15*bcad0816Sgdamore  *    notice, this list of conditions and the following disclaimer.
16*bcad0816Sgdamore  * 2. Redistributions in binary form must reproduce the above
17*bcad0816Sgdamore  *    copyright notice, this list of conditions and the following
18*bcad0816Sgdamore  *    disclaimer in the documentation and/or other materials provided
19*bcad0816Sgdamore  *    with the distribution.
20*bcad0816Sgdamore  * 3. All advertising materials mentioning features or use of this
21*bcad0816Sgdamore  *    software must display the following acknowledgements:
22*bcad0816Sgdamore  *      This product includes software developed by the Urbana-Champaign
23*bcad0816Sgdamore  *      Independent Media Center.
24*bcad0816Sgdamore  *	This product includes software developed by Garrett D'Amore.
25*bcad0816Sgdamore  * 4. Urbana-Champaign Independent Media Center's name and Garrett
26*bcad0816Sgdamore  *    D'Amore's name may not be used to endorse or promote products
27*bcad0816Sgdamore  *    derived from this software without specific prior written permission.
28*bcad0816Sgdamore  *
29*bcad0816Sgdamore  * THIS SOFTWARE IS PROVIDED BY THE URBANA-CHAMPAIGN INDEPENDENT
30*bcad0816Sgdamore  * MEDIA CENTER AND GARRETT D'AMORE ``AS IS'' AND ANY EXPRESS OR
31*bcad0816Sgdamore  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32*bcad0816Sgdamore  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33*bcad0816Sgdamore  * ARE DISCLAIMED.  IN NO EVENT SHALL THE URBANA-CHAMPAIGN INDEPENDENT
34*bcad0816Sgdamore  * MEDIA CENTER OR GARRETT D'AMORE BE LIABLE FOR ANY DIRECT, INDIRECT,
35*bcad0816Sgdamore  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
36*bcad0816Sgdamore  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37*bcad0816Sgdamore  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
38*bcad0816Sgdamore  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39*bcad0816Sgdamore  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40*bcad0816Sgdamore  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
41*bcad0816Sgdamore  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42*bcad0816Sgdamore  */
43*bcad0816Sgdamore 
44*bcad0816Sgdamore #ifndef	_MIPS_ALCHEMY_AUSPIREG_H_
45*bcad0816Sgdamore #define	_MIPS_ALCHEMY_AUSPIREG_H_
46*bcad0816Sgdamore 
47*bcad0816Sgdamore #define	SPICFG_RT_8		(0x3 << 30)
48*bcad0816Sgdamore #define	SPICFG_RT_4		(0x2 << 30)
49*bcad0816Sgdamore #define	SPICFG_RT_2		(0x1 << 30)
50*bcad0816Sgdamore #define	SPICFG_RT_1		(0x0 << 30)
51*bcad0816Sgdamore #define	SPICFG_TT_8		(0x3 << 28)
52*bcad0816Sgdamore #define	SPICFG_TT_4		(0x2 << 28)
53*bcad0816Sgdamore #define	SPICFG_TT_2		(0x1 << 28)
54*bcad0816Sgdamore #define	SPICFG_TT_1		(0x0 << 28)
55*bcad0816Sgdamore #define	SPICFG_DD		(1 << 27)	/* disable DMA */
56*bcad0816Sgdamore #define	SPICFG_DE		(1 << 26)	/* device enable */
57*bcad0816Sgdamore #define	SPICFG_BRG_MASK		(0x3f << 15)	/* baud rate generator */
58*bcad0816Sgdamore #define	SPICFG_BRG_SHIFT	15
59*bcad0816Sgdamore #define	SPICFG_DIV_MASK		(0x3 << 13)	/* psc clock divider */
60*bcad0816Sgdamore #define	SPICFG_DIV_SHIFT	13
61*bcad0816Sgdamore #define	SPICFG_BI		(1 << 12)	/* bit clock invert */
62*bcad0816Sgdamore #define	SPICFG_PSE		(1 << 11)	/* port swap enable */
63*bcad0816Sgdamore #define	SPICFG_CGE		(1 << 10)	/* clock gate enable */
64*bcad0816Sgdamore #define	SPICFG_CDE		(1 << 9)	/* clock phase delay enable */
65*bcad0816Sgdamore #define	SPICFG_LEN_MASK		(0x1f << 4)	/* data length */
66*bcad0816Sgdamore #define	SPICFG_LEN_SHIFT	4
67*bcad0816Sgdamore #define	SPICFG_LB		(1 << 3)	/* loopback mode */
68*bcad0816Sgdamore #define	SPICFG_MLF		(1 << 2)	/* msb/lsb data first */
69*bcad0816Sgdamore #define	SPICFG_MO		(1 << 0)	/* master only mode */
70*bcad0816Sgdamore 
71*bcad0816Sgdamore /* and also SPIEVNT */
72*bcad0816Sgdamore #define	SPIMSK_MM		(1 << 16)	/* multiple master error */
73*bcad0816Sgdamore #define	SPIMSK_RR		(1 << 13)	/* rx fifo request */
74*bcad0816Sgdamore #define	SPIMSK_RO		(1 << 12)	/* rx fifo overflow */
75*bcad0816Sgdamore #define	SPIMSK_RU		(1 << 11)	/* rx fifo underflow */
76*bcad0816Sgdamore #define	SPIMSK_TR		(1 << 10)	/* tx fifo request */
77*bcad0816Sgdamore #define	SPIMSK_TO		(1 << 9)	/* tx fifo overflow */
78*bcad0816Sgdamore #define	SPIMSK_TU		(1 << 8)	/* tx fifo underflow */
79*bcad0816Sgdamore #define	SPIMSK_SD		(1 << 5)	/* slave done */
80*bcad0816Sgdamore #define	SPIMSK_MD		(1 << 4)	/* master done */
81*bcad0816Sgdamore #define	SPIMSK_ALL		(SPIMSK_MM | SPIMSK_RR | SPIMSK_RO | \
82*bcad0816Sgdamore 				 SPIMSK_RU | SPIMSK_TR | SPIMSK_TO | \
83*bcad0816Sgdamore 				 SPIMSK_TU | SPIMSK_SD | SPIMSK_MD)
84*bcad0816Sgdamore #define	SPIMSK_NORM		(SPIMSK_RU | SPIMSK_TO | SPIMSK_TR | SPIMSK_SD)
85*bcad0816Sgdamore 
86*bcad0816Sgdamore #define	SPIPCR_RC		(1 << 6)	/* rx data clear */
87*bcad0816Sgdamore #define	SPIPCR_SP		(1 << 5)	/* slave stop */
88*bcad0816Sgdamore #define	SPIPCR_SS		(1 << 4)	/* slave start */
89*bcad0816Sgdamore #define	SPIPCR_TC		(1 << 2)	/* tx data clear */
90*bcad0816Sgdamore #define	SPIPCR_MS		(1 << 0)	/* master start*/
91*bcad0816Sgdamore 
92*bcad0816Sgdamore #define	SPISTAT_RF		(1 << 13)	/* rx fifo full */
93*bcad0816Sgdamore #define	SPISTAT_RE		(1 << 12)	/* rx fifo empty */
94*bcad0816Sgdamore #define	SPISTAT_RR		(1 << 11)	/* rx request */
95*bcad0816Sgdamore #define	SPISTAT_TF		(1 << 10)	/* tx fifo full */
96*bcad0816Sgdamore #define	SPISTAT_TE		(1 << 9)	/* tx fifo empty */
97*bcad0816Sgdamore #define	SPISTAT_TR		(1 << 8)	/* tx request */
98*bcad0816Sgdamore #define	SPISTAT_SB		(1 << 5)	/* slave busy */
99*bcad0816Sgdamore #define	SPISTAT_MB		(1 << 4)	/* master busy */
100*bcad0816Sgdamore #define	SPISTAT_DI		(1 << 2)	/* device interrupt */
101*bcad0816Sgdamore #define	SPISTAT_DR		(1 << 1)	/* device ready */
102*bcad0816Sgdamore #define	SPISTAT_SR		(1 << 0)	/* psc ready */
103*bcad0816Sgdamore 
104*bcad0816Sgdamore #define	SPITXRX_LC		(1 << 29)	/* last character */
105*bcad0816Sgdamore #define	SPITXRX_ST		(1 << 28)	/* select togle */
106*bcad0816Sgdamore #define	SPITXRX_DATA_MASK	(0xffffff)
107*bcad0816Sgdamore #define	SPITXRX_DATA_SHIFT	0
108*bcad0816Sgdamore 
109*bcad0816Sgdamore #endif	/* _MIPS_ALCHEMY_AUSPIREG_H_ */
110