summaryrefslogtreecommitdiff
path: root/chip/lm4/i2c.c
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-05-22 16:59:06 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-26 22:39:52 +0000
commit2259e8ffb7645e0decfadd95fb4d1cdda8208095 (patch)
tree4f0d32e89c7cc4adbd23fdc2f93762e094fc5fff /chip/lm4/i2c.c
parent51113874f0f903a6b9c5ae2de643093dad68a184 (diff)
downloadchrome-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/lm4/i2c.c')
-rw-r--r--chip/lm4/i2c.c30
1 files changed, 0 insertions, 30 deletions
diff --git a/chip/lm4/i2c.c b/chip/lm4/i2c.c
index 56b4666330..5f3b9bfc74 100644
--- a/chip/lm4/i2c.c
+++ b/chip/lm4/i2c.c
@@ -305,36 +305,6 @@ int i2c_get_line_levels(int port)
return LM4_I2C_MBMON(port) & 0x03;
}
-int i2c_read_string(int port, int slave_addr, int offset, uint8_t *data,
- int len)
-{
- int rv;
- uint8_t reg, block_length;
-
- 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, &reg, 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;
-}
-
void i2c_set_timeout(int port, uint32_t timeout)
{
pdata[port].timeout_us = timeout ? timeout : I2C_TIMEOUT_DEFAULT_US;