.. | .. |
---|
432 | 432 | |
---|
433 | 433 | regmap_read(dev->map, DW_IC_DATA_CMD, &tmp); |
---|
434 | 434 | /* Ensure length byte is a valid value */ |
---|
435 | | - if (flags & I2C_M_RECV_LEN && |
---|
436 | | - tmp <= I2C_SMBUS_BLOCK_MAX && tmp > 0) { |
---|
| 435 | + if (flags & I2C_M_RECV_LEN) { |
---|
| 436 | + /* |
---|
| 437 | + * if IC_EMPTYFIFO_HOLD_MASTER_EN is set, which cannot be |
---|
| 438 | + * detected from the registers, the controller can be |
---|
| 439 | + * disabled if the STOP bit is set. But it is only set |
---|
| 440 | + * after receiving block data response length in |
---|
| 441 | + * I2C_FUNC_SMBUS_BLOCK_DATA case. That needs to read |
---|
| 442 | + * another byte with STOP bit set when the block data |
---|
| 443 | + * response length is invalid to complete the transaction. |
---|
| 444 | + */ |
---|
| 445 | + if (!tmp || tmp > I2C_SMBUS_BLOCK_MAX) |
---|
| 446 | + tmp = 1; |
---|
| 447 | + |
---|
437 | 448 | len = i2c_dw_recv_len(dev, tmp); |
---|
438 | 449 | } |
---|
439 | 450 | *buf++ = tmp; |
---|