#ifndef _GTMPSCREG_H
#define _GTMPSCREG_H
#define GTMPSC_BASE(u) (MPSC0_BASE + ((u) << 12))
#define GTMPSC_SIZE 0x1000
#define GTMPSC_NCHAN 2
#define GTMPSC_MMCR_LO 0x000
#define GTMPSC_MMCR_HI 0x004
#define GTMPSC_MPCR 0x008
#define GTMPSC_CHR_BASE 0x008
#define GTMPSC_CHRN(n) (GTMPSC_CHR_BASE + ((n) << 2))
#define GTMPSC_NCHR 11
#define GTMPSC_MRR 0xb400
#define GTMPSC_RCRR 0xb404
#define GTMPSC_TCRR 0xb408
#define GTMPSC_MRR_PORT0 0
#define GTMPSC_MRR_NONE 7
#define GTMPSC_MRR_MR0_MASK __BITS(2,0)
#define GTMPSC_MRR_RESa __BITS(5,3)
#define GTMPSC_MRR_MR1_MASK __BITS(8,6)
#define GTMPSC_MRR_RESb __BITS(30,9)
#define GTMPSC_MRRE_DSC __BIT(31)
#define GTMPSC_MRR_RES (GTMPSC_MRR_RESa|GTMPSC_MRR_RESb)
#define GTMPSC_CRR_BRG0 0x0
#define GTMPSC_CRR_BRG1 0x1
#define GTMPSC_CRR_BRG2 0x2
#define GTMPSC_CRR_SCLK0 0x8
#define GTMPSC_TCRR_TSCLK0 0x9
#define GTMPSC_CRR(u, v) ((v) << GTMPSC_CRR_SHIFT(u))
#define GTMPSC_CRR_SHIFT(u) ((u) * 8)
#define GTMPSC_CRR_MASK 0xf
#define GTMPSC_CRR_RESa __BITS(7,4)
#define GTMPSC_CRR_RESb __BITS(31,12)
#define GTMPSC_CRR_RES (GTMPSC_CRR_RESa|GTMPSC_CRR_RESb)
#define GTMPSC_MMCR_LO_MODE_MASK __BITS(2,0)
#define GTMPSC_MMCR_LO_MODE_UART (0x4 << 0)
#define GTMPSC_MMCR_LO_TTX __BIT(3)
#define GTMPSC_MMCR_LO_TRX __BIT(4)
#define GTMPSC_MMCR_LO_RESa __BIT(5)
#define GTMPSC_MMCR_LO_ET __BIT(6)
#define GTMPSC_MMCR_LO_ER __BIT(7)
#define GTMPSC_MMCR_LO_LPBK_MASK __BITS(9,8)
#define GTMPSC_MMCR_LO_LPBK_NONE (0 << 8)
#define GTMPSC_MMCR_LO_LPBK_LOOP (1 << 8)
#define GTMPSC_MMCR_LO_LPBK_ECHO (2 << 8)
#define GTMPSC_MMCR_LO_LPBK_LBE (3 << 8)
#define GTMPSC_MMCR_LO_NLM __BIT(10)
#define GTMPSC_MMCR_LO_RESb __BIT(11)
#define GTMPSC_MMCR_LO_TSYN __BIT(12)
#define GTMPSC_MMCR_LO_RESc __BIT(13)
#define GTMPSC_MMCR_LO_TSNS_MASK __BITS(15,14)
#define GTMPSC_MMCR_LO_TSNS_INF (0 << 14)
#define GTMPSC_MMCR_LO_TIDL __BIT(16)
#define GTMPSC_MMCR_LO_RTSM __BIT(17)
#define GTMPSC_MMCR_LO_RESd __BIT(18)
#define GTMPSC_MMCR_LO_CTSS __BIT(19)
#define GTMPSC_MMCR_LO_CDS __BIT(20)
#define GTMPSC_MMCR_LO_CTSM __BIT(21)
#define GTMPSC_MMCR_LO_CDM __BIT(22)
#define GTMPSC_MMCR_LO_CRCM_MASK __BITS(25,23)
#define GTMPSC_MMCR_LO_CRCM_NONE (0 << 23)
#define GTMPSC_MMCR_LO_RESe __BITS(27,26)
#define GTMPSC_MMCR_LO_TRVD __BIT(28)
#define GTMPSC_MMCR_LO_RRVD __BIT(29)
#define GTMPSC_MMCR_LO_RESf __BIT(30)
#define GTMPSC_MMCR_LO_GDE __BIT(31)
#define GTMPSC_MMCR_LO_RES \
(GTMPSC_MMCR_LO_RESa|GTMPSC_MMCR_LO_RESb|GTMPSC_MMCR_LO_RESc \
|GTMPSC_MMCR_LO_RESd|GTMPSC_MMCR_LO_RESe|GTMPSC_MMCR_LO_RESf)
#define GTMPSC_MMCR_HI_TCI __BIT(0)
#define GTMPSC_MMCR_HI_TINV __BIT(1)
#define GTMPSC_MMCR_HI_TPL __BITS(4,2)
#define GTMPSC_MMCR_HI_TPL_NONE 0
#define GTMPSC_MMCR_HI_TPL_16 (6 << 2)
#define GTMPSC_MMCR_HI_TPPT_MASK __BITS(8,5)
#define GTMPSC_MMCR_HI_TPPT_NONE (0 << 5)
#define GTMPSC_MMCR_HI_TCDV_MASK __BITS(10,9)
#define GTMPSC_MMCR_HI_TCDV_1X (0 << 9)
#define GTMPSC_MMCR_HI_TCDV_8X (1 << 9)
#define GTMPSC_MMCR_HI_TCDV_16X (2 << 9)
#define GTMPSC_MMCR_HI_TCDV_32X (3 << 9)
#define GTMPSC_MMCR_HI_TDEC_MASK __BITS(13,11)
#define GTMPSC_MMCR_HI_TDEC_NRZ (0 << 9)
#define GTMPSC_MMCR_HI_TDEC_NRZI (1 << 9)
#define GTMPSC_MMCR_HI_TDEC_FM0 (2 << 9)
#define GTMPSC_MMCR_HI_TDEC_MAN (4 << 9)
#define GTMPSC_MMCR_HI_TDEC_DMAN (6 << 9)
#define GTMPSC_MMCR_HI_RESa __BITS(15,14)
#define GTMPSC_MMCR_HI_RINV __BIT(16)
#define GTMPSC_MMCR_HI_GDW __BITS(20,17)
#define GTMPSC_MMCR_HI_RESb __BIT(21)
#define GTMPSC_MMCR_HI_RDW __BIT(22)
#define GTMPSC_MMCR_HI_RSYL_MASK __BITS(24,23)
#define GTMPSC_MMCR_HI_RSYL_EXT (0 << 23)
#define GTMPSC_MMCR_HI_RSYL_4BIT (1 << 23)
#define GTMPSC_MMCR_HI_RSYL_8BIT (2 << 23)
#define GTMPSC_MMCR_HI_RSYL_16BIT (3 << 23)
#define GTMPSC_MMCR_HI_RCDV_MASK __BITS(26,25)
#define GTMPSC_MMCR_HI_RCDV_1X (0 << 25)
#define GTMPSC_MMCR_HI_RCDV_8X (1 << 25)
#define GTMPSC_MMCR_HI_RCDV_16X (2 << 25)
#define GTMPSC_MMCR_HI_RCDV_32X (3 << 25)
#define GTMPSC_MMCR_HI_RENC_MASK __BITS(29,27)
#define GTMPSC_MMCR_HI_RENC_NRZ (0 << 27)
#define GTMPSC_MMCR_HI_RENC_NRZI (1 << 27)
#define GTMPSC_MMCR_HI_RENC_FM0 (2 << 27)
#define GTMPSC_MMCR_HI_RENC_MAN (4 << 27)
#define GTMPSC_MMCR_HI_RENC_DMAN (6 << 27)
#define GTMPSC_MMCR_HI_SEDG_MASK __BITS(31,30)
#define GTMPSC_MMCR_HI_SEDG_BOTH (0 << 30)
#define GTMPSC_MMCR_HI_SEDG_RISE (1 << 30)
#define GTMPSC_MMCR_HI_SEDG_FALL (2 << 30)
#define GTMPSC_MMCR_HI_SEDG_NONE (3 << 30)
#define SDMA_CSR_RX_PE __BIT(0)
#define SDMA_CSR_RX_CDL __BIT(1)
#define SDMA_CSR_RX_RESa __BIT(2)
#define SDMA_CSR_RX_FR __BIT(3)
#define SDMA_CSR_RX_RESb __BITS(5,4)
#define SDMA_CSR_RX_OR __BIT(6)
#define SDMA_CSR_RX_RESc __BITS(8,7)
#define SDMA_CSR_RX_BR __BIT(9)
#define SDMA_CSR_RX_MI __BIT(10)
#define SDMA_CSR_RX_ADDR __BIT(11)
#define SDMA_CSR_RX_AMATCH __BIT(12)
#define SDMA_CSR_RX_CT __BIT(13)
#define SDMA_CSR_RX_C __BIT(14)
#define SDMA_CSR_RX_ES __BIT(15)
#define SDMA_CSR_RX_L __BIT(16)
#define SDMA_CSR_RX_F __BIT(17)
#define SDMA_CSR_RX_RESd __BITS(22,18)
#define SDMA_CSR_RX_EI __BIT(23)
#define SDMA_CSR_RX_RESe __BITS(29,24)
#define SDMA_CSR_RX_AUTO __BIT(30)
#define SDMA_CSR_RX_OWN __BIT(31)
#define SDMA_CSR_RX_RES (SDMA_CSR_RX_RESa|SDMA_CSR_RX_RESb|SDMA_CSR_RX_RESc \
|SDMA_CSR_RX_RESd|SDMA_CSR_RX_RESe)
#define SDMA_CSR_TX_RESa __BIT(0)
#define SDMA_CSR_TX_CTSL __BIT(1)
#define SDMA_CSR_TX_RESb __BITS(14,2)
#define SDMA_CSR_TX_ES __BIT(15)
#define SDMA_CSR_TX_L __BIT(16)
#define SDMA_CSR_TX_F __BIT(17)
#define SDMA_CSR_TX_P __BIT(18)
#define SDMA_CSR_TX_ADDR __BIT(19)
#define SDMA_CSR_TX_NS __BIT(20)
#define SDMA_CSR_TX_RESc __BITS(22,21)
#define SDMA_CSR_TX_EI __BIT(23)
#define SDMA_CSR_TX_RESd __BITS(29,24)
#define SDMA_CSR_TX_AUTO __BIT(30)
#define SDMA_CSR_TX_OWN __BIT(31)
#define SDMA_CSR_TX_RES \
(SDMA_CSR_TX_RESa|SDMA_CSR_TX_RESb|SDMA_CSR_TX_RESc|SDMA_CSR_TX_RESd)
#define GTMPSC_MPCR_RESa __BITS(5,0)
#define GTMPSC_MPCR_DRT __BIT(6)
#define GTMPSC_MPCR_ISO __BIT(7)
#define GTMPSC_MPCR_RZS __BIT(8)
#define GTMPSC_MPCR_FRZ __BIT(9)
#define GTMPSC_MPCR_UM_MASK __BITS(11,10)
#define GTMPSC_MPCR_UM_NORM (0 << 10)
#define GTMPSC_MPCR_UM_MDROP (1 << 10)
#define GTMPSC_MPCR_CLMASK __BITS(13,12)
#define GTMPSC_MPCR_CL_5 (0 << 12)
#define GTMPSC_MPCR_CL_6 (1 << 12)
#define GTMPSC_MPCR_CL_7 (2 << 12)
#define GTMPSC_MPCR_CL_8 (3 << 12)
#define GTMPSC_MPCR_SBL_1 (0 << 14)
#define GTMPSC_MPCR_SBL_2 (1 << 14)
#define GTMPSC_MPCR_FLC_NORM 0x0
#define GTMPSC_MPCR_FLC_ASYNC __BIT(15)
#define GTMPSC_MPCR_RESb __BITS(31,16)
#define GTMPSC_MPCR_RES (GTMPSC_MPCR_RESa|GTMPSC_MPCR_RESb)
#define GTMPSC_CHR1_TCS __BITS(7,0)
#define GTMPSC_CHR1_BRK __BITS(23,16)
#define GTMPSC_CHR1_RES __BITS(15,8)|__BITS(31,24)
#define GTMPSC_CHR2_RESa __BIT(0)
#define GTMPSC_CHR2_TEV __BIT(1)
#define GTMPSC_CHR2_TPM_MASK __BITS(3,2)
#define GTMPSC_CHR2_TPM_ODD (0 << 2)
#define GTMPSC_CHR2_TPM_LOW (1 << 2)
#define GTMPSC_CHR2_TPM_EVEN (2 << 2)
#define GTMPSC_CHR2_TPM_HIGH (3 << 2)
#define GTMPSC_CHR2_RESb __BITS(6,4)
#define GTMPSC_CHR2_TXABORT __BIT(7)
#define GTMPSC_CHR2_RESc __BIT(8)
#define GTMPSC_CHR2_TCS __BIT(9)
#define GTMPSC_CHR2_RESd __BITS(16,10)
#define GTMPSC_CHR2_REC __BIT(17)
#define GTMPSC_CHR2_RPM_MASK __BITS(19,18)
#define GTMPSC_CHR2_RPM_ODD (0 << 18)
#define GTMPSC_CHR2_RPM_LOW (1 << 18)
#define GTMPSC_CHR2_RPM_EVEN (2 << 18)
#define GTMPSC_CHR2_RPM_HIGH (3 << 18)
#define GTMPSC_CHR2_RESe __BITS(22,20)
#define GTMPSC_CHR2_RXABORT __BIT(23)
#define GTMPSC_CHR2_RESf __BIT(24)
#define GTMPSC_CHR2_CRD __BIT(25)
#define GTMPSC_CHR2_RESg __BITS(30,26)
#define GTMPSC_CHR2_EH __BIT(31)
#define GTMPSC_CHR2_RES \
(GTMPSC_CHR2_RESa|GTMPSC_CHR2_RESb|GTMPSC_CHR2_RESc| \
GTMPSC_CHR2_RESd|GTMPSC_CHR2_RESe|GTMPSC_CHR2_RESf| \
GTMPSC_CHR2_RESg)
#define GTMPSC_CHR3_MIR __BITS(15,0)
#define GTMPSC_CHR3_RES __BITS(31,16)
#define GTMPSC_CHR4_CFR __BITS(7,0)
#define GTMPSC_CHR4_RES __BITS(31,8)
#define GTMPSC_CHRCC_SHIFT 16
#define GTMPSC_CHRCC_CHAR __BITS(7,0)
#define GTMPSC_CHRCC_RES __BITS(11,8)
#define GTMPSC_CHRCC_INT __BIT(12)
#define GTMPSC_CHRCC_CO __BIT(13)
#define GTMPSC_CHRCC_R __BIT(14)
#define GTMPSC_CHRCC_V __BIT(15)
#define GTMPSC_CHR9_AD1 __BITS(7,0)
#define GTMPSC_CHR9_RESa __BITS(14,8)
#define GTMPSC_CHR9_MODE1 __BIT(15)
#define GTMPSC_CHR9_AD2 __BITS(23,16)
#define GTMPSC_CHR9_RESb __BITS(30,24)
#define GTMPSC_CHR9_MODE2 __BIT(31)
#define GTMPSC_CHR9_RES (GTMPSC_CHR9_RESa|GTMPSC_CHR9_RESb)
#define GTMPSC_CHR10_CTS __BIT(0)
#define GTMPSC_CHR10_CD __BIT(1)
#define GTMPSC_CHR10_RESa __BIT(2)
#define GTMPSC_CHR10_TIDLE __BIT(3)
#define GTMPSC_CHR10_RESb __BIT(4)
#define GTMPSC_CHR10_RHS __BIT(5)
#define GTMPSC_CHR10_RESc __BIT(6)
#define GTMPSC_CHR10_RLS __BIT(7)
#define GTMPSC_CHR10_RESd __BITS(10,8)
#define GTMPSC_CHR10_RLIDL __BIT(11)
#define GTMPSC_CHR10_RESe __BITS(15,12)
#define GTMPSC_CHR10_RCRn __BITS(23,16)
#define GTMPSC_CHR10_RESf __BITS(31,24)
#define GTMPSC_CHR10_RES \
(GTMPSC_CHR10_RESa|GTMPSC_CHR10_RESb|GTMPSC_CHR10_RESc \
|GTMPSC_CHR10_RESd|GTMPSC_CHR10_RESe|GTMPSC_CHR10_RESf)
#endif