xref: /openbmc/linux/arch/mips/include/asm/mach-au1x00/au1xxx_psc.h (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
1*384740dcSRalf Baechle /*
2*384740dcSRalf Baechle  *
3*384740dcSRalf Baechle  * BRIEF MODULE DESCRIPTION
4*384740dcSRalf Baechle  *	Include file for Alchemy Semiconductor's Au1k CPU.
5*384740dcSRalf Baechle  *
6*384740dcSRalf Baechle  * Copyright 2004 Embedded Edge, LLC
7*384740dcSRalf Baechle  *	dan@embeddededge.com
8*384740dcSRalf Baechle  *
9*384740dcSRalf Baechle  *  This program is free software; you can redistribute  it and/or modify it
10*384740dcSRalf Baechle  *  under  the terms of  the GNU General  Public License as published by the
11*384740dcSRalf Baechle  *  Free Software Foundation;  either version 2 of the  License, or (at your
12*384740dcSRalf Baechle  *  option) any later version.
13*384740dcSRalf Baechle  *
14*384740dcSRalf Baechle  *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
15*384740dcSRalf Baechle  *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
16*384740dcSRalf Baechle  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
17*384740dcSRalf Baechle  *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
18*384740dcSRalf Baechle  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19*384740dcSRalf Baechle  *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
20*384740dcSRalf Baechle  *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21*384740dcSRalf Baechle  *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
22*384740dcSRalf Baechle  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23*384740dcSRalf Baechle  *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24*384740dcSRalf Baechle  *
25*384740dcSRalf Baechle  *  You should have received a copy of the  GNU General Public License along
26*384740dcSRalf Baechle  *  with this program; if not, write  to the Free Software Foundation, Inc.,
27*384740dcSRalf Baechle  *  675 Mass Ave, Cambridge, MA 02139, USA.
28*384740dcSRalf Baechle  */
29*384740dcSRalf Baechle 
30*384740dcSRalf Baechle /* Specifics for the Au1xxx Programmable Serial Controllers, first
31*384740dcSRalf Baechle  * seen in the AU1550 part.
32*384740dcSRalf Baechle  */
33*384740dcSRalf Baechle #ifndef _AU1000_PSC_H_
34*384740dcSRalf Baechle #define _AU1000_PSC_H_
35*384740dcSRalf Baechle 
36*384740dcSRalf Baechle /*
37*384740dcSRalf Baechle  * The PSC select and control registers are common to all protocols.
38*384740dcSRalf Baechle  */
39*384740dcSRalf Baechle #define PSC_SEL_OFFSET		0x00000000
40*384740dcSRalf Baechle #define PSC_CTRL_OFFSET		0x00000004
41*384740dcSRalf Baechle 
42*384740dcSRalf Baechle #define PSC_SEL_CLK_MASK	(3 << 4)
43*384740dcSRalf Baechle #define PSC_SEL_CLK_INTCLK	(0 << 4)
44*384740dcSRalf Baechle #define PSC_SEL_CLK_EXTCLK	(1 << 4)
45*384740dcSRalf Baechle #define PSC_SEL_CLK_SERCLK	(2 << 4)
46*384740dcSRalf Baechle 
47*384740dcSRalf Baechle #define PSC_SEL_PS_MASK		0x00000007
48*384740dcSRalf Baechle #define PSC_SEL_PS_DISABLED	0
49*384740dcSRalf Baechle #define PSC_SEL_PS_SPIMODE	2
50*384740dcSRalf Baechle #define PSC_SEL_PS_I2SMODE	3
51*384740dcSRalf Baechle #define PSC_SEL_PS_AC97MODE	4
52*384740dcSRalf Baechle #define PSC_SEL_PS_SMBUSMODE	5
53*384740dcSRalf Baechle 
54*384740dcSRalf Baechle #define PSC_CTRL_DISABLE	0
55*384740dcSRalf Baechle #define PSC_CTRL_SUSPEND	2
56*384740dcSRalf Baechle #define PSC_CTRL_ENABLE		3
57*384740dcSRalf Baechle 
58*384740dcSRalf Baechle /* AC97 Registers. */
59*384740dcSRalf Baechle #define PSC_AC97CFG_OFFSET	0x00000008
60*384740dcSRalf Baechle #define PSC_AC97MSK_OFFSET	0x0000000c
61*384740dcSRalf Baechle #define PSC_AC97PCR_OFFSET	0x00000010
62*384740dcSRalf Baechle #define PSC_AC97STAT_OFFSET	0x00000014
63*384740dcSRalf Baechle #define PSC_AC97EVNT_OFFSET	0x00000018
64*384740dcSRalf Baechle #define PSC_AC97TXRX_OFFSET	0x0000001c
65*384740dcSRalf Baechle #define PSC_AC97CDC_OFFSET	0x00000020
66*384740dcSRalf Baechle #define PSC_AC97RST_OFFSET	0x00000024
67*384740dcSRalf Baechle #define PSC_AC97GPO_OFFSET	0x00000028
68*384740dcSRalf Baechle #define PSC_AC97GPI_OFFSET	0x0000002c
69*384740dcSRalf Baechle 
70*384740dcSRalf Baechle /* AC97 Config Register. */
71*384740dcSRalf Baechle #define PSC_AC97CFG_RT_MASK	(3 << 30)
72*384740dcSRalf Baechle #define PSC_AC97CFG_RT_FIFO1	(0 << 30)
73*384740dcSRalf Baechle #define PSC_AC97CFG_RT_FIFO2	(1 << 30)
74*384740dcSRalf Baechle #define PSC_AC97CFG_RT_FIFO4	(2 << 30)
75*384740dcSRalf Baechle #define PSC_AC97CFG_RT_FIFO8	(3 << 30)
76*384740dcSRalf Baechle 
77*384740dcSRalf Baechle #define PSC_AC97CFG_TT_MASK	(3 << 28)
78*384740dcSRalf Baechle #define PSC_AC97CFG_TT_FIFO1	(0 << 28)
79*384740dcSRalf Baechle #define PSC_AC97CFG_TT_FIFO2	(1 << 28)
80*384740dcSRalf Baechle #define PSC_AC97CFG_TT_FIFO4	(2 << 28)
81*384740dcSRalf Baechle #define PSC_AC97CFG_TT_FIFO8	(3 << 28)
82*384740dcSRalf Baechle 
83*384740dcSRalf Baechle #define PSC_AC97CFG_DD_DISABLE	(1 << 27)
84*384740dcSRalf Baechle #define PSC_AC97CFG_DE_ENABLE	(1 << 26)
85*384740dcSRalf Baechle #define PSC_AC97CFG_SE_ENABLE	(1 << 25)
86*384740dcSRalf Baechle 
87*384740dcSRalf Baechle #define PSC_AC97CFG_LEN_MASK	(0xf << 21)
88*384740dcSRalf Baechle #define PSC_AC97CFG_TXSLOT_MASK (0x3ff << 11)
89*384740dcSRalf Baechle #define PSC_AC97CFG_RXSLOT_MASK (0x3ff << 1)
90*384740dcSRalf Baechle #define PSC_AC97CFG_GE_ENABLE	(1)
91*384740dcSRalf Baechle 
92*384740dcSRalf Baechle /* Enable slots 3-12. */
93*384740dcSRalf Baechle #define PSC_AC97CFG_TXSLOT_ENA(x)	(1 << (((x) - 3) + 11))
94*384740dcSRalf Baechle #define PSC_AC97CFG_RXSLOT_ENA(x)	(1 << (((x) - 3) + 1))
95*384740dcSRalf Baechle 
96*384740dcSRalf Baechle /*
97*384740dcSRalf Baechle  * The word length equation is ((x) * 2) + 2, so choose 'x' appropriately.
98*384740dcSRalf Baechle  * The only sensible numbers are 7, 9, or possibly 11.	Nah, just do the
99*384740dcSRalf Baechle  * arithmetic in the macro.
100*384740dcSRalf Baechle  */
101*384740dcSRalf Baechle #define PSC_AC97CFG_SET_LEN(x)	(((((x) - 2) / 2) & 0xf) << 21)
102*384740dcSRalf Baechle #define PSC_AC97CFG_GET_LEN(x)	(((((x) >> 21) & 0xf) * 2) + 2)
103*384740dcSRalf Baechle 
104*384740dcSRalf Baechle /* AC97 Mask Register. */
105*384740dcSRalf Baechle #define PSC_AC97MSK_GR		(1 << 25)
106*384740dcSRalf Baechle #define PSC_AC97MSK_CD		(1 << 24)
107*384740dcSRalf Baechle #define PSC_AC97MSK_RR		(1 << 13)
108*384740dcSRalf Baechle #define PSC_AC97MSK_RO		(1 << 12)
109*384740dcSRalf Baechle #define PSC_AC97MSK_RU		(1 << 11)
110*384740dcSRalf Baechle #define PSC_AC97MSK_TR		(1 << 10)
111*384740dcSRalf Baechle #define PSC_AC97MSK_TO		(1 << 9)
112*384740dcSRalf Baechle #define PSC_AC97MSK_TU		(1 << 8)
113*384740dcSRalf Baechle #define PSC_AC97MSK_RD		(1 << 5)
114*384740dcSRalf Baechle #define PSC_AC97MSK_TD		(1 << 4)
115*384740dcSRalf Baechle #define PSC_AC97MSK_ALLMASK	(PSC_AC97MSK_GR | PSC_AC97MSK_CD | \
116*384740dcSRalf Baechle 				 PSC_AC97MSK_RR | PSC_AC97MSK_RO | \
117*384740dcSRalf Baechle 				 PSC_AC97MSK_RU | PSC_AC97MSK_TR | \
118*384740dcSRalf Baechle 				 PSC_AC97MSK_TO | PSC_AC97MSK_TU | \
119*384740dcSRalf Baechle 				 PSC_AC97MSK_RD | PSC_AC97MSK_TD)
120*384740dcSRalf Baechle 
121*384740dcSRalf Baechle /* AC97 Protocol Control Register. */
122*384740dcSRalf Baechle #define PSC_AC97PCR_RC		(1 << 6)
123*384740dcSRalf Baechle #define PSC_AC97PCR_RP		(1 << 5)
124*384740dcSRalf Baechle #define PSC_AC97PCR_RS		(1 << 4)
125*384740dcSRalf Baechle #define PSC_AC97PCR_TC		(1 << 2)
126*384740dcSRalf Baechle #define PSC_AC97PCR_TP		(1 << 1)
127*384740dcSRalf Baechle #define PSC_AC97PCR_TS		(1 << 0)
128*384740dcSRalf Baechle 
129*384740dcSRalf Baechle /* AC97 Status register (read only). */
130*384740dcSRalf Baechle #define PSC_AC97STAT_CB		(1 << 26)
131*384740dcSRalf Baechle #define PSC_AC97STAT_CP		(1 << 25)
132*384740dcSRalf Baechle #define PSC_AC97STAT_CR		(1 << 24)
133*384740dcSRalf Baechle #define PSC_AC97STAT_RF		(1 << 13)
134*384740dcSRalf Baechle #define PSC_AC97STAT_RE		(1 << 12)
135*384740dcSRalf Baechle #define PSC_AC97STAT_RR		(1 << 11)
136*384740dcSRalf Baechle #define PSC_AC97STAT_TF		(1 << 10)
137*384740dcSRalf Baechle #define PSC_AC97STAT_TE		(1 << 9)
138*384740dcSRalf Baechle #define PSC_AC97STAT_TR		(1 << 8)
139*384740dcSRalf Baechle #define PSC_AC97STAT_RB		(1 << 5)
140*384740dcSRalf Baechle #define PSC_AC97STAT_TB		(1 << 4)
141*384740dcSRalf Baechle #define PSC_AC97STAT_DI		(1 << 2)
142*384740dcSRalf Baechle #define PSC_AC97STAT_DR		(1 << 1)
143*384740dcSRalf Baechle #define PSC_AC97STAT_SR		(1 << 0)
144*384740dcSRalf Baechle 
145*384740dcSRalf Baechle /* AC97 Event Register. */
146*384740dcSRalf Baechle #define PSC_AC97EVNT_GR		(1 << 25)
147*384740dcSRalf Baechle #define PSC_AC97EVNT_CD		(1 << 24)
148*384740dcSRalf Baechle #define PSC_AC97EVNT_RR		(1 << 13)
149*384740dcSRalf Baechle #define PSC_AC97EVNT_RO		(1 << 12)
150*384740dcSRalf Baechle #define PSC_AC97EVNT_RU		(1 << 11)
151*384740dcSRalf Baechle #define PSC_AC97EVNT_TR		(1 << 10)
152*384740dcSRalf Baechle #define PSC_AC97EVNT_TO		(1 << 9)
153*384740dcSRalf Baechle #define PSC_AC97EVNT_TU		(1 << 8)
154*384740dcSRalf Baechle #define PSC_AC97EVNT_RD		(1 << 5)
155*384740dcSRalf Baechle #define PSC_AC97EVNT_TD		(1 << 4)
156*384740dcSRalf Baechle 
157*384740dcSRalf Baechle /* CODEC Command Register. */
158*384740dcSRalf Baechle #define PSC_AC97CDC_RD		(1 << 25)
159*384740dcSRalf Baechle #define PSC_AC97CDC_ID_MASK	(3 << 23)
160*384740dcSRalf Baechle #define PSC_AC97CDC_INDX_MASK	(0x7f << 16)
161*384740dcSRalf Baechle #define PSC_AC97CDC_ID(x)	(((x) & 0x03) << 23)
162*384740dcSRalf Baechle #define PSC_AC97CDC_INDX(x)	(((x) & 0x7f) << 16)
163*384740dcSRalf Baechle 
164*384740dcSRalf Baechle /* AC97 Reset Control Register. */
165*384740dcSRalf Baechle #define PSC_AC97RST_RST		(1 << 1)
166*384740dcSRalf Baechle #define PSC_AC97RST_SNC		(1 << 0)
167*384740dcSRalf Baechle 
168*384740dcSRalf Baechle /* PSC in I2S Mode. */
169*384740dcSRalf Baechle typedef struct	psc_i2s {
170*384740dcSRalf Baechle 	u32	psc_sel;
171*384740dcSRalf Baechle 	u32	psc_ctrl;
172*384740dcSRalf Baechle 	u32	psc_i2scfg;
173*384740dcSRalf Baechle 	u32	psc_i2smsk;
174*384740dcSRalf Baechle 	u32	psc_i2spcr;
175*384740dcSRalf Baechle 	u32	psc_i2sstat;
176*384740dcSRalf Baechle 	u32	psc_i2sevent;
177*384740dcSRalf Baechle 	u32	psc_i2stxrx;
178*384740dcSRalf Baechle 	u32	psc_i2sudf;
179*384740dcSRalf Baechle } psc_i2s_t;
180*384740dcSRalf Baechle 
181*384740dcSRalf Baechle #define PSC_I2SCFG_OFFSET	0x08
182*384740dcSRalf Baechle #define PSC_I2SMASK_OFFSET	0x0C
183*384740dcSRalf Baechle #define PSC_I2SPCR_OFFSET	0x10
184*384740dcSRalf Baechle #define PSC_I2SSTAT_OFFSET	0x14
185*384740dcSRalf Baechle #define PSC_I2SEVENT_OFFSET	0x18
186*384740dcSRalf Baechle #define PSC_I2SRXTX_OFFSET	0x1C
187*384740dcSRalf Baechle #define PSC_I2SUDF_OFFSET	0x20
188*384740dcSRalf Baechle 
189*384740dcSRalf Baechle /* I2S Config Register. */
190*384740dcSRalf Baechle #define PSC_I2SCFG_RT_MASK	(3 << 30)
191*384740dcSRalf Baechle #define PSC_I2SCFG_RT_FIFO1	(0 << 30)
192*384740dcSRalf Baechle #define PSC_I2SCFG_RT_FIFO2	(1 << 30)
193*384740dcSRalf Baechle #define PSC_I2SCFG_RT_FIFO4	(2 << 30)
194*384740dcSRalf Baechle #define PSC_I2SCFG_RT_FIFO8	(3 << 30)
195*384740dcSRalf Baechle 
196*384740dcSRalf Baechle #define PSC_I2SCFG_TT_MASK	(3 << 28)
197*384740dcSRalf Baechle #define PSC_I2SCFG_TT_FIFO1	(0 << 28)
198*384740dcSRalf Baechle #define PSC_I2SCFG_TT_FIFO2	(1 << 28)
199*384740dcSRalf Baechle #define PSC_I2SCFG_TT_FIFO4	(2 << 28)
200*384740dcSRalf Baechle #define PSC_I2SCFG_TT_FIFO8	(3 << 28)
201*384740dcSRalf Baechle 
202*384740dcSRalf Baechle #define PSC_I2SCFG_DD_DISABLE	(1 << 27)
203*384740dcSRalf Baechle #define PSC_I2SCFG_DE_ENABLE	(1 << 26)
204*384740dcSRalf Baechle #define PSC_I2SCFG_SET_WS(x)	(((((x) / 2) - 1) & 0x7f) << 16)
205*384740dcSRalf Baechle #define PSC_I2SCFG_WS(n)	((n & 0xFF) << 16)
206*384740dcSRalf Baechle #define PSC_I2SCFG_WS_MASK	(PSC_I2SCFG_WS(0x3F))
207*384740dcSRalf Baechle #define PSC_I2SCFG_WI		(1 << 15)
208*384740dcSRalf Baechle 
209*384740dcSRalf Baechle #define PSC_I2SCFG_DIV_MASK	(3 << 13)
210*384740dcSRalf Baechle #define PSC_I2SCFG_DIV2		(0 << 13)
211*384740dcSRalf Baechle #define PSC_I2SCFG_DIV4		(1 << 13)
212*384740dcSRalf Baechle #define PSC_I2SCFG_DIV8		(2 << 13)
213*384740dcSRalf Baechle #define PSC_I2SCFG_DIV16	(3 << 13)
214*384740dcSRalf Baechle 
215*384740dcSRalf Baechle #define PSC_I2SCFG_BI		(1 << 12)
216*384740dcSRalf Baechle #define PSC_I2SCFG_BUF		(1 << 11)
217*384740dcSRalf Baechle #define PSC_I2SCFG_MLJ		(1 << 10)
218*384740dcSRalf Baechle #define PSC_I2SCFG_XM		(1 << 9)
219*384740dcSRalf Baechle 
220*384740dcSRalf Baechle /* The word length equation is simply LEN+1. */
221*384740dcSRalf Baechle #define PSC_I2SCFG_SET_LEN(x)	((((x) - 1) & 0x1f) << 4)
222*384740dcSRalf Baechle #define PSC_I2SCFG_GET_LEN(x)	((((x) >> 4) & 0x1f) + 1)
223*384740dcSRalf Baechle 
224*384740dcSRalf Baechle #define PSC_I2SCFG_LB		(1 << 2)
225*384740dcSRalf Baechle #define PSC_I2SCFG_MLF		(1 << 1)
226*384740dcSRalf Baechle #define PSC_I2SCFG_MS		(1 << 0)
227*384740dcSRalf Baechle 
228*384740dcSRalf Baechle /* I2S Mask Register. */
229*384740dcSRalf Baechle #define PSC_I2SMSK_RR		(1 << 13)
230*384740dcSRalf Baechle #define PSC_I2SMSK_RO		(1 << 12)
231*384740dcSRalf Baechle #define PSC_I2SMSK_RU		(1 << 11)
232*384740dcSRalf Baechle #define PSC_I2SMSK_TR		(1 << 10)
233*384740dcSRalf Baechle #define PSC_I2SMSK_TO		(1 << 9)
234*384740dcSRalf Baechle #define PSC_I2SMSK_TU		(1 << 8)
235*384740dcSRalf Baechle #define PSC_I2SMSK_RD		(1 << 5)
236*384740dcSRalf Baechle #define PSC_I2SMSK_TD		(1 << 4)
237*384740dcSRalf Baechle #define PSC_I2SMSK_ALLMASK	(PSC_I2SMSK_RR | PSC_I2SMSK_RO | \
238*384740dcSRalf Baechle 				 PSC_I2SMSK_RU | PSC_I2SMSK_TR | \
239*384740dcSRalf Baechle 				 PSC_I2SMSK_TO | PSC_I2SMSK_TU | \
240*384740dcSRalf Baechle 				 PSC_I2SMSK_RD | PSC_I2SMSK_TD)
241*384740dcSRalf Baechle 
242*384740dcSRalf Baechle /* I2S Protocol Control Register. */
243*384740dcSRalf Baechle #define PSC_I2SPCR_RC		(1 << 6)
244*384740dcSRalf Baechle #define PSC_I2SPCR_RP		(1 << 5)
245*384740dcSRalf Baechle #define PSC_I2SPCR_RS		(1 << 4)
246*384740dcSRalf Baechle #define PSC_I2SPCR_TC		(1 << 2)
247*384740dcSRalf Baechle #define PSC_I2SPCR_TP		(1 << 1)
248*384740dcSRalf Baechle #define PSC_I2SPCR_TS		(1 << 0)
249*384740dcSRalf Baechle 
250*384740dcSRalf Baechle /* I2S Status register (read only). */
251*384740dcSRalf Baechle #define PSC_I2SSTAT_RF		(1 << 13)
252*384740dcSRalf Baechle #define PSC_I2SSTAT_RE		(1 << 12)
253*384740dcSRalf Baechle #define PSC_I2SSTAT_RR		(1 << 11)
254*384740dcSRalf Baechle #define PSC_I2SSTAT_TF		(1 << 10)
255*384740dcSRalf Baechle #define PSC_I2SSTAT_TE		(1 << 9)
256*384740dcSRalf Baechle #define PSC_I2SSTAT_TR		(1 << 8)
257*384740dcSRalf Baechle #define PSC_I2SSTAT_RB		(1 << 5)
258*384740dcSRalf Baechle #define PSC_I2SSTAT_TB		(1 << 4)
259*384740dcSRalf Baechle #define PSC_I2SSTAT_DI		(1 << 2)
260*384740dcSRalf Baechle #define PSC_I2SSTAT_DR		(1 << 1)
261*384740dcSRalf Baechle #define PSC_I2SSTAT_SR		(1 << 0)
262*384740dcSRalf Baechle 
263*384740dcSRalf Baechle /* I2S Event Register. */
264*384740dcSRalf Baechle #define PSC_I2SEVNT_RR		(1 << 13)
265*384740dcSRalf Baechle #define PSC_I2SEVNT_RO		(1 << 12)
266*384740dcSRalf Baechle #define PSC_I2SEVNT_RU		(1 << 11)
267*384740dcSRalf Baechle #define PSC_I2SEVNT_TR		(1 << 10)
268*384740dcSRalf Baechle #define PSC_I2SEVNT_TO		(1 << 9)
269*384740dcSRalf Baechle #define PSC_I2SEVNT_TU		(1 << 8)
270*384740dcSRalf Baechle #define PSC_I2SEVNT_RD		(1 << 5)
271*384740dcSRalf Baechle #define PSC_I2SEVNT_TD		(1 << 4)
272*384740dcSRalf Baechle 
273*384740dcSRalf Baechle /* PSC in SPI Mode. */
274*384740dcSRalf Baechle typedef struct	psc_spi {
275*384740dcSRalf Baechle 	u32	psc_sel;
276*384740dcSRalf Baechle 	u32	psc_ctrl;
277*384740dcSRalf Baechle 	u32	psc_spicfg;
278*384740dcSRalf Baechle 	u32	psc_spimsk;
279*384740dcSRalf Baechle 	u32	psc_spipcr;
280*384740dcSRalf Baechle 	u32	psc_spistat;
281*384740dcSRalf Baechle 	u32	psc_spievent;
282*384740dcSRalf Baechle 	u32	psc_spitxrx;
283*384740dcSRalf Baechle } psc_spi_t;
284*384740dcSRalf Baechle 
285*384740dcSRalf Baechle /* SPI Config Register. */
286*384740dcSRalf Baechle #define PSC_SPICFG_RT_MASK	(3 << 30)
287*384740dcSRalf Baechle #define PSC_SPICFG_RT_FIFO1	(0 << 30)
288*384740dcSRalf Baechle #define PSC_SPICFG_RT_FIFO2	(1 << 30)
289*384740dcSRalf Baechle #define PSC_SPICFG_RT_FIFO4	(2 << 30)
290*384740dcSRalf Baechle #define PSC_SPICFG_RT_FIFO8	(3 << 30)
291*384740dcSRalf Baechle 
292*384740dcSRalf Baechle #define PSC_SPICFG_TT_MASK	(3 << 28)
293*384740dcSRalf Baechle #define PSC_SPICFG_TT_FIFO1	(0 << 28)
294*384740dcSRalf Baechle #define PSC_SPICFG_TT_FIFO2	(1 << 28)
295*384740dcSRalf Baechle #define PSC_SPICFG_TT_FIFO4	(2 << 28)
296*384740dcSRalf Baechle #define PSC_SPICFG_TT_FIFO8	(3 << 28)
297*384740dcSRalf Baechle 
298*384740dcSRalf Baechle #define PSC_SPICFG_DD_DISABLE	(1 << 27)
299*384740dcSRalf Baechle #define PSC_SPICFG_DE_ENABLE	(1 << 26)
300*384740dcSRalf Baechle #define PSC_SPICFG_CLR_BAUD(x)	((x) & ~((0x3f) << 15))
301*384740dcSRalf Baechle #define PSC_SPICFG_SET_BAUD(x)	(((x) & 0x3f) << 15)
302*384740dcSRalf Baechle 
303*384740dcSRalf Baechle #define PSC_SPICFG_SET_DIV(x)	(((x) & 0x03) << 13)
304*384740dcSRalf Baechle #define PSC_SPICFG_DIV2		0
305*384740dcSRalf Baechle #define PSC_SPICFG_DIV4		1
306*384740dcSRalf Baechle #define PSC_SPICFG_DIV8		2
307*384740dcSRalf Baechle #define PSC_SPICFG_DIV16	3
308*384740dcSRalf Baechle 
309*384740dcSRalf Baechle #define PSC_SPICFG_BI		(1 << 12)
310*384740dcSRalf Baechle #define PSC_SPICFG_PSE		(1 << 11)
311*384740dcSRalf Baechle #define PSC_SPICFG_CGE		(1 << 10)
312*384740dcSRalf Baechle #define PSC_SPICFG_CDE		(1 << 9)
313*384740dcSRalf Baechle 
314*384740dcSRalf Baechle #define PSC_SPICFG_CLR_LEN(x)	((x) & ~((0x1f) << 4))
315*384740dcSRalf Baechle #define PSC_SPICFG_SET_LEN(x)	(((x-1) & 0x1f) << 4)
316*384740dcSRalf Baechle 
317*384740dcSRalf Baechle #define PSC_SPICFG_LB		(1 << 3)
318*384740dcSRalf Baechle #define PSC_SPICFG_MLF		(1 << 1)
319*384740dcSRalf Baechle #define PSC_SPICFG_MO		(1 << 0)
320*384740dcSRalf Baechle 
321*384740dcSRalf Baechle /* SPI Mask Register. */
322*384740dcSRalf Baechle #define PSC_SPIMSK_MM		(1 << 16)
323*384740dcSRalf Baechle #define PSC_SPIMSK_RR		(1 << 13)
324*384740dcSRalf Baechle #define PSC_SPIMSK_RO		(1 << 12)
325*384740dcSRalf Baechle #define PSC_SPIMSK_RU		(1 << 11)
326*384740dcSRalf Baechle #define PSC_SPIMSK_TR		(1 << 10)
327*384740dcSRalf Baechle #define PSC_SPIMSK_TO		(1 << 9)
328*384740dcSRalf Baechle #define PSC_SPIMSK_TU		(1 << 8)
329*384740dcSRalf Baechle #define PSC_SPIMSK_SD		(1 << 5)
330*384740dcSRalf Baechle #define PSC_SPIMSK_MD		(1 << 4)
331*384740dcSRalf Baechle #define PSC_SPIMSK_ALLMASK	(PSC_SPIMSK_MM | PSC_SPIMSK_RR | \
332*384740dcSRalf Baechle 				 PSC_SPIMSK_RO | PSC_SPIMSK_TO | \
333*384740dcSRalf Baechle 				 PSC_SPIMSK_TU | PSC_SPIMSK_SD | \
334*384740dcSRalf Baechle 				 PSC_SPIMSK_MD)
335*384740dcSRalf Baechle 
336*384740dcSRalf Baechle /* SPI Protocol Control Register. */
337*384740dcSRalf Baechle #define PSC_SPIPCR_RC		(1 << 6)
338*384740dcSRalf Baechle #define PSC_SPIPCR_SP		(1 << 5)
339*384740dcSRalf Baechle #define PSC_SPIPCR_SS		(1 << 4)
340*384740dcSRalf Baechle #define PSC_SPIPCR_TC		(1 << 2)
341*384740dcSRalf Baechle #define PSC_SPIPCR_MS		(1 << 0)
342*384740dcSRalf Baechle 
343*384740dcSRalf Baechle /* SPI Status register (read only). */
344*384740dcSRalf Baechle #define PSC_SPISTAT_RF		(1 << 13)
345*384740dcSRalf Baechle #define PSC_SPISTAT_RE		(1 << 12)
346*384740dcSRalf Baechle #define PSC_SPISTAT_RR		(1 << 11)
347*384740dcSRalf Baechle #define PSC_SPISTAT_TF		(1 << 10)
348*384740dcSRalf Baechle #define PSC_SPISTAT_TE		(1 << 9)
349*384740dcSRalf Baechle #define PSC_SPISTAT_TR		(1 << 8)
350*384740dcSRalf Baechle #define PSC_SPISTAT_SB		(1 << 5)
351*384740dcSRalf Baechle #define PSC_SPISTAT_MB		(1 << 4)
352*384740dcSRalf Baechle #define PSC_SPISTAT_DI		(1 << 2)
353*384740dcSRalf Baechle #define PSC_SPISTAT_DR		(1 << 1)
354*384740dcSRalf Baechle #define PSC_SPISTAT_SR		(1 << 0)
355*384740dcSRalf Baechle 
356*384740dcSRalf Baechle /* SPI Event Register. */
357*384740dcSRalf Baechle #define PSC_SPIEVNT_MM		(1 << 16)
358*384740dcSRalf Baechle #define PSC_SPIEVNT_RR		(1 << 13)
359*384740dcSRalf Baechle #define PSC_SPIEVNT_RO		(1 << 12)
360*384740dcSRalf Baechle #define PSC_SPIEVNT_RU		(1 << 11)
361*384740dcSRalf Baechle #define PSC_SPIEVNT_TR		(1 << 10)
362*384740dcSRalf Baechle #define PSC_SPIEVNT_TO		(1 << 9)
363*384740dcSRalf Baechle #define PSC_SPIEVNT_TU		(1 << 8)
364*384740dcSRalf Baechle #define PSC_SPIEVNT_SD		(1 << 5)
365*384740dcSRalf Baechle #define PSC_SPIEVNT_MD		(1 << 4)
366*384740dcSRalf Baechle 
367*384740dcSRalf Baechle /* Transmit register control. */
368*384740dcSRalf Baechle #define PSC_SPITXRX_LC		(1 << 29)
369*384740dcSRalf Baechle #define PSC_SPITXRX_SR		(1 << 28)
370*384740dcSRalf Baechle 
371*384740dcSRalf Baechle /* SMBus Config Register. */
372*384740dcSRalf Baechle #define PSC_SMBCFG_RT_MASK	(3 << 30)
373*384740dcSRalf Baechle #define PSC_SMBCFG_RT_FIFO1	(0 << 30)
374*384740dcSRalf Baechle #define PSC_SMBCFG_RT_FIFO2	(1 << 30)
375*384740dcSRalf Baechle #define PSC_SMBCFG_RT_FIFO4	(2 << 30)
376*384740dcSRalf Baechle #define PSC_SMBCFG_RT_FIFO8	(3 << 30)
377*384740dcSRalf Baechle 
378*384740dcSRalf Baechle #define PSC_SMBCFG_TT_MASK	(3 << 28)
379*384740dcSRalf Baechle #define PSC_SMBCFG_TT_FIFO1	(0 << 28)
380*384740dcSRalf Baechle #define PSC_SMBCFG_TT_FIFO2	(1 << 28)
381*384740dcSRalf Baechle #define PSC_SMBCFG_TT_FIFO4	(2 << 28)
382*384740dcSRalf Baechle #define PSC_SMBCFG_TT_FIFO8	(3 << 28)
383*384740dcSRalf Baechle 
384*384740dcSRalf Baechle #define PSC_SMBCFG_DD_DISABLE	(1 << 27)
385*384740dcSRalf Baechle #define PSC_SMBCFG_DE_ENABLE	(1 << 26)
386*384740dcSRalf Baechle 
387*384740dcSRalf Baechle #define PSC_SMBCFG_SET_DIV(x)	(((x) & 0x03) << 13)
388*384740dcSRalf Baechle #define PSC_SMBCFG_DIV2		0
389*384740dcSRalf Baechle #define PSC_SMBCFG_DIV4		1
390*384740dcSRalf Baechle #define PSC_SMBCFG_DIV8		2
391*384740dcSRalf Baechle #define PSC_SMBCFG_DIV16	3
392*384740dcSRalf Baechle 
393*384740dcSRalf Baechle #define PSC_SMBCFG_GCE		(1 << 9)
394*384740dcSRalf Baechle #define PSC_SMBCFG_SFM		(1 << 8)
395*384740dcSRalf Baechle 
396*384740dcSRalf Baechle #define PSC_SMBCFG_SET_SLV(x)	(((x) & 0x7f) << 1)
397*384740dcSRalf Baechle 
398*384740dcSRalf Baechle /* SMBus Mask Register. */
399*384740dcSRalf Baechle #define PSC_SMBMSK_DN		(1 << 30)
400*384740dcSRalf Baechle #define PSC_SMBMSK_AN		(1 << 29)
401*384740dcSRalf Baechle #define PSC_SMBMSK_AL		(1 << 28)
402*384740dcSRalf Baechle #define PSC_SMBMSK_RR		(1 << 13)
403*384740dcSRalf Baechle #define PSC_SMBMSK_RO		(1 << 12)
404*384740dcSRalf Baechle #define PSC_SMBMSK_RU		(1 << 11)
405*384740dcSRalf Baechle #define PSC_SMBMSK_TR		(1 << 10)
406*384740dcSRalf Baechle #define PSC_SMBMSK_TO		(1 << 9)
407*384740dcSRalf Baechle #define PSC_SMBMSK_TU		(1 << 8)
408*384740dcSRalf Baechle #define PSC_SMBMSK_SD		(1 << 5)
409*384740dcSRalf Baechle #define PSC_SMBMSK_MD		(1 << 4)
410*384740dcSRalf Baechle #define PSC_SMBMSK_ALLMASK	(PSC_SMBMSK_DN | PSC_SMBMSK_AN | \
411*384740dcSRalf Baechle 				 PSC_SMBMSK_AL | PSC_SMBMSK_RR | \
412*384740dcSRalf Baechle 				 PSC_SMBMSK_RO | PSC_SMBMSK_TO | \
413*384740dcSRalf Baechle 				 PSC_SMBMSK_TU | PSC_SMBMSK_SD | \
414*384740dcSRalf Baechle 				 PSC_SMBMSK_MD)
415*384740dcSRalf Baechle 
416*384740dcSRalf Baechle /* SMBus Protocol Control Register. */
417*384740dcSRalf Baechle #define PSC_SMBPCR_DC		(1 << 2)
418*384740dcSRalf Baechle #define PSC_SMBPCR_MS		(1 << 0)
419*384740dcSRalf Baechle 
420*384740dcSRalf Baechle /* SMBus Status register (read only). */
421*384740dcSRalf Baechle #define PSC_SMBSTAT_BB		(1 << 28)
422*384740dcSRalf Baechle #define PSC_SMBSTAT_RF		(1 << 13)
423*384740dcSRalf Baechle #define PSC_SMBSTAT_RE		(1 << 12)
424*384740dcSRalf Baechle #define PSC_SMBSTAT_RR		(1 << 11)
425*384740dcSRalf Baechle #define PSC_SMBSTAT_TF		(1 << 10)
426*384740dcSRalf Baechle #define PSC_SMBSTAT_TE		(1 << 9)
427*384740dcSRalf Baechle #define PSC_SMBSTAT_TR		(1 << 8)
428*384740dcSRalf Baechle #define PSC_SMBSTAT_SB		(1 << 5)
429*384740dcSRalf Baechle #define PSC_SMBSTAT_MB		(1 << 4)
430*384740dcSRalf Baechle #define PSC_SMBSTAT_DI		(1 << 2)
431*384740dcSRalf Baechle #define PSC_SMBSTAT_DR		(1 << 1)
432*384740dcSRalf Baechle #define PSC_SMBSTAT_SR		(1 << 0)
433*384740dcSRalf Baechle 
434*384740dcSRalf Baechle /* SMBus Event Register. */
435*384740dcSRalf Baechle #define PSC_SMBEVNT_DN		(1 << 30)
436*384740dcSRalf Baechle #define PSC_SMBEVNT_AN		(1 << 29)
437*384740dcSRalf Baechle #define PSC_SMBEVNT_AL		(1 << 28)
438*384740dcSRalf Baechle #define PSC_SMBEVNT_RR		(1 << 13)
439*384740dcSRalf Baechle #define PSC_SMBEVNT_RO		(1 << 12)
440*384740dcSRalf Baechle #define PSC_SMBEVNT_RU		(1 << 11)
441*384740dcSRalf Baechle #define PSC_SMBEVNT_TR		(1 << 10)
442*384740dcSRalf Baechle #define PSC_SMBEVNT_TO		(1 << 9)
443*384740dcSRalf Baechle #define PSC_SMBEVNT_TU		(1 << 8)
444*384740dcSRalf Baechle #define PSC_SMBEVNT_SD		(1 << 5)
445*384740dcSRalf Baechle #define PSC_SMBEVNT_MD		(1 << 4)
446*384740dcSRalf Baechle #define PSC_SMBEVNT_ALLCLR	(PSC_SMBEVNT_DN | PSC_SMBEVNT_AN | \
447*384740dcSRalf Baechle 				 PSC_SMBEVNT_AL | PSC_SMBEVNT_RR | \
448*384740dcSRalf Baechle 				 PSC_SMBEVNT_RO | PSC_SMBEVNT_TO | \
449*384740dcSRalf Baechle 				 PSC_SMBEVNT_TU | PSC_SMBEVNT_SD | \
450*384740dcSRalf Baechle 				 PSC_SMBEVNT_MD)
451*384740dcSRalf Baechle 
452*384740dcSRalf Baechle /* Transmit register control. */
453*384740dcSRalf Baechle #define PSC_SMBTXRX_RSR		(1 << 28)
454*384740dcSRalf Baechle #define PSC_SMBTXRX_STP		(1 << 29)
455*384740dcSRalf Baechle #define PSC_SMBTXRX_DATAMASK	0xff
456*384740dcSRalf Baechle 
457*384740dcSRalf Baechle /* SMBus protocol timers register. */
458*384740dcSRalf Baechle #define PSC_SMBTMR_SET_TH(x)	(((x) & 0x03) << 30)
459*384740dcSRalf Baechle #define PSC_SMBTMR_SET_PS(x)	(((x) & 0x1f) << 25)
460*384740dcSRalf Baechle #define PSC_SMBTMR_SET_PU(x)	(((x) & 0x1f) << 20)
461*384740dcSRalf Baechle #define PSC_SMBTMR_SET_SH(x)	(((x) & 0x1f) << 15)
462*384740dcSRalf Baechle #define PSC_SMBTMR_SET_SU(x)	(((x) & 0x1f) << 10)
463*384740dcSRalf Baechle #define PSC_SMBTMR_SET_CL(x)	(((x) & 0x1f) << 5)
464*384740dcSRalf Baechle #define PSC_SMBTMR_SET_CH(x)	(((x) & 0x1f) << 0)
465*384740dcSRalf Baechle 
466*384740dcSRalf Baechle #endif /* _AU1000_PSC_H_ */
467