linux/include/linux/amba/serial.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 *  linux/include/asm-arm/hardware/serial_amba.h
 *
 *  Internal header file for AMBA serial ports
 *
 *  Copyright (C) ARM Limited
 *  Copyright (C) 2000 Deep Blue Solutions Ltd.
 */
#ifndef ASM_ARM_HARDWARE_SERIAL_AMBA_H
#define ASM_ARM_HARDWARE_SERIAL_AMBA_H

#ifndef __ASSEMBLY__
#include <linux/bitfield.h>
#include <linux/bits.h>
#endif

#include <linux/types.h>

/* -------------------------------------------------------------------------------
 *  From AMBA UART (PL010) Block Specification
 * -------------------------------------------------------------------------------
 *  UART Register Offsets.
 */
#define UART01x_DR
#define UART01x_RSR
#define UART01x_ECR
#define UART010_LCRH
#define ST_UART011_DMAWM
#define UART010_LCRM
#define ST_UART011_TIMEOUT
#define UART010_LCRL
#define UART010_CR
#define UART01x_FR
#define UART010_IIR
#define UART010_ICR
#define ST_UART011_LCRH_RX
#define UART01x_ILPR
#define UART011_IBRD
#define UART011_FBRD
#define UART011_LCRH
#define ST_UART011_LCRH_TX
#define UART011_CR
#define UART011_IFLS
#define UART011_IMSC
#define UART011_RIS
#define UART011_MIS
#define UART011_ICR
#define UART011_DMACR
#define ST_UART011_XFCR
#define ST_UART011_XON1
#define ST_UART011_XON2
#define ST_UART011_XOFF1
#define ST_UART011_XOFF2
#define ST_UART011_ITCR
#define ST_UART011_ITIP
#define ST_UART011_ABCR
#define ST_UART011_ABIMSC

/*
 * ZTE UART register offsets.  This UART has a radically different address
 * allocation from the ARM and ST variants, so we list all registers here.
 * We assume unlisted registers do not exist.
 */
#define ZX_UART011_DR
#define ZX_UART011_FR
#define ZX_UART011_IBRD
#define ZX_UART011_FBRD
#define ZX_UART011_LCRH
#define ZX_UART011_CR
#define ZX_UART011_IFLS
#define ZX_UART011_IMSC
#define ZX_UART011_RIS
#define ZX_UART011_MIS
#define ZX_UART011_ICR
#define ZX_UART011_DMACR

#define UART011_DR_OE
#define UART011_DR_BE
#define UART011_DR_PE
#define UART011_DR_FE

#define UART01x_RSR_OE
#define UART01x_RSR_BE
#define UART01x_RSR_PE
#define UART01x_RSR_FE

#define UART011_FR_RI
#define UART011_FR_TXFE
#define UART011_FR_RXFF
#define UART01x_FR_TXFF
#define UART01x_FR_RXFE
#define UART01x_FR_BUSY
#define UART01x_FR_DCD
#define UART01x_FR_DSR
#define UART01x_FR_CTS
#define UART01x_FR_TMSK

/*
 * Some bits of Flag Register on ZTE device have different position from
 * standard ones.
 */
#define ZX_UART01x_FR_BUSY
#define ZX_UART01x_FR_DSR
#define ZX_UART01x_FR_CTS
#define ZX_UART011_FR_RI

#define UART011_CR_CTSEN
#define UART011_CR_RTSEN
#define UART011_CR_OUT2
#define UART011_CR_OUT1
#define UART011_CR_RTS
#define UART011_CR_DTR
#define UART011_CR_RXE
#define UART011_CR_TXE
#define UART011_CR_LBE
#define UART010_CR_RTIE
#define UART010_CR_TIE
#define UART010_CR_RIE
#define UART010_CR_MSIE
#define ST_UART011_CR_OVSFACT
#define UART01x_CR_IIRLP
#define UART01x_CR_SIREN
#define UART01x_CR_UARTEN

#define UART011_LCRH_SPS
#define UART01x_LCRH_WLEN_8
#define UART01x_LCRH_WLEN_7
#define UART01x_LCRH_WLEN_6
#define UART01x_LCRH_WLEN_5
#define UART01x_LCRH_FEN
#define UART01x_LCRH_STP2
#define UART01x_LCRH_EPS
#define UART01x_LCRH_PEN
#define UART01x_LCRH_BRK

#define ST_UART011_DMAWM_RX
#define ST_UART011_DMAWM_RX_1
#define ST_UART011_DMAWM_RX_2
#define ST_UART011_DMAWM_RX_4
#define ST_UART011_DMAWM_RX_8
#define ST_UART011_DMAWM_RX_16
#define ST_UART011_DMAWM_RX_32
#define ST_UART011_DMAWM_RX_48
#define ST_UART011_DMAWM_TX
#define ST_UART011_DMAWM_TX_1
#define ST_UART011_DMAWM_TX_2
#define ST_UART011_DMAWM_TX_4
#define ST_UART011_DMAWM_TX_8
#define ST_UART011_DMAWM_TX_16
#define ST_UART011_DMAWM_TX_32
#define ST_UART011_DMAWM_TX_48

#define UART010_IIR_RTIS
#define UART010_IIR_TIS
#define UART010_IIR_RIS
#define UART010_IIR_MIS

#define UART011_IFLS_RXIFLSEL
#define UART011_IFLS_RX1_8
#define UART011_IFLS_RX2_8
#define UART011_IFLS_RX4_8
#define UART011_IFLS_RX6_8
#define UART011_IFLS_RX7_8
#define UART011_IFLS_TXIFLSEL
#define UART011_IFLS_TX1_8
#define UART011_IFLS_TX2_8
#define UART011_IFLS_TX4_8
#define UART011_IFLS_TX6_8
#define UART011_IFLS_TX7_8
/* special values for ST vendor with deeper fifo */
#define UART011_IFLS_RX_HALF
#define UART011_IFLS_TX_HALF

#define UART011_OEIM
#define UART011_BEIM
#define UART011_PEIM
#define UART011_FEIM
#define UART011_RTIM
#define UART011_TXIM
#define UART011_RXIM
#define UART011_DSRMIM
#define UART011_DCDMIM
#define UART011_CTSMIM
#define UART011_RIMIM

#define UART011_OEIS
#define UART011_BEIS
#define UART011_PEIS
#define UART011_FEIS
#define UART011_RTIS
#define UART011_TXIS
#define UART011_RXIS
#define UART011_DSRMIS
#define UART011_DCDMIS
#define UART011_CTSMIS
#define UART011_RIMIS

#define UART011_OEIC
#define UART011_BEIC
#define UART011_PEIC
#define UART011_FEIC
#define UART011_RTIC
#define UART011_TXIC
#define UART011_RXIC
#define UART011_DSRMIC
#define UART011_DCDMIC
#define UART011_CTSMIC
#define UART011_RIMIC

#define UART011_DMAONERR
#define UART011_TXDMAE
#define UART011_RXDMAE

#define UART01x_RSR_ANY
#define UART01x_FR_MODEM_ANY

#ifndef __ASSEMBLY__
struct amba_device; /* in uncompress this is included but amba/bus.h is not */
struct amba_pl010_data {};

struct dma_chan;
struct amba_pl011_data {};
#endif

#endif