blob: 0bf794313ffd5cb8a0b06d26ff7b1b5a69d496e5 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _MXSER_H
2#define _MXSER_H
3
4/*
5 * Semi-public control interfaces
6 */
Jiri Slaby1c456072008-02-07 00:16:46 -08007
Linus Torvalds1da177e2005-04-16 15:20:36 -07008/*
9 * MOXA ioctls
10 */
11
12#define MOXA 0x400
13#define MOXA_GETDATACOUNT (MOXA + 23)
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#define MOXA_DIAGNOSE (MOXA + 50)
15#define MOXA_CHKPORTENABLE (MOXA + 60)
16#define MOXA_HighSpeedOn (MOXA + 61)
17#define MOXA_GET_MAJOR (MOXA + 63)
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#define MOXA_GETMSTATUS (MOXA + 65)
19#define MOXA_SET_OP_MODE (MOXA + 66)
20#define MOXA_GET_OP_MODE (MOXA + 67)
21
22#define RS232_MODE 0
23#define RS485_2WIRE_MODE 1
24#define RS422_MODE 2
25#define RS485_4WIRE_MODE 3
26#define OP_MODE_MASK 3
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
Jiri Slaby1c456072008-02-07 00:16:46 -080028#define MOXA_SDS_RSTICOUNTER (MOXA + 69)
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#define MOXA_ASPP_OQUEUE (MOXA + 70)
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#define MOXA_ASPP_MON (MOXA + 73)
31#define MOXA_ASPP_LSTATUS (MOXA + 74)
32#define MOXA_ASPP_MON_EXT (MOXA + 75)
33#define MOXA_SET_BAUD_METHOD (MOXA + 76)
34
Linus Torvalds1da177e2005-04-16 15:20:36 -070035/* --------------------------------------------------- */
36
37#define NPPI_NOTIFY_PARITY 0x01
38#define NPPI_NOTIFY_FRAMING 0x02
39#define NPPI_NOTIFY_HW_OVERRUN 0x04
40#define NPPI_NOTIFY_SW_OVERRUN 0x08
41#define NPPI_NOTIFY_BREAK 0x10
42
Jiri Slaby1c456072008-02-07 00:16:46 -080043#define NPPI_NOTIFY_CTSHOLD 0x01 /* Tx hold by CTS low */
44#define NPPI_NOTIFY_DSRHOLD 0x02 /* Tx hold by DSR low */
45#define NPPI_NOTIFY_XOFFHOLD 0x08 /* Tx hold by Xoff received */
46#define NPPI_NOTIFY_XOFFXENT 0x10 /* Xoff Sent */
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
Jiri Slaby1c456072008-02-07 00:16:46 -080048/* follow just for Moxa Must chip define. */
49/* */
50/* when LCR register (offset 0x03) write following value, */
51/* the Must chip will enter enchance mode. And write value */
52/* on EFR (offset 0x02) bit 6,7 to change bank. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070053#define MOXA_MUST_ENTER_ENCHANCE 0xBF
54
Jiri Slaby1c456072008-02-07 00:16:46 -080055/* when enhance mode enable, access on general bank register */
Linus Torvalds1da177e2005-04-16 15:20:36 -070056#define MOXA_MUST_GDL_REGISTER 0x07
57#define MOXA_MUST_GDL_MASK 0x7F
58#define MOXA_MUST_GDL_HAS_BAD_DATA 0x80
59
Jiri Slaby1c456072008-02-07 00:16:46 -080060#define MOXA_MUST_LSR_RERR 0x80 /* error in receive FIFO */
61/* enchance register bank select and enchance mode setting register */
62/* when LCR register equal to 0xBF */
Linus Torvalds1da177e2005-04-16 15:20:36 -070063#define MOXA_MUST_EFR_REGISTER 0x02
Jiri Slaby1c456072008-02-07 00:16:46 -080064/* enchance mode enable */
Linus Torvalds1da177e2005-04-16 15:20:36 -070065#define MOXA_MUST_EFR_EFRB_ENABLE 0x10
Jiri Slaby1c456072008-02-07 00:16:46 -080066/* enchance reister bank set 0, 1, 2 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070067#define MOXA_MUST_EFR_BANK0 0x00
68#define MOXA_MUST_EFR_BANK1 0x40
69#define MOXA_MUST_EFR_BANK2 0x80
70#define MOXA_MUST_EFR_BANK3 0xC0
71#define MOXA_MUST_EFR_BANK_MASK 0xC0
72
Jiri Slaby1c456072008-02-07 00:16:46 -080073/* set XON1 value register, when LCR=0xBF and change to bank0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070074#define MOXA_MUST_XON1_REGISTER 0x04
75
Jiri Slaby1c456072008-02-07 00:16:46 -080076/* set XON2 value register, when LCR=0xBF and change to bank0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070077#define MOXA_MUST_XON2_REGISTER 0x05
78
Jiri Slaby1c456072008-02-07 00:16:46 -080079/* set XOFF1 value register, when LCR=0xBF and change to bank0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070080#define MOXA_MUST_XOFF1_REGISTER 0x06
81
Jiri Slaby1c456072008-02-07 00:16:46 -080082/* set XOFF2 value register, when LCR=0xBF and change to bank0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070083#define MOXA_MUST_XOFF2_REGISTER 0x07
84
85#define MOXA_MUST_RBRTL_REGISTER 0x04
86#define MOXA_MUST_RBRTH_REGISTER 0x05
87#define MOXA_MUST_RBRTI_REGISTER 0x06
88#define MOXA_MUST_THRTL_REGISTER 0x07
89#define MOXA_MUST_ENUM_REGISTER 0x04
90#define MOXA_MUST_HWID_REGISTER 0x05
91#define MOXA_MUST_ECR_REGISTER 0x06
92#define MOXA_MUST_CSR_REGISTER 0x07
93
Jiri Slaby1c456072008-02-07 00:16:46 -080094/* good data mode enable */
Linus Torvalds1da177e2005-04-16 15:20:36 -070095#define MOXA_MUST_FCR_GDA_MODE_ENABLE 0x20
Jiri Slaby1c456072008-02-07 00:16:46 -080096/* only good data put into RxFIFO */
Linus Torvalds1da177e2005-04-16 15:20:36 -070097#define MOXA_MUST_FCR_GDA_ONLY_ENABLE 0x10
98
Jiri Slaby1c456072008-02-07 00:16:46 -080099/* enable CTS interrupt */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100#define MOXA_MUST_IER_ECTSI 0x80
Jiri Slaby1c456072008-02-07 00:16:46 -0800101/* enable RTS interrupt */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102#define MOXA_MUST_IER_ERTSI 0x40
Jiri Slaby1c456072008-02-07 00:16:46 -0800103/* enable Xon/Xoff interrupt */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104#define MOXA_MUST_IER_XINT 0x20
Jiri Slaby1c456072008-02-07 00:16:46 -0800105/* enable GDA interrupt */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106#define MOXA_MUST_IER_EGDAI 0x10
107
108#define MOXA_MUST_RECV_ISR (UART_IER_RDI | MOXA_MUST_IER_EGDAI)
109
Jiri Slaby1c456072008-02-07 00:16:46 -0800110/* GDA interrupt pending */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111#define MOXA_MUST_IIR_GDA 0x1C
112#define MOXA_MUST_IIR_RDA 0x04
113#define MOXA_MUST_IIR_RTO 0x0C
114#define MOXA_MUST_IIR_LSR 0x06
115
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300116/* received Xon/Xoff or specical interrupt pending */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117#define MOXA_MUST_IIR_XSC 0x10
118
Jiri Slaby1c456072008-02-07 00:16:46 -0800119/* RTS/CTS change state interrupt pending */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120#define MOXA_MUST_IIR_RTSCTS 0x20
121#define MOXA_MUST_IIR_MASK 0x3E
122
123#define MOXA_MUST_MCR_XON_FLAG 0x40
124#define MOXA_MUST_MCR_XON_ANY 0x80
125#define MOXA_MUST_MCR_TX_XON 0x08
126
Jiri Slaby1c456072008-02-07 00:16:46 -0800127/* software flow control on chip mask value */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128#define MOXA_MUST_EFR_SF_MASK 0x0F
Jiri Slaby1c456072008-02-07 00:16:46 -0800129/* send Xon1/Xoff1 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130#define MOXA_MUST_EFR_SF_TX1 0x08
Jiri Slaby1c456072008-02-07 00:16:46 -0800131/* send Xon2/Xoff2 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132#define MOXA_MUST_EFR_SF_TX2 0x04
Jiri Slaby1c456072008-02-07 00:16:46 -0800133/* send Xon1,Xon2/Xoff1,Xoff2 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134#define MOXA_MUST_EFR_SF_TX12 0x0C
Jiri Slaby1c456072008-02-07 00:16:46 -0800135/* don't send Xon/Xoff */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136#define MOXA_MUST_EFR_SF_TX_NO 0x00
Jiri Slaby1c456072008-02-07 00:16:46 -0800137/* Tx software flow control mask */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138#define MOXA_MUST_EFR_SF_TX_MASK 0x0C
Jiri Slaby1c456072008-02-07 00:16:46 -0800139/* don't receive Xon/Xoff */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140#define MOXA_MUST_EFR_SF_RX_NO 0x00
Jiri Slaby1c456072008-02-07 00:16:46 -0800141/* receive Xon1/Xoff1 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142#define MOXA_MUST_EFR_SF_RX1 0x02
Jiri Slaby1c456072008-02-07 00:16:46 -0800143/* receive Xon2/Xoff2 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144#define MOXA_MUST_EFR_SF_RX2 0x01
Jiri Slaby1c456072008-02-07 00:16:46 -0800145/* receive Xon1,Xon2/Xoff1,Xoff2 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146#define MOXA_MUST_EFR_SF_RX12 0x03
Jiri Slaby1c456072008-02-07 00:16:46 -0800147/* Rx software flow control mask */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148#define MOXA_MUST_EFR_SF_RX_MASK 0x03
149
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150#endif