blob: d912b9f2a2a22a82aaa972d769d50aa6226152d6 [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
Saket Saurabh984e6082013-06-04 11:40:41 +053035#define MSM_ENABLE_UART_CLOCK 13
36#define MSM_DISABLE_UART_CLOCK 14
37#define MSM_GET_UART_CLOCK_STATUS 15
38
Sathish Ambley99e2a242011-10-25 15:49:53 -070039enum msm_hsl_regs {
40 UARTDM_MR1,
41 UARTDM_MR2,
42 UARTDM_IMR,
43 UARTDM_SR,
44 UARTDM_CR,
45 UARTDM_CSR,
46 UARTDM_IPR,
47 UARTDM_ISR,
48 UARTDM_RX_TOTAL_SNAP,
49 UARTDM_RFWR,
50 UARTDM_TFWR,
51 UARTDM_RF,
52 UARTDM_TF,
53 UARTDM_MISR,
54 UARTDM_DMRX,
55 UARTDM_NCF_TX,
56 UARTDM_DMEN,
57 UARTDM_BCR,
Stepan Moskovchenko1d4731e2012-02-21 20:18:23 -080058 UARTDM_TXFS,
59 UARTDM_RXFS,
60 UARTDM_LAST,
Sathish Ambley99e2a242011-10-25 15:49:53 -070061};
62
Saket Saurabhc708fc72013-03-25 19:04:08 +053063enum msm_hs_regs {
64 UART_DM_MR1,
65 UART_DM_MR2,
66 UART_DM_IMR,
67 UART_DM_SR,
68 UART_DM_CR,
69 UART_DM_CSR,
70 UART_DM_IPR,
71 UART_DM_ISR,
72 UART_DM_RX_TOTAL_SNAP,
73 UART_DM_RFWR,
74 UART_DM_TFWR,
75 UART_DM_RF,
76 UART_DM_TF,
77 UART_DM_MISR,
78 UART_DM_DMRX,
79 UART_DM_NCF_TX,
80 UART_DM_DMEN,
81 UART_DM_TXFS,
82 UART_DM_RXFS,
83 UART_DM_RX_TRANS_CTRL,
84 UART_DM_LAST,
85};
86
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070087#define UARTDM_MR1_ADDR 0x0
88#define UARTDM_MR2_ADDR 0x4
89
Saket Saurabh6089f952012-12-07 15:49:13 +053090/* Backward Compatability Register for UARTDM Core v1.4 */
91#define UARTDM_BCR_ADDR 0xc8
92
93/*
94 * UARTDM Core v1.4 STALE_IRQ_EMPTY bit defination
95 * Stale interrupt will fire if bit is set when RX-FIFO is empty
96 */
97#define UARTDM_BCR_STALE_IRQ_EMPTY 0x2
98
Mayank Rana05396b22013-03-16 19:10:11 +053099/* TRANSFER_CONTROL Register for UARTDM Core v1.4 */
100#define UARTDM_RX_TRANS_CTRL_ADDR 0xcc
101
102/* TRANSFER_CONTROL Register bits */
103#define RX_STALE_AUTO_RE_EN 0x1
104#define RX_TRANS_AUTO_RE_ACTIVATE 0x2
105#define RX_DMRX_CYCLIC_EN 0x4
106
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700107/* write only register */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700108#define UARTDM_CSR_115200 0xFF
109#define UARTDM_CSR_57600 0xEE
110#define UARTDM_CSR_38400 0xDD
111#define UARTDM_CSR_28800 0xCC
112#define UARTDM_CSR_19200 0xBB
113#define UARTDM_CSR_14400 0xAA
114#define UARTDM_CSR_9600 0x99
115#define UARTDM_CSR_7200 0x88
116#define UARTDM_CSR_4800 0x77
117#define UARTDM_CSR_3600 0x66
118#define UARTDM_CSR_2400 0x55
119#define UARTDM_CSR_1200 0x44
120#define UARTDM_CSR_600 0x33
121#define UARTDM_CSR_300 0x22
122#define UARTDM_CSR_150 0x11
123#define UARTDM_CSR_75 0x00
124
125/* write only register */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700126#define UARTDM_IPR_ADDR 0x18
127#define UARTDM_TFWR_ADDR 0x1c
128#define UARTDM_RFWR_ADDR 0x20
129#define UARTDM_HCR_ADDR 0x24
130#define UARTDM_DMRX_ADDR 0x34
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700131#define UARTDM_DMEN_ADDR 0x3c
132
133/* UART_DM_NO_CHARS_FOR_TX */
134#define UARTDM_NCF_TX_ADDR 0x40
135
136#define UARTDM_BADR_ADDR 0x44
137
138#define UARTDM_SIM_CFG_ADDR 0x80
139
140/* Read Only register */
Stepan Moskovchenko1d4731e2012-02-21 20:18:23 -0800141#define UARTDM_TXFS_ADDR 0x4C
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700142#define UARTDM_RXFS_ADDR 0x50
143
144/* Register field Mask Mapping */
145#define UARTDM_SR_RX_BREAK_BMSK BIT(6)
146#define UARTDM_SR_PAR_FRAME_BMSK BIT(5)
147#define UARTDM_SR_OVERRUN_BMSK BIT(4)
148#define UARTDM_SR_TXEMT_BMSK BIT(3)
149#define UARTDM_SR_TXRDY_BMSK BIT(2)
150#define UARTDM_SR_RXRDY_BMSK BIT(0)
151
152#define UARTDM_CR_TX_DISABLE_BMSK BIT(3)
153#define UARTDM_CR_RX_DISABLE_BMSK BIT(1)
154#define UARTDM_CR_TX_EN_BMSK BIT(2)
155#define UARTDM_CR_RX_EN_BMSK BIT(0)
156
157/* UARTDM_CR channel_comman bit value (register field is bits 8:4) */
158#define RESET_RX 0x10
159#define RESET_TX 0x20
160#define RESET_ERROR_STATUS 0x30
161#define RESET_BREAK_INT 0x40
162#define START_BREAK 0x50
163#define STOP_BREAK 0x60
164#define RESET_CTS 0x70
165#define RESET_STALE_INT 0x80
166#define RFR_LOW 0xD0
167#define RFR_HIGH 0xE0
168#define CR_PROTECTION_EN 0x100
169#define STALE_EVENT_ENABLE 0x500
170#define STALE_EVENT_DISABLE 0x600
171#define FORCE_STALE_EVENT 0x400
172#define CLEAR_TX_READY 0x300
173#define RESET_TX_ERROR 0x800
174#define RESET_TX_DONE 0x810
175
Saket Saurabh6089f952012-12-07 15:49:13 +0530176/*
177 * UARTDM_CR BAM IFC comman bit value
178 * for UARTDM Core v1.4
179 */
180#define START_RX_BAM_IFC 0x850
181#define START_TX_BAM_IFC 0x860
182
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700183#define UARTDM_MR1_AUTO_RFR_LEVEL1_BMSK 0xffffff00
184#define UARTDM_MR1_AUTO_RFR_LEVEL0_BMSK 0x3f
185#define UARTDM_MR1_CTS_CTL_BMSK 0x40
186#define UARTDM_MR1_RX_RDY_CTL_BMSK 0x80
187
Saket Saurabh6089f952012-12-07 15:49:13 +0530188/*
189 * UARTDM Core v1.4 MR2_RFR_CTS_LOOP bitmask
190 * Enables internal loopback between RFR_N of
191 * RX channel and CTS_N of TX channel.
192 */
193#define UARTDM_MR2_RFR_CTS_LOOP_MODE_BMSK 0x400
194
Stepan Moskovchenkoe4b0d792012-05-10 14:10:44 -0700195#define UARTDM_MR2_LOOP_MODE_BMSK 0x80
196#define UARTDM_MR2_ERROR_MODE_BMSK 0x40
197#define UARTDM_MR2_BITS_PER_CHAR_BMSK 0x30
198#define UARTDM_MR2_RX_ZERO_CHAR_OFF 0x100
199#define UARTDM_MR2_RX_ERROR_CHAR_OFF 0x200
200#define UARTDM_MR2_RX_BREAK_ZERO_CHAR_OFF 0x100
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700201
202#define UARTDM_MR2_BITS_PER_CHAR_8 (0x3 << 4)
203
204/* bits per character configuration */
205#define FIVE_BPC (0 << 4)
206#define SIX_BPC (1 << 4)
207#define SEVEN_BPC (2 << 4)
208#define EIGHT_BPC (3 << 4)
209
210#define UARTDM_MR2_STOP_BIT_LEN_BMSK 0xc
211#define STOP_BIT_ONE (1 << 2)
212#define STOP_BIT_TWO (3 << 2)
213
214#define UARTDM_MR2_PARITY_MODE_BMSK 0x3
215
216/* Parity configuration */
217#define NO_PARITY 0x0
Saket Saurabhfd40e5f2012-10-16 15:41:02 +0530218#define EVEN_PARITY 0x2
219#define ODD_PARITY 0x1
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700220#define SPACE_PARITY 0x3
221
222#define UARTDM_IPR_STALE_TIMEOUT_MSB_BMSK 0xffffff80
223#define UARTDM_IPR_STALE_LSB_BMSK 0x1f
224
225/* These can be used for both ISR and IMR register */
226#define UARTDM_ISR_TX_READY_BMSK BIT(7)
227#define UARTDM_ISR_CURRENT_CTS_BMSK BIT(6)
228#define UARTDM_ISR_DELTA_CTS_BMSK BIT(5)
229#define UARTDM_ISR_RXLEV_BMSK BIT(4)
230#define UARTDM_ISR_RXSTALE_BMSK BIT(3)
231#define UARTDM_ISR_RXBREAK_BMSK BIT(2)
232#define UARTDM_ISR_RXHUNT_BMSK BIT(1)
233#define UARTDM_ISR_TXLEV_BMSK BIT(0)
234
235/* Field definitions for UART_DM_DMEN*/
236#define UARTDM_TX_DM_EN_BMSK 0x1
237#define UARTDM_RX_DM_EN_BMSK 0x2
238
Saket Saurabh6089f952012-12-07 15:49:13 +0530239/*
240 * UARTDM Core v1.4 bitmask
241 * Bitmasks for enabling Rx and Tx BAM Interface
242 */
243#define UARTDM_TX_BAM_ENABLE_BMSK 0x4
244#define UARTDM_RX_BAM_ENABLE_BMSK 0x8
245
Saket Saurabh6089f952012-12-07 15:49:13 +0530246/* Register offsets for UART Core v13 */
247
248/* write only register */
249#define UARTDM_CSR_ADDR 0x8
250
251/* write only register */
252#define UARTDM_TF_ADDR 0x70
253#define UARTDM_TF2_ADDR 0x74
254#define UARTDM_TF3_ADDR 0x78
255#define UARTDM_TF4_ADDR 0x7c
256
257/* write only register */
258#define UARTDM_CR_ADDR 0x10
259/* write only register */
260#define UARTDM_IMR_ADDR 0x14
261#define UARTDM_IRDA_ADDR 0x38
262
263/* Read Only register */
264#define UARTDM_SR_ADDR 0x8
265
266/* Read Only register */
267#define UARTDM_RF_ADDR 0x70
268#define UARTDM_RF2_ADDR 0x74
269#define UARTDM_RF3_ADDR 0x78
270#define UARTDM_RF4_ADDR 0x7c
271
272/* Read Only register */
273#define UARTDM_MISR_ADDR 0x10
274
275/* Read Only register */
276#define UARTDM_ISR_ADDR 0x14
277#define UARTDM_RX_TOTAL_SNAP_ADDR 0x38
278
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700279#endif /* MSM_SERIAL_HS_HWREG_H */