[coreboot-gerrit] New patch to review for coreboot: soc/intel/quark: Fix I2C driver

Lee Leahy (leroy.p.leahy@intel.com) gerrit at coreboot.org
Wed Jan 4 17:55:16 CET 2017


Lee Leahy (leroy.p.leahy at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18029

-gerrit

commit a716fdf3575700ba52cec519643db17f8788e423
Author: Lee Leahy <leroy.p.leahy at intel.com>
Date:   Tue Jan 3 16:00:15 2017 -0800

    soc/intel/quark: Fix I2C driver
    
    Fix the return values for the I2C driver.  Success = 0, Failure = -1.
    This driver now works with the code in vboot.
    
    TEST=Build and run on Galileo Gen2
    
    Change-Id: I421ebb23989aa283b5182dcae4f8099c9ec16eee
    Signed-off-by: Lee Leahy <leroy.p.leahy at intel.com>
---
 src/mainboard/intel/galileo/reg_access.c | 4 ++--
 src/soc/intel/quark/i2c.c                | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/mainboard/intel/galileo/reg_access.c b/src/mainboard/intel/galileo/reg_access.c
index 3a8001b..0c36412 100644
--- a/src/mainboard/intel/galileo/reg_access.c
+++ b/src/mainboard/intel/galileo/reg_access.c
@@ -47,7 +47,7 @@ static uint64_t reg_read(struct reg_script_context *ctx)
 		if (ctx->display_features)
 			printk(BIOS_INFO, "I2C chip 0x%02x: ", step->id);
 		ret_code = i2c_readb(0, step->id, (uint8_t)step->reg, &value);
-		ASSERT(ret_code == 2);
+		ASSERT(ret_code == 0);
 		break;
 	}
 	return value;
@@ -79,7 +79,7 @@ static void reg_write(struct reg_script_context *ctx)
 			printk(BIOS_INFO, "I2C chip 0x%02x: ", step->id);
 		value = (uint8_t)step->value;
 		ret_code = i2c_writeb(0, step->id, (uint8_t)step->reg, value);
-		ASSERT(ret_code == 2);
+		ASSERT(ret_code == 0);
 		break;
 	}
 }
diff --git a/src/soc/intel/quark/i2c.c b/src/soc/intel/quark/i2c.c
index 4675295..3e2c3ff 100644
--- a/src/soc/intel/quark/i2c.c
+++ b/src/soc/intel/quark/i2c.c
@@ -66,7 +66,6 @@ int platform_i2c_transfer(unsigned bus, struct i2c_seg *segments, int count)
 	/* Set the slave address */
 	ASSERT (count > 0);
 	ASSERT (segments != NULL);
-	ASSERT (segments->read == 0);
 
 	/* Clear the start and stop detection */
 	status = regs->ic_clr_start_det;
@@ -173,5 +172,5 @@ int platform_i2c_transfer(unsigned bus, struct i2c_seg *segments, int count)
 		status = regs->ic_status;
 	}
 
-	return bytes_transferred;
+	return 0;
 }



More information about the coreboot-gerrit mailing list