summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/acpi_device.c1
-rw-r--r--src/cpu/allwinner/a10/twi.c2
-rw-r--r--src/device/i2c.c3
-rw-r--r--src/device/software_i2c.c2
-rw-r--r--src/drivers/ams/as3722rtc.c2
-rw-r--r--src/drivers/i2c/da7219/da7219.c2
-rw-r--r--src/drivers/i2c/generic/chip.h2
-rw-r--r--src/drivers/i2c/generic/generic.c2
-rw-r--r--src/drivers/i2c/max98927/max98927.c2
-rw-r--r--src/drivers/i2c/nau8825/nau8825.c2
-rw-r--r--src/drivers/i2c/rx6110sa/rx6110sa.c2
-rw-r--r--src/drivers/i2c/tpm/chip.c2
-rw-r--r--src/drivers/i2c/tpm/chip.h2
-rw-r--r--src/drivers/i2c/tpm/cr50.c2
-rw-r--r--src/drivers/i2c/tpm/tis.c2
-rw-r--r--src/drivers/i2c/tpm/tis_atmel.c2
-rw-r--r--src/drivers/i2c/tpm/tpm.c2
-rw-r--r--src/drivers/i2c/ww_ring/ww_ring.c2
-rw-r--r--src/drivers/intel/mipi_camera/camera.c2
-rw-r--r--src/drivers/maxim/max77686/max77686.c2
-rw-r--r--src/drivers/parade/ps8625/ps8625.c2
-rw-r--r--src/drivers/parade/ps8640/ps8640.c2
-rw-r--r--src/drivers/ti/tps65090/tps65090.c2
-rw-r--r--src/drivers/ti/tps65913/tps65913rtc.c2
-rw-r--r--src/drivers/xpowers/axp209/axp209.c2
-rw-r--r--src/ec/google/chromeec/ec_i2c.c2
-rw-r--r--src/include/device/i2c.h159
-rw-r--r--src/include/device/i2c_bus.h44
-rw-r--r--src/include/device/i2c_simple.h157
-rw-r--r--src/mainboard/google/daisy/mainboard.c2
-rw-r--r--src/mainboard/google/daisy/romstage.c2
-rw-r--r--src/mainboard/google/foster/bootblock.c2
-rw-r--r--src/mainboard/google/foster/pmic.c2
-rw-r--r--src/mainboard/google/gru/mainboard.c2
-rw-r--r--src/mainboard/google/nyan/bootblock.c2
-rw-r--r--src/mainboard/google/nyan/pmic.c2
-rw-r--r--src/mainboard/google/nyan_big/bootblock.c2
-rw-r--r--src/mainboard/google/nyan_big/pmic.c2
-rw-r--r--src/mainboard/google/nyan_blaze/bootblock.c2
-rw-r--r--src/mainboard/google/nyan_blaze/pmic.c2
-rw-r--r--src/mainboard/google/peach_pit/mainboard.c2
-rw-r--r--src/mainboard/google/peach_pit/romstage.c2
-rw-r--r--src/mainboard/google/smaug/bootblock.c2
-rw-r--r--src/mainboard/google/smaug/mainboard.c2
-rw-r--r--src/mainboard/google/smaug/pmic.c2
-rw-r--r--src/mainboard/google/smaug/romstage.c2
-rw-r--r--src/mainboard/google/veyron/mainboard.c2
-rw-r--r--src/mainboard/google/veyron_mickey/mainboard.c2
-rw-r--r--src/mainboard/google/veyron_rialto/mainboard.c2
-rw-r--r--src/mainboard/intel/galileo/reg_access.c2
-rw-r--r--src/mainboard/intel/galileo/vboot.c2
-rw-r--r--src/mainboard/intel/kblrvp/ramstage.c2
-rw-r--r--src/mainboard/siemens/mc_apl1/ptn3460.c2
-rw-r--r--src/soc/broadcom/cygnus/i2c.c2
-rw-r--r--src/soc/intel/apollolake/chip.h2
-rw-r--r--src/soc/intel/common/block/i2c/i2c.c2
-rw-r--r--src/soc/intel/common/block/i2c/i2c_early.c2
-rw-r--r--src/soc/intel/common/block/i2c/lpss_i2c.c2
-rw-r--r--src/soc/intel/common/block/include/intelblocks/lpss_i2c.h1
-rw-r--r--src/soc/intel/quark/gpio_i2c.c2
-rw-r--r--src/soc/intel/quark/i2c.c2
-rw-r--r--src/soc/intel/skylake/chip.h2
-rw-r--r--src/soc/mediatek/mt8173/da9212.c2
-rw-r--r--src/soc/mediatek/mt8173/i2c.c2
-rw-r--r--src/soc/mediatek/mt8173/mt6311.c2
-rw-r--r--src/soc/nvidia/tegra/i2c.c2
-rw-r--r--src/soc/nvidia/tegra/software_i2c.c2
-rw-r--r--src/soc/nvidia/tegra124/dp.c2
-rw-r--r--src/soc/nvidia/tegra210/dp.c2
-rw-r--r--src/soc/qualcomm/ipq40xx/i2c.c2
-rw-r--r--src/soc/qualcomm/ipq806x/i2c.c2
-rw-r--r--src/soc/rockchip/common/i2c.c2
-rw-r--r--src/soc/rockchip/common/rk808.c2
-rw-r--r--src/soc/rockchip/rk3288/software_i2c.c2
-rw-r--r--src/soc/samsung/exynos5250/i2c.c2
-rw-r--r--src/soc/samsung/exynos5420/i2c.c2
76 files changed, 274 insertions, 231 deletions
diff --git a/src/arch/x86/acpi_device.c b/src/arch/x86/acpi_device.c
index 49439cc4a9..aac7b88497 100644
--- a/src/arch/x86/acpi_device.c
+++ b/src/arch/x86/acpi_device.c
@@ -18,7 +18,6 @@
#include <arch/acpi_device.h>
#include <arch/acpigen.h>
#include <device/device.h>
-#include <device/i2c.h>
#include <device/path.h>
#if IS_ENABLED(CONFIG_GENERIC_GPIO_LIB)
#include <gpio.h>
diff --git a/src/cpu/allwinner/a10/twi.c b/src/cpu/allwinner/a10/twi.c
index 123d34ec05..6601db3dde 100644
--- a/src/cpu/allwinner/a10/twi.c
+++ b/src/cpu/allwinner/a10/twi.c
@@ -25,7 +25,7 @@
#include <arch/io.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#define TWI_BASE(n) (A1X_TWI0_BASE + 0x400 * (n))
diff --git a/src/device/i2c.c b/src/device/i2c.c
index 67470d4921..6fdd5cff26 100644
--- a/src/device/i2c.c
+++ b/src/device/i2c.c
@@ -14,7 +14,8 @@
*/
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_bus.h>
+#include <device/i2c_simple.h>
#include <stdint.h>
#if ENV_RAMSTAGE
diff --git a/src/device/software_i2c.c b/src/device/software_i2c.c
index 368d145b3e..ec6722bbed 100644
--- a/src/device/software_i2c.c
+++ b/src/device/software_i2c.c
@@ -16,7 +16,7 @@
#include <assert.h>
#include <timer.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
/*
* The implementation is based on Wikipedia.
diff --git a/src/drivers/ams/as3722rtc.c b/src/drivers/ams/as3722rtc.c
index 4afcdcc22c..40285d4ef2 100644
--- a/src/drivers/ams/as3722rtc.c
+++ b/src/drivers/ams/as3722rtc.c
@@ -15,7 +15,7 @@
#include <bcd.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <rtc.h>
#include <stdint.h>
diff --git a/src/drivers/i2c/da7219/da7219.c b/src/drivers/i2c/da7219/da7219.c
index b29a4a15af..2e7d46010e 100644
--- a/src/drivers/i2c/da7219/da7219.c
+++ b/src/drivers/i2c/da7219/da7219.c
@@ -17,7 +17,7 @@
#include <arch/acpi_device.h>
#include <arch/acpigen.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <device/device.h>
#include <device/path.h>
#include <stdint.h>
diff --git a/src/drivers/i2c/generic/chip.h b/src/drivers/i2c/generic/chip.h
index 5810db801f..c5d458b6ee 100644
--- a/src/drivers/i2c/generic/chip.h
+++ b/src/drivers/i2c/generic/chip.h
@@ -17,7 +17,7 @@
#define __I2C_GENERIC_CHIP_H__
#include <arch/acpi_device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
struct drivers_i2c_generic_config {
const char *hid; /* ACPI _HID (required) */
diff --git a/src/drivers/i2c/generic/generic.c b/src/drivers/i2c/generic/generic.c
index f8de1c22d9..b7a535e47f 100644
--- a/src/drivers/i2c/generic/generic.c
+++ b/src/drivers/i2c/generic/generic.c
@@ -16,7 +16,7 @@
#include <arch/acpi_device.h>
#include <arch/acpigen.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <device/device.h>
#include <device/path.h>
#include <gpio.h>
diff --git a/src/drivers/i2c/max98927/max98927.c b/src/drivers/i2c/max98927/max98927.c
index a3e6661a00..976c2f259a 100644
--- a/src/drivers/i2c/max98927/max98927.c
+++ b/src/drivers/i2c/max98927/max98927.c
@@ -17,7 +17,7 @@
#include <arch/acpi_device.h>
#include <arch/acpigen.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <device/device.h>
#include <device/path.h>
#include <stdint.h>
diff --git a/src/drivers/i2c/nau8825/nau8825.c b/src/drivers/i2c/nau8825/nau8825.c
index a86eff41f3..42dd8478e6 100644
--- a/src/drivers/i2c/nau8825/nau8825.c
+++ b/src/drivers/i2c/nau8825/nau8825.c
@@ -17,7 +17,7 @@
#include <arch/acpi_device.h>
#include <arch/acpigen.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <device/device.h>
#include <device/path.h>
#include <stdint.h>
diff --git a/src/drivers/i2c/rx6110sa/rx6110sa.c b/src/drivers/i2c/rx6110sa/rx6110sa.c
index 2c62f230bd..2402d59ebf 100644
--- a/src/drivers/i2c/rx6110sa/rx6110sa.c
+++ b/src/drivers/i2c/rx6110sa/rx6110sa.c
@@ -13,7 +13,7 @@
* GNU General Public License for more details.
*/
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <device/smbus.h>
#include <device/device.h>
#include <version.h>
diff --git a/src/drivers/i2c/tpm/chip.c b/src/drivers/i2c/tpm/chip.c
index 1781e996e5..595a05cdbc 100644
--- a/src/drivers/i2c/tpm/chip.c
+++ b/src/drivers/i2c/tpm/chip.c
@@ -16,7 +16,7 @@
#include <arch/acpi_device.h>
#include <arch/acpigen.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <device/device.h>
#include <device/path.h>
#include <stdint.h>
diff --git a/src/drivers/i2c/tpm/chip.h b/src/drivers/i2c/tpm/chip.h
index 83df998c96..5abd3a94f3 100644
--- a/src/drivers/i2c/tpm/chip.h
+++ b/src/drivers/i2c/tpm/chip.h
@@ -1,5 +1,5 @@
#include <arch/acpi_device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
struct drivers_i2c_tpm_config {
const char *hid; /* ACPI _HID (required) */
diff --git a/src/drivers/i2c/tpm/cr50.c b/src/drivers/i2c/tpm/cr50.c
index 3505dcec1d..baf5fe0cce 100644
--- a/src/drivers/i2c/tpm/cr50.c
+++ b/src/drivers/i2c/tpm/cr50.c
@@ -36,7 +36,7 @@
#include <types.h>
#include <delay.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <endian.h>
#include <timer.h>
#include <tpm.h>
diff --git a/src/drivers/i2c/tpm/tis.c b/src/drivers/i2c/tpm/tis.c
index 7cdb2a23b5..20c2d7136a 100644
--- a/src/drivers/i2c/tpm/tis.c
+++ b/src/drivers/i2c/tpm/tis.c
@@ -19,7 +19,7 @@
#include <assert.h>
#include <commonlib/endian.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <endian.h>
#include <lib.h>
#include <tpm.h>
diff --git a/src/drivers/i2c/tpm/tis_atmel.c b/src/drivers/i2c/tpm/tis_atmel.c
index b6e13513f3..151209974a 100644
--- a/src/drivers/i2c/tpm/tis_atmel.c
+++ b/src/drivers/i2c/tpm/tis_atmel.c
@@ -20,7 +20,7 @@
#include <commonlib/endian.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <endian.h>
#include <lib.h>
#include <tpm.h>
diff --git a/src/drivers/i2c/tpm/tpm.c b/src/drivers/i2c/tpm/tpm.c
index 1b078f4c19..2ce04018b3 100644
--- a/src/drivers/i2c/tpm/tpm.c
+++ b/src/drivers/i2c/tpm/tpm.c
@@ -35,7 +35,7 @@
#include <types.h>
#include <delay.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <endian.h>
#include <timer.h>
#include <tpm.h>
diff --git a/src/drivers/i2c/ww_ring/ww_ring.c b/src/drivers/i2c/ww_ring/ww_ring.c
index 5fb593c727..61dfae7dcf 100644
--- a/src/drivers/i2c/ww_ring/ww_ring.c
+++ b/src/drivers/i2c/ww_ring/ww_ring.c
@@ -28,7 +28,7 @@
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <string.h>
#include "drivers/i2c/ww_ring/ww_ring_programs.h"
diff --git a/src/drivers/intel/mipi_camera/camera.c b/src/drivers/intel/mipi_camera/camera.c
index 7752f0aff3..00ffad903f 100644
--- a/src/drivers/intel/mipi_camera/camera.c
+++ b/src/drivers/intel/mipi_camera/camera.c
@@ -17,7 +17,7 @@
#include <arch/acpi_device.h>
#include <arch/acpigen.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <device/device.h>
#include <device/path.h>
#include <string.h>
diff --git a/src/drivers/maxim/max77686/max77686.c b/src/drivers/maxim/max77686/max77686.c
index d806484ded..f1ee32f4fe 100644
--- a/src/drivers/maxim/max77686/max77686.c
+++ b/src/drivers/maxim/max77686/max77686.c
@@ -15,7 +15,7 @@
#include <console/console.h>
#include <arch/io.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include "max77686.h"
diff --git a/src/drivers/parade/ps8625/ps8625.c b/src/drivers/parade/ps8625/ps8625.c
index 3943b8455d..3e90cbb3e4 100644
--- a/src/drivers/parade/ps8625/ps8625.c
+++ b/src/drivers/parade/ps8625/ps8625.c
@@ -13,7 +13,7 @@
* GNU General Public License for more details.
*/
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <stdint.h>
#include <stdlib.h>
diff --git a/src/drivers/parade/ps8640/ps8640.c b/src/drivers/parade/ps8640/ps8640.c
index 62bbf635b8..c8f414002a 100644
--- a/src/drivers/parade/ps8640/ps8640.c
+++ b/src/drivers/parade/ps8640/ps8640.c
@@ -14,7 +14,7 @@
*/
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <edid.h>
#include <console/console.h>
#include <timer.h>
diff --git a/src/drivers/ti/tps65090/tps65090.c b/src/drivers/ti/tps65090/tps65090.c
index 58bb3ce95d..6eae6fb1ae 100644
--- a/src/drivers/ti/tps65090/tps65090.c
+++ b/src/drivers/ti/tps65090/tps65090.c
@@ -36,7 +36,7 @@
#include <delay.h>
#include <types.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include "tps65090.h"
/* TPS65090 register addresses */
diff --git a/src/drivers/ti/tps65913/tps65913rtc.c b/src/drivers/ti/tps65913/tps65913rtc.c
index f6fed9822b..0c19b160bf 100644
--- a/src/drivers/ti/tps65913/tps65913rtc.c
+++ b/src/drivers/ti/tps65913/tps65913rtc.c
@@ -15,7 +15,7 @@
#include <bcd.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <rtc.h>
#include <stdint.h>
diff --git a/src/drivers/xpowers/axp209/axp209.c b/src/drivers/xpowers/axp209/axp209.c
index de11fbe1bd..da575ccffd 100644
--- a/src/drivers/xpowers/axp209/axp209.c
+++ b/src/drivers/xpowers/axp209/axp209.c
@@ -13,7 +13,7 @@
#include <console/console.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
/* Hide these definitions from the rest of the source, so keep them here */
enum registers {
diff --git a/src/ec/google/chromeec/ec_i2c.c b/src/ec/google/chromeec/ec_i2c.c
index 40bd0bb219..22b491ace3 100644
--- a/src/ec/google/chromeec/ec_i2c.c
+++ b/src/ec/google/chromeec/ec_i2c.c
@@ -16,7 +16,7 @@
#include <arch/io.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <stdint.h>
#include <string.h>
diff --git a/src/include/device/i2c.h b/src/include/device/i2c.h
index 9939bc60bf..d6ee15aa5a 100644
--- a/src/include/device/i2c.h
+++ b/src/include/device/i2c.h
@@ -17,7 +17,6 @@
#define _DEVICE_I2C_H_
#include <stdint.h>
-#include <stdlib.h>
/**
* struct i2c_msg - an I2C transaction segment beginning with START
@@ -67,162 +66,4 @@ enum i2c_address_mode {
I2C_MODE_10_BIT
};
-
-int platform_i2c_transfer(unsigned int bus, struct i2c_msg *segments,
- int count);
-
-#define SOFTWARE_I2C_MAX_BUS 10 /* increase as necessary */
-
-struct software_i2c_ops {
- void (*set_sda)(unsigned int bus, int high);
- void (*set_scl)(unsigned int bus, int high);
- int (*get_sda)(unsigned int bus);
- int (*get_scl)(unsigned int bus);
-};
-
-extern struct software_i2c_ops *software_i2c[];
-
-int software_i2c_transfer(unsigned int bus, struct i2c_msg *segments,
- int count);
-void software_i2c_wedge_ack(unsigned int bus, u8 slave);
-void software_i2c_wedge_read(unsigned int bus, u8 slave, u8 reg, int bit_count);
-void software_i2c_wedge_write(unsigned int bus, u8 slave, u8 reg,
- int bit_count);
-
-int i2c_read_field(unsigned int bus, uint8_t slave, uint8_t reg, uint8_t *data,
- uint8_t mask, uint8_t shift);
-int i2c_write_field(unsigned int bus, uint8_t slave, uint8_t reg, uint8_t data,
- uint8_t mask, uint8_t shift);
-
-/*
- * software_i2c is supposed to be a debug feature. It's usually not compiled in,
- * but when it is it can be dynamically enabled at runtime for certain busses.
- * Need this ugly stub to arbitrate since I2C device drivers hardcode
- * 'i2c_transfer()' as their entry point.
- */
-static inline int i2c_transfer(unsigned int bus, struct i2c_msg *segments,
- int count)
-{
- if (CONFIG_SOFTWARE_I2C)
- if (bus < SOFTWARE_I2C_MAX_BUS && software_i2c[bus])
- return software_i2c_transfer(bus, segments, count);
-
- return platform_i2c_transfer(bus, segments, count);
-}
-
-/*
- * Read a raw chunk of data in one segment and one frame.
- *
- * [start][slave addr][r][data][stop]
- */
-static inline int i2c_read_raw(unsigned int bus, uint8_t slave, uint8_t *data,
- int len)
-{
- struct i2c_msg seg = {
- .flags = I2C_M_RD, .slave = slave, .buf = data, .len = len
- };
-
- return i2c_transfer(bus, &seg, 1);
-}
-
-/*
- * Write a raw chunk of data in one segment and one frame.
- *
- * [start][slave addr][w][data][stop]
- */
-static inline int i2c_write_raw(unsigned int bus, uint8_t slave, uint8_t *data,
- int len)
-{
- struct i2c_msg seg = {
- .flags = 0, .slave = slave, .buf = data, .len = len
- };
-
- return i2c_transfer(bus, &seg, 1);
-}
-
-/**
- * Read multi-bytes with two segments in one frame
- *
- * [start][slave addr][w][register addr][start][slave addr][r][data...][stop]
- */
-static inline int i2c_read_bytes(unsigned int bus, uint8_t slave, uint8_t reg,
- uint8_t *data, int len)
-{
- struct i2c_msg seg[2];
-
- seg[0].flags = 0;
- seg[0].slave = slave;
- seg[0].buf = &reg;
- seg[0].len = 1;
- seg[1].flags = I2C_M_RD;
- seg[1].slave = slave;
- seg[1].buf = data;
- seg[1].len = len;
-
- return i2c_transfer(bus, seg, ARRAY_SIZE(seg));
-}
-
-/**
- * Read a byte with two segments in one frame
- *
- * [start][slave addr][w][register addr][start][slave addr][r][data][stop]
- */
-static inline int i2c_readb(unsigned int bus, uint8_t slave, uint8_t reg,
- uint8_t *data)
-{
- struct i2c_msg seg[2];
-
- seg[0].flags = 0;
- seg[0].slave = slave;
- seg[0].buf = &reg;
- seg[0].len = 1;
- seg[1].flags = I2C_M_RD;
- seg[1].slave = slave;
- seg[1].buf = data;
- seg[1].len = 1;
-
- return i2c_transfer(bus, seg, ARRAY_SIZE(seg));
-}
-
-/**
- * Write a byte with one segment in one frame.
- *
- * [start][slave addr][w][register addr][data][stop]
- */
-static inline int i2c_writeb(unsigned int bus, uint8_t slave, uint8_t reg,
- uint8_t data)
-{
- struct i2c_msg seg;
- uint8_t buf[] = {reg, data};
-
- seg.flags = 0;
- seg.slave = slave;
- seg.buf = buf;
- seg.len = ARRAY_SIZE(buf);
-
- return i2c_transfer(bus, &seg, 1);
-}
-
-/* I2C bus operation for ramstage drivers */
-struct device;
-struct i2c_bus_operations {
- /*
- * This is an SOC specific method that can be provided to translate the
- * 'struct device' for an I2C controller into a unique I2C bus number.
- * Returns -1 if the bus number for this device cannot be determined.
- */
- int (*dev_to_bus)(struct device *dev);
-};
-
-/* Return I2C bus number for provided device, -1 if not found */
-int i2c_dev_find_bus(struct device *dev);
-
-/* Variants of I2C helper functions that take a device instead of bus number */
-int i2c_dev_transfer(struct device *dev, struct i2c_msg *segments, int count);
-int i2c_dev_readb(struct device *dev, uint8_t reg, uint8_t *data);
-int i2c_dev_writeb(struct device *dev, uint8_t reg, uint8_t data);
-int i2c_dev_read_bytes(struct device *dev, uint8_t reg, uint8_t *data, int len);
-int i2c_dev_read_raw(struct device *dev, uint8_t *data, int len);
-int i2c_dev_write_raw(struct device *dev, uint8_t *data, int len);
-
#endif /* _DEVICE_I2C_H_ */
diff --git a/src/include/device/i2c_bus.h b/src/include/device/i2c_bus.h
new file mode 100644
index 0000000000..474d9e5b2c
--- /dev/null
+++ b/src/include/device/i2c_bus.h
@@ -0,0 +1,44 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2014 Google, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DEVICE_I2C_BUS_H_
+#define _DEVICE_I2C_BUS_H_
+
+#include <stdint.h>
+#include <device/i2c.h>
+#include <device/device.h>
+
+/* I2C bus operation for ramstage drivers */
+struct i2c_bus_operations {
+ /*
+ * This is an SOC specific method that can be provided to translate the
+ * 'struct device' for an I2C controller into a unique I2C bus number.
+ * Returns -1 if the bus number for this device cannot be determined.
+ */
+ int (*dev_to_bus)(struct device *dev);
+};
+
+/* Return I2C bus number for provided device, -1 if not found */
+int i2c_dev_find_bus(struct device *dev);
+
+/* Variants of I2C helper functions that take a device instead of bus number */
+int i2c_dev_transfer(struct device *dev, struct i2c_msg *segments, int count);
+int i2c_dev_readb(struct device *dev, uint8_t reg, uint8_t *data);
+int i2c_dev_writeb(struct device *dev, uint8_t reg, uint8_t data);
+int i2c_dev_read_bytes(struct device *dev, uint8_t reg, uint8_t *data, int len);
+int i2c_dev_read_raw(struct device *dev, uint8_t *data, int len);
+int i2c_dev_write_raw(struct device *dev, uint8_t *data, int len);
+
+#endif /* _DEVICE_I2C_BUS_H_ */
diff --git a/src/include/device/i2c_simple.h b/src/include/device/i2c_simple.h
new file mode 100644
index 0000000000..dcde601994
--- /dev/null
+++ b/src/include/device/i2c_simple.h
@@ -0,0 +1,157 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2014 Google, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _DEVICE_I2C_SIMPLE_H_
+#define _DEVICE_I2C_SIMPLE_H_
+
+#include <commonlib/helpers.h>
+#include <device/i2c.h>
+
+int platform_i2c_transfer(unsigned int bus, struct i2c_msg *segments,
+ int count);
+
+#define SOFTWARE_I2C_MAX_BUS 10 /* increase as necessary */
+
+struct software_i2c_ops {
+ void (*set_sda)(unsigned int bus, int high);
+ void (*set_scl)(unsigned int bus, int high);
+ int (*get_sda)(unsigned int bus);
+ int (*get_scl)(unsigned int bus);
+};
+
+extern struct software_i2c_ops *software_i2c[];
+
+int software_i2c_transfer(unsigned int bus, struct i2c_msg *segments,
+ int count);
+void software_i2c_wedge_ack(unsigned int bus, u8 slave);
+void software_i2c_wedge_read(unsigned int bus, u8 slave, u8 reg, int bit_count);
+void software_i2c_wedge_write(unsigned int bus, u8 slave, u8 reg,
+ int bit_count);
+
+int i2c_read_field(unsigned int bus, uint8_t slave, uint8_t reg, uint8_t *data,
+ uint8_t mask, uint8_t shift);
+int i2c_write_field(unsigned int bus, uint8_t slave, uint8_t reg, uint8_t data,
+ uint8_t mask, uint8_t shift);
+
+/*
+ * software_i2c is supposed to be a debug feature. It's usually not compiled in,
+ * but when it is it can be dynamically enabled at runtime for certain busses.
+ * Need this ugly stub to arbitrate since I2C device drivers hardcode
+ * 'i2c_transfer()' as their entry point.
+ */
+static inline int i2c_transfer(unsigned int bus, struct i2c_msg *segments,
+ int count)
+{
+ if (CONFIG_SOFTWARE_I2C)
+ if (bus < SOFTWARE_I2C_MAX_BUS && software_i2c[bus])
+ return software_i2c_transfer(bus, segments, count);
+
+ return platform_i2c_transfer(bus, segments, count);
+}
+
+/*
+ * Read a raw chunk of data in one segment and one frame.
+ *
+ * [start][slave addr][r][data][stop]
+ */
+static inline int i2c_read_raw(unsigned int bus, uint8_t slave, uint8_t *data,
+ int len)
+{
+ struct i2c_msg seg = {
+ .flags = I2C_M_RD, .slave = slave, .buf = data, .len = len
+ };
+
+ return i2c_transfer(bus, &seg, 1);
+}
+
+/*
+ * Write a raw chunk of data in one segment and one frame.
+ *
+ * [start][slave addr][w][data][stop]
+ */
+static inline int i2c_write_raw(unsigned int bus, uint8_t slave, uint8_t *data,
+ int len)
+{
+ struct i2c_msg seg = {
+ .flags = 0, .slave = slave, .buf = data, .len = len
+ };
+
+ return i2c_transfer(bus, &seg, 1);
+}
+
+/**
+ * Read multi-bytes with two segments in one frame
+ *
+ * [start][slave addr][w][register addr][start][slave addr][r][data...][stop]
+ */
+static inline int i2c_read_bytes(unsigned int bus, uint8_t slave, uint8_t reg,
+ uint8_t *data, int len)
+{
+ struct i2c_msg seg[2];
+
+ seg[0].flags = 0;
+ seg[0].slave = slave;
+ seg[0].buf = &reg;
+ seg[0].len = 1;
+ seg[1].flags = I2C_M_RD;
+ seg[1].slave = slave;
+ seg[1].buf = data;
+ seg[1].len = len;
+
+ return i2c_transfer(bus, seg, ARRAY_SIZE(seg));
+}
+
+/**
+ * Read a byte with two segments in one frame
+ *
+ * [start][slave addr][w][register addr][start][slave addr][r][data][stop]
+ */
+static inline int i2c_readb(unsigned int bus, uint8_t slave, uint8_t reg,
+ uint8_t *data)
+{
+ struct i2c_msg seg[2];
+
+ seg[0].flags = 0;
+ seg[0].slave = slave;
+ seg[0].buf = &reg;
+ seg[0].len = 1;
+ seg[1].flags = I2C_M_RD;
+ seg[1].slave = slave;
+ seg[1].buf = data;
+ seg[1].len = 1;
+
+ return i2c_transfer(bus, seg, ARRAY_SIZE(seg));
+}
+
+/**
+ * Write a byte with one segment in one frame.
+ *
+ * [start][slave addr][w][register addr][data][stop]
+ */
+static inline int i2c_writeb(unsigned int bus, uint8_t slave, uint8_t reg,
+ uint8_t data)
+{
+ struct i2c_msg seg;
+ uint8_t buf[] = {reg, data};
+
+ seg.flags = 0;
+ seg.slave = slave;
+ seg.buf = buf;
+ seg.len = ARRAY_SIZE(buf);
+
+ return i2c_transfer(bus, &seg, 1);
+}
+
+#endif /* _DEVICE_I2C_SIMPLE_H_ */
diff --git a/src/mainboard/google/daisy/mainboard.c b/src/mainboard/google/daisy/mainboard.c
index e67bdcfe09..336a9e5f4a 100644
--- a/src/mainboard/google/daisy/mainboard.c
+++ b/src/mainboard/google/daisy/mainboard.c
@@ -19,7 +19,7 @@
#include <cbmem.h>
#include <delay.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <drivers/ti/tps65090/tps65090.h>
#include <edid.h>
#include <soc/clk.h>
diff --git a/src/mainboard/google/daisy/romstage.c b/src/mainboard/google/daisy/romstage.c
index 3c6ff5ebef..33efdf7cba 100644
--- a/src/mainboard/google/daisy/romstage.c
+++ b/src/mainboard/google/daisy/romstage.c
@@ -21,7 +21,7 @@
#include <cbmem.h>
#include <console/console.h>
#include <program_loading.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <drivers/maxim/max77686/max77686.h>
#include <soc/clk.h>
#include <soc/cpu.h>
diff --git a/src/mainboard/google/foster/bootblock.c b/src/mainboard/google/foster/bootblock.c
index a4449f54ed..e986ee3c1c 100644
--- a/src/mainboard/google/foster/bootblock.c
+++ b/src/mainboard/google/foster/bootblock.c
@@ -17,7 +17,7 @@
#include <arch/io.h>
#include <bootblock_common.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <soc/addressmap.h>
#include <soc/clk_rst.h>
#include <soc/clock.h>
diff --git a/src/mainboard/google/foster/pmic.c b/src/mainboard/google/foster/pmic.c
index 2eeccb2241..b73983b614 100644
--- a/src/mainboard/google/foster/pmic.c
+++ b/src/mainboard/google/foster/pmic.c
@@ -17,7 +17,7 @@
#include <boardid.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <stdint.h>
#include <stdlib.h>
diff --git a/src/mainboard/google/gru/mainboard.c b/src/mainboard/google/gru/mainboard.c
index 240a5493e8..77c185cb3d 100644
--- a/src/mainboard/google/gru/mainboard.c
+++ b/src/mainboard/google/gru/mainboard.c
@@ -19,7 +19,7 @@
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <ec/google/chromeec/ec.h>
#include <gpio.h>
#include <soc/bl31_plat_params.h>
diff --git a/src/mainboard/google/nyan/bootblock.c b/src/mainboard/google/nyan/bootblock.c
index 98c6fb963e..92c0e1a443 100644
--- a/src/mainboard/google/nyan/bootblock.c
+++ b/src/mainboard/google/nyan/bootblock.c
@@ -16,7 +16,7 @@
#include <arch/io.h>
#include <bootblock_common.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <gpio.h>
#include <soc/addressmap.h>
#include <soc/clk_rst.h>
diff --git a/src/mainboard/google/nyan/pmic.c b/src/mainboard/google/nyan/pmic.c
index 5c56cbe36b..f115586b0f 100644
--- a/src/mainboard/google/nyan/pmic.c
+++ b/src/mainboard/google/nyan/pmic.c
@@ -17,7 +17,7 @@
#include <boardid.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <stdint.h>
#include <stdlib.h>
#include <reset.h>
diff --git a/src/mainboard/google/nyan_big/bootblock.c b/src/mainboard/google/nyan_big/bootblock.c
index c10af7173a..dcc18146ea 100644
--- a/src/mainboard/google/nyan_big/bootblock.c
+++ b/src/mainboard/google/nyan_big/bootblock.c
@@ -16,7 +16,7 @@
#include <arch/io.h>
#include <bootblock_common.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <gpio.h>
#include <soc/addressmap.h>
#include <soc/clk_rst.h>
diff --git a/src/mainboard/google/nyan_big/pmic.c b/src/mainboard/google/nyan_big/pmic.c
index 2436febc87..77b6545341 100644
--- a/src/mainboard/google/nyan_big/pmic.c
+++ b/src/mainboard/google/nyan_big/pmic.c
@@ -17,7 +17,7 @@
#include <boardid.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <stdint.h>
#include <stdlib.h>
#include <reset.h>
diff --git a/src/mainboard/google/nyan_blaze/bootblock.c b/src/mainboard/google/nyan_blaze/bootblock.c
index c10af7173a..dcc18146ea 100644
--- a/src/mainboard/google/nyan_blaze/bootblock.c
+++ b/src/mainboard/google/nyan_blaze/bootblock.c
@@ -16,7 +16,7 @@
#include <arch/io.h>
#include <bootblock_common.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <gpio.h>
#include <soc/addressmap.h>
#include <soc/clk_rst.h>
diff --git a/src/mainboard/google/nyan_blaze/pmic.c b/src/mainboard/google/nyan_blaze/pmic.c
index 2436febc87..77b6545341 100644
--- a/src/mainboard/google/nyan_blaze/pmic.c
+++ b/src/mainboard/google/nyan_blaze/pmic.c
@@ -17,7 +17,7 @@
#include <boardid.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <stdint.h>
#include <stdlib.h>
#include <reset.h>
diff --git a/src/mainboard/google/peach_pit/mainboard.c b/src/mainboard/google/peach_pit/mainboard.c
index 4cc72f1ceb..14d3e2f51e 100644
--- a/src/mainboard/google/peach_pit/mainboard.c
+++ b/src/mainboard/google/peach_pit/mainboard.c
@@ -19,7 +19,7 @@
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <drivers/parade/ps8625/ps8625.h>
#include <ec/google/chromeec/ec.h>
#include <edid.h>
diff --git a/src/mainboard/google/peach_pit/romstage.c b/src/mainboard/google/peach_pit/romstage.c
index 2bcf83672e..1268df2689 100644
--- a/src/mainboard/google/peach_pit/romstage.c
+++ b/src/mainboard/google/peach_pit/romstage.c
@@ -22,7 +22,7 @@
#include <cbmem.h>
#include <commonlib/region.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <drivers/maxim/max77802/max77802.h>
#include <program_loading.h>
#include <soc/clk.h>
diff --git a/src/mainboard/google/smaug/bootblock.c b/src/mainboard/google/smaug/bootblock.c
index 783705dffe..fd5d293b6c 100644
--- a/src/mainboard/google/smaug/bootblock.c
+++ b/src/mainboard/google/smaug/bootblock.c
@@ -16,7 +16,7 @@
#include <arch/io.h>
#include <bootblock_common.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <soc/addressmap.h>
#include <soc/clk_rst.h>
#include <soc/clock.h>
diff --git a/src/mainboard/google/smaug/mainboard.c b/src/mainboard/google/smaug/mainboard.c
index 8c445d8365..c783ca4727 100644
--- a/src/mainboard/google/smaug/mainboard.c
+++ b/src/mainboard/google/smaug/mainboard.c
@@ -20,7 +20,7 @@
#include <boot/coreboot_tables.h>
#include <delay.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <soc/addressmap.h>
#include <soc/clk_rst.h>
#include <soc/clock.h>
diff --git a/src/mainboard/google/smaug/pmic.c b/src/mainboard/google/smaug/pmic.c
index 25e870a123..77de277afa 100644
--- a/src/mainboard/google/smaug/pmic.c
+++ b/src/mainboard/google/smaug/pmic.c
@@ -17,7 +17,7 @@
#include <boardid.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <stdint.h>
#include <stdlib.h>
diff --git a/src/mainboard/google/smaug/romstage.c b/src/mainboard/google/smaug/romstage.c
index 213fad7437..fd7c07f84d 100644
--- a/src/mainboard/google/smaug/romstage.c
+++ b/src/mainboard/google/smaug/romstage.c
@@ -15,7 +15,7 @@
#include <delay.h>
#include <soc/addressmap.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <soc/clock.h>
#include <soc/funitcfg.h>
#include <soc/nvidia/tegra/i2c.h>
diff --git a/src/mainboard/google/veyron/mainboard.c b/src/mainboard/google/veyron/mainboard.c
index a6bbf881e3..15e2a574e8 100644
--- a/src/mainboard/google/veyron/mainboard.c
+++ b/src/mainboard/google/veyron/mainboard.c
@@ -19,7 +19,7 @@
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <edid.h>
#include <elog.h>
#include <gpio.h>
diff --git a/src/mainboard/google/veyron_mickey/mainboard.c b/src/mainboard/google/veyron_mickey/mainboard.c
index ef085b2f07..26fcbb9467 100644
--- a/src/mainboard/google/veyron_mickey/mainboard.c
+++ b/src/mainboard/google/veyron_mickey/mainboard.c
@@ -19,7 +19,7 @@
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <edid.h>
#include <elog.h>
#include <gpio.h>
diff --git a/src/mainboard/google/veyron_rialto/mainboard.c b/src/mainboard/google/veyron_rialto/mainboard.c
index b9b6a2225a..91bf46a526 100644
--- a/src/mainboard/google/veyron_rialto/mainboard.c
+++ b/src/mainboard/google/veyron_rialto/mainboard.c
@@ -19,7 +19,7 @@
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <edid.h>
#include <elog.h>
#include <gpio.h>
diff --git a/src/mainboard/intel/galileo/reg_access.c b/src/mainboard/intel/galileo/reg_access.c
index c595dffba7..cff69aba4a 100644
--- a/src/mainboard/intel/galileo/reg_access.c
+++ b/src/mainboard/intel/galileo/reg_access.c
@@ -18,7 +18,7 @@
#include <assert.h>
#include <arch/io.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <soc/pci_devs.h>
#include <soc/reg_access.h>
#include "reg_access.h"
diff --git a/src/mainboard/intel/galileo/vboot.c b/src/mainboard/intel/galileo/vboot.c
index 90d8f0a93e..ffea7698b0 100644
--- a/src/mainboard/intel/galileo/vboot.c
+++ b/src/mainboard/intel/galileo/vboot.c
@@ -16,7 +16,7 @@
#include <bootmode.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <lib.h>
#include <soc/i2c.h>
#include <soc/reg_access.h>
diff --git a/src/mainboard/intel/kblrvp/ramstage.c b/src/mainboard/intel/kblrvp/ramstage.c
index d733341f4a..1e6aa1141b 100644
--- a/src/mainboard/intel/kblrvp/ramstage.c
+++ b/src/mainboard/intel/kblrvp/ramstage.c
@@ -15,7 +15,7 @@
#include <bootstate.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <soc/ramstage.h>
#include <variant/gpio.h>
diff --git a/src/mainboard/siemens/mc_apl1/ptn3460.c b/src/mainboard/siemens/mc_apl1/ptn3460.c
index 7fc5507356..1877e8b9fa 100644
--- a/src/mainboard/siemens/mc_apl1/ptn3460.c
+++ b/src/mainboard/siemens/mc_apl1/ptn3460.c
@@ -16,7 +16,7 @@
#include <console/console.h>
#include <lib.h>
#include <hwilib.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include "ptn3460.h"
/**
diff --git a/src/soc/broadcom/cygnus/i2c.c b/src/soc/broadcom/cygnus/i2c.c
index bc43a8886f..ac431e734a 100644
--- a/src/soc/broadcom/cygnus/i2c.c
+++ b/src/soc/broadcom/cygnus/i2c.c
@@ -17,7 +17,7 @@
#include <assert.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <soc/i2c.h>
struct cygnus_i2c_regs {
diff --git a/src/soc/intel/apollolake/chip.h b/src/soc/intel/apollolake/chip.h
index 7b36089b3c..33e2dade88 100644
--- a/src/soc/intel/apollolake/chip.h
+++ b/src/soc/intel/apollolake/chip.h
@@ -22,7 +22,7 @@
#include <soc/gpio.h>
#include <intelblocks/lpc_lib.h>
#include <intelblocks/lpss_i2c.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <soc/pm.h>
#include <soc/usb.h>
diff --git a/src/soc/intel/common/block/i2c/i2c.c b/src/soc/intel/common/block/i2c/i2c.c
index f4b1e8c5ff..aeb6d8f2ed 100644
--- a/src/soc/intel/common/block/i2c/i2c.c
+++ b/src/soc/intel/common/block/i2c/i2c.c
@@ -14,7 +14,7 @@
*/
#include <arch/acpigen.h>
-#include <device/i2c.h>
+#include <device/i2c_bus.h>
#include <device/pci.h>
#include <device/pci_def.h>
#include <device/pci_ids.h>
diff --git a/src/soc/intel/common/block/i2c/i2c_early.c b/src/soc/intel/common/block/i2c/i2c_early.c
index 7c9ce60513..74fc994ca3 100644
--- a/src/soc/intel/common/block/i2c/i2c_early.c
+++ b/src/soc/intel/common/block/i2c/i2c_early.c
@@ -17,7 +17,7 @@
#include <arch/io.h>
#include <console/console.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <device/pci.h>
#include <device/pci_def.h>
#include <intelblocks/lpss.h>
diff --git a/src/soc/intel/common/block/i2c/lpss_i2c.c b/src/soc/intel/common/block/i2c/lpss_i2c.c
index 711517f6d3..868a6ad300 100644
--- a/src/soc/intel/common/block/i2c/lpss_i2c.c
+++ b/src/soc/intel/common/block/i2c/lpss_i2c.c
@@ -18,7 +18,7 @@
#include <arch/io.h>
#include <console/console.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <device/pci.h>
#include <device/pci_def.h>
#include <device/pci_ids.h>
diff --git a/src/soc/intel/common/block/include/intelblocks/lpss_i2c.h b/src/soc/intel/common/block/include/intelblocks/lpss_i2c.h
index 2f60d654b1..033081f4b9 100644
--- a/src/soc/intel/common/block/include/intelblocks/lpss_i2c.h
+++ b/src/soc/intel/common/block/include/intelblocks/lpss_i2c.h
@@ -16,6 +16,7 @@
#ifndef SOC_INTEL_COMMON_BLOCK_LPSS_I2C_H
#define SOC_INTEL_COMMON_BLOCK_LPSS_I2C_H
+#include <device/device.h>
#include <device/i2c.h>
#include <stdint.h>
diff --git a/src/soc/intel/quark/gpio_i2c.c b/src/soc/intel/quark/gpio_i2c.c
index 5580894ee1..d5543b803c 100644
--- a/src/soc/intel/quark/gpio_i2c.c
+++ b/src/soc/intel/quark/gpio_i2c.c
@@ -16,7 +16,7 @@
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <soc/i2c.h>
diff --git a/src/soc/intel/quark/i2c.c b/src/soc/intel/quark/i2c.c
index e8dba5376f..2a194af768 100644
--- a/src/soc/intel/quark/i2c.c
+++ b/src/soc/intel/quark/i2c.c
@@ -17,7 +17,7 @@
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <soc/i2c.h>
diff --git a/src/soc/intel/skylake/chip.h b/src/soc/intel/skylake/chip.h
index efd3566f76..ea985db11a 100644
--- a/src/soc/intel/skylake/chip.h
+++ b/src/soc/intel/skylake/chip.h
@@ -20,7 +20,7 @@
#define _SOC_CHIP_H_
#include <arch/acpi_device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <intelblocks/gspi.h>
#include <intelblocks/lpss_i2c.h>
#include <stdint.h>
diff --git a/src/soc/mediatek/mt8173/da9212.c b/src/soc/mediatek/mt8173/da9212.c
index 8161667fa9..cc20979f50 100644
--- a/src/soc/mediatek/mt8173/da9212.c
+++ b/src/soc/mediatek/mt8173/da9212.c
@@ -14,7 +14,7 @@
*/
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <soc/da9212.h>
enum {
diff --git a/src/soc/mediatek/mt8173/i2c.c b/src/soc/mediatek/mt8173/i2c.c
index 1d541e5d0f..9ca6803011 100644
--- a/src/soc/mediatek/mt8173/i2c.c
+++ b/src/soc/mediatek/mt8173/i2c.c
@@ -15,7 +15,7 @@
#include <assert.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <string.h>
#include <symbols.h>
#include <timer.h>
diff --git a/src/soc/mediatek/mt8173/mt6311.c b/src/soc/mediatek/mt8173/mt6311.c
index 8390dfd4d0..8f0b274cfa 100644
--- a/src/soc/mediatek/mt8173/mt6311.c
+++ b/src/soc/mediatek/mt8173/mt6311.c
@@ -14,7 +14,7 @@
*/
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <soc/mt6311.h>
enum {
diff --git a/src/soc/nvidia/tegra/i2c.c b/src/soc/nvidia/tegra/i2c.c
index e371a9d30f..7d3e0bff90 100644
--- a/src/soc/nvidia/tegra/i2c.c
+++ b/src/soc/nvidia/tegra/i2c.c
@@ -16,7 +16,7 @@
#include <arch/io.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <stdlib.h>
#include <string.h>
#include <soc/addressmap.h>
diff --git a/src/soc/nvidia/tegra/software_i2c.c b/src/soc/nvidia/tegra/software_i2c.c
index fe2f61edbf..50aac8c45a 100644
--- a/src/soc/nvidia/tegra/software_i2c.c
+++ b/src/soc/nvidia/tegra/software_i2c.c
@@ -13,7 +13,7 @@
* GNU General Public License for more details.
*/
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <gpio.h>
#include <soc/pinmux.h>
diff --git a/src/soc/nvidia/tegra124/dp.c b/src/soc/nvidia/tegra124/dp.c
index 0132369073..d646e8ebdc 100644
--- a/src/soc/nvidia/tegra124/dp.c
+++ b/src/soc/nvidia/tegra124/dp.c
@@ -19,7 +19,7 @@
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <edid.h>
#include <soc/addressmap.h>
#include <soc/nvidia/tegra/i2c.h>
diff --git a/src/soc/nvidia/tegra210/dp.c b/src/soc/nvidia/tegra210/dp.c
index 350eb8254d..119b4a74c8 100644
--- a/src/soc/nvidia/tegra210/dp.c
+++ b/src/soc/nvidia/tegra210/dp.c
@@ -17,7 +17,7 @@
#include <arch/io.h>
#include <console/console.h>
#include <device/device.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <edid.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/soc/qualcomm/ipq40xx/i2c.c b/src/soc/qualcomm/ipq40xx/i2c.c
index 0cffaacbb2..133f56435f 100644
--- a/src/soc/qualcomm/ipq40xx/i2c.c
+++ b/src/soc/qualcomm/ipq40xx/i2c.c
@@ -33,7 +33,7 @@
#include <assert.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <stdlib.h>
#include <string.h>
#include <soc/blsp.h>
diff --git a/src/soc/qualcomm/ipq806x/i2c.c b/src/soc/qualcomm/ipq806x/i2c.c
index 009cb94c1f..9660ec84d6 100644
--- a/src/soc/qualcomm/ipq806x/i2c.c
+++ b/src/soc/qualcomm/ipq806x/i2c.c
@@ -31,7 +31,7 @@
#include <assert.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <stdlib.h>
#include <string.h>
#include <soc/gsbi.h>
diff --git a/src/soc/rockchip/common/i2c.c b/src/soc/rockchip/common/i2c.c
index 5847f1658f..09b56246fd 100644
--- a/src/soc/rockchip/common/i2c.c
+++ b/src/soc/rockchip/common/i2c.c
@@ -18,7 +18,7 @@
#include <cbfs.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <soc/addressmap.h>
#include <soc/grf.h>
#include <soc/soc.h>
diff --git a/src/soc/rockchip/common/rk808.c b/src/soc/rockchip/common/rk808.c
index a68b838f48..9b4708cfab 100644
--- a/src/soc/rockchip/common/rk808.c
+++ b/src/soc/rockchip/common/rk808.c
@@ -17,7 +17,7 @@
#include <bcd.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <rtc.h>
#include <soc/rk808.h>
#include <stdint.h>
diff --git a/src/soc/rockchip/rk3288/software_i2c.c b/src/soc/rockchip/rk3288/software_i2c.c
index 886e2d1e91..dbe058eea6 100644
--- a/src/soc/rockchip/rk3288/software_i2c.c
+++ b/src/soc/rockchip/rk3288/software_i2c.c
@@ -15,7 +15,7 @@
#include <arch/io.h>
#include <console/console.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <gpio.h>
#include <soc/grf.h>
#include <soc/i2c.h>
diff --git a/src/soc/samsung/exynos5250/i2c.c b/src/soc/samsung/exynos5250/i2c.c
index 6319a10b34..19ef667896 100644
--- a/src/soc/samsung/exynos5250/i2c.c
+++ b/src/soc/samsung/exynos5250/i2c.c
@@ -19,7 +19,7 @@
#include <assert.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <soc/clk.h>
#include <soc/i2c.h>
#include <soc/periph.h>
diff --git a/src/soc/samsung/exynos5420/i2c.c b/src/soc/samsung/exynos5420/i2c.c
index ae9560ffdd..dd5ffd20d0 100644
--- a/src/soc/samsung/exynos5420/i2c.c
+++ b/src/soc/samsung/exynos5420/i2c.c
@@ -19,7 +19,7 @@
#include <assert.h>
#include <console/console.h>
#include <delay.h>
-#include <device/i2c.h>
+#include <device/i2c_simple.h>
#include <soc/clk.h>
#include <soc/i2c.h>
#include <soc/periph.h>