diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2015-05-22 16:59:06 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-26 22:39:52 +0000 |
commit | 2259e8ffb7645e0decfadd95fb4d1cdda8208095 (patch) | |
tree | 4f0d32e89c7cc4adbd23fdc2f93762e094fc5fff /chip/npcx | |
parent | 51113874f0f903a6b9c5ae2de643093dad68a184 (diff) | |
download | chrome-ec-2259e8ffb7645e0decfadd95fb4d1cdda8208095.tar.gz |
i2c: Move i2c_read_string to common code
Since stm32 and mec1322 now support open-ended i2c_xfer, we can move the
lm4 i2c_read_string implementation to common code and delete all
chip-specific versions.
BUG=chrome-os-partner:39613
TEST=Run "battery" from EC console on Cyan and Oak, verify that battery
info + strings are correctly printed.
BRANCH=None
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I06369df64bb2eb747d163664b4c96eeacb4b1faa
Reviewed-on: https://chromium-review.googlesource.com/272938
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'chip/npcx')
-rw-r--r-- | chip/npcx/i2c.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/chip/npcx/i2c.c b/chip/npcx/i2c.c index 33f512cc22..a8002d7573 100644 --- a/chip/npcx/i2c.c +++ b/chip/npcx/i2c.c @@ -481,41 +481,6 @@ int i2c_raw_get_sda(int port) return 1; } -int i2c_read_string(int port, int slave_addr, int offset, uint8_t *data, - int len) -{ - int rv; - uint8_t reg, block_length; - - /* Check block protocol size */ - if ((len <= 0) || (len > 32)) - return EC_ERROR_INVAL; - - i2c_lock(port, 1); - reg = offset; - - /* - * Send device reg space offset, and read back block length. Keep this - * session open without a stop. - */ - rv = i2c_xfer(port, slave_addr, ®, 1, &block_length, 1, - I2C_XFER_START); - if (rv) - goto exit; - - if (len && block_length > (len - 1)) - block_length = len - 1; - - rv = i2c_xfer(port, slave_addr, 0, 0, data, block_length, - I2C_XFER_STOP); - data[block_length] = 0; - -exit: - i2c_lock(port, 0); - - return rv; -} - /*****************************************************************************/ /* Hooks */ static void i2c_freq_changed(void) |