1.1 --- a/pkg/devices/lib/i2c/src/jz4780.cc Mon Jul 22 00:17:30 2019 +0200
1.2 +++ b/pkg/devices/lib/i2c/src/jz4780.cc Wed Jul 24 00:51:30 2019 +0200
1.3 @@ -472,6 +472,8 @@
1.4 if (!can_queue)
1.5 return;
1.6
1.7 + // At most, only queue as many reads as are remaining.
1.8 +
1.9 if (remaining < can_queue)
1.10 can_queue = remaining;
1.11
1.12 @@ -487,6 +489,7 @@
1.13 // Issue the stop condition after the final read request.
1.14 // In practice, an extra read request works better since it does not risk a
1.15 // transmission abort condition and would permit following transactions.
1.16 + // However, it does risk causing an address autoincrement with some devices.
1.17
1.18 if (_total == _reqpos)
1.19 _regs[Smb_data_command] = Smb_command_read;
1.20 @@ -542,13 +545,7 @@
1.21
1.22 // Read all expected.
1.23
1.24 - if (queued <= Smb_fifo_limit)
1.25 - _regs[Rx_fifo_thold] = queued - 1;
1.26 -
1.27 - // Read to limit.
1.28 -
1.29 - else
1.30 - _regs[Rx_fifo_thold] = Smb_fifo_limit - 1;
1.31 + _regs[Rx_fifo_thold] = queued - 1;
1.32 }
1.33
1.34 // Read from the target device.