From 37d7ac8b5ba12d4618b8a91f35d444fe9572beb4 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Mon, 5 May 2014 18:03:46 -0700 Subject: i2c: Add software_i2c driver for I2C debugging and emulation This patch adds I2C emulation in software through raw toggling of the SDA/SCL lines. Platforms need to provide bindings to toggle their respective I2C busses for this to work (e.g. by pinmuxing them as GPIOs, currently only enabled for Tegra). This is mostly useful as a debugging feature, to drive unusual states on a bus and closely monitor the device output without the need of a bus analyzer. It provides a few functions to "wedge" an I2C bus by aborting a transaction at certain points, which can be used to test if a system can correctly recover from an ill-timed reboot. However, it can also dynamically replace the existing I2C transfer functions and drive some/all I2C transfers on the system, which might be useful if a driver for the actual I2C controller hardware is not (yet) available. Based on original code by Doug Anderson and Hung-ying Tyan for the ChromeOS embedded controller project. BRANCH=None BUG=chrome-os-partner:28323 TEST=Spread tegra_software_i2c_init()/tegra_software_i2c_disable() through the code and see that everything still works. Original-Change-Id: I9ee7ccbd1efb38206669a35d0c3318af16f8be63 Original-Signed-off-by: Julius Werner Original-Reviewed-on: https://chromium-review.googlesource.com/198791 Original-Reviewed-by: Doug Anderson Original-Reviewed-by: Tom Warren Original-Reviewed-by: Stefan Reinauer (cherry picked from commit 8f71503dbbd74c5298e90e2163b67d4efe3e89db) Signed-off-by: Marc Jones Change-Id: Id6c5f75bb5baaabd62b6b1fc26c2c71d9f1ce682 Reviewed-on: http://review.coreboot.org/7947 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks --- src/cpu/allwinner/a10/twi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cpu') diff --git a/src/cpu/allwinner/a10/twi.c b/src/cpu/allwinner/a10/twi.c index 14e5ec7d9f..d6a0127803 100644 --- a/src/cpu/allwinner/a10/twi.c +++ b/src/cpu/allwinner/a10/twi.c @@ -215,7 +215,7 @@ static int i2c_write(unsigned bus, unsigned chip, unsigned addr, * TODO: Rewite the i2c_transfer and supporting functions * */ -int i2c_transfer(unsigned bus, struct i2c_seg *segments, int count) +int platform_i2c_transfer(unsigned bus, struct i2c_seg *segments, int count) { struct i2c_seg *seg = segments; -- cgit v1.2.3