@@ -100,14 +100,18 @@ static void dw8250_force_idle(struct uart_port *p)
100
100
(void )p -> serial_in (p , UART_RX );
101
101
}
102
102
103
- static void dw8250_check_lcr (struct uart_port * p , int value )
103
+ static void dw8250_check_lcr (struct uart_port * p , int offset , int value )
104
104
{
105
- void __iomem * offset = p -> membase + (UART_LCR << p -> regshift );
105
+ struct dw8250_data * d = to_dw8250_data (p -> private_data );
106
+ void __iomem * addr = p -> membase + (offset << p -> regshift );
106
107
int tries = 1000 ;
107
108
109
+ if (offset != UART_LCR || d -> uart_16550_compatible )
110
+ return ;
111
+
108
112
/* Make sure LCR write wasn't ignored */
109
113
while (tries -- ) {
110
- unsigned int lcr = p -> serial_in (p , UART_LCR );
114
+ unsigned int lcr = p -> serial_in (p , offset );
111
115
112
116
if ((value & ~UART_LCR_SPAR ) == (lcr & ~UART_LCR_SPAR ))
113
117
return ;
@@ -116,15 +120,15 @@ static void dw8250_check_lcr(struct uart_port *p, int value)
116
120
117
121
#ifdef CONFIG_64BIT
118
122
if (p -> type == PORT_OCTEON )
119
- __raw_writeq (value & 0xff , offset );
123
+ __raw_writeq (value & 0xff , addr );
120
124
else
121
125
#endif
122
126
if (p -> iotype == UPIO_MEM32 )
123
- writel (value , offset );
127
+ writel (value , addr );
124
128
else if (p -> iotype == UPIO_MEM32BE )
125
- iowrite32be (value , offset );
129
+ iowrite32be (value , addr );
126
130
else
127
- writeb (value , offset );
131
+ writeb (value , addr );
128
132
}
129
133
/*
130
134
* FIXME: this deadlocks if port->lock is already held
@@ -158,12 +162,8 @@ static void dw8250_tx_wait_empty(struct uart_port *p)
158
162
159
163
static void dw8250_serial_out (struct uart_port * p , int offset , int value )
160
164
{
161
- struct dw8250_data * d = to_dw8250_data (p -> private_data );
162
-
163
165
writeb (value , p -> membase + (offset << p -> regshift ));
164
-
165
- if (offset == UART_LCR && !d -> uart_16550_compatible )
166
- dw8250_check_lcr (p , value );
166
+ dw8250_check_lcr (p , offset , value );
167
167
}
168
168
169
169
static void dw8250_serial_out38x (struct uart_port * p , int offset , int value )
@@ -194,26 +194,19 @@ static unsigned int dw8250_serial_inq(struct uart_port *p, int offset)
194
194
195
195
static void dw8250_serial_outq (struct uart_port * p , int offset , int value )
196
196
{
197
- struct dw8250_data * d = to_dw8250_data (p -> private_data );
198
-
199
197
value &= 0xff ;
200
198
__raw_writeq (value , p -> membase + (offset << p -> regshift ));
201
199
/* Read back to ensure register write ordering. */
202
200
__raw_readq (p -> membase + (UART_LCR << p -> regshift ));
203
201
204
- if (offset == UART_LCR && !d -> uart_16550_compatible )
205
- dw8250_check_lcr (p , value );
202
+ dw8250_check_lcr (p , offset , value );
206
203
}
207
204
#endif /* CONFIG_64BIT */
208
205
209
206
static void dw8250_serial_out32 (struct uart_port * p , int offset , int value )
210
207
{
211
- struct dw8250_data * d = to_dw8250_data (p -> private_data );
212
-
213
208
writel (value , p -> membase + (offset << p -> regshift ));
214
-
215
- if (offset == UART_LCR && !d -> uart_16550_compatible )
216
- dw8250_check_lcr (p , value );
209
+ dw8250_check_lcr (p , offset , value );
217
210
}
218
211
219
212
static unsigned int dw8250_serial_in32 (struct uart_port * p , int offset )
@@ -225,12 +218,8 @@ static unsigned int dw8250_serial_in32(struct uart_port *p, int offset)
225
218
226
219
static void dw8250_serial_out32be (struct uart_port * p , int offset , int value )
227
220
{
228
- struct dw8250_data * d = to_dw8250_data (p -> private_data );
229
-
230
221
iowrite32be (value , p -> membase + (offset << p -> regshift ));
231
-
232
- if (offset == UART_LCR && !d -> uart_16550_compatible )
233
- dw8250_check_lcr (p , value );
222
+ dw8250_check_lcr (p , offset , value );
234
223
}
235
224
236
225
static unsigned int dw8250_serial_in32be (struct uart_port * p , int offset )
0 commit comments