summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorYidi Lin <yidi.lin@mediatek.com>2016-03-15 14:38:44 +0800
committerMartin Roth <martinroth@google.com>2016-03-21 23:10:55 +0100
commitd33ebd13741b7473e93a1a6780edbb1e2dca8258 (patch)
tree66fd6e199ad63397f4d2c3fbb16debb088231c91 /src/include
parentf7d4f73053f0c26bfe411a9f3ef86f98389538b5 (diff)
downloadcoreboot-d33ebd13741b7473e93a1a6780edbb1e2dca8258.tar.gz
coreboot-d33ebd13741b7473e93a1a6780edbb1e2dca8258.tar.bz2
coreboot-d33ebd13741b7473e93a1a6780edbb1e2dca8258.zip
device: Add i2c read/write register field API
i2c_read_field() - read the value from the specific register field i2c_write_field() - write the value to the specific register field BRANCH=none BUG=none TEST=none Change-Id: I2098715b4583c1936c93b3ff45ec330910964304 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 0817fc76d07491b39c066f1393a6435f0831b50c Original-Change-Id: I92c187a89d10cfcecf3dfd9291e0bc015459c393 Original-Signed-off-by: Yidi Lin <yidi.lin@mediatek.com> Original-Reviewed-on: https://chromium-review.googlesource.com/332712 Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/14105 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/device/i2c.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/include/device/i2c.h b/src/include/device/i2c.h
index 8e59ba7c2102..b152bb98c26f 100644
--- a/src/include/device/i2c.h
+++ b/src/include/device/i2c.h
@@ -45,6 +45,11 @@ void software_i2c_wedge_ack(unsigned bus, u8 chip);
void software_i2c_wedge_read(unsigned bus, u8 chip, u8 reg, int bit_count);
void software_i2c_wedge_write(unsigned bus, u8 chip, u8 reg, int bit_count);
+int i2c_read_field(unsigned bus, uint8_t chip, uint8_t reg, uint8_t *data,
+ uint8_t mask, uint8_t shift);
+int i2c_write_field(unsigned bus, uint8_t chip, 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.