xref: /linux/drivers/net/wan/hd64570.h (revision 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2)
1*1da177e4SLinus Torvalds #ifndef __HD64570_H
2*1da177e4SLinus Torvalds #define __HD64570_H
3*1da177e4SLinus Torvalds 
4*1da177e4SLinus Torvalds /* SCA HD64570 register definitions - all addresses for mode 0 (8086 MPU)
5*1da177e4SLinus Torvalds    and 1 (64180 MPU). For modes 2 and 3, XOR the address with 0x01.
6*1da177e4SLinus Torvalds 
7*1da177e4SLinus Torvalds    Source: HD64570 SCA User's Manual
8*1da177e4SLinus Torvalds */
9*1da177e4SLinus Torvalds 
10*1da177e4SLinus Torvalds 
11*1da177e4SLinus Torvalds 
12*1da177e4SLinus Torvalds /* SCA Control Registers */
13*1da177e4SLinus Torvalds #define LPR    0x00		/* Low Power */
14*1da177e4SLinus Torvalds 
15*1da177e4SLinus Torvalds /* Wait controller registers */
16*1da177e4SLinus Torvalds #define PABR0  0x02		/* Physical Address Boundary 0 */
17*1da177e4SLinus Torvalds #define PABR1  0x03		/* Physical Address Boundary 1 */
18*1da177e4SLinus Torvalds #define WCRL   0x04		/* Wait Control L */
19*1da177e4SLinus Torvalds #define WCRM   0x05		/* Wait Control M */
20*1da177e4SLinus Torvalds #define WCRH   0x06		/* Wait Control H */
21*1da177e4SLinus Torvalds 
22*1da177e4SLinus Torvalds #define PCR    0x08		/* DMA Priority Control */
23*1da177e4SLinus Torvalds #define DMER   0x09		/* DMA Master Enable */
24*1da177e4SLinus Torvalds 
25*1da177e4SLinus Torvalds 
26*1da177e4SLinus Torvalds /* Interrupt registers */
27*1da177e4SLinus Torvalds #define ISR0   0x10		/* Interrupt Status 0  */
28*1da177e4SLinus Torvalds #define ISR1   0x11		/* Interrupt Status 1  */
29*1da177e4SLinus Torvalds #define ISR2   0x12		/* Interrupt Status 2  */
30*1da177e4SLinus Torvalds 
31*1da177e4SLinus Torvalds #define IER0   0x14		/* Interrupt Enable 0  */
32*1da177e4SLinus Torvalds #define IER1   0x15		/* Interrupt Enable 1  */
33*1da177e4SLinus Torvalds #define IER2   0x16		/* Interrupt Enable 2  */
34*1da177e4SLinus Torvalds 
35*1da177e4SLinus Torvalds #define ITCR   0x18		/* Interrupt Control */
36*1da177e4SLinus Torvalds #define IVR    0x1A		/* Interrupt Vector */
37*1da177e4SLinus Torvalds #define IMVR   0x1C		/* Interrupt Modified Vector */
38*1da177e4SLinus Torvalds 
39*1da177e4SLinus Torvalds 
40*1da177e4SLinus Torvalds 
41*1da177e4SLinus Torvalds /* MSCI channel (port) 0 registers - offset 0x20
42*1da177e4SLinus Torvalds    MSCI channel (port) 1 registers - offset 0x40 */
43*1da177e4SLinus Torvalds 
44*1da177e4SLinus Torvalds #define MSCI0_OFFSET 0x20
45*1da177e4SLinus Torvalds #define MSCI1_OFFSET 0x40
46*1da177e4SLinus Torvalds 
47*1da177e4SLinus Torvalds #define TRBL   0x00		/* TX/RX buffer L */
48*1da177e4SLinus Torvalds #define TRBH   0x01		/* TX/RX buffer H */
49*1da177e4SLinus Torvalds #define ST0    0x02		/* Status 0 */
50*1da177e4SLinus Torvalds #define ST1    0x03		/* Status 1 */
51*1da177e4SLinus Torvalds #define ST2    0x04		/* Status 2 */
52*1da177e4SLinus Torvalds #define ST3    0x05		/* Status 3 */
53*1da177e4SLinus Torvalds #define FST    0x06		/* Frame Status  */
54*1da177e4SLinus Torvalds #define IE0    0x08		/* Interrupt Enable 0 */
55*1da177e4SLinus Torvalds #define IE1    0x09		/* Interrupt Enable 1 */
56*1da177e4SLinus Torvalds #define IE2    0x0A		/* Interrupt Enable 2 */
57*1da177e4SLinus Torvalds #define FIE    0x0B		/* Frame Interrupt Enable  */
58*1da177e4SLinus Torvalds #define CMD    0x0C		/* Command */
59*1da177e4SLinus Torvalds #define MD0    0x0E		/* Mode 0 */
60*1da177e4SLinus Torvalds #define MD1    0x0F		/* Mode 1 */
61*1da177e4SLinus Torvalds #define MD2    0x10		/* Mode 2 */
62*1da177e4SLinus Torvalds #define CTL    0x11		/* Control */
63*1da177e4SLinus Torvalds #define SA0    0x12		/* Sync/Address 0 */
64*1da177e4SLinus Torvalds #define SA1    0x13		/* Sync/Address 1 */
65*1da177e4SLinus Torvalds #define IDL    0x14		/* Idle Pattern */
66*1da177e4SLinus Torvalds #define TMC    0x15		/* Time Constant */
67*1da177e4SLinus Torvalds #define RXS    0x16		/* RX Clock Source */
68*1da177e4SLinus Torvalds #define TXS    0x17		/* TX Clock Source */
69*1da177e4SLinus Torvalds #define TRC0   0x18		/* TX Ready Control 0 */
70*1da177e4SLinus Torvalds #define TRC1   0x19		/* TX Ready Control 1 */
71*1da177e4SLinus Torvalds #define RRC    0x1A		/* RX Ready Control */
72*1da177e4SLinus Torvalds #define CST0   0x1C		/* Current Status 0 */
73*1da177e4SLinus Torvalds #define CST1   0x1D		/* Current Status 1 */
74*1da177e4SLinus Torvalds 
75*1da177e4SLinus Torvalds 
76*1da177e4SLinus Torvalds /* Timer channel 0 (port 0 RX) registers - offset 0x60
77*1da177e4SLinus Torvalds    Timer channel 1 (port 0 TX) registers - offset 0x68
78*1da177e4SLinus Torvalds    Timer channel 2 (port 1 RX) registers - offset 0x70
79*1da177e4SLinus Torvalds    Timer channel 3 (port 1 TX) registers - offset 0x78
80*1da177e4SLinus Torvalds */
81*1da177e4SLinus Torvalds 
82*1da177e4SLinus Torvalds #define TIMER0RX_OFFSET 0x60
83*1da177e4SLinus Torvalds #define TIMER0TX_OFFSET 0x68
84*1da177e4SLinus Torvalds #define TIMER1RX_OFFSET 0x70
85*1da177e4SLinus Torvalds #define TIMER1TX_OFFSET 0x78
86*1da177e4SLinus Torvalds 
87*1da177e4SLinus Torvalds #define TCNTL  0x00		/* Up-counter L */
88*1da177e4SLinus Torvalds #define TCNTH  0x01		/* Up-counter H */
89*1da177e4SLinus Torvalds #define TCONRL 0x02		/* Constant L */
90*1da177e4SLinus Torvalds #define TCONRH 0x03		/* Constant H */
91*1da177e4SLinus Torvalds #define TCSR   0x04		/* Control/Status */
92*1da177e4SLinus Torvalds #define TEPR   0x05		/* Expand Prescale */
93*1da177e4SLinus Torvalds 
94*1da177e4SLinus Torvalds 
95*1da177e4SLinus Torvalds 
96*1da177e4SLinus Torvalds /* DMA channel 0 (port 0 RX) registers - offset 0x80
97*1da177e4SLinus Torvalds    DMA channel 1 (port 0 TX) registers - offset 0xA0
98*1da177e4SLinus Torvalds    DMA channel 2 (port 1 RX) registers - offset 0xC0
99*1da177e4SLinus Torvalds    DMA channel 3 (port 1 TX) registers - offset 0xE0
100*1da177e4SLinus Torvalds */
101*1da177e4SLinus Torvalds 
102*1da177e4SLinus Torvalds #define DMAC0RX_OFFSET 0x80
103*1da177e4SLinus Torvalds #define DMAC0TX_OFFSET 0xA0
104*1da177e4SLinus Torvalds #define DMAC1RX_OFFSET 0xC0
105*1da177e4SLinus Torvalds #define DMAC1TX_OFFSET 0xE0
106*1da177e4SLinus Torvalds 
107*1da177e4SLinus Torvalds #define BARL   0x00		/* Buffer Address L (chained block) */
108*1da177e4SLinus Torvalds #define BARH   0x01		/* Buffer Address H (chained block) */
109*1da177e4SLinus Torvalds #define BARB   0x02		/* Buffer Address B (chained block) */
110*1da177e4SLinus Torvalds 
111*1da177e4SLinus Torvalds #define DARL   0x00		/* RX Destination Addr L (single block) */
112*1da177e4SLinus Torvalds #define DARH   0x01		/* RX Destination Addr H (single block) */
113*1da177e4SLinus Torvalds #define DARB   0x02		/* RX Destination Addr B (single block) */
114*1da177e4SLinus Torvalds 
115*1da177e4SLinus Torvalds #define SARL   0x04		/* TX Source Address L (single block) */
116*1da177e4SLinus Torvalds #define SARH   0x05		/* TX Source Address H (single block) */
117*1da177e4SLinus Torvalds #define SARB   0x06		/* TX Source Address B (single block) */
118*1da177e4SLinus Torvalds 
119*1da177e4SLinus Torvalds #define CPB    0x06		/* Chain Pointer Base (chained block) */
120*1da177e4SLinus Torvalds 
121*1da177e4SLinus Torvalds #define CDAL   0x08		/* Current Descriptor Addr L (chained block) */
122*1da177e4SLinus Torvalds #define CDAH   0x09		/* Current Descriptor Addr H (chained block) */
123*1da177e4SLinus Torvalds #define EDAL   0x0A		/* Error Descriptor Addr L (chained block) */
124*1da177e4SLinus Torvalds #define EDAH   0x0B		/* Error Descriptor Addr H (chained block) */
125*1da177e4SLinus Torvalds #define BFLL   0x0C		/* RX Receive Buffer Length L (chained block)*/
126*1da177e4SLinus Torvalds #define BFLH   0x0D		/* RX Receive Buffer Length H (chained block)*/
127*1da177e4SLinus Torvalds #define BCRL   0x0E		/* Byte Count L */
128*1da177e4SLinus Torvalds #define BCRH   0x0F		/* Byte Count H */
129*1da177e4SLinus Torvalds #define DSR    0x10		/* DMA Status */
130*1da177e4SLinus Torvalds #define DSR_RX(node) (DSR + (node ? DMAC1RX_OFFSET : DMAC0RX_OFFSET))
131*1da177e4SLinus Torvalds #define DSR_TX(node) (DSR + (node ? DMAC1TX_OFFSET : DMAC0TX_OFFSET))
132*1da177e4SLinus Torvalds #define DMR    0x11		/* DMA Mode */
133*1da177e4SLinus Torvalds #define DMR_RX(node) (DMR + (node ? DMAC1RX_OFFSET : DMAC0RX_OFFSET))
134*1da177e4SLinus Torvalds #define DMR_TX(node) (DMR + (node ? DMAC1TX_OFFSET : DMAC0TX_OFFSET))
135*1da177e4SLinus Torvalds #define FCT    0x13		/* Frame End Interrupt Counter */
136*1da177e4SLinus Torvalds #define FCT_RX(node) (FCT + (node ? DMAC1RX_OFFSET : DMAC0RX_OFFSET))
137*1da177e4SLinus Torvalds #define FCT_TX(node) (FCT + (node ? DMAC1TX_OFFSET : DMAC0TX_OFFSET))
138*1da177e4SLinus Torvalds #define DIR    0x14		/* DMA Interrupt Enable */
139*1da177e4SLinus Torvalds #define DIR_RX(node) (DIR + (node ? DMAC1RX_OFFSET : DMAC0RX_OFFSET))
140*1da177e4SLinus Torvalds #define DIR_TX(node) (DIR + (node ? DMAC1TX_OFFSET : DMAC0TX_OFFSET))
141*1da177e4SLinus Torvalds #define DCR    0x15		/* DMA Command  */
142*1da177e4SLinus Torvalds #define DCR_RX(node) (DCR + (node ? DMAC1RX_OFFSET : DMAC0RX_OFFSET))
143*1da177e4SLinus Torvalds #define DCR_TX(node) (DCR + (node ? DMAC1TX_OFFSET : DMAC0TX_OFFSET))
144*1da177e4SLinus Torvalds 
145*1da177e4SLinus Torvalds 
146*1da177e4SLinus Torvalds 
147*1da177e4SLinus Torvalds 
148*1da177e4SLinus Torvalds /* Descriptor Structure */
149*1da177e4SLinus Torvalds 
150*1da177e4SLinus Torvalds typedef struct {
151*1da177e4SLinus Torvalds 	u16 cp;			/* Chain Pointer */
152*1da177e4SLinus Torvalds 	u32 bp;			/* Buffer Pointer (24 bits) */
153*1da177e4SLinus Torvalds 	u16 len;		/* Data Length */
154*1da177e4SLinus Torvalds 	u8 stat;		/* Status */
155*1da177e4SLinus Torvalds 	u8 unused;		/* pads to 2-byte boundary */
156*1da177e4SLinus Torvalds }__attribute__ ((packed)) pkt_desc;
157*1da177e4SLinus Torvalds 
158*1da177e4SLinus Torvalds 
159*1da177e4SLinus Torvalds /* Packet Descriptor Status bits */
160*1da177e4SLinus Torvalds 
161*1da177e4SLinus Torvalds #define ST_TX_EOM     0x80	/* End of frame */
162*1da177e4SLinus Torvalds #define ST_TX_EOT     0x01	/* End of transmition */
163*1da177e4SLinus Torvalds 
164*1da177e4SLinus Torvalds #define ST_RX_EOM     0x80	/* End of frame */
165*1da177e4SLinus Torvalds #define ST_RX_SHORT   0x40	/* Short frame */
166*1da177e4SLinus Torvalds #define ST_RX_ABORT   0x20	/* Abort */
167*1da177e4SLinus Torvalds #define ST_RX_RESBIT  0x10	/* Residual bit */
168*1da177e4SLinus Torvalds #define ST_RX_OVERRUN 0x08	/* Overrun */
169*1da177e4SLinus Torvalds #define ST_RX_CRC     0x04	/* CRC */
170*1da177e4SLinus Torvalds 
171*1da177e4SLinus Torvalds #define ST_ERROR_MASK 0x7C
172*1da177e4SLinus Torvalds 
173*1da177e4SLinus Torvalds #define DIR_EOTE      0x80      /* Transfer completed */
174*1da177e4SLinus Torvalds #define DIR_EOME      0x40      /* Frame Transfer Completed (chained-block) */
175*1da177e4SLinus Torvalds #define DIR_BOFE      0x20      /* Buffer Overflow/Underflow (chained-block)*/
176*1da177e4SLinus Torvalds #define DIR_COFE      0x10      /* Counter Overflow (chained-block) */
177*1da177e4SLinus Torvalds 
178*1da177e4SLinus Torvalds 
179*1da177e4SLinus Torvalds #define DSR_EOT       0x80      /* Transfer completed */
180*1da177e4SLinus Torvalds #define DSR_EOM       0x40      /* Frame Transfer Completed (chained-block) */
181*1da177e4SLinus Torvalds #define DSR_BOF       0x20      /* Buffer Overflow/Underflow (chained-block)*/
182*1da177e4SLinus Torvalds #define DSR_COF       0x10      /* Counter Overflow (chained-block) */
183*1da177e4SLinus Torvalds #define DSR_DE        0x02	/* DMA Enable */
184*1da177e4SLinus Torvalds #define DSR_DWE       0x01      /* DMA Write Disable */
185*1da177e4SLinus Torvalds 
186*1da177e4SLinus Torvalds /* DMA Master Enable Register (DMER) bits */
187*1da177e4SLinus Torvalds #define DMER_DME      0x80	/* DMA Master Enable */
188*1da177e4SLinus Torvalds 
189*1da177e4SLinus Torvalds 
190*1da177e4SLinus Torvalds #define CMD_RESET     0x21	/* Reset Channel */
191*1da177e4SLinus Torvalds #define CMD_TX_ENABLE 0x02	/* Start transmitter */
192*1da177e4SLinus Torvalds #define CMD_RX_ENABLE 0x12	/* Start receiver */
193*1da177e4SLinus Torvalds 
194*1da177e4SLinus Torvalds #define MD0_HDLC      0x80	/* Bit-sync HDLC mode */
195*1da177e4SLinus Torvalds #define MD0_CRC_ENA   0x04	/* Enable CRC code calculation */
196*1da177e4SLinus Torvalds #define MD0_CRC_CCITT 0x02	/* CCITT CRC instead of CRC-16 */
197*1da177e4SLinus Torvalds #define MD0_CRC_PR1   0x01	/* Initial all-ones instead of all-zeros */
198*1da177e4SLinus Torvalds 
199*1da177e4SLinus Torvalds #define MD0_CRC_NONE  0x00
200*1da177e4SLinus Torvalds #define MD0_CRC_16_0  0x04
201*1da177e4SLinus Torvalds #define MD0_CRC_16    0x05
202*1da177e4SLinus Torvalds #define MD0_CRC_ITU_0 0x06
203*1da177e4SLinus Torvalds #define MD0_CRC_ITU   0x07
204*1da177e4SLinus Torvalds 
205*1da177e4SLinus Torvalds #define MD2_NRZ	      0x00
206*1da177e4SLinus Torvalds #define MD2_NRZI      0x20
207*1da177e4SLinus Torvalds #define MD2_MANCHESTER 0x80
208*1da177e4SLinus Torvalds #define MD2_FM_MARK   0xA0
209*1da177e4SLinus Torvalds #define MD2_FM_SPACE  0xC0
210*1da177e4SLinus Torvalds #define MD2_LOOPBACK  0x03      /* Local data Loopback */
211*1da177e4SLinus Torvalds 
212*1da177e4SLinus Torvalds #define CTL_NORTS     0x01
213*1da177e4SLinus Torvalds #define CTL_IDLE      0x10	/* Transmit an idle pattern */
214*1da177e4SLinus Torvalds #define CTL_UDRNC     0x20	/* Idle after CRC or FCS+flag transmition */
215*1da177e4SLinus Torvalds 
216*1da177e4SLinus Torvalds #define ST0_TXRDY     0x02	/* TX ready */
217*1da177e4SLinus Torvalds #define ST0_RXRDY     0x01	/* RX ready */
218*1da177e4SLinus Torvalds 
219*1da177e4SLinus Torvalds #define ST1_UDRN      0x80	/* MSCI TX underrun */
220*1da177e4SLinus Torvalds #define ST1_CDCD      0x04	/* DCD level changed */
221*1da177e4SLinus Torvalds 
222*1da177e4SLinus Torvalds #define ST3_CTS       0x08	/* modem input - /CTS */
223*1da177e4SLinus Torvalds #define ST3_DCD       0x04	/* modem input - /DCD */
224*1da177e4SLinus Torvalds 
225*1da177e4SLinus Torvalds #define IE0_TXINT     0x80	/* TX INT MSCI interrupt enable */
226*1da177e4SLinus Torvalds #define IE0_RXINTA    0x40	/* RX INT A MSCI interrupt enable */
227*1da177e4SLinus Torvalds #define IE1_UDRN      0x80	/* TX underrun MSCI interrupt enable */
228*1da177e4SLinus Torvalds #define IE1_CDCD      0x04	/* DCD level changed */
229*1da177e4SLinus Torvalds 
230*1da177e4SLinus Torvalds #define DCR_ABORT     0x01	/* Software abort command */
231*1da177e4SLinus Torvalds #define DCR_CLEAR_EOF 0x02	/* Clear EOF interrupt */
232*1da177e4SLinus Torvalds 
233*1da177e4SLinus Torvalds /* TX and RX Clock Source - RXS and TXS */
234*1da177e4SLinus Torvalds #define CLK_BRG_MASK  0x0F
235*1da177e4SLinus Torvalds #define CLK_LINE_RX   0x00	/* TX/RX clock line input */
236*1da177e4SLinus Torvalds #define CLK_LINE_TX   0x00	/* TX/RX line input */
237*1da177e4SLinus Torvalds #define CLK_BRG_RX    0x40	/* internal baud rate generator */
238*1da177e4SLinus Torvalds #define CLK_BRG_TX    0x40	/* internal baud rate generator */
239*1da177e4SLinus Torvalds #define CLK_RXCLK_TX  0x60	/* TX clock from RX clock */
240*1da177e4SLinus Torvalds 
241*1da177e4SLinus Torvalds #endif
242