ipq806x: i2c: stop transfer as soon as an error is reported

I2c transfer may consist of multiple segments (for instance write
segment to set the register address and then a read segment to read
the register value). Transfer should be stopped as soon as a segment
processing error has been reported.

BRANCH=master
BUG=chrome-os-partner:35328
TEST=transfer shall not process the read segment when the write segment fails

Change-Id: I85b7b59b376ce33ba3f6d2526be86e9f6585d97b
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 50cd4d40851b3cea99183c549c47b4486a3deb4a
Original-Change-Id: Id65f995d860dd670b289fbdd9eb0ca19a50d7007
Original-Signed-off-by: Sourabh Banerjee <sbanerje@codeaurora.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/254494
Original-Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Original-Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://review.coreboot.org/9824
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Sourabh Banerjee 2015-02-27 19:11:19 +05:30 committed by Patrick Georgi
parent f36cffc07a
commit 54cc8badc9
1 changed files with 1 additions and 1 deletions

View File

@ -150,7 +150,7 @@ int platform_i2c_transfer(unsigned bus, struct i2c_seg *segments, int seg_count)
if (i2c_init(bus)) if (i2c_init(bus))
return 1; return 1;
while (seg_count--) { while (!ret && seg_count--) {
if (seg->read) if (seg->read)
ret = i2c_read(bus, seg->chip, seg->buf, seg->len); ret = i2c_read(bus, seg->chip, seg->buf, seg->len);
else else