diff options
author | Abhijeet Dharmapurikar <adharmap@codeaurora.org> | 2010-05-20 18:20:23 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-06-04 16:37:16 -0400 |
commit | 18c79d76ece432a48c985ea404800f8ee154ada2 (patch) | |
tree | 864f598be56999e4437e01a413d1c72beb78d75e /drivers/serial/msm_serial.h | |
parent | ad8456361fa19068cf49b50a4f98e41b73c08e76 (diff) |
msm_serial: fix serial on trout
Set the mnd counter based on uartclk. This fixes a problem
on 7x30 where the uartclk is 19.2Mhz rather than the usual
4.8Mhz.
Trout incorrectly reports uartclk to be running at 19.2Mhz
It is actually running at 4.8Mhz. For trout force mnd
counter values as if uartclk was fed by tcxo/4.
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
[dwalker@codeaurora.org: inlined, moved into header, added comments.]
Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/serial/msm_serial.h')
-rw-r--r-- | drivers/serial/msm_serial.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/serial/msm_serial.h b/drivers/serial/msm_serial.h index 689f1fa0e84e..f6ca9ca79e98 100644 --- a/drivers/serial/msm_serial.h +++ b/drivers/serial/msm_serial.h | |||
@@ -114,4 +114,60 @@ | |||
114 | #define UART_MISR 0x0010 | 114 | #define UART_MISR 0x0010 |
115 | #define UART_ISR 0x0014 | 115 | #define UART_ISR 0x0014 |
116 | 116 | ||
117 | #define UART_TO_MSM(uart_port) ((struct msm_port *) uart_port) | ||
118 | |||
119 | static inline | ||
120 | void msm_write(struct uart_port *port, unsigned int val, unsigned int off) | ||
121 | { | ||
122 | __raw_writel(val, port->membase + off); | ||
123 | } | ||
124 | |||
125 | static inline | ||
126 | unsigned int msm_read(struct uart_port *port, unsigned int off) | ||
127 | { | ||
128 | return __raw_readl(port->membase + off); | ||
129 | } | ||
130 | |||
131 | /* | ||
132 | * Setup the MND registers to use the TCXO clock. | ||
133 | */ | ||
134 | static inline void msm_serial_set_mnd_regs_tcxo(struct uart_port *port) | ||
135 | { | ||
136 | msm_write(port, 0x06, UART_MREG); | ||
137 | msm_write(port, 0xF1, UART_NREG); | ||
138 | msm_write(port, 0x0F, UART_DREG); | ||
139 | msm_write(port, 0x1A, UART_MNDREG); | ||
140 | } | ||
141 | |||
142 | /* | ||
143 | * Setup the MND registers to use the TCXO clock divided by 4. | ||
144 | */ | ||
145 | static inline void msm_serial_set_mnd_regs_tcxoby4(struct uart_port *port) | ||
146 | { | ||
147 | msm_write(port, 0x18, UART_MREG); | ||
148 | msm_write(port, 0xF6, UART_NREG); | ||
149 | msm_write(port, 0x0F, UART_DREG); | ||
150 | msm_write(port, 0x0A, UART_MNDREG); | ||
151 | } | ||
152 | |||
153 | static inline | ||
154 | void msm_serial_set_mnd_regs_from_uartclk(struct uart_port *port) | ||
155 | { | ||
156 | if (port->uartclk == 19200000) | ||
157 | msm_serial_set_mnd_regs_tcxo(port); | ||
158 | else | ||
159 | msm_serial_set_mnd_regs_tcxoby4(port); | ||
160 | } | ||
161 | |||
162 | /* | ||
163 | * TROUT has a specific defect that makes it report it's uartclk | ||
164 | * as 19.2Mhz (TCXO) when it's actually 4.8Mhz (TCXO/4). This special | ||
165 | * cases TROUT to use the right clock. | ||
166 | */ | ||
167 | #ifdef CONFIG_MACH_TROUT | ||
168 | #define msm_serial_set_mnd_regs msm_serial_set_mnd_regs_tcxoby4 | ||
169 | #else | ||
170 | #define msm_serial_set_mnd_regs msm_serial_set_mnd_regs_from_uartclk | ||
171 | #endif | ||
172 | |||
117 | #endif /* __DRIVERS_SERIAL_MSM_SERIAL_H */ | 173 | #endif /* __DRIVERS_SERIAL_MSM_SERIAL_H */ |