15b81b6b3SRodney W. Grimes /*- 2*7282444bSPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause 3*7282444bSPedro F. Giffuni * 45b81b6b3SRodney W. Grimes * Copyright (c) 1991 The Regents of the University of California. 55b81b6b3SRodney W. Grimes * All rights reserved. 65b81b6b3SRodney W. Grimes * 75b81b6b3SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 85b81b6b3SRodney W. Grimes * modification, are permitted provided that the following conditions 95b81b6b3SRodney W. Grimes * are met: 105b81b6b3SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 115b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 125b81b6b3SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 135b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 145b81b6b3SRodney W. Grimes * documentation and/or other materials provided with the distribution. 15fbbd9655SWarner Losh * 3. Neither the name of the University nor the names of its contributors 165b81b6b3SRodney W. Grimes * may be used to endorse or promote products derived from this software 175b81b6b3SRodney W. Grimes * without specific prior written permission. 185b81b6b3SRodney W. Grimes * 195b81b6b3SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 205b81b6b3SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 215b81b6b3SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 225b81b6b3SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 235b81b6b3SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 245b81b6b3SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 255b81b6b3SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 265b81b6b3SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 275b81b6b3SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 285b81b6b3SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 295b81b6b3SRodney W. Grimes * SUCH DAMAGE. 305b81b6b3SRodney W. Grimes */ 315b81b6b3SRodney W. Grimes 325b81b6b3SRodney W. Grimes /* 3374814b32SBruce Evans * NS8250... UART registers. 345b81b6b3SRodney W. Grimes */ 3586fe8739SBruce Evans 3674814b32SBruce Evans /* 8250 registers #[0-6]. */ 3774814b32SBruce Evans 3874814b32SBruce Evans #define com_data 0 /* data register (R/W) */ 394f5d62fbSMarcel Moolenaar #define REG_DATA com_data 4074814b32SBruce Evans 4174814b32SBruce Evans #define com_ier 1 /* interrupt enable register (W) */ 424f5d62fbSMarcel Moolenaar #define REG_IER com_ier 4386fe8739SBruce Evans #define IER_ERXRDY 0x1 4486fe8739SBruce Evans #define IER_ETXRDY 0x2 4586fe8739SBruce Evans #define IER_ERLS 0x4 4686fe8739SBruce Evans #define IER_EMSC 0x8 4757b28934SRuslan Bukin /* 4857b28934SRuslan Bukin * Receive timeout interrupt enable. 4957b28934SRuslan Bukin * Implemented in Intel XScale, Ingenic XBurst. 5057b28934SRuslan Bukin */ 5157b28934SRuslan Bukin #define IER_RXTMOUT 0x10 5286fe8739SBruce Evans 5357b28934SRuslan Bukin #define IER_BITS "\20\1ERXRDY\2ETXRDY\3ERLS\4EMSC\5RXTMOUT" 5404ddfac3SSam Leffler 5574814b32SBruce Evans #define com_iir 2 /* interrupt identification register (R) */ 564f5d62fbSMarcel Moolenaar #define REG_IIR com_iir 5786fe8739SBruce Evans #define IIR_IMASK 0xf 5886fe8739SBruce Evans #define IIR_RXTOUT 0xc 5918f32335SWarner Losh #define IIR_BUSY 0x7 6086fe8739SBruce Evans #define IIR_RLS 0x6 6186fe8739SBruce Evans #define IIR_RXRDY 0x4 6286fe8739SBruce Evans #define IIR_TXRDY 0x2 6386fe8739SBruce Evans #define IIR_NOPEND 0x1 6486fe8739SBruce Evans #define IIR_MLSC 0x0 6586fe8739SBruce Evans #define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */ 6686fe8739SBruce Evans 6704ddfac3SSam Leffler #define IIR_BITS "\20\1NOPEND\2TXRDY\3RXRDY" 6804ddfac3SSam Leffler 692b843bc9SBruce Evans #define com_lcr 3 /* line control register (R/W) */ 702b843bc9SBruce Evans #define com_cfcr com_lcr /* character format control register (R/W) */ 714f5d62fbSMarcel Moolenaar #define REG_LCR com_lcr 722b843bc9SBruce Evans #define LCR_DLAB 0x80 732b843bc9SBruce Evans #define CFCR_DLAB LCR_DLAB 742b843bc9SBruce Evans #define LCR_EFR_ENABLE 0xbf /* magic to enable EFR on 16650 up */ 752b843bc9SBruce Evans #define CFCR_EFR_ENABLE LCR_EFR_ENABLE 764f5d62fbSMarcel Moolenaar #define LCR_SBREAK 0x40 774f5d62fbSMarcel Moolenaar #define CFCR_SBREAK LCR_SBREAK 784f5d62fbSMarcel Moolenaar #define LCR_PZERO 0x30 794f5d62fbSMarcel Moolenaar #define CFCR_PZERO LCR_PZERO 804f5d62fbSMarcel Moolenaar #define LCR_PONE 0x20 814f5d62fbSMarcel Moolenaar #define CFCR_PONE LCR_PONE 824f5d62fbSMarcel Moolenaar #define LCR_PEVEN 0x10 834f5d62fbSMarcel Moolenaar #define CFCR_PEVEN LCR_PEVEN 844f5d62fbSMarcel Moolenaar #define LCR_PODD 0x00 854f5d62fbSMarcel Moolenaar #define CFCR_PODD LCR_PODD 864f5d62fbSMarcel Moolenaar #define LCR_PENAB 0x08 874f5d62fbSMarcel Moolenaar #define CFCR_PENAB LCR_PENAB 884f5d62fbSMarcel Moolenaar #define LCR_STOPB 0x04 894f5d62fbSMarcel Moolenaar #define CFCR_STOPB LCR_STOPB 904f5d62fbSMarcel Moolenaar #define LCR_8BITS 0x03 914f5d62fbSMarcel Moolenaar #define CFCR_8BITS LCR_8BITS 924f5d62fbSMarcel Moolenaar #define LCR_7BITS 0x02 934f5d62fbSMarcel Moolenaar #define CFCR_7BITS LCR_7BITS 944f5d62fbSMarcel Moolenaar #define LCR_6BITS 0x01 954f5d62fbSMarcel Moolenaar #define CFCR_6BITS LCR_6BITS 964f5d62fbSMarcel Moolenaar #define LCR_5BITS 0x00 974f5d62fbSMarcel Moolenaar #define CFCR_5BITS LCR_5BITS 9886fe8739SBruce Evans 9974814b32SBruce Evans #define com_mcr 4 /* modem control register (R/W) */ 1004f5d62fbSMarcel Moolenaar #define REG_MCR com_mcr 10186fe8739SBruce Evans #define MCR_PRESCALE 0x80 /* only available on 16650 up */ 10286fe8739SBruce Evans #define MCR_LOOPBACK 0x10 1034f5d62fbSMarcel Moolenaar #define MCR_IE 0x08 1044f5d62fbSMarcel Moolenaar #define MCR_IENABLE MCR_IE 10586fe8739SBruce Evans #define MCR_DRS 0x04 10686fe8739SBruce Evans #define MCR_RTS 0x02 10786fe8739SBruce Evans #define MCR_DTR 0x01 10886fe8739SBruce Evans 10904ddfac3SSam Leffler #define MCR_BITS "\20\1DTR\2RTS\3DRS\4IE\5LOOPBACK\10PRESCALE" 11004ddfac3SSam Leffler 11174814b32SBruce Evans #define com_lsr 5 /* line status register (R/W) */ 1124f5d62fbSMarcel Moolenaar #define REG_LSR com_lsr 11386fe8739SBruce Evans #define LSR_RCV_FIFO 0x80 1144f5d62fbSMarcel Moolenaar #define LSR_TEMT 0x40 1154f5d62fbSMarcel Moolenaar #define LSR_TSRE LSR_TEMT 1164f5d62fbSMarcel Moolenaar #define LSR_THRE 0x20 1174f5d62fbSMarcel Moolenaar #define LSR_TXRDY LSR_THRE 11886fe8739SBruce Evans #define LSR_BI 0x10 11986fe8739SBruce Evans #define LSR_FE 0x08 12086fe8739SBruce Evans #define LSR_PE 0x04 12186fe8739SBruce Evans #define LSR_OE 0x02 12286fe8739SBruce Evans #define LSR_RXRDY 0x01 12386fe8739SBruce Evans #define LSR_RCV_MASK 0x1f 12486fe8739SBruce Evans 12504ddfac3SSam Leffler #define LSR_BITS "\20\1RXRDY\2OE\3PE\4FE\5BI\6THRE\7TEMT\10RCV_FIFO" 12604ddfac3SSam Leffler 12774814b32SBruce Evans #define com_msr 6 /* modem status register (R/W) */ 1284f5d62fbSMarcel Moolenaar #define REG_MSR com_msr 12986fe8739SBruce Evans #define MSR_DCD 0x80 13086fe8739SBruce Evans #define MSR_RI 0x40 13186fe8739SBruce Evans #define MSR_DSR 0x20 13286fe8739SBruce Evans #define MSR_CTS 0x10 13386fe8739SBruce Evans #define MSR_DDCD 0x08 13486fe8739SBruce Evans #define MSR_TERI 0x04 13586fe8739SBruce Evans #define MSR_DDSR 0x02 13686fe8739SBruce Evans #define MSR_DCTS 0x01 13786fe8739SBruce Evans 13804ddfac3SSam Leffler #define MSR_BITS "\20\1DCTS\2DDSR\3TERI\4DDCD\5CTS\6DSR\7RI\10DCD" 13904ddfac3SSam Leffler 14074814b32SBruce Evans /* 8250 multiplexed registers #[0-1]. Access enabled by LCR[7]. */ 1412b843bc9SBruce Evans #define com_dll 0 /* divisor latch low (R/W) */ 1422b843bc9SBruce Evans #define com_dlbl com_dll 1432b843bc9SBruce Evans #define com_dlm 1 /* divisor latch high (R/W) */ 1442b843bc9SBruce Evans #define com_dlbh com_dlm 14558957d87SBenno Rice #define REG_DLL com_dll 14658957d87SBenno Rice #define REG_DLH com_dlm 14774814b32SBruce Evans 14874814b32SBruce Evans /* 16450 register #7. Not multiplexed. */ 14974814b32SBruce Evans #define com_scr 7 /* scratch register (R/W) */ 15074814b32SBruce Evans 15174814b32SBruce Evans /* 16550 register #2. Not multiplexed. */ 1522b843bc9SBruce Evans #define com_fcr 2 /* FIFO control register (W) */ 1532b843bc9SBruce Evans #define com_fifo com_fcr 1544f5d62fbSMarcel Moolenaar #define REG_FCR com_fcr 1554f5d62fbSMarcel Moolenaar #define FCR_ENABLE 0x01 1564f5d62fbSMarcel Moolenaar #define FIFO_ENABLE FCR_ENABLE 1574f5d62fbSMarcel Moolenaar #define FCR_RCV_RST 0x02 1584f5d62fbSMarcel Moolenaar #define FIFO_RCV_RST FCR_RCV_RST 1594f5d62fbSMarcel Moolenaar #define FCR_XMT_RST 0x04 1604f5d62fbSMarcel Moolenaar #define FIFO_XMT_RST FCR_XMT_RST 1614f5d62fbSMarcel Moolenaar #define FCR_DMA 0x08 1624f5d62fbSMarcel Moolenaar #define FIFO_DMA_MODE FCR_DMA 1634f5d62fbSMarcel Moolenaar #define FCR_RX_LOW 0x00 1644f5d62fbSMarcel Moolenaar #define FIFO_RX_LOW FCR_RX_LOW 1654f5d62fbSMarcel Moolenaar #define FCR_RX_MEDL 0x40 1664f5d62fbSMarcel Moolenaar #define FIFO_RX_MEDL FCR_RX_MEDL 1674f5d62fbSMarcel Moolenaar #define FCR_RX_MEDH 0x80 1684f5d62fbSMarcel Moolenaar #define FIFO_RX_MEDH FCR_RX_MEDH 1694f5d62fbSMarcel Moolenaar #define FCR_RX_HIGH 0xc0 1704f5d62fbSMarcel Moolenaar #define FIFO_RX_HIGH FCR_RX_HIGH 17174814b32SBruce Evans 17204ddfac3SSam Leffler #define FCR_BITS "\20\1ENABLE\2RCV_RST\3XMT_RST\4DMA" 17304ddfac3SSam Leffler 17474814b32SBruce Evans /* 16650 registers #2,[4-7]. Access enabled by LCR_EFR_ENABLE. */ 17574814b32SBruce Evans 1762b843bc9SBruce Evans #define com_efr 2 /* enhanced features register (R/W) */ 1774f5d62fbSMarcel Moolenaar #define REG_EFR com_efr 1784f5d62fbSMarcel Moolenaar #define EFR_CTS 0x80 1794f5d62fbSMarcel Moolenaar #define EFR_AUTOCTS EFR_CTS 1804f5d62fbSMarcel Moolenaar #define EFR_RTS 0x40 1814f5d62fbSMarcel Moolenaar #define EFR_AUTORTS EFR_RTS 18286fe8739SBruce Evans #define EFR_EFE 0x10 /* enhanced functions enable */ 18386fe8739SBruce Evans 184fec27f50SBruce Evans #define com_xon1 4 /* XON 1 character (R/W) */ 185fec27f50SBruce Evans #define com_xon2 5 /* XON 2 character (R/W) */ 186fec27f50SBruce Evans #define com_xoff1 6 /* XOFF 1 character (R/W) */ 187fec27f50SBruce Evans #define com_xoff2 7 /* XOFF 2 character (R/W) */ 188fec27f50SBruce Evans 189ac4adddfSGanbold Tsagaankhuu #define DW_REG_USR 31 /* DesignWare derived Uart Status Reg */ 19018f32335SWarner Losh #define com_usr 39 /* Octeon 16750/16550 Uart Status Reg */ 19118f32335SWarner Losh #define REG_USR com_usr 19249e368acSZbigniew Bodek #define USR_BUSY 1 /* Uart Busy. Serial transfer in progress */ 19318f32335SWarner Losh #define USR_TXFIFO_NOTFULL 2 /* Uart TX FIFO Not full */ 19418f32335SWarner Losh 195efcfe951SBruce Evans /* 16950 register #1. Access enabled by ACR[7]. Also requires !LCR[7]. */ 196efcfe951SBruce Evans #define com_asr 1 /* additional status register (R[0-7]/W[0-1]) */ 197efcfe951SBruce Evans 198efcfe951SBruce Evans /* 16950 register #3. R/W access enabled by ACR[7]. */ 199efcfe951SBruce Evans #define com_rfl 3 /* receiver fifo level (R) */ 200efcfe951SBruce Evans 201efcfe951SBruce Evans /* 202efcfe951SBruce Evans * 16950 register #4. Access enabled by ACR[7]. Also requires 203efcfe951SBruce Evans * !LCR_EFR_ENABLE. 204efcfe951SBruce Evans */ 205efcfe951SBruce Evans #define com_tfl 4 /* transmitter fifo level (R) */ 206efcfe951SBruce Evans 207efcfe951SBruce Evans /* 208efcfe951SBruce Evans * 16950 register #5. Accessible if !LCR_EFR_ENABLE. Read access also 209efcfe951SBruce Evans * requires ACR[6]. 210efcfe951SBruce Evans */ 211efcfe951SBruce Evans #define com_icr 5 /* index control register (R/W) */ 2123deebd53SMarius Strobl #define REG_ICR com_icr 213efcfe951SBruce Evans 214efcfe951SBruce Evans /* 215efcfe951SBruce Evans * 16950 register #7. It is the same as com_scr except it has a different 216efcfe951SBruce Evans * abbreviation in the manufacturer's data sheet and it also serves as an 217efcfe951SBruce Evans * index into the Indexed Control register set. 218efcfe951SBruce Evans */ 219efcfe951SBruce Evans #define com_spr com_scr /* scratch pad (and index) register (R/W) */ 2204f5d62fbSMarcel Moolenaar #define REG_SPR com_scr 221efcfe951SBruce Evans 222efcfe951SBruce Evans /* 223efcfe951SBruce Evans * 16950 indexed control registers #[0-0x13]. Access is via index in SPR, 224efcfe951SBruce Evans * data in ICR (if ICR is accessible). 225efcfe951SBruce Evans */ 226efcfe951SBruce Evans 227efcfe951SBruce Evans #define com_acr 0 /* additional control register (R/W) */ 2283deebd53SMarius Strobl #define REG_ACR com_acr 229efcfe951SBruce Evans #define ACR_ASE 0x80 /* ASR/RFL/TFL enable */ 230efcfe951SBruce Evans #define ACR_ICRE 0x40 /* ICR enable */ 231efcfe951SBruce Evans #define ACR_TLE 0x20 /* TTL/RTL enable */ 232efcfe951SBruce Evans 233efcfe951SBruce Evans #define com_cpr 1 /* clock prescaler register (R/W) */ 234efcfe951SBruce Evans #define com_tcr 2 /* times clock register (R/W) */ 235efcfe951SBruce Evans #define com_ttl 4 /* transmitter trigger level (R/W) */ 236efcfe951SBruce Evans #define com_rtl 5 /* receiver trigger level (R/W) */ 237efcfe951SBruce Evans /* ... */ 238efcfe951SBruce Evans 23986fe8739SBruce Evans /* Hardware extension mode register for RSB-2000/3000. */ 24086fe8739SBruce Evans #define com_emr com_msr 24186fe8739SBruce Evans #define EMR_EXBUFF 0x04 24286fe8739SBruce Evans #define EMR_CTSFLW 0x08 24386fe8739SBruce Evans #define EMR_DSRFLW 0x10 24486fe8739SBruce Evans #define EMR_RTSFLW 0x20 24586fe8739SBruce Evans #define EMR_DTRFLW 0x40 24686fe8739SBruce Evans #define EMR_EFMODE 0x80 247