@@ -143,9 +143,6 @@ static int wmt_i2c_write(struct wmt_i2c_dev *i2c_dev, struct i2c_msg *pmsg,
143
143
if (!(pmsg -> flags & I2C_M_NOSTART )) {
144
144
val = readw (i2c_dev -> base + REG_CR );
145
145
val &= ~CR_TX_END ;
146
- writew (val , i2c_dev -> base + REG_CR );
147
-
148
- val = readw (i2c_dev -> base + REG_CR );
149
146
val |= CR_CPU_RDY ;
150
147
writew (val , i2c_dev -> base + REG_CR );
151
148
}
@@ -201,24 +198,15 @@ static int wmt_i2c_read(struct wmt_i2c_dev *i2c_dev, struct i2c_msg *pmsg)
201
198
u32 xfer_len = 0 ;
202
199
203
200
val = readw (i2c_dev -> base + REG_CR );
204
- val &= ~CR_TX_END ;
205
- writew (val , i2c_dev -> base + REG_CR );
201
+ val &= ~(CR_TX_END | CR_TX_NEXT_NO_ACK );
206
202
207
- val = readw (i2c_dev -> base + REG_CR );
208
- val &= ~CR_TX_NEXT_NO_ACK ;
209
- writew (val , i2c_dev -> base + REG_CR );
210
-
211
- if (!(pmsg -> flags & I2C_M_NOSTART )) {
212
- val = readw (i2c_dev -> base + REG_CR );
203
+ if (!(pmsg -> flags & I2C_M_NOSTART ))
213
204
val |= CR_CPU_RDY ;
214
- writew (val , i2c_dev -> base + REG_CR );
215
- }
216
205
217
- if (pmsg -> len == 1 ) {
218
- val = readw (i2c_dev -> base + REG_CR );
206
+ if (pmsg -> len == 1 )
219
207
val |= CR_TX_NEXT_NO_ACK ;
220
- writew ( val , i2c_dev -> base + REG_CR );
221
- }
208
+
209
+ writew ( val , i2c_dev -> base + REG_CR );
222
210
223
211
reinit_completion (& i2c_dev -> complete );
224
212
@@ -240,15 +228,10 @@ static int wmt_i2c_read(struct wmt_i2c_dev *i2c_dev, struct i2c_msg *pmsg)
240
228
pmsg -> buf [xfer_len ] = readw (i2c_dev -> base + REG_CDR ) >> 8 ;
241
229
xfer_len ++ ;
242
230
243
- if (xfer_len == pmsg -> len - 1 ) {
244
- val = readw (i2c_dev -> base + REG_CR );
245
- val |= (CR_TX_NEXT_NO_ACK | CR_CPU_RDY );
246
- writew (val , i2c_dev -> base + REG_CR );
247
- } else {
248
- val = readw (i2c_dev -> base + REG_CR );
249
- val |= CR_CPU_RDY ;
250
- writew (val , i2c_dev -> base + REG_CR );
251
- }
231
+ val = readw (i2c_dev -> base + REG_CR ) | CR_CPU_RDY ;
232
+ if (xfer_len == pmsg -> len - 1 )
233
+ val |= CR_TX_NEXT_NO_ACK ;
234
+ writew (val , i2c_dev -> base + REG_CR );
252
235
}
253
236
254
237
return 0 ;
0 commit comments