0001
0002 #ifndef _IP22_ZILOG_H
0003 #define _IP22_ZILOG_H
0004
0005 #include <asm/byteorder.h>
0006
0007 struct zilog_channel {
0008 #ifdef __BIG_ENDIAN
0009 volatile unsigned char unused0[3];
0010 volatile unsigned char control;
0011 volatile unsigned char unused1[3];
0012 volatile unsigned char data;
0013 #else
0014 volatile unsigned char control;
0015 volatile unsigned char unused0[3];
0016 volatile unsigned char data;
0017 volatile unsigned char unused1[3];
0018 #endif
0019 };
0020
0021 struct zilog_layout {
0022 struct zilog_channel channelB;
0023 struct zilog_channel channelA;
0024 };
0025
0026 #define NUM_ZSREGS 16
0027
0028
0029
0030
0031 #define BRG_TO_BPS(brg, freq) ((freq) / 2 / ((brg) + 2))
0032 #define BPS_TO_BRG(bps, freq) ((((freq) + (bps)) / (2 * (bps))) - 2)
0033
0034
0035
0036 #define FLAG 0x7e
0037
0038
0039 #define R0 0
0040 #define R1 1
0041 #define R2 2
0042 #define R3 3
0043 #define R4 4
0044 #define R5 5
0045 #define R6 6
0046 #define R7 7
0047 #define R8 8
0048 #define R9 9
0049 #define R10 10
0050 #define R11 11
0051 #define R12 12
0052 #define R13 13
0053 #define R14 14
0054 #define R15 15
0055
0056 #define NULLCODE 0
0057 #define POINT_HIGH 0x8
0058 #define RES_EXT_INT 0x10
0059 #define SEND_ABORT 0x18
0060 #define RES_RxINT_FC 0x20
0061 #define RES_Tx_P 0x28
0062 #define ERR_RES 0x30
0063 #define RES_H_IUS 0x38
0064
0065 #define RES_Rx_CRC 0x40
0066 #define RES_Tx_CRC 0x80
0067 #define RES_EOM_L 0xC0
0068
0069
0070
0071 #define EXT_INT_ENAB 0x1
0072 #define TxINT_ENAB 0x2
0073 #define PAR_SPEC 0x4
0074
0075 #define RxINT_DISAB 0
0076 #define RxINT_FCERR 0x8
0077 #define INT_ALL_Rx 0x10
0078 #define INT_ERR_Rx 0x18
0079 #define RxINT_MASK 0x18
0080
0081 #define WT_RDY_RT 0x20
0082 #define WT_FN_RDYFN 0x40
0083 #define WT_RDY_ENAB 0x80
0084
0085
0086
0087
0088
0089 #define RxENAB 0x1
0090 #define SYNC_L_INH 0x2
0091 #define ADD_SM 0x4
0092 #define RxCRC_ENAB 0x8
0093 #define ENT_HM 0x10
0094 #define AUTO_ENAB 0x20
0095 #define Rx5 0x0
0096 #define Rx7 0x40
0097 #define Rx6 0x80
0098 #define Rx8 0xc0
0099 #define RxN_MASK 0xc0
0100
0101
0102
0103 #define PAR_ENAB 0x1
0104 #define PAR_EVEN 0x2
0105
0106 #define SYNC_ENAB 0
0107 #define SB1 0x4
0108 #define SB15 0x8
0109 #define SB2 0xc
0110
0111 #define MONSYNC 0
0112 #define BISYNC 0x10
0113 #define SDLC 0x20
0114 #define EXTSYNC 0x30
0115
0116 #define X1CLK 0x0
0117 #define X16CLK 0x40
0118 #define X32CLK 0x80
0119 #define X64CLK 0xC0
0120 #define XCLK_MASK 0xC0
0121
0122
0123
0124 #define TxCRC_ENAB 0x1
0125 #define RTS 0x2
0126 #define SDLC_CRC 0x4
0127 #define TxENAB 0x8
0128 #define SND_BRK 0x10
0129 #define Tx5 0x0
0130 #define Tx7 0x20
0131 #define Tx6 0x40
0132 #define Tx8 0x60
0133 #define TxN_MASK 0x60
0134 #define DTR 0x80
0135
0136
0137
0138
0139
0140
0141
0142
0143 #define VIS 1
0144 #define NV 2
0145 #define DLC 4
0146 #define MIE 8
0147 #define STATHI 0x10
0148 #define NORESET 0
0149 #define CHRB 0x40
0150 #define CHRA 0x80
0151 #define FHWRES 0xc0
0152
0153
0154 #define BIT6 1
0155 #define LOOPMODE 2
0156 #define ABUNDER 4
0157 #define MARKIDLE 8
0158 #define GAOP 0x10
0159 #define NRZ 0
0160 #define NRZI 0x20
0161 #define FM1 0x40
0162 #define FM0 0x60
0163 #define CRCPS 0x80
0164
0165
0166 #define TRxCXT 0
0167 #define TRxCTC 1
0168 #define TRxCBR 2
0169 #define TRxCDP 3
0170 #define TRxCOI 4
0171 #define TCRTxCP 0
0172 #define TCTRxCP 8
0173 #define TCBR 0x10
0174 #define TCDPLL 0x18
0175 #define RCRTxCP 0
0176 #define RCTRxCP 0x20
0177 #define RCBR 0x40
0178 #define RCDPLL 0x60
0179 #define RTxCX 0x80
0180
0181
0182
0183
0184
0185
0186 #define BRENAB 1
0187 #define BRSRC 2
0188 #define DTRREQ 4
0189 #define AUTOECHO 8
0190 #define LOOPBAK 0x10
0191 #define SEARCH 0x20
0192 #define RMC 0x40
0193 #define DISDPLL 0x60
0194 #define SSBR 0x80
0195 #define SSRTxC 0xa0
0196 #define SFMM 0xc0
0197 #define SNRZI 0xe0
0198
0199
0200 #define ZCIE 2
0201 #define DCDIE 8
0202 #define SYNCIE 0x10
0203 #define CTSIE 0x20
0204 #define TxUIE 0x40
0205 #define BRKIE 0x80
0206
0207
0208
0209 #define Rx_CH_AV 0x1
0210 #define ZCOUNT 0x2
0211 #define Tx_BUF_EMP 0x4
0212 #define DCD 0x8
0213 #define SYNC 0x10
0214 #define CTS 0x20
0215 #define TxEOM 0x40
0216 #define BRK_ABRT 0x80
0217
0218
0219 #define ALL_SNT 0x1
0220
0221 #define RES3 0x8
0222 #define RES4 0x4
0223 #define RES5 0xc
0224 #define RES6 0x2
0225 #define RES7 0xa
0226 #define RES8 0x6
0227 #define RES18 0xe
0228 #define RES28 0x0
0229
0230 #define PAR_ERR 0x10
0231 #define Rx_OVR 0x20
0232 #define CRC_ERR 0x40
0233 #define END_FR 0x80
0234
0235
0236 #define CHB_Tx_EMPTY 0x00
0237 #define CHB_EXT_STAT 0x02
0238 #define CHB_Rx_AVAIL 0x04
0239 #define CHB_SPECIAL 0x06
0240 #define CHA_Tx_EMPTY 0x08
0241 #define CHA_EXT_STAT 0x0a
0242 #define CHA_Rx_AVAIL 0x0c
0243 #define CHA_SPECIAL 0x0e
0244 #define STATUS_MASK 0x0e
0245
0246
0247 #define CHBEXT 0x1
0248 #define CHBTxIP 0x2
0249 #define CHBRxIP 0x4
0250 #define CHAEXT 0x8
0251 #define CHATxIP 0x10
0252 #define CHARxIP 0x20
0253
0254
0255
0256
0257 #define ONLOOP 2
0258 #define LOOPSEND 0x10
0259 #define CLK2MIS 0x40
0260 #define CLK1MIS 0x80
0261
0262
0263
0264
0265
0266
0267
0268
0269 #define ZS_CLEARERR(channel) do { writeb(ERR_RES, &channel->control); \
0270 udelay(5); } while(0)
0271
0272 #define ZS_CLEARSTAT(channel) do { writeb(RES_EXT_INT, &channel->control); \
0273 udelay(5); } while(0)
0274
0275 #define ZS_CLEARFIFO(channel) do { readb(&channel->data); \
0276 udelay(2); \
0277 readb(&channel->data); \
0278 udelay(2); \
0279 readb(&channel->data); \
0280 udelay(2); } while(0)
0281
0282 #endif