11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _SUNZILOG_H 21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _SUNZILOG_H 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct zilog_channel { 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds volatile unsigned char control; 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds volatile unsigned char __pad1; 71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds volatile unsigned char data; 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds volatile unsigned char __pad2; 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct zilog_layout { 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct zilog_channel channelB; 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct zilog_channel channelA; 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 167cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue#define NUM_ZSREGS 17 177cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue#define R7p 16 /* Written as R7 with P15 bit 0 set */ 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Conversion routines to/from brg time constants from/to bits 201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * per second. 211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BRG_TO_BPS(brg, freq) ((freq) / 2 / ((brg) + 2)) 231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BPS_TO_BRG(bps, freq) ((((freq) + (bps)) / (2 * (bps))) - 2) 241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* The Zilog register set */ 261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define FLAG 0x7e 281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 0 */ 301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R0 0 /* Register selects */ 311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R1 1 321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R2 2 331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R3 3 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R4 4 351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R5 5 361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R6 6 371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R7 7 381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R8 8 391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R9 9 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R10 10 411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R11 11 421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R12 12 431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R13 13 441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R14 14 451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define R15 15 461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NULLCODE 0 /* Null Code */ 481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define POINT_HIGH 0x8 /* Select upper half of registers */ 491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES_EXT_INT 0x10 /* Reset Ext. Status Interrupts */ 501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SEND_ABORT 0x18 /* HDLC Abort */ 511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES_RxINT_FC 0x20 /* Reset RxINT on First Character */ 521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES_Tx_P 0x28 /* Reset TxINT Pending */ 531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ERR_RES 0x30 /* Error Reset */ 541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES_H_IUS 0x38 /* Reset highest IUS */ 551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES_Rx_CRC 0x40 /* Reset Rx CRC Checker */ 571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES_Tx_CRC 0x80 /* Reset Tx CRC Checker */ 581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES_EOM_L 0xC0 /* Reset EOM latch */ 591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 1 */ 611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define EXT_INT_ENAB 0x1 /* Ext Int Enable */ 631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TxINT_ENAB 0x2 /* Tx Int Enable */ 641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define PAR_SPEC 0x4 /* Parity is special condition */ 651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RxINT_DISAB 0 /* Rx Int Disable */ 671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RxINT_FCERR 0x8 /* Rx Int on First Character Only or Error */ 681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define INT_ALL_Rx 0x10 /* Int on all Rx Characters or error */ 691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define INT_ERR_Rx 0x18 /* Int on error only */ 701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RxINT_MASK 0x18 711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define WT_RDY_RT 0x20 /* Wait/Ready on R/T */ 731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define WT_FN_RDYFN 0x40 /* Wait/FN/Ready FN */ 741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define WT_RDY_ENAB 0x80 /* Wait/Ready Enable */ 751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register #2 (Interrupt Vector) */ 771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 3 */ 791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RxENAB 0x1 /* Rx Enable */ 811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SYNC_L_INH 0x2 /* Sync Character Load Inhibit */ 821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ADD_SM 0x4 /* Address Search Mode (SDLC) */ 831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RxCRC_ENAB 0x8 /* Rx CRC Enable */ 841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ENT_HM 0x10 /* Enter Hunt Mode */ 851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define AUTO_ENAB 0x20 /* Auto Enables */ 861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define Rx5 0x0 /* Rx 5 Bits/Character */ 871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define Rx7 0x40 /* Rx 7 Bits/Character */ 881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define Rx6 0x80 /* Rx 6 Bits/Character */ 891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define Rx8 0xc0 /* Rx 8 Bits/Character */ 901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RxN_MASK 0xc0 911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 4 */ 931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define PAR_ENAB 0x1 /* Parity Enable */ 951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define PAR_EVEN 0x2 /* Parity Even/Odd* */ 961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SYNC_ENAB 0 /* Sync Modes Enable */ 981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SB1 0x4 /* 1 stop bit/char */ 991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SB15 0x8 /* 1.5 stop bits/char */ 1001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SB2 0xc /* 2 stop bits/char */ 1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define MONSYNC 0 /* 8 Bit Sync character */ 1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BISYNC 0x10 /* 16 bit sync character */ 1041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SDLC 0x20 /* SDLC Mode (01111110 Sync Flag) */ 1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define EXTSYNC 0x30 /* External Sync Mode */ 1061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define X1CLK 0x0 /* x1 clock mode */ 1081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define X16CLK 0x40 /* x16 clock mode */ 1091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define X32CLK 0x80 /* x32 clock mode */ 1101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define X64CLK 0xC0 /* x64 clock mode */ 1111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define XCLK_MASK 0xC0 1121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 5 */ 1141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TxCRC_ENAB 0x1 /* Tx CRC Enable */ 1161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RTS 0x2 /* RTS */ 1171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SDLC_CRC 0x4 /* SDLC/CRC-16 */ 1181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TxENAB 0x8 /* Tx Enable */ 1191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SND_BRK 0x10 /* Send Break */ 1201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define Tx5 0x0 /* Tx 5 bits (or less)/character */ 1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define Tx7 0x20 /* Tx 7 bits/character */ 1221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define Tx6 0x40 /* Tx 6 bits/character */ 1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define Tx8 0x60 /* Tx 8 bits/character */ 1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TxN_MASK 0x60 1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DTR 0x80 /* DTR */ 1261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 6 (Sync bits 0-7/SDLC Address Field) */ 1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 7 (Sync bits 8-15/SDLC 01111110) */ 1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1317cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue/* Write Register 7' (ESCC Only) */ 1327cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue#define AUTO_TxFLAG 1 /* Automatic Tx SDLC Flag */ 1337cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue#define AUTO_EOM_RST 2 /* Automatic EOM Reset */ 1347cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue#define AUTOnRTS 4 /* Automatic /RTS pin deactivation */ 1357cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue#define RxFIFO_LVL 8 /* Receive FIFO interrupt level */ 1367cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue#define nDTRnREQ 0x10 /* /DTR/REQ timing */ 1377cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue#define TxFIFO_LVL 0x20 /* Transmit FIFO interrupt level */ 1387cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue#define EXT_RD_EN 0x40 /* Extended read register enable */ 1397cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue 1401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 8 (transmit buffer) */ 1411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 9 (Master interrupt control) */ 1431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define VIS 1 /* Vector Includes Status */ 1441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NV 2 /* No Vector */ 1451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DLC 4 /* Disable Lower Chain */ 1461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define MIE 8 /* Master Interrupt Enable */ 1471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define STATHI 0x10 /* Status high */ 1487cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue#define SWIACK 0x20 /* Software Interrupt Ack (not on NMOS) */ 1491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NORESET 0 /* No reset on write to R9 */ 1501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHRB 0x40 /* Reset channel B */ 1511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHRA 0x80 /* Reset channel A */ 1521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define FHWRES 0xc0 /* Force hardware reset */ 1531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 10 (misc control bits) */ 1551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BIT6 1 /* 6 bit/8bit sync */ 1561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOOPMODE 2 /* SDLC Loop mode */ 1571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ABUNDER 4 /* Abort/flag on SDLC xmit underrun */ 1581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define MARKIDLE 8 /* Mark/flag on idle */ 1591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define GAOP 0x10 /* Go active on poll */ 1601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NRZ 0 /* NRZ mode */ 1611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define NRZI 0x20 /* NRZI mode */ 1621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define FM1 0x40 /* FM1 (transition = 1) */ 1631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define FM0 0x60 /* FM0 (transition = 0) */ 1641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CRCPS 0x80 /* CRC Preset I/O */ 1651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 11 (Clock Mode control) */ 1671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TRxCXT 0 /* TRxC = Xtal output */ 1681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TRxCTC 1 /* TRxC = Transmit clock */ 1691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TRxCBR 2 /* TRxC = BR Generator Output */ 1701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TRxCDP 3 /* TRxC = DPLL output */ 1711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TRxCOI 4 /* TRxC O/I */ 1721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCRTxCP 0 /* Transmit clock = RTxC pin */ 1731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCTRxCP 8 /* Transmit clock = TRxC pin */ 1741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCBR 0x10 /* Transmit clock = BR Generator output */ 1751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCDPLL 0x18 /* Transmit clock = DPLL output */ 1761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCRTxCP 0 /* Receive clock = RTxC pin */ 1771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCTRxCP 0x20 /* Receive clock = TRxC pin */ 1781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCBR 0x40 /* Receive clock = BR Generator output */ 1791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCDPLL 0x60 /* Receive clock = DPLL output */ 1801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RTxCX 0x80 /* RTxC Xtal/No Xtal */ 1811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 12 (lower byte of baud rate generator time constant) */ 1831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 13 (upper byte of baud rate generator time constant) */ 1851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 14 (Misc control bits) */ 1871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BRENAB 1 /* Baud rate generator enable */ 1881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BRSRC 2 /* Baud rate generator source */ 1891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DTRREQ 4 /* DTR/Request function */ 1901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define AUTOECHO 8 /* Auto Echo */ 1911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOOPBAK 0x10 /* Local loopback */ 1921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SEARCH 0x20 /* Enter search mode */ 1931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RMC 0x40 /* Reset missing clock */ 1941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DISDPLL 0x60 /* Disable DPLL */ 1951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SSBR 0x80 /* Set DPLL source = BR generator */ 1961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SSRTxC 0xa0 /* Set DPLL source = RTxC */ 1971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SFMM 0xc0 /* Set FM mode */ 1981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SNRZI 0xe0 /* Set NRZI mode */ 1991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Write Register 15 (external/status interrupt control) */ 2017cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue#define WR7pEN 1 /* WR7' Enable (ESCC only) */ 2021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ZCIE 2 /* Zero count IE */ 2037cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue#define FIFOEN 4 /* FIFO Enable (ESCC only) */ 2041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCDIE 8 /* DCD IE */ 2051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SYNCIE 0x10 /* Sync/hunt IE */ 2061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CTSIE 0x20 /* CTS IE */ 2071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TxUIE 0x40 /* Tx Underrun/EOM IE */ 2081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BRKIE 0x80 /* Break/Abort IE */ 2091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Read Register 0 */ 2121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define Rx_CH_AV 0x1 /* Rx Character Available */ 2131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ZCOUNT 0x2 /* Zero count */ 2141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define Tx_BUF_EMP 0x4 /* Tx Buffer empty */ 2151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCD 0x8 /* DCD */ 2161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SYNC 0x10 /* Sync/hunt */ 2171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CTS 0x20 /* CTS */ 2181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TxEOM 0x40 /* Tx underrun */ 2191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BRK_ABRT 0x80 /* Break/Abort */ 2201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Read Register 1 */ 2221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ALL_SNT 0x1 /* All sent */ 2231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Residue Data for 8 Rx bits/char programmed */ 2241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES3 0x8 /* 0/3 */ 2251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES4 0x4 /* 0/4 */ 2261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES5 0xc /* 0/5 */ 2271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES6 0x2 /* 0/6 */ 2281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES7 0xa /* 0/7 */ 2291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES8 0x6 /* 0/8 */ 2301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES18 0xe /* 1/8 */ 2311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RES28 0x0 /* 2/8 */ 2321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Special Rx Condition Interrupts */ 2331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define PAR_ERR 0x10 /* Parity error */ 2341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define Rx_OVR 0x20 /* Rx Overrun Error */ 2351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CRC_ERR 0x40 /* CRC/Framing Error */ 2361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define END_FR 0x80 /* End of Frame (SDLC) */ 2371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Read Register 2 (channel b only) - Interrupt vector */ 2391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHB_Tx_EMPTY 0x00 2401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHB_EXT_STAT 0x02 2411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHB_Rx_AVAIL 0x04 2421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHB_SPECIAL 0x06 2431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHA_Tx_EMPTY 0x08 2441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHA_EXT_STAT 0x0a 2451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHA_Rx_AVAIL 0x0c 2461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHA_SPECIAL 0x0e 2471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define STATUS_MASK 0x0e 2481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Read Register 3 (interrupt pending register) ch a only */ 2501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHBEXT 0x1 /* Channel B Ext/Stat IP */ 2511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHBTxIP 0x2 /* Channel B Tx IP */ 2521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHBRxIP 0x4 /* Channel B Rx IP */ 2531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHAEXT 0x8 /* Channel A Ext/Stat IP */ 2541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHATxIP 0x10 /* Channel A Tx IP */ 2551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CHARxIP 0x20 /* Channel A Rx IP */ 2561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2577cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue/* Read Register 6 (LSB frame byte count [Not on NMOS]) */ 2587cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue 2597cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue/* Read Register 7 (MSB frame byte count and FIFO status [Not on NMOS]) */ 2607cc5c8559c62289d027812bfdd4eb6a28c5769b6Mark Fortescue 2611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Read Register 8 (receive data register) */ 2621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Read Register 10 (misc status bits) */ 2641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ONLOOP 2 /* On loop */ 2651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define LOOPSEND 0x10 /* Loop sending */ 2661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CLK2MIS 0x40 /* Two clocks missing */ 2671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CLK1MIS 0x80 /* One clock missing */ 2681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Read Register 12 (lower byte of baud rate generator constant) */ 2701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Read Register 13 (upper byte of baud rate generator constant) */ 2721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Read Register 15 (value of WR 15) */ 2741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Misc macros */ 2761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ZS_CLEARERR(channel) do { sbus_writeb(ERR_RES, &channel->control); \ 2771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds udelay(5); } while(0) 2781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ZS_CLEARSTAT(channel) do { sbus_writeb(RES_EXT_INT, &channel->control); \ 2801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds udelay(5); } while(0) 2811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ZS_CLEARFIFO(channel) do { sbus_readb(&channel->data); \ 2831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds udelay(2); \ 2841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds sbus_readb(&channel->data); \ 2851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds udelay(2); \ 2861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds sbus_readb(&channel->data); \ 2871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds udelay(2); } while(0) 2881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* _SUNZILOG_H */ 290