/*
* Copyright (c) 1998, 2001 Matthew R. Green
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* cirrus-logic CL-CD180/CD1864/CD1865 register definitions, from the
* CL-CD1865 data book.
*/
/*
* available registers for us.
*
* the cd1865 provides 4 types of registers: global, indexed indirect,
* channel, and unavailable. we should never touch the unavailable, as it
* may cause the cd1865 to fail. the indexed indirect registers are
* really pointers to the correct channel we are currently servicing, and
* as such must only be accessed during service-request service routines.
* global registers set and provide common functionality between all of
* the channels. channel registers only affect the specific channel.
* access to channel registers is limited to the current channel, as
* specified in the CAR register, ie. to access different channels, the CAR
* register must be changed first.
*/
/*
* the registers themselves.
*/
/* global registers */
#define CD18xx_GFRCR 0x6b /* global firmware revision code */
#define CD18xx_SRCR 0x66 /* service request configuration */
#define CD18xx_PPRH 0x70 /* prescaler period (high) */
#define CD18xx_PPRL 0x71 /* prescaler period (low) */
#define CD18xx_MSMR 0x61 /* modem service match */
#define CD18xx_TSMR 0x62 /* transmit service match */
#define CD18xx_RSMR 0x63 /* receive service match */
#define CD18xx_GSVR 0x40 /* global service vector */
#define CD18xx_SRSR 0x65 /* service request status */
#define CD18xx_MRAR 0x75 /* modem request acknowledge */
#define CD18xx_TRAR 0x76 /* transmit request acknowledge */
#define CD18xx_RRAR 0x77 /* receive request acknowledge */
#define CD18xx_GSCR1 0x41 /* global service channel (1) */
#define CD18xx_GSCR2 0x42 /* global service channel (2) */
#define CD18xx_GSCR3 0x43 /* global service channel (3) */
#define CD18xx_CAR 0x64 /* channel access register */
/* indexed indirect registers */
#define CD18xx_RDCR 0x07 /* receive data count */
#define CD18xx_RDR 0x78 /* receiver data register */
#define CD18xx_RCSR 0x7a /* receiver channel status */
#define CD18xx_TDR 0x7b /* transmit data register */
#define CD18xx_EOSRR 0x7f /* end of service request */
/* channel registers */
#define CD18xx_SRER 0x02 /* service request enable */
#define CD18xx_CCR 0x01 /* channel command */
#define CD18xx_COR1 0x03 /* channel option (1) */
#define CD18xx_COR2 0x04 /* channel option (2) */
#define CD18xx_COR3 0x05 /* channel option (3) */
#define CD18xx_CCSR 0x06 /* channel control status */
#define CD18xx_RBR 0x33 /* receiver bit */
#define CD18xx_RTPR 0x18 /* receive time-out period */
#define CD18xx_RBPRH 0x31 /* receive bit rate period (high) */
#define CD18xx_RBPRL 0x32 /* receive bit rate period (low) */
#define CD18xx_TBPRH 0x39 /* transmit bit rate period (high) */
#define CD18xx_TBPRL 0x3a /* transmit bit rate period (low) */
#define CD18xx_SCHR1 0x09 /* special character (1) */
#define CD18xx_SCHR2 0x0a /* special character (2) */
#define CD18xx_SCHR3 0x0b /* special character (3) */
#define CD18xx_SCHR4 0x0c /* special character (4) */
#define CD18xx_MCR 0x10 /* modem change */
#define CD18xx_MCOR1 0x10 /* modem change option (1) */
#define CD18xx_MCOR2 0x11 /* modem change option (2) */
#define CD18xx_MSVR 0x28 /* modem signal value */
#define CD18xx_MSVRTS 0x29 /* modem signal value RTS */
#define CD18xx_MSVDTR 0x2a /* modem signal value DTR */
/* service request status register */
#define CD18xx_SRSR_CONTEXT 0xc0 /* service request context */
#define CD18xx_SRSR_PENDING 0x15 /* get status bits for each */
#define CD18xx_SRSR_RxPEND 0x10 /* got a Rx interrupt */
#define CD18xx_SRSR_TxPEND 0x04 /* got a Tx interrupt */
#define CD18xx_SRSR_MxPEND 0x01 /* got a modem interrupt */
/* global service channel registers */
#define CD18xx_GSCR_USER1 0xe0 /* 3 bits of user-defined data */
#define CD18xx_GSCR_CAR 0x1c /* CAR of current channel */
#define CD18xx_GSCR_USER2 0x03 /* 2 bits of user-defined data */
/* indexed indirect registers */
/* receive data count register */
#define CD18xx_RDCR_ZERO 0xf0 /* reserved, must be zero */
#define CD18xx_RDCR_GOODBYTES 0x0f /* number of good bytes */
/* receive character status register */
#define CD18xx_RCSR_TIMEOUT 0x80 /* timeout has occurred on channel */
#define CD18xx_RCSR_SCD 0x70 /* special character detect */
#define CD18xx_RCSR_BREAK 0x08 /* line break detected */
#define CD18xx_RCSR_PARITYERR 0x04 /* parity error detected */
#define CD18xx_RCSR_FRAMERR 0x02 /* framing error detected */
#define CD18xx_RCSR_OVERRUNERR 0x01 /* overrun error detected */
/* transmit data register */
#define CD18xx_TDR_ETC_BYTE 0x00 /* first byte of break message */
#define CD18xx_TDR_BREAK_BYTE 0x81 /* first byte of break message */
#define CD18xx_TDR_NOBREAK_BYTE 0x83 /* first byte of clean break message */
/* channel registers */
/* service request enable register */
#define CD18xx_SRER_DSR 0x80 /* DSR service request */
#define CD18xx_SRER_CD 0x40 /* CD service request */
#define CD18xx_SRER_CTS 0x20 /* CTS service request */
#define CD18xx_SRER_Rx 0x10 /* Rx data service request */
#define CD18xx_SRER_RxSC 0x08 /* Rx special char service request */
#define CD18xx_SRER_Tx 0x04 /* Tx ready service request */
#define CD18xx_SRER_TxEMPTY 0x02 /* Tx empty service request */
#define CD18xx_SRER_NNDT 0x01 /* no new data timeout service request */
/* modem change option register 1 */
#define CD18xx_MCOR1_DSR 0x80 /* high-to-low on DSR */
#define CD18xx_MCOR1_CD 0x40 /* high-to-low on CD */
#define CD18xx_MCOR1_CTS 0x20 /* high-to-low on CTS */
#define CD18xx_MCOR1_DTR 0x08 /* high-to-low on DSR mode */
/* modem change option register 2 */
#define CD18xx_MCOR2_DSR 0x80 /* low-to-high on DSR */
#define CD18xx_MCOR2_CD 0x40 /* low-to-high on CD */
#define CD18xx_MCOR2_CTS 0x20 /* low-to-high on CST */
/* modem signal value register */
#define CD18xx_MSVR_DSR 0x80 /* current DSR state */
#define CD18xx_MSVR_CD 0x40 /* current CD state */
#define CD18xx_MSVR_CTS 0x20 /* current CTS state */
#define CD18xx_MSVR_DTR 0x02 /* current DTR state */
#define CD18xx_MSVR_RTS 0x01 /* current RTS state */
#define CD18xx_MSVR_RESET (CD18xx_MSVR_DSR|CD18xx_MSVR_CD| \
CD18xx_MSVR_CTS|CD18xx_MSVR_DTR| \
CD18xx_MSVR_RTS)
/* modem signal value request-to-send register */
#define CD18xx_MSVRTS_RTS 0x01 /* change RTS and not DTR */
/* modem signal value data-terminal-ready register */
#define CD18xx_MSVDTR_DTR 0x01 /* change DTR and not RTS */