blob: 81f3d540647ab51bdc86bdc325866d49c9f6b49b [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* drivers/serial/msm_serial_hs_hwreg.h
2 *
Stepan Moskovchenkoe4b0d792012-05-10 14:10:44 -07003 * Copyright (c) 2007-2009, 2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004 *
5 * All source code in this file is licensed under the following license
6 * except where indicated.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you can find it at http://www.fsf.org
19 */
20
21#ifndef MSM_SERIAL_HS_HWREG_H
22#define MSM_SERIAL_HS_HWREG_H
23
24#define GSBI_CONTROL_ADDR 0x0
25#define GSBI_PROTOCOL_CODE_MASK 0x30
26#define GSBI_PROTOCOL_I2C_UART 0x60
27#define GSBI_PROTOCOL_UART 0x40
28#define GSBI_PROTOCOL_IDLE 0x0
29
30#define TCSR_ADM_1_A_CRCI_MUX_SEL 0x78
31#define TCSR_ADM_1_B_CRCI_MUX_SEL 0x7C
32#define ADM1_CRCI_GSBI6_RX_SEL 0x800
33#define ADM1_CRCI_GSBI6_TX_SEL 0x400
34
Sathish Ambley99e2a242011-10-25 15:49:53 -070035enum msm_hsl_regs {
36 UARTDM_MR1,
37 UARTDM_MR2,
38 UARTDM_IMR,
39 UARTDM_SR,
40 UARTDM_CR,
41 UARTDM_CSR,
42 UARTDM_IPR,
43 UARTDM_ISR,
44 UARTDM_RX_TOTAL_SNAP,
45 UARTDM_RFWR,
46 UARTDM_TFWR,
47 UARTDM_RF,
48 UARTDM_TF,
49 UARTDM_MISR,
50 UARTDM_DMRX,
51 UARTDM_NCF_TX,
52 UARTDM_DMEN,
53 UARTDM_BCR,
Stepan Moskovchenko1d4731e2012-02-21 20:18:23 -080054 UARTDM_TXFS,
55 UARTDM_RXFS,
56 UARTDM_LAST,
Sathish Ambley99e2a242011-10-25 15:49:53 -070057};
58
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070059#define UARTDM_MR1_ADDR 0x0
60#define UARTDM_MR2_ADDR 0x4
61
62/* write only register */
63#define UARTDM_CSR_ADDR 0x8
64#define UARTDM_CSR_115200 0xFF
65#define UARTDM_CSR_57600 0xEE
66#define UARTDM_CSR_38400 0xDD
67#define UARTDM_CSR_28800 0xCC
68#define UARTDM_CSR_19200 0xBB
69#define UARTDM_CSR_14400 0xAA
70#define UARTDM_CSR_9600 0x99
71#define UARTDM_CSR_7200 0x88
72#define UARTDM_CSR_4800 0x77
73#define UARTDM_CSR_3600 0x66
74#define UARTDM_CSR_2400 0x55
75#define UARTDM_CSR_1200 0x44
76#define UARTDM_CSR_600 0x33
77#define UARTDM_CSR_300 0x22
78#define UARTDM_CSR_150 0x11
79#define UARTDM_CSR_75 0x00
80
81/* write only register */
82#define UARTDM_TF_ADDR 0x70
83#define UARTDM_TF2_ADDR 0x74
84#define UARTDM_TF3_ADDR 0x78
85#define UARTDM_TF4_ADDR 0x7C
86
87/* write only register */
88#define UARTDM_CR_ADDR 0x10
89/* write only register */
90#define UARTDM_IMR_ADDR 0x14
91
92#define UARTDM_IPR_ADDR 0x18
93#define UARTDM_TFWR_ADDR 0x1c
94#define UARTDM_RFWR_ADDR 0x20
95#define UARTDM_HCR_ADDR 0x24
96#define UARTDM_DMRX_ADDR 0x34
97#define UARTDM_IRDA_ADDR 0x38
98#define UARTDM_DMEN_ADDR 0x3c
99
100/* UART_DM_NO_CHARS_FOR_TX */
101#define UARTDM_NCF_TX_ADDR 0x40
102
103#define UARTDM_BADR_ADDR 0x44
104
105#define UARTDM_SIM_CFG_ADDR 0x80
106
107/* Read Only register */
108#define UARTDM_SR_ADDR 0x8
109
110/* Read Only register */
111#define UARTDM_RF_ADDR 0x70
112#define UARTDM_RF2_ADDR 0x74
113#define UARTDM_RF3_ADDR 0x78
114#define UARTDM_RF4_ADDR 0x7C
115
116/* Read Only register */
117#define UARTDM_MISR_ADDR 0x10
118
119/* Read Only register */
120#define UARTDM_ISR_ADDR 0x14
121#define UARTDM_RX_TOTAL_SNAP_ADDR 0x38
122
Stepan Moskovchenko1d4731e2012-02-21 20:18:23 -0800123#define UARTDM_TXFS_ADDR 0x4C
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700124#define UARTDM_RXFS_ADDR 0x50
125
126/* Register field Mask Mapping */
127#define UARTDM_SR_RX_BREAK_BMSK BIT(6)
128#define UARTDM_SR_PAR_FRAME_BMSK BIT(5)
129#define UARTDM_SR_OVERRUN_BMSK BIT(4)
130#define UARTDM_SR_TXEMT_BMSK BIT(3)
131#define UARTDM_SR_TXRDY_BMSK BIT(2)
132#define UARTDM_SR_RXRDY_BMSK BIT(0)
133
134#define UARTDM_CR_TX_DISABLE_BMSK BIT(3)
135#define UARTDM_CR_RX_DISABLE_BMSK BIT(1)
136#define UARTDM_CR_TX_EN_BMSK BIT(2)
137#define UARTDM_CR_RX_EN_BMSK BIT(0)
138
139/* UARTDM_CR channel_comman bit value (register field is bits 8:4) */
140#define RESET_RX 0x10
141#define RESET_TX 0x20
142#define RESET_ERROR_STATUS 0x30
143#define RESET_BREAK_INT 0x40
144#define START_BREAK 0x50
145#define STOP_BREAK 0x60
146#define RESET_CTS 0x70
147#define RESET_STALE_INT 0x80
148#define RFR_LOW 0xD0
149#define RFR_HIGH 0xE0
150#define CR_PROTECTION_EN 0x100
151#define STALE_EVENT_ENABLE 0x500
152#define STALE_EVENT_DISABLE 0x600
153#define FORCE_STALE_EVENT 0x400
154#define CLEAR_TX_READY 0x300
155#define RESET_TX_ERROR 0x800
156#define RESET_TX_DONE 0x810
157
158#define UARTDM_MR1_AUTO_RFR_LEVEL1_BMSK 0xffffff00
159#define UARTDM_MR1_AUTO_RFR_LEVEL0_BMSK 0x3f
160#define UARTDM_MR1_CTS_CTL_BMSK 0x40
161#define UARTDM_MR1_RX_RDY_CTL_BMSK 0x80
162
Stepan Moskovchenkoe4b0d792012-05-10 14:10:44 -0700163#define UARTDM_MR2_LOOP_MODE_BMSK 0x80
164#define UARTDM_MR2_ERROR_MODE_BMSK 0x40
165#define UARTDM_MR2_BITS_PER_CHAR_BMSK 0x30
166#define UARTDM_MR2_RX_ZERO_CHAR_OFF 0x100
167#define UARTDM_MR2_RX_ERROR_CHAR_OFF 0x200
168#define UARTDM_MR2_RX_BREAK_ZERO_CHAR_OFF 0x100
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700169
170#define UARTDM_MR2_BITS_PER_CHAR_8 (0x3 << 4)
171
172/* bits per character configuration */
173#define FIVE_BPC (0 << 4)
174#define SIX_BPC (1 << 4)
175#define SEVEN_BPC (2 << 4)
176#define EIGHT_BPC (3 << 4)
177
178#define UARTDM_MR2_STOP_BIT_LEN_BMSK 0xc
179#define STOP_BIT_ONE (1 << 2)
180#define STOP_BIT_TWO (3 << 2)
181
182#define UARTDM_MR2_PARITY_MODE_BMSK 0x3
183
184/* Parity configuration */
185#define NO_PARITY 0x0
186#define EVEN_PARITY 0x1
187#define ODD_PARITY 0x2
188#define SPACE_PARITY 0x3
189
190#define UARTDM_IPR_STALE_TIMEOUT_MSB_BMSK 0xffffff80
191#define UARTDM_IPR_STALE_LSB_BMSK 0x1f
192
193/* These can be used for both ISR and IMR register */
194#define UARTDM_ISR_TX_READY_BMSK BIT(7)
195#define UARTDM_ISR_CURRENT_CTS_BMSK BIT(6)
196#define UARTDM_ISR_DELTA_CTS_BMSK BIT(5)
197#define UARTDM_ISR_RXLEV_BMSK BIT(4)
198#define UARTDM_ISR_RXSTALE_BMSK BIT(3)
199#define UARTDM_ISR_RXBREAK_BMSK BIT(2)
200#define UARTDM_ISR_RXHUNT_BMSK BIT(1)
201#define UARTDM_ISR_TXLEV_BMSK BIT(0)
202
203/* Field definitions for UART_DM_DMEN*/
204#define UARTDM_TX_DM_EN_BMSK 0x1
205#define UARTDM_RX_DM_EN_BMSK 0x2
206
207#endif /* MSM_SERIAL_HS_HWREG_H */