1 /*  *********************************************************************
2     *  SB1250 Board Support Package
3     *
4     *  Synchronous Serial Constants		 File: sb1250_syncser.h
5     *
6     *  This module contains constants and macros useful for
7     *  manipulating the SB1250's Synchronous Serial
8     *
9     *  SB1250 specification level:  User's manual 1/02/02
10     *
11     *********************************************************************
12     *
13     *  Copyright 2000,2001,2002,2003
14     *  Broadcom Corporation. All rights reserved.
15     *
16     *  This program is free software; you can redistribute it and/or
17     *  modify it under the terms of the GNU General Public License as
18     *  published by the Free Software Foundation; either version 2 of
19     *  the License, or (at your option) any later version.
20     *
21     *  This program is distributed in the hope that it will be useful,
22     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
23     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24     *  GNU General Public License for more details.
25     *
26     *  You should have received a copy of the GNU General Public License
27     *  along with this program; if not, write to the Free Software
28     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29     *  MA 02111-1307 USA
30     ********************************************************************* */
31 
32 
33 #ifndef _SB1250_SYNCSER_H
34 #define _SB1250_SYNCSER_H
35 
36 #include <asm/sibyte/sb1250_defs.h>
37 
38 /*
39  * Serial Mode Configuration Register
40  */
41 
42 #define M_SYNCSER_CRC_MODE		   _SB_MAKEMASK1(0)
43 #define M_SYNCSER_MSB_FIRST		   _SB_MAKEMASK1(1)
44 
45 #define S_SYNCSER_FLAG_NUM		   2
46 #define M_SYNCSER_FLAG_NUM		   _SB_MAKEMASK(4, S_SYNCSER_FLAG_NUM)
47 #define V_SYNCSER_FLAG_NUM		   _SB_MAKEVALUE(x, S_SYNCSER_FLAG_NUM)
48 
49 #define M_SYNCSER_FLAG_EN		   _SB_MAKEMASK1(6)
50 #define M_SYNCSER_HDLC_EN		   _SB_MAKEMASK1(7)
51 #define M_SYNCSER_LOOP_MODE		   _SB_MAKEMASK1(8)
52 #define M_SYNCSER_LOOPBACK		   _SB_MAKEMASK1(9)
53 
54 /*
55  * Serial Clock Source and Line Interface Mode Register
56  */
57 
58 #define M_SYNCSER_RXCLK_INV		   _SB_MAKEMASK1(0)
59 #define M_SYNCSER_RXCLK_EXT		   _SB_MAKEMASK1(1)
60 
61 #define S_SYNCSER_RXSYNC_DLY		   2
62 #define M_SYNCSER_RXSYNC_DLY		   _SB_MAKEMASK(2, S_SYNCSER_RXSYNC_DLY)
63 #define V_SYNCSER_RXSYNC_DLY(x)		   _SB_MAKEVALUE(x, S_SYNCSER_RXSYNC_DLY)
64 
65 #define M_SYNCSER_RXSYNC_LOW		   _SB_MAKEMASK1(4)
66 #define M_SYNCSER_RXSTRB_LOW		   _SB_MAKEMASK1(5)
67 
68 #define M_SYNCSER_RXSYNC_EDGE		   _SB_MAKEMASK1(6)
69 #define M_SYNCSER_RXSYNC_INT		   _SB_MAKEMASK1(7)
70 
71 #define M_SYNCSER_TXCLK_INV		   _SB_MAKEMASK1(8)
72 #define M_SYNCSER_TXCLK_EXT		   _SB_MAKEMASK1(9)
73 
74 #define S_SYNCSER_TXSYNC_DLY		   10
75 #define M_SYNCSER_TXSYNC_DLY		   _SB_MAKEMASK(2, S_SYNCSER_TXSYNC_DLY)
76 #define V_SYNCSER_TXSYNC_DLY(x)		   _SB_MAKEVALUE(x, S_SYNCSER_TXSYNC_DLY)
77 
78 #define M_SYNCSER_TXSYNC_LOW		   _SB_MAKEMASK1(12)
79 #define M_SYNCSER_TXSTRB_LOW		   _SB_MAKEMASK1(13)
80 
81 #define M_SYNCSER_TXSYNC_EDGE		   _SB_MAKEMASK1(14)
82 #define M_SYNCSER_TXSYNC_INT		   _SB_MAKEMASK1(15)
83 
84 /*
85  * Serial Command Register
86  */
87 
88 #define M_SYNCSER_CMD_RX_EN		   _SB_MAKEMASK1(0)
89 #define M_SYNCSER_CMD_TX_EN		   _SB_MAKEMASK1(1)
90 #define M_SYNCSER_CMD_RX_RESET		   _SB_MAKEMASK1(2)
91 #define M_SYNCSER_CMD_TX_RESET		   _SB_MAKEMASK1(3)
92 #define M_SYNCSER_CMD_TX_PAUSE		   _SB_MAKEMASK1(5)
93 
94 /*
95  * Serial DMA Enable Register
96  */
97 
98 #define M_SYNCSER_DMA_RX_EN		   _SB_MAKEMASK1(0)
99 #define M_SYNCSER_DMA_TX_EN		   _SB_MAKEMASK1(4)
100 
101 /*
102  * Serial Status Register
103  */
104 
105 #define M_SYNCSER_RX_CRCERR		   _SB_MAKEMASK1(0)
106 #define M_SYNCSER_RX_ABORT		   _SB_MAKEMASK1(1)
107 #define M_SYNCSER_RX_OCTET		   _SB_MAKEMASK1(2)
108 #define M_SYNCSER_RX_LONGFRM		   _SB_MAKEMASK1(3)
109 #define M_SYNCSER_RX_SHORTFRM		   _SB_MAKEMASK1(4)
110 #define M_SYNCSER_RX_OVERRUN		   _SB_MAKEMASK1(5)
111 #define M_SYNCSER_RX_SYNC_ERR		   _SB_MAKEMASK1(6)
112 #define M_SYNCSER_TX_CRCERR		   _SB_MAKEMASK1(8)
113 #define M_SYNCSER_TX_UNDERRUN		   _SB_MAKEMASK1(9)
114 #define M_SYNCSER_TX_SYNC_ERR		   _SB_MAKEMASK1(10)
115 #define M_SYNCSER_TX_PAUSE_COMPLETE	   _SB_MAKEMASK1(11)
116 #define M_SYNCSER_RX_EOP_COUNT		   _SB_MAKEMASK1(16)
117 #define M_SYNCSER_RX_EOP_TIMER		   _SB_MAKEMASK1(17)
118 #define M_SYNCSER_RX_EOP_SEEN		   _SB_MAKEMASK1(18)
119 #define M_SYNCSER_RX_HWM		   _SB_MAKEMASK1(19)
120 #define M_SYNCSER_RX_LWM		   _SB_MAKEMASK1(20)
121 #define M_SYNCSER_RX_DSCR		   _SB_MAKEMASK1(21)
122 #define M_SYNCSER_RX_DERR		   _SB_MAKEMASK1(22)
123 #define M_SYNCSER_TX_EOP_COUNT		   _SB_MAKEMASK1(24)
124 #define M_SYNCSER_TX_EOP_TIMER		   _SB_MAKEMASK1(25)
125 #define M_SYNCSER_TX_EOP_SEEN		   _SB_MAKEMASK1(26)
126 #define M_SYNCSER_TX_HWM		   _SB_MAKEMASK1(27)
127 #define M_SYNCSER_TX_LWM		   _SB_MAKEMASK1(28)
128 #define M_SYNCSER_TX_DSCR		   _SB_MAKEMASK1(29)
129 #define M_SYNCSER_TX_DERR		   _SB_MAKEMASK1(30)
130 #define M_SYNCSER_TX_DZERO		   _SB_MAKEMASK1(31)
131 
132 /*
133  * Sequencer Table Entry format
134  */
135 
136 #define M_SYNCSER_SEQ_LAST		   _SB_MAKEMASK1(0)
137 #define M_SYNCSER_SEQ_BYTE		   _SB_MAKEMASK1(1)
138 
139 #define S_SYNCSER_SEQ_COUNT		   2
140 #define M_SYNCSER_SEQ_COUNT		   _SB_MAKEMASK(4, S_SYNCSER_SEQ_COUNT)
141 #define V_SYNCSER_SEQ_COUNT(x)		   _SB_MAKEVALUE(x, S_SYNCSER_SEQ_COUNT)
142 
143 #define M_SYNCSER_SEQ_ENABLE		   _SB_MAKEMASK1(6)
144 #define M_SYNCSER_SEQ_STROBE		   _SB_MAKEMASK1(7)
145 
146 #endif
147