1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2ab4382d2SGreg Kroah-Hartman #ifndef _SUNZILOG_H 3ab4382d2SGreg Kroah-Hartman #define _SUNZILOG_H 4ab4382d2SGreg Kroah-Hartman 5ab4382d2SGreg Kroah-Hartman struct zilog_channel { 6ab4382d2SGreg Kroah-Hartman volatile unsigned char control; 7ab4382d2SGreg Kroah-Hartman volatile unsigned char __pad1; 8ab4382d2SGreg Kroah-Hartman volatile unsigned char data; 9ab4382d2SGreg Kroah-Hartman volatile unsigned char __pad2; 10ab4382d2SGreg Kroah-Hartman }; 11ab4382d2SGreg Kroah-Hartman 12ab4382d2SGreg Kroah-Hartman struct zilog_layout { 13ab4382d2SGreg Kroah-Hartman struct zilog_channel channelB; 14ab4382d2SGreg Kroah-Hartman struct zilog_channel channelA; 15ab4382d2SGreg Kroah-Hartman }; 16ab4382d2SGreg Kroah-Hartman 17ab4382d2SGreg Kroah-Hartman #define NUM_ZSREGS 17 18ab4382d2SGreg Kroah-Hartman #define R7p 16 /* Written as R7 with P15 bit 0 set */ 19ab4382d2SGreg Kroah-Hartman 20ab4382d2SGreg Kroah-Hartman /* Conversion routines to/from brg time constants from/to bits 21ab4382d2SGreg Kroah-Hartman * per second. 22ab4382d2SGreg Kroah-Hartman */ 23ab4382d2SGreg Kroah-Hartman #define BRG_TO_BPS(brg, freq) ((freq) / 2 / ((brg) + 2)) 24ab4382d2SGreg Kroah-Hartman #define BPS_TO_BRG(bps, freq) ((((freq) + (bps)) / (2 * (bps))) - 2) 25ab4382d2SGreg Kroah-Hartman 26ab4382d2SGreg Kroah-Hartman /* The Zilog register set */ 27ab4382d2SGreg Kroah-Hartman 28ab4382d2SGreg Kroah-Hartman #define FLAG 0x7e 29ab4382d2SGreg Kroah-Hartman 30ab4382d2SGreg Kroah-Hartman /* Write Register 0 */ 31ab4382d2SGreg Kroah-Hartman #define R0 0 /* Register selects */ 32ab4382d2SGreg Kroah-Hartman #define R1 1 33ab4382d2SGreg Kroah-Hartman #define R2 2 34ab4382d2SGreg Kroah-Hartman #define R3 3 35ab4382d2SGreg Kroah-Hartman #define R4 4 36ab4382d2SGreg Kroah-Hartman #define R5 5 37ab4382d2SGreg Kroah-Hartman #define R6 6 38ab4382d2SGreg Kroah-Hartman #define R7 7 39ab4382d2SGreg Kroah-Hartman #define R8 8 40ab4382d2SGreg Kroah-Hartman #define R9 9 41ab4382d2SGreg Kroah-Hartman #define R10 10 42ab4382d2SGreg Kroah-Hartman #define R11 11 43ab4382d2SGreg Kroah-Hartman #define R12 12 44ab4382d2SGreg Kroah-Hartman #define R13 13 45ab4382d2SGreg Kroah-Hartman #define R14 14 46ab4382d2SGreg Kroah-Hartman #define R15 15 47ab4382d2SGreg Kroah-Hartman 48ab4382d2SGreg Kroah-Hartman #define NULLCODE 0 /* Null Code */ 49ab4382d2SGreg Kroah-Hartman #define POINT_HIGH 0x8 /* Select upper half of registers */ 50ab4382d2SGreg Kroah-Hartman #define RES_EXT_INT 0x10 /* Reset Ext. Status Interrupts */ 51ab4382d2SGreg Kroah-Hartman #define SEND_ABORT 0x18 /* HDLC Abort */ 52ab4382d2SGreg Kroah-Hartman #define RES_RxINT_FC 0x20 /* Reset RxINT on First Character */ 53ab4382d2SGreg Kroah-Hartman #define RES_Tx_P 0x28 /* Reset TxINT Pending */ 54ab4382d2SGreg Kroah-Hartman #define ERR_RES 0x30 /* Error Reset */ 55ab4382d2SGreg Kroah-Hartman #define RES_H_IUS 0x38 /* Reset highest IUS */ 56ab4382d2SGreg Kroah-Hartman 57ab4382d2SGreg Kroah-Hartman #define RES_Rx_CRC 0x40 /* Reset Rx CRC Checker */ 58ab4382d2SGreg Kroah-Hartman #define RES_Tx_CRC 0x80 /* Reset Tx CRC Checker */ 59ab4382d2SGreg Kroah-Hartman #define RES_EOM_L 0xC0 /* Reset EOM latch */ 60ab4382d2SGreg Kroah-Hartman 61ab4382d2SGreg Kroah-Hartman /* Write Register 1 */ 62ab4382d2SGreg Kroah-Hartman 63ab4382d2SGreg Kroah-Hartman #define EXT_INT_ENAB 0x1 /* Ext Int Enable */ 64ab4382d2SGreg Kroah-Hartman #define TxINT_ENAB 0x2 /* Tx Int Enable */ 65ab4382d2SGreg Kroah-Hartman #define PAR_SPEC 0x4 /* Parity is special condition */ 66ab4382d2SGreg Kroah-Hartman 67ab4382d2SGreg Kroah-Hartman #define RxINT_DISAB 0 /* Rx Int Disable */ 68ab4382d2SGreg Kroah-Hartman #define RxINT_FCERR 0x8 /* Rx Int on First Character Only or Error */ 69ab4382d2SGreg Kroah-Hartman #define INT_ALL_Rx 0x10 /* Int on all Rx Characters or error */ 70ab4382d2SGreg Kroah-Hartman #define INT_ERR_Rx 0x18 /* Int on error only */ 71ab4382d2SGreg Kroah-Hartman #define RxINT_MASK 0x18 72ab4382d2SGreg Kroah-Hartman 73ab4382d2SGreg Kroah-Hartman #define WT_RDY_RT 0x20 /* Wait/Ready on R/T */ 74ab4382d2SGreg Kroah-Hartman #define WT_FN_RDYFN 0x40 /* Wait/FN/Ready FN */ 75ab4382d2SGreg Kroah-Hartman #define WT_RDY_ENAB 0x80 /* Wait/Ready Enable */ 76ab4382d2SGreg Kroah-Hartman 77ab4382d2SGreg Kroah-Hartman /* Write Register #2 (Interrupt Vector) */ 78ab4382d2SGreg Kroah-Hartman 79ab4382d2SGreg Kroah-Hartman /* Write Register 3 */ 80ab4382d2SGreg Kroah-Hartman 81ab4382d2SGreg Kroah-Hartman #define RxENAB 0x1 /* Rx Enable */ 82ab4382d2SGreg Kroah-Hartman #define SYNC_L_INH 0x2 /* Sync Character Load Inhibit */ 83ab4382d2SGreg Kroah-Hartman #define ADD_SM 0x4 /* Address Search Mode (SDLC) */ 84ab4382d2SGreg Kroah-Hartman #define RxCRC_ENAB 0x8 /* Rx CRC Enable */ 85ab4382d2SGreg Kroah-Hartman #define ENT_HM 0x10 /* Enter Hunt Mode */ 86ab4382d2SGreg Kroah-Hartman #define AUTO_ENAB 0x20 /* Auto Enables */ 87ab4382d2SGreg Kroah-Hartman #define Rx5 0x0 /* Rx 5 Bits/Character */ 88ab4382d2SGreg Kroah-Hartman #define Rx7 0x40 /* Rx 7 Bits/Character */ 89ab4382d2SGreg Kroah-Hartman #define Rx6 0x80 /* Rx 6 Bits/Character */ 90ab4382d2SGreg Kroah-Hartman #define Rx8 0xc0 /* Rx 8 Bits/Character */ 91ab4382d2SGreg Kroah-Hartman #define RxN_MASK 0xc0 92ab4382d2SGreg Kroah-Hartman 93ab4382d2SGreg Kroah-Hartman /* Write Register 4 */ 94ab4382d2SGreg Kroah-Hartman 95ab4382d2SGreg Kroah-Hartman #define PAR_ENAB 0x1 /* Parity Enable */ 96ab4382d2SGreg Kroah-Hartman #define PAR_EVEN 0x2 /* Parity Even/Odd* */ 97ab4382d2SGreg Kroah-Hartman 98ab4382d2SGreg Kroah-Hartman #define SYNC_ENAB 0 /* Sync Modes Enable */ 99ab4382d2SGreg Kroah-Hartman #define SB1 0x4 /* 1 stop bit/char */ 100ab4382d2SGreg Kroah-Hartman #define SB15 0x8 /* 1.5 stop bits/char */ 101ab4382d2SGreg Kroah-Hartman #define SB2 0xc /* 2 stop bits/char */ 102ab4382d2SGreg Kroah-Hartman 103ab4382d2SGreg Kroah-Hartman #define MONSYNC 0 /* 8 Bit Sync character */ 104ab4382d2SGreg Kroah-Hartman #define BISYNC 0x10 /* 16 bit sync character */ 105ab4382d2SGreg Kroah-Hartman #define SDLC 0x20 /* SDLC Mode (01111110 Sync Flag) */ 106ab4382d2SGreg Kroah-Hartman #define EXTSYNC 0x30 /* External Sync Mode */ 107ab4382d2SGreg Kroah-Hartman 108ab4382d2SGreg Kroah-Hartman #define X1CLK 0x0 /* x1 clock mode */ 109ab4382d2SGreg Kroah-Hartman #define X16CLK 0x40 /* x16 clock mode */ 110ab4382d2SGreg Kroah-Hartman #define X32CLK 0x80 /* x32 clock mode */ 111ab4382d2SGreg Kroah-Hartman #define X64CLK 0xC0 /* x64 clock mode */ 112ab4382d2SGreg Kroah-Hartman #define XCLK_MASK 0xC0 113ab4382d2SGreg Kroah-Hartman 114ab4382d2SGreg Kroah-Hartman /* Write Register 5 */ 115ab4382d2SGreg Kroah-Hartman 116ab4382d2SGreg Kroah-Hartman #define TxCRC_ENAB 0x1 /* Tx CRC Enable */ 117ab4382d2SGreg Kroah-Hartman #define RTS 0x2 /* RTS */ 118ab4382d2SGreg Kroah-Hartman #define SDLC_CRC 0x4 /* SDLC/CRC-16 */ 119ab4382d2SGreg Kroah-Hartman #define TxENAB 0x8 /* Tx Enable */ 120ab4382d2SGreg Kroah-Hartman #define SND_BRK 0x10 /* Send Break */ 121ab4382d2SGreg Kroah-Hartman #define Tx5 0x0 /* Tx 5 bits (or less)/character */ 122ab4382d2SGreg Kroah-Hartman #define Tx7 0x20 /* Tx 7 bits/character */ 123ab4382d2SGreg Kroah-Hartman #define Tx6 0x40 /* Tx 6 bits/character */ 124ab4382d2SGreg Kroah-Hartman #define Tx8 0x60 /* Tx 8 bits/character */ 125ab4382d2SGreg Kroah-Hartman #define TxN_MASK 0x60 126ab4382d2SGreg Kroah-Hartman #define DTR 0x80 /* DTR */ 127ab4382d2SGreg Kroah-Hartman 128ab4382d2SGreg Kroah-Hartman /* Write Register 6 (Sync bits 0-7/SDLC Address Field) */ 129ab4382d2SGreg Kroah-Hartman 130ab4382d2SGreg Kroah-Hartman /* Write Register 7 (Sync bits 8-15/SDLC 01111110) */ 131ab4382d2SGreg Kroah-Hartman 132ab4382d2SGreg Kroah-Hartman /* Write Register 7' (ESCC Only) */ 133ab4382d2SGreg Kroah-Hartman #define AUTO_TxFLAG 1 /* Automatic Tx SDLC Flag */ 134ab4382d2SGreg Kroah-Hartman #define AUTO_EOM_RST 2 /* Automatic EOM Reset */ 135ab4382d2SGreg Kroah-Hartman #define AUTOnRTS 4 /* Automatic /RTS pin deactivation */ 136ab4382d2SGreg Kroah-Hartman #define RxFIFO_LVL 8 /* Receive FIFO interrupt level */ 137ab4382d2SGreg Kroah-Hartman #define nDTRnREQ 0x10 /* /DTR/REQ timing */ 138ab4382d2SGreg Kroah-Hartman #define TxFIFO_LVL 0x20 /* Transmit FIFO interrupt level */ 139ab4382d2SGreg Kroah-Hartman #define EXT_RD_EN 0x40 /* Extended read register enable */ 140ab4382d2SGreg Kroah-Hartman 141ab4382d2SGreg Kroah-Hartman /* Write Register 8 (transmit buffer) */ 142ab4382d2SGreg Kroah-Hartman 143ab4382d2SGreg Kroah-Hartman /* Write Register 9 (Master interrupt control) */ 144ab4382d2SGreg Kroah-Hartman #define VIS 1 /* Vector Includes Status */ 145ab4382d2SGreg Kroah-Hartman #define NV 2 /* No Vector */ 146ab4382d2SGreg Kroah-Hartman #define DLC 4 /* Disable Lower Chain */ 147ab4382d2SGreg Kroah-Hartman #define MIE 8 /* Master Interrupt Enable */ 148ab4382d2SGreg Kroah-Hartman #define STATHI 0x10 /* Status high */ 149ab4382d2SGreg Kroah-Hartman #define SWIACK 0x20 /* Software Interrupt Ack (not on NMOS) */ 150ab4382d2SGreg Kroah-Hartman #define NORESET 0 /* No reset on write to R9 */ 151ab4382d2SGreg Kroah-Hartman #define CHRB 0x40 /* Reset channel B */ 152ab4382d2SGreg Kroah-Hartman #define CHRA 0x80 /* Reset channel A */ 153ab4382d2SGreg Kroah-Hartman #define FHWRES 0xc0 /* Force hardware reset */ 154ab4382d2SGreg Kroah-Hartman 155ab4382d2SGreg Kroah-Hartman /* Write Register 10 (misc control bits) */ 156ab4382d2SGreg Kroah-Hartman #define BIT6 1 /* 6 bit/8bit sync */ 157ab4382d2SGreg Kroah-Hartman #define LOOPMODE 2 /* SDLC Loop mode */ 158ab4382d2SGreg Kroah-Hartman #define ABUNDER 4 /* Abort/flag on SDLC xmit underrun */ 159ab4382d2SGreg Kroah-Hartman #define MARKIDLE 8 /* Mark/flag on idle */ 160ab4382d2SGreg Kroah-Hartman #define GAOP 0x10 /* Go active on poll */ 161ab4382d2SGreg Kroah-Hartman #define NRZ 0 /* NRZ mode */ 162ab4382d2SGreg Kroah-Hartman #define NRZI 0x20 /* NRZI mode */ 163ab4382d2SGreg Kroah-Hartman #define FM1 0x40 /* FM1 (transition = 1) */ 164ab4382d2SGreg Kroah-Hartman #define FM0 0x60 /* FM0 (transition = 0) */ 165ab4382d2SGreg Kroah-Hartman #define CRCPS 0x80 /* CRC Preset I/O */ 166ab4382d2SGreg Kroah-Hartman 167ab4382d2SGreg Kroah-Hartman /* Write Register 11 (Clock Mode control) */ 168ab4382d2SGreg Kroah-Hartman #define TRxCXT 0 /* TRxC = Xtal output */ 169ab4382d2SGreg Kroah-Hartman #define TRxCTC 1 /* TRxC = Transmit clock */ 170ab4382d2SGreg Kroah-Hartman #define TRxCBR 2 /* TRxC = BR Generator Output */ 171ab4382d2SGreg Kroah-Hartman #define TRxCDP 3 /* TRxC = DPLL output */ 172ab4382d2SGreg Kroah-Hartman #define TRxCOI 4 /* TRxC O/I */ 173ab4382d2SGreg Kroah-Hartman #define TCRTxCP 0 /* Transmit clock = RTxC pin */ 174ab4382d2SGreg Kroah-Hartman #define TCTRxCP 8 /* Transmit clock = TRxC pin */ 175ab4382d2SGreg Kroah-Hartman #define TCBR 0x10 /* Transmit clock = BR Generator output */ 176ab4382d2SGreg Kroah-Hartman #define TCDPLL 0x18 /* Transmit clock = DPLL output */ 177ab4382d2SGreg Kroah-Hartman #define RCRTxCP 0 /* Receive clock = RTxC pin */ 178ab4382d2SGreg Kroah-Hartman #define RCTRxCP 0x20 /* Receive clock = TRxC pin */ 179ab4382d2SGreg Kroah-Hartman #define RCBR 0x40 /* Receive clock = BR Generator output */ 180ab4382d2SGreg Kroah-Hartman #define RCDPLL 0x60 /* Receive clock = DPLL output */ 181ab4382d2SGreg Kroah-Hartman #define RTxCX 0x80 /* RTxC Xtal/No Xtal */ 182ab4382d2SGreg Kroah-Hartman 183ab4382d2SGreg Kroah-Hartman /* Write Register 12 (lower byte of baud rate generator time constant) */ 184ab4382d2SGreg Kroah-Hartman 185ab4382d2SGreg Kroah-Hartman /* Write Register 13 (upper byte of baud rate generator time constant) */ 186ab4382d2SGreg Kroah-Hartman 187ab4382d2SGreg Kroah-Hartman /* Write Register 14 (Misc control bits) */ 188ab4382d2SGreg Kroah-Hartman #define BRENAB 1 /* Baud rate generator enable */ 189ab4382d2SGreg Kroah-Hartman #define BRSRC 2 /* Baud rate generator source */ 190ab4382d2SGreg Kroah-Hartman #define DTRREQ 4 /* DTR/Request function */ 191ab4382d2SGreg Kroah-Hartman #define AUTOECHO 8 /* Auto Echo */ 192ab4382d2SGreg Kroah-Hartman #define LOOPBAK 0x10 /* Local loopback */ 193ab4382d2SGreg Kroah-Hartman #define SEARCH 0x20 /* Enter search mode */ 194ab4382d2SGreg Kroah-Hartman #define RMC 0x40 /* Reset missing clock */ 195ab4382d2SGreg Kroah-Hartman #define DISDPLL 0x60 /* Disable DPLL */ 196ab4382d2SGreg Kroah-Hartman #define SSBR 0x80 /* Set DPLL source = BR generator */ 197ab4382d2SGreg Kroah-Hartman #define SSRTxC 0xa0 /* Set DPLL source = RTxC */ 198ab4382d2SGreg Kroah-Hartman #define SFMM 0xc0 /* Set FM mode */ 199ab4382d2SGreg Kroah-Hartman #define SNRZI 0xe0 /* Set NRZI mode */ 200ab4382d2SGreg Kroah-Hartman 201ab4382d2SGreg Kroah-Hartman /* Write Register 15 (external/status interrupt control) */ 202ab4382d2SGreg Kroah-Hartman #define WR7pEN 1 /* WR7' Enable (ESCC only) */ 203ab4382d2SGreg Kroah-Hartman #define ZCIE 2 /* Zero count IE */ 204ab4382d2SGreg Kroah-Hartman #define FIFOEN 4 /* FIFO Enable (ESCC only) */ 205ab4382d2SGreg Kroah-Hartman #define DCDIE 8 /* DCD IE */ 206ab4382d2SGreg Kroah-Hartman #define SYNCIE 0x10 /* Sync/hunt IE */ 207ab4382d2SGreg Kroah-Hartman #define CTSIE 0x20 /* CTS IE */ 208ab4382d2SGreg Kroah-Hartman #define TxUIE 0x40 /* Tx Underrun/EOM IE */ 209ab4382d2SGreg Kroah-Hartman #define BRKIE 0x80 /* Break/Abort IE */ 210ab4382d2SGreg Kroah-Hartman 211ab4382d2SGreg Kroah-Hartman 212ab4382d2SGreg Kroah-Hartman /* Read Register 0 */ 213ab4382d2SGreg Kroah-Hartman #define Rx_CH_AV 0x1 /* Rx Character Available */ 214ab4382d2SGreg Kroah-Hartman #define ZCOUNT 0x2 /* Zero count */ 215ab4382d2SGreg Kroah-Hartman #define Tx_BUF_EMP 0x4 /* Tx Buffer empty */ 216ab4382d2SGreg Kroah-Hartman #define DCD 0x8 /* DCD */ 217ab4382d2SGreg Kroah-Hartman #define SYNC 0x10 /* Sync/hunt */ 218ab4382d2SGreg Kroah-Hartman #define CTS 0x20 /* CTS */ 219ab4382d2SGreg Kroah-Hartman #define TxEOM 0x40 /* Tx underrun */ 220ab4382d2SGreg Kroah-Hartman #define BRK_ABRT 0x80 /* Break/Abort */ 221ab4382d2SGreg Kroah-Hartman 222ab4382d2SGreg Kroah-Hartman /* Read Register 1 */ 223ab4382d2SGreg Kroah-Hartman #define ALL_SNT 0x1 /* All sent */ 224ab4382d2SGreg Kroah-Hartman /* Residue Data for 8 Rx bits/char programmed */ 225ab4382d2SGreg Kroah-Hartman #define RES3 0x8 /* 0/3 */ 226ab4382d2SGreg Kroah-Hartman #define RES4 0x4 /* 0/4 */ 227ab4382d2SGreg Kroah-Hartman #define RES5 0xc /* 0/5 */ 228ab4382d2SGreg Kroah-Hartman #define RES6 0x2 /* 0/6 */ 229ab4382d2SGreg Kroah-Hartman #define RES7 0xa /* 0/7 */ 230ab4382d2SGreg Kroah-Hartman #define RES8 0x6 /* 0/8 */ 231ab4382d2SGreg Kroah-Hartman #define RES18 0xe /* 1/8 */ 232ab4382d2SGreg Kroah-Hartman #define RES28 0x0 /* 2/8 */ 233ab4382d2SGreg Kroah-Hartman /* Special Rx Condition Interrupts */ 234ab4382d2SGreg Kroah-Hartman #define PAR_ERR 0x10 /* Parity error */ 235ab4382d2SGreg Kroah-Hartman #define Rx_OVR 0x20 /* Rx Overrun Error */ 236ab4382d2SGreg Kroah-Hartman #define CRC_ERR 0x40 /* CRC/Framing Error */ 237ab4382d2SGreg Kroah-Hartman #define END_FR 0x80 /* End of Frame (SDLC) */ 238ab4382d2SGreg Kroah-Hartman 239ab4382d2SGreg Kroah-Hartman /* Read Register 2 (channel b only) - Interrupt vector */ 240ab4382d2SGreg Kroah-Hartman #define CHB_Tx_EMPTY 0x00 241ab4382d2SGreg Kroah-Hartman #define CHB_EXT_STAT 0x02 242ab4382d2SGreg Kroah-Hartman #define CHB_Rx_AVAIL 0x04 243ab4382d2SGreg Kroah-Hartman #define CHB_SPECIAL 0x06 244ab4382d2SGreg Kroah-Hartman #define CHA_Tx_EMPTY 0x08 245ab4382d2SGreg Kroah-Hartman #define CHA_EXT_STAT 0x0a 246ab4382d2SGreg Kroah-Hartman #define CHA_Rx_AVAIL 0x0c 247ab4382d2SGreg Kroah-Hartman #define CHA_SPECIAL 0x0e 248ab4382d2SGreg Kroah-Hartman #define STATUS_MASK 0x0e 249ab4382d2SGreg Kroah-Hartman 250ab4382d2SGreg Kroah-Hartman /* Read Register 3 (interrupt pending register) ch a only */ 251ab4382d2SGreg Kroah-Hartman #define CHBEXT 0x1 /* Channel B Ext/Stat IP */ 252ab4382d2SGreg Kroah-Hartman #define CHBTxIP 0x2 /* Channel B Tx IP */ 253ab4382d2SGreg Kroah-Hartman #define CHBRxIP 0x4 /* Channel B Rx IP */ 254ab4382d2SGreg Kroah-Hartman #define CHAEXT 0x8 /* Channel A Ext/Stat IP */ 255ab4382d2SGreg Kroah-Hartman #define CHATxIP 0x10 /* Channel A Tx IP */ 256ab4382d2SGreg Kroah-Hartman #define CHARxIP 0x20 /* Channel A Rx IP */ 257ab4382d2SGreg Kroah-Hartman 258ab4382d2SGreg Kroah-Hartman /* Read Register 6 (LSB frame byte count [Not on NMOS]) */ 259ab4382d2SGreg Kroah-Hartman 260ab4382d2SGreg Kroah-Hartman /* Read Register 7 (MSB frame byte count and FIFO status [Not on NMOS]) */ 261ab4382d2SGreg Kroah-Hartman 262ab4382d2SGreg Kroah-Hartman /* Read Register 8 (receive data register) */ 263ab4382d2SGreg Kroah-Hartman 264ab4382d2SGreg Kroah-Hartman /* Read Register 10 (misc status bits) */ 265ab4382d2SGreg Kroah-Hartman #define ONLOOP 2 /* On loop */ 266ab4382d2SGreg Kroah-Hartman #define LOOPSEND 0x10 /* Loop sending */ 267ab4382d2SGreg Kroah-Hartman #define CLK2MIS 0x40 /* Two clocks missing */ 268ab4382d2SGreg Kroah-Hartman #define CLK1MIS 0x80 /* One clock missing */ 269ab4382d2SGreg Kroah-Hartman 270ab4382d2SGreg Kroah-Hartman /* Read Register 12 (lower byte of baud rate generator constant) */ 271ab4382d2SGreg Kroah-Hartman 272ab4382d2SGreg Kroah-Hartman /* Read Register 13 (upper byte of baud rate generator constant) */ 273ab4382d2SGreg Kroah-Hartman 274ab4382d2SGreg Kroah-Hartman /* Read Register 15 (value of WR 15) */ 275ab4382d2SGreg Kroah-Hartman 276ab4382d2SGreg Kroah-Hartman /* Misc macros */ 277ab4382d2SGreg Kroah-Hartman #define ZS_CLEARERR(channel) do { sbus_writeb(ERR_RES, &channel->control); \ 278ab4382d2SGreg Kroah-Hartman udelay(5); } while(0) 279ab4382d2SGreg Kroah-Hartman 280ab4382d2SGreg Kroah-Hartman #define ZS_CLEARSTAT(channel) do { sbus_writeb(RES_EXT_INT, &channel->control); \ 281ab4382d2SGreg Kroah-Hartman udelay(5); } while(0) 282ab4382d2SGreg Kroah-Hartman 283ab4382d2SGreg Kroah-Hartman #define ZS_CLEARFIFO(channel) do { sbus_readb(&channel->data); \ 284ab4382d2SGreg Kroah-Hartman udelay(2); \ 285ab4382d2SGreg Kroah-Hartman sbus_readb(&channel->data); \ 286ab4382d2SGreg Kroah-Hartman udelay(2); \ 287ab4382d2SGreg Kroah-Hartman sbus_readb(&channel->data); \ 288ab4382d2SGreg Kroah-Hartman udelay(2); } while(0) 289ab4382d2SGreg Kroah-Hartman 290ab4382d2SGreg Kroah-Hartman #endif /* _SUNZILOG_H */ 291