blob: cdd0450da124b04219e753eb589dc7c7d76b83b7 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* drivers/serial/msm_serial_hs_hwreg.h
2 *
Saket Saurabh6089f952012-12-07 15:49:13 +05303 * Copyright (c) 2007-2009, 2012-2013,The Linux Foundation. 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
Saket Saurabh6089f952012-12-07 15:49:13 +053062/* Backward Compatability Register for UARTDM Core v1.4 */
63#define UARTDM_BCR_ADDR 0xc8
64
65/*
66 * UARTDM Core v1.4 STALE_IRQ_EMPTY bit defination
67 * Stale interrupt will fire if bit is set when RX-FIFO is empty
68 */
69#define UARTDM_BCR_STALE_IRQ_EMPTY 0x2
70
Mayank Rana05396b22013-03-16 19:10:11 +053071/* TRANSFER_CONTROL Register for UARTDM Core v1.4 */
72#define UARTDM_RX_TRANS_CTRL_ADDR 0xcc
73
74/* TRANSFER_CONTROL Register bits */
75#define RX_STALE_AUTO_RE_EN 0x1
76#define RX_TRANS_AUTO_RE_ACTIVATE 0x2
77#define RX_DMRX_CYCLIC_EN 0x4
78
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070079/* write only register */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070080#define UARTDM_CSR_115200 0xFF
81#define UARTDM_CSR_57600 0xEE
82#define UARTDM_CSR_38400 0xDD
83#define UARTDM_CSR_28800 0xCC
84#define UARTDM_CSR_19200 0xBB
85#define UARTDM_CSR_14400 0xAA
86#define UARTDM_CSR_9600 0x99
87#define UARTDM_CSR_7200 0x88
88#define UARTDM_CSR_4800 0x77
89#define UARTDM_CSR_3600 0x66
90#define UARTDM_CSR_2400 0x55
91#define UARTDM_CSR_1200 0x44
92#define UARTDM_CSR_600 0x33
93#define UARTDM_CSR_300 0x22
94#define UARTDM_CSR_150 0x11
95#define UARTDM_CSR_75 0x00
96
97/* write only register */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070098#define UARTDM_IPR_ADDR 0x18
99#define UARTDM_TFWR_ADDR 0x1c
100#define UARTDM_RFWR_ADDR 0x20
101#define UARTDM_HCR_ADDR 0x24
102#define UARTDM_DMRX_ADDR 0x34
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700103#define UARTDM_DMEN_ADDR 0x3c
104
105/* UART_DM_NO_CHARS_FOR_TX */
106#define UARTDM_NCF_TX_ADDR 0x40
107
108#define UARTDM_BADR_ADDR 0x44
109
110#define UARTDM_SIM_CFG_ADDR 0x80
111
112/* Read Only register */
Stepan Moskovchenko1d4731e2012-02-21 20:18:23 -0800113#define UARTDM_TXFS_ADDR 0x4C
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700114#define UARTDM_RXFS_ADDR 0x50
115
116/* Register field Mask Mapping */
117#define UARTDM_SR_RX_BREAK_BMSK BIT(6)
118#define UARTDM_SR_PAR_FRAME_BMSK BIT(5)
119#define UARTDM_SR_OVERRUN_BMSK BIT(4)
120#define UARTDM_SR_TXEMT_BMSK BIT(3)
121#define UARTDM_SR_TXRDY_BMSK BIT(2)
122#define UARTDM_SR_RXRDY_BMSK BIT(0)
123
124#define UARTDM_CR_TX_DISABLE_BMSK BIT(3)
125#define UARTDM_CR_RX_DISABLE_BMSK BIT(1)
126#define UARTDM_CR_TX_EN_BMSK BIT(2)
127#define UARTDM_CR_RX_EN_BMSK BIT(0)
128
129/* UARTDM_CR channel_comman bit value (register field is bits 8:4) */
130#define RESET_RX 0x10
131#define RESET_TX 0x20
132#define RESET_ERROR_STATUS 0x30
133#define RESET_BREAK_INT 0x40
134#define START_BREAK 0x50
135#define STOP_BREAK 0x60
136#define RESET_CTS 0x70
137#define RESET_STALE_INT 0x80
138#define RFR_LOW 0xD0
139#define RFR_HIGH 0xE0
140#define CR_PROTECTION_EN 0x100
141#define STALE_EVENT_ENABLE 0x500
142#define STALE_EVENT_DISABLE 0x600
143#define FORCE_STALE_EVENT 0x400
144#define CLEAR_TX_READY 0x300
145#define RESET_TX_ERROR 0x800
146#define RESET_TX_DONE 0x810
147
Saket Saurabh6089f952012-12-07 15:49:13 +0530148/*
149 * UARTDM_CR BAM IFC comman bit value
150 * for UARTDM Core v1.4
151 */
152#define START_RX_BAM_IFC 0x850
153#define START_TX_BAM_IFC 0x860
154
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700155#define UARTDM_MR1_AUTO_RFR_LEVEL1_BMSK 0xffffff00
156#define UARTDM_MR1_AUTO_RFR_LEVEL0_BMSK 0x3f
157#define UARTDM_MR1_CTS_CTL_BMSK 0x40
158#define UARTDM_MR1_RX_RDY_CTL_BMSK 0x80
159
Saket Saurabh6089f952012-12-07 15:49:13 +0530160/*
161 * UARTDM Core v1.4 MR2_RFR_CTS_LOOP bitmask
162 * Enables internal loopback between RFR_N of
163 * RX channel and CTS_N of TX channel.
164 */
165#define UARTDM_MR2_RFR_CTS_LOOP_MODE_BMSK 0x400
166
Stepan Moskovchenkoe4b0d792012-05-10 14:10:44 -0700167#define UARTDM_MR2_LOOP_MODE_BMSK 0x80
168#define UARTDM_MR2_ERROR_MODE_BMSK 0x40
169#define UARTDM_MR2_BITS_PER_CHAR_BMSK 0x30
170#define UARTDM_MR2_RX_ZERO_CHAR_OFF 0x100
171#define UARTDM_MR2_RX_ERROR_CHAR_OFF 0x200
172#define UARTDM_MR2_RX_BREAK_ZERO_CHAR_OFF 0x100
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700173
174#define UARTDM_MR2_BITS_PER_CHAR_8 (0x3 << 4)
175
176/* bits per character configuration */
177#define FIVE_BPC (0 << 4)
178#define SIX_BPC (1 << 4)
179#define SEVEN_BPC (2 << 4)
180#define EIGHT_BPC (3 << 4)
181
182#define UARTDM_MR2_STOP_BIT_LEN_BMSK 0xc
183#define STOP_BIT_ONE (1 << 2)
184#define STOP_BIT_TWO (3 << 2)
185
186#define UARTDM_MR2_PARITY_MODE_BMSK 0x3
187
188/* Parity configuration */
189#define NO_PARITY 0x0
Saket Saurabhfd40e5f2012-10-16 15:41:02 +0530190#define EVEN_PARITY 0x2
191#define ODD_PARITY 0x1
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700192#define SPACE_PARITY 0x3
193
194#define UARTDM_IPR_STALE_TIMEOUT_MSB_BMSK 0xffffff80
195#define UARTDM_IPR_STALE_LSB_BMSK 0x1f
196
197/* These can be used for both ISR and IMR register */
198#define UARTDM_ISR_TX_READY_BMSK BIT(7)
199#define UARTDM_ISR_CURRENT_CTS_BMSK BIT(6)
200#define UARTDM_ISR_DELTA_CTS_BMSK BIT(5)
201#define UARTDM_ISR_RXLEV_BMSK BIT(4)
202#define UARTDM_ISR_RXSTALE_BMSK BIT(3)
203#define UARTDM_ISR_RXBREAK_BMSK BIT(2)
204#define UARTDM_ISR_RXHUNT_BMSK BIT(1)
205#define UARTDM_ISR_TXLEV_BMSK BIT(0)
206
207/* Field definitions for UART_DM_DMEN*/
208#define UARTDM_TX_DM_EN_BMSK 0x1
209#define UARTDM_RX_DM_EN_BMSK 0x2
210
Saket Saurabh6089f952012-12-07 15:49:13 +0530211/*
212 * UARTDM Core v1.4 bitmask
213 * Bitmasks for enabling Rx and Tx BAM Interface
214 */
215#define UARTDM_TX_BAM_ENABLE_BMSK 0x4
216#define UARTDM_RX_BAM_ENABLE_BMSK 0x8
217
218/*
219 * Some of the BLSP Based UART Core(v14) existing register offsets
220 * are different compare to GSBI based UART Core(v13)
221 * Hence add the changed register offsets for UART Core v14
222 */
223#ifdef CONFIG_MSM_UARTDM_Core_v14
224
225/* write only register */
Saket Saurabh2c3f0b92013-01-16 15:06:39 +0530226#define UARTDM_CSR_ADDR 0xa0
Saket Saurabh6089f952012-12-07 15:49:13 +0530227
228/* write only register */
229#define UARTDM_TF_ADDR 0x100
230#define UARTDM_TF2_ADDR 0x104
231#define UARTDM_TF3_ADDR 0x108
232#define UARTDM_TF4_ADDR 0x10c
233#define UARTDM_TF5_ADDR 0x110
234#define UARTDM_TF6_ADDR 0x114
235#define UARTDM_TF7_ADDR 0x118
236#define UARTDM_TF8_ADDR 0x11c
237#define UARTDM_TF9_ADDR 0x120
238#define UARTDM_TF10_ADDR 0x124
239#define UARTDM_TF11_ADDR 0x128
240#define UARTDM_TF12_ADDR 0x12c
241#define UARTDM_TF13_ADDR 0x130
242#define UARTDM_TF14_ADDR 0x134
243#define UARTDM_TF15_ADDR 0x138
244#define UARTDM_TF16_ADDR 0x13c
245
246/* write only register */
247#define UARTDM_CR_ADDR 0xa8
248/* write only register */
249#define UARTDM_IMR_ADDR 0xb0
250#define UARTDM_IRDA_ADDR 0xb8
251
252/* Read Only register */
253#define UARTDM_SR_ADDR 0xa4
254
255/* Read Only register */
256#define UARTDM_RF_ADDR 0x140
257#define UARTDM_RF2_ADDR 0x144
258#define UARTDM_RF3_ADDR 0x148
259#define UARTDM_RF4_ADDR 0x14c
260#define UARTDM_RF5_ADDR 0x150
261#define UARTDM_RF6_ADDR 0x154
262#define UARTDM_RF7_ADDR 0x158
263#define UARTDM_RF8_ADDR 0x15c
264#define UARTDM_RF9_ADDR 0x160
265#define UARTDM_RF10_ADDR 0x164
266#define UARTDM_RF11_ADDR 0x168
267#define UARTDM_RF12_ADDR 0x16c
268#define UARTDM_RF13_ADDR 0x170
269#define UARTDM_RF14_ADDR 0x174
270#define UARTDM_RF15_ADDR 0x178
271#define UARTDM_RF16_ADDR 0x17c
272
273/* Read Only register */
274#define UARTDM_MISR_ADDR 0xac
275
276/* Read Only register */
277#define UARTDM_ISR_ADDR 0xb4
278#define UARTDM_RX_TOTAL_SNAP_ADDR 0xbc
279
280#else
281
282/* Register offsets for UART Core v13 */
283
284/* write only register */
285#define UARTDM_CSR_ADDR 0x8
286
287/* write only register */
288#define UARTDM_TF_ADDR 0x70
289#define UARTDM_TF2_ADDR 0x74
290#define UARTDM_TF3_ADDR 0x78
291#define UARTDM_TF4_ADDR 0x7c
292
293/* write only register */
294#define UARTDM_CR_ADDR 0x10
295/* write only register */
296#define UARTDM_IMR_ADDR 0x14
297#define UARTDM_IRDA_ADDR 0x38
298
299/* Read Only register */
300#define UARTDM_SR_ADDR 0x8
301
302/* Read Only register */
303#define UARTDM_RF_ADDR 0x70
304#define UARTDM_RF2_ADDR 0x74
305#define UARTDM_RF3_ADDR 0x78
306#define UARTDM_RF4_ADDR 0x7c
307
308/* Read Only register */
309#define UARTDM_MISR_ADDR 0x10
310
311/* Read Only register */
312#define UARTDM_ISR_ADDR 0x14
313#define UARTDM_RX_TOTAL_SNAP_ADDR 0x38
314
315#endif
316
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700317#endif /* MSM_SERIAL_HS_HWREG_H */