From cdb61a6f5d2268b059ac56da3b69ad0313f3fb90 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 7 Apr 2014 18:45:14 -0700 Subject: i2c: Replace the i2c API. The new API is in use in depthcharge and is based around the "i2c_transfer" function instead of i2c_read and i2c_write. The new function takes an array of i2c_seg structures which represent each portion of the transfer after a start bit and before the stop bit. If there's more than one segment, they're seperated by repeated starts. Some wrapper functions have also been added which make certain common operations easy. These include reading or writing a byte from a register or reading or writing a blob of raw data. The i2c device drivers generally use these wrappers but can call the i2c_transfer function directly if the need something different. The tegra i2c driver was very similar to the one in depthcharge and was simple to convert. The Exynos 5250 and 5420 drivers were ported from depthcharge and replace the ones in coreboot. The Exynos 5420 driver was ported from the high speed portion of the one in coreboot and was straightforward to port back. The low speed portion and the Exynos 5250 drivers had been transplanted from U-Boot and were replaced with the depthcharge implementation. BUG=None TEST=Built and booted on nyan with and without EFS. Built and booted on, pit and daisy. BRANCH=None Original-Change-Id: I1e98c3fa2560be25444ab3d0394bb214b9d56e93 Original-Signed-off-by: Gabe Black Original-Reviewed-on: https://chromium-review.googlesource.com/193561 Original-Reviewed-by: David Hendricks Original-Reviewed-by: Jimmy Zhang Original-Tested-by: Jimmy Zhang Original-Reviewed-by: Hung-Te Lin Original-Commit-Queue: Gabe Black Original-Tested-by: Gabe Black (cherry picked from commit 00c423fb2c06c69d580ee3ec0a3892ebf164a5fe) This cherry-pick required additional changes to the following: src/cpu/allwinner/a10/twi.c src/drivers/xpowers/axp209/axp209.c Signed-off-by: Marc Jones Change-Id: I691959c66308eeeec219b1bec463b8b365a246d7 Reviewed-on: http://review.coreboot.org/7751 Tested-by: build bot (Jenkins) Reviewed-by: Alexandru Gagniuc Reviewed-by: Patrick Georgi --- src/drivers/ti/tps65090/tps65090.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/drivers/ti') diff --git a/src/drivers/ti/tps65090/tps65090.c b/src/drivers/ti/tps65090/tps65090.c index 653d20da24..35a050f36f 100644 --- a/src/drivers/ti/tps65090/tps65090.c +++ b/src/drivers/ti/tps65090/tps65090.c @@ -64,7 +64,7 @@ static int tps65090_i2c_write(unsigned int bus, { int ret; - ret = i2c_write(bus, TPS65090_I2C_ADDR, reg_addr, 1, &value, 1); + ret = i2c_writeb(bus, TPS65090_I2C_ADDR, reg_addr, value); printk(BIOS_DEBUG, "%s: reg=%#x, value=%#x, ret=%d\n", __func__, reg_addr, value, ret); return ret; @@ -76,7 +76,7 @@ static int tps65090_i2c_read(unsigned int bus, int ret; printk(BIOS_DEBUG, "%s: reg=%#x, ", __func__, reg_addr); - ret = i2c_read(bus, TPS65090_I2C_ADDR, reg_addr, 1, value, 1); + ret = i2c_readb(bus, TPS65090_I2C_ADDR, reg_addr, value); if (ret) printk(BIOS_DEBUG, "fail, ret=%d\n", ret); else -- cgit v1.2.3