162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * scc2698.h 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * driver for the IPOCTAL boards 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Copyright (C) 2009-2012 CERN (www.cern.ch) 862306a36Sopenharmony_ci * Author: Nicolas Serafini, EIC2 SA 962306a36Sopenharmony_ci * Author: Samuel Iglesias Gonsalvez <siglesias@igalia.com> 1062306a36Sopenharmony_ci */ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#ifndef SCC2698_H_ 1362306a36Sopenharmony_ci#define SCC2698_H_ 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/* 1662306a36Sopenharmony_ci * union scc2698_channel - Channel access to scc2698 IO 1762306a36Sopenharmony_ci * 1862306a36Sopenharmony_ci * dn value are only spacer. 1962306a36Sopenharmony_ci * 2062306a36Sopenharmony_ci */ 2162306a36Sopenharmony_ciunion scc2698_channel { 2262306a36Sopenharmony_ci struct { 2362306a36Sopenharmony_ci u8 d0, mr; /* Mode register 1/2*/ 2462306a36Sopenharmony_ci u8 d1, sr; /* Status register */ 2562306a36Sopenharmony_ci u8 d2, r1; /* reserved */ 2662306a36Sopenharmony_ci u8 d3, rhr; /* Receive holding register (R) */ 2762306a36Sopenharmony_ci u8 junk[8]; /* other crap for block control */ 2862306a36Sopenharmony_ci } __packed r; /* Read access */ 2962306a36Sopenharmony_ci struct { 3062306a36Sopenharmony_ci u8 d0, mr; /* Mode register 1/2 */ 3162306a36Sopenharmony_ci u8 d1, csr; /* Clock select register */ 3262306a36Sopenharmony_ci u8 d2, cr; /* Command register */ 3362306a36Sopenharmony_ci u8 d3, thr; /* Transmit holding register */ 3462306a36Sopenharmony_ci u8 junk[8]; /* other crap for block control */ 3562306a36Sopenharmony_ci } __packed w; /* Write access */ 3662306a36Sopenharmony_ci}; 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci/* 3962306a36Sopenharmony_ci * union scc2698_block - Block access to scc2698 IO 4062306a36Sopenharmony_ci * 4162306a36Sopenharmony_ci * The scc2698 contain 4 block. 4262306a36Sopenharmony_ci * Each block containt two channel a and b. 4362306a36Sopenharmony_ci * dn value are only spacer. 4462306a36Sopenharmony_ci * 4562306a36Sopenharmony_ci */ 4662306a36Sopenharmony_ciunion scc2698_block { 4762306a36Sopenharmony_ci struct { 4862306a36Sopenharmony_ci u8 d0, mra; /* Mode register 1/2 (a) */ 4962306a36Sopenharmony_ci u8 d1, sra; /* Status register (a) */ 5062306a36Sopenharmony_ci u8 d2, r1; /* reserved */ 5162306a36Sopenharmony_ci u8 d3, rhra; /* Receive holding register (a) */ 5262306a36Sopenharmony_ci u8 d4, ipcr; /* Input port change register of block */ 5362306a36Sopenharmony_ci u8 d5, isr; /* Interrupt status register of block */ 5462306a36Sopenharmony_ci u8 d6, ctur; /* Counter timer upper register of block */ 5562306a36Sopenharmony_ci u8 d7, ctlr; /* Counter timer lower register of block */ 5662306a36Sopenharmony_ci u8 d8, mrb; /* Mode register 1/2 (b) */ 5762306a36Sopenharmony_ci u8 d9, srb; /* Status register (b) */ 5862306a36Sopenharmony_ci u8 da, r2; /* reserved */ 5962306a36Sopenharmony_ci u8 db, rhrb; /* Receive holding register (b) */ 6062306a36Sopenharmony_ci u8 dc, r3; /* reserved */ 6162306a36Sopenharmony_ci u8 dd, ip; /* Input port register of block */ 6262306a36Sopenharmony_ci u8 de, ctg; /* Start counter timer of block */ 6362306a36Sopenharmony_ci u8 df, cts; /* Stop counter timer of block */ 6462306a36Sopenharmony_ci } __packed r; /* Read access */ 6562306a36Sopenharmony_ci struct { 6662306a36Sopenharmony_ci u8 d0, mra; /* Mode register 1/2 (a) */ 6762306a36Sopenharmony_ci u8 d1, csra; /* Clock select register (a) */ 6862306a36Sopenharmony_ci u8 d2, cra; /* Command register (a) */ 6962306a36Sopenharmony_ci u8 d3, thra; /* Transmit holding register (a) */ 7062306a36Sopenharmony_ci u8 d4, acr; /* Auxiliary control register of block */ 7162306a36Sopenharmony_ci u8 d5, imr; /* Interrupt mask register of block */ 7262306a36Sopenharmony_ci u8 d6, ctu; /* Counter timer upper register of block */ 7362306a36Sopenharmony_ci u8 d7, ctl; /* Counter timer lower register of block */ 7462306a36Sopenharmony_ci u8 d8, mrb; /* Mode register 1/2 (b) */ 7562306a36Sopenharmony_ci u8 d9, csrb; /* Clock select register (a) */ 7662306a36Sopenharmony_ci u8 da, crb; /* Command register (b) */ 7762306a36Sopenharmony_ci u8 db, thrb; /* Transmit holding register (b) */ 7862306a36Sopenharmony_ci u8 dc, r1; /* reserved */ 7962306a36Sopenharmony_ci u8 dd, opcr; /* Output port configuration register of block */ 8062306a36Sopenharmony_ci u8 de, r2; /* reserved */ 8162306a36Sopenharmony_ci u8 df, r3; /* reserved */ 8262306a36Sopenharmony_ci } __packed w; /* Write access */ 8362306a36Sopenharmony_ci}; 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci#define MR1_CHRL_5_BITS (0x0 << 0) 8662306a36Sopenharmony_ci#define MR1_CHRL_6_BITS (0x1 << 0) 8762306a36Sopenharmony_ci#define MR1_CHRL_7_BITS (0x2 << 0) 8862306a36Sopenharmony_ci#define MR1_CHRL_8_BITS (0x3 << 0) 8962306a36Sopenharmony_ci#define MR1_PARITY_EVEN (0x1 << 2) 9062306a36Sopenharmony_ci#define MR1_PARITY_ODD (0x0 << 2) 9162306a36Sopenharmony_ci#define MR1_PARITY_ON (0x0 << 3) 9262306a36Sopenharmony_ci#define MR1_PARITY_FORCE (0x1 << 3) 9362306a36Sopenharmony_ci#define MR1_PARITY_OFF (0x2 << 3) 9462306a36Sopenharmony_ci#define MR1_PARITY_SPECIAL (0x3 << 3) 9562306a36Sopenharmony_ci#define MR1_ERROR_CHAR (0x0 << 5) 9662306a36Sopenharmony_ci#define MR1_ERROR_BLOCK (0x1 << 5) 9762306a36Sopenharmony_ci#define MR1_RxINT_RxRDY (0x0 << 6) 9862306a36Sopenharmony_ci#define MR1_RxINT_FFULL (0x1 << 6) 9962306a36Sopenharmony_ci#define MR1_RxRTS_CONTROL_ON (0x1 << 7) 10062306a36Sopenharmony_ci#define MR1_RxRTS_CONTROL_OFF (0x0 << 7) 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci#define MR2_STOP_BITS_LENGTH_1 (0x7 << 0) 10362306a36Sopenharmony_ci#define MR2_STOP_BITS_LENGTH_2 (0xF << 0) 10462306a36Sopenharmony_ci#define MR2_CTS_ENABLE_TX_ON (0x1 << 4) 10562306a36Sopenharmony_ci#define MR2_CTS_ENABLE_TX_OFF (0x0 << 4) 10662306a36Sopenharmony_ci#define MR2_TxRTS_CONTROL_ON (0x1 << 5) 10762306a36Sopenharmony_ci#define MR2_TxRTS_CONTROL_OFF (0x0 << 5) 10862306a36Sopenharmony_ci#define MR2_CH_MODE_NORMAL (0x0 << 6) 10962306a36Sopenharmony_ci#define MR2_CH_MODE_ECHO (0x1 << 6) 11062306a36Sopenharmony_ci#define MR2_CH_MODE_LOCAL (0x2 << 6) 11162306a36Sopenharmony_ci#define MR2_CH_MODE_REMOTE (0x3 << 6) 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ci#define CR_ENABLE_RX (0x1 << 0) 11462306a36Sopenharmony_ci#define CR_DISABLE_RX (0x1 << 1) 11562306a36Sopenharmony_ci#define CR_ENABLE_TX (0x1 << 2) 11662306a36Sopenharmony_ci#define CR_DISABLE_TX (0x1 << 3) 11762306a36Sopenharmony_ci#define CR_CMD_RESET_MR (0x1 << 4) 11862306a36Sopenharmony_ci#define CR_CMD_RESET_RX (0x2 << 4) 11962306a36Sopenharmony_ci#define CR_CMD_RESET_TX (0x3 << 4) 12062306a36Sopenharmony_ci#define CR_CMD_RESET_ERR_STATUS (0x4 << 4) 12162306a36Sopenharmony_ci#define CR_CMD_RESET_BREAK_CHANGE (0x5 << 4) 12262306a36Sopenharmony_ci#define CR_CMD_START_BREAK (0x6 << 4) 12362306a36Sopenharmony_ci#define CR_CMD_STOP_BREAK (0x7 << 4) 12462306a36Sopenharmony_ci#define CR_CMD_ASSERT_RTSN (0x8 << 4) 12562306a36Sopenharmony_ci#define CR_CMD_NEGATE_RTSN (0x9 << 4) 12662306a36Sopenharmony_ci#define CR_CMD_SET_TIMEOUT_MODE (0xA << 4) 12762306a36Sopenharmony_ci#define CR_CMD_DISABLE_TIMEOUT_MODE (0xC << 4) 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci#define SR_RX_READY (0x1 << 0) 13062306a36Sopenharmony_ci#define SR_FIFO_FULL (0x1 << 1) 13162306a36Sopenharmony_ci#define SR_TX_READY (0x1 << 2) 13262306a36Sopenharmony_ci#define SR_TX_EMPTY (0x1 << 3) 13362306a36Sopenharmony_ci#define SR_OVERRUN_ERROR (0x1 << 4) 13462306a36Sopenharmony_ci#define SR_PARITY_ERROR (0x1 << 5) 13562306a36Sopenharmony_ci#define SR_FRAMING_ERROR (0x1 << 6) 13662306a36Sopenharmony_ci#define SR_RECEIVED_BREAK (0x1 << 7) 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci#define SR_ERROR (0xF0) 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci#define ACR_DELTA_IP0_IRQ_EN (0x1 << 0) 14162306a36Sopenharmony_ci#define ACR_DELTA_IP1_IRQ_EN (0x1 << 1) 14262306a36Sopenharmony_ci#define ACR_DELTA_IP2_IRQ_EN (0x1 << 2) 14362306a36Sopenharmony_ci#define ACR_DELTA_IP3_IRQ_EN (0x1 << 3) 14462306a36Sopenharmony_ci#define ACR_CT_Mask (0x7 << 4) 14562306a36Sopenharmony_ci#define ACR_CExt (0x0 << 4) 14662306a36Sopenharmony_ci#define ACR_CTxCA (0x1 << 4) 14762306a36Sopenharmony_ci#define ACR_CTxCB (0x2 << 4) 14862306a36Sopenharmony_ci#define ACR_CClk16 (0x3 << 4) 14962306a36Sopenharmony_ci#define ACR_TExt (0x4 << 4) 15062306a36Sopenharmony_ci#define ACR_TExt16 (0x5 << 4) 15162306a36Sopenharmony_ci#define ACR_TClk (0x6 << 4) 15262306a36Sopenharmony_ci#define ACR_TClk16 (0x7 << 4) 15362306a36Sopenharmony_ci#define ACR_BRG_SET1 (0x0 << 7) 15462306a36Sopenharmony_ci#define ACR_BRG_SET2 (0x1 << 7) 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci#define TX_CLK_75 (0x0 << 0) 15762306a36Sopenharmony_ci#define TX_CLK_110 (0x1 << 0) 15862306a36Sopenharmony_ci#define TX_CLK_38400 (0x2 << 0) 15962306a36Sopenharmony_ci#define TX_CLK_150 (0x3 << 0) 16062306a36Sopenharmony_ci#define TX_CLK_300 (0x4 << 0) 16162306a36Sopenharmony_ci#define TX_CLK_600 (0x5 << 0) 16262306a36Sopenharmony_ci#define TX_CLK_1200 (0x6 << 0) 16362306a36Sopenharmony_ci#define TX_CLK_2000 (0x7 << 0) 16462306a36Sopenharmony_ci#define TX_CLK_2400 (0x8 << 0) 16562306a36Sopenharmony_ci#define TX_CLK_4800 (0x9 << 0) 16662306a36Sopenharmony_ci#define TX_CLK_1800 (0xA << 0) 16762306a36Sopenharmony_ci#define TX_CLK_9600 (0xB << 0) 16862306a36Sopenharmony_ci#define TX_CLK_19200 (0xC << 0) 16962306a36Sopenharmony_ci#define RX_CLK_75 (0x0 << 4) 17062306a36Sopenharmony_ci#define RX_CLK_110 (0x1 << 4) 17162306a36Sopenharmony_ci#define RX_CLK_38400 (0x2 << 4) 17262306a36Sopenharmony_ci#define RX_CLK_150 (0x3 << 4) 17362306a36Sopenharmony_ci#define RX_CLK_300 (0x4 << 4) 17462306a36Sopenharmony_ci#define RX_CLK_600 (0x5 << 4) 17562306a36Sopenharmony_ci#define RX_CLK_1200 (0x6 << 4) 17662306a36Sopenharmony_ci#define RX_CLK_2000 (0x7 << 4) 17762306a36Sopenharmony_ci#define RX_CLK_2400 (0x8 << 4) 17862306a36Sopenharmony_ci#define RX_CLK_4800 (0x9 << 4) 17962306a36Sopenharmony_ci#define RX_CLK_1800 (0xA << 4) 18062306a36Sopenharmony_ci#define RX_CLK_9600 (0xB << 4) 18162306a36Sopenharmony_ci#define RX_CLK_19200 (0xC << 4) 18262306a36Sopenharmony_ci 18362306a36Sopenharmony_ci#define OPCR_MPOa_RTSN (0x0 << 0) 18462306a36Sopenharmony_ci#define OPCR_MPOa_C_TO (0x1 << 0) 18562306a36Sopenharmony_ci#define OPCR_MPOa_TxC1X (0x2 << 0) 18662306a36Sopenharmony_ci#define OPCR_MPOa_TxC16X (0x3 << 0) 18762306a36Sopenharmony_ci#define OPCR_MPOa_RxC1X (0x4 << 0) 18862306a36Sopenharmony_ci#define OPCR_MPOa_RxC16X (0x5 << 0) 18962306a36Sopenharmony_ci#define OPCR_MPOa_TxRDY (0x6 << 0) 19062306a36Sopenharmony_ci#define OPCR_MPOa_RxRDY_FF (0x7 << 0) 19162306a36Sopenharmony_ci 19262306a36Sopenharmony_ci#define OPCR_MPOb_RTSN (0x0 << 4) 19362306a36Sopenharmony_ci#define OPCR_MPOb_C_TO (0x1 << 4) 19462306a36Sopenharmony_ci#define OPCR_MPOb_TxC1X (0x2 << 4) 19562306a36Sopenharmony_ci#define OPCR_MPOb_TxC16X (0x3 << 4) 19662306a36Sopenharmony_ci#define OPCR_MPOb_RxC1X (0x4 << 4) 19762306a36Sopenharmony_ci#define OPCR_MPOb_RxC16X (0x5 << 4) 19862306a36Sopenharmony_ci#define OPCR_MPOb_TxRDY (0x6 << 4) 19962306a36Sopenharmony_ci#define OPCR_MPOb_RxRDY_FF (0x7 << 4) 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci#define OPCR_MPP_INPUT (0x0 << 7) 20262306a36Sopenharmony_ci#define OPCR_MPP_OUTPUT (0x1 << 7) 20362306a36Sopenharmony_ci 20462306a36Sopenharmony_ci#define IMR_TxRDY_A (0x1 << 0) 20562306a36Sopenharmony_ci#define IMR_RxRDY_FFULL_A (0x1 << 1) 20662306a36Sopenharmony_ci#define IMR_DELTA_BREAK_A (0x1 << 2) 20762306a36Sopenharmony_ci#define IMR_COUNTER_READY (0x1 << 3) 20862306a36Sopenharmony_ci#define IMR_TxRDY_B (0x1 << 4) 20962306a36Sopenharmony_ci#define IMR_RxRDY_FFULL_B (0x1 << 5) 21062306a36Sopenharmony_ci#define IMR_DELTA_BREAK_B (0x1 << 6) 21162306a36Sopenharmony_ci#define IMR_INPUT_PORT_CHANGE (0x1 << 7) 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_ci#define ISR_TxRDY_A (0x1 << 0) 21462306a36Sopenharmony_ci#define ISR_RxRDY_FFULL_A (0x1 << 1) 21562306a36Sopenharmony_ci#define ISR_DELTA_BREAK_A (0x1 << 2) 21662306a36Sopenharmony_ci#define ISR_COUNTER_READY (0x1 << 3) 21762306a36Sopenharmony_ci#define ISR_TxRDY_B (0x1 << 4) 21862306a36Sopenharmony_ci#define ISR_RxRDY_FFULL_B (0x1 << 5) 21962306a36Sopenharmony_ci#define ISR_DELTA_BREAK_B (0x1 << 6) 22062306a36Sopenharmony_ci#define ISR_INPUT_PORT_CHANGE (0x1 << 7) 22162306a36Sopenharmony_ci 22262306a36Sopenharmony_ci#define ACK_INT_REQ0 0 22362306a36Sopenharmony_ci#define ACK_INT_REQ1 2 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_ci#endif /* SCC2698_H_ */ 226