From 2259e8ffb7645e0decfadd95fb4d1cdda8208095 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Fri, 22 May 2015 16:59:06 -0700 Subject: 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 Change-Id: I06369df64bb2eb747d163664b4c96eeacb4b1faa Reviewed-on: https://chromium-review.googlesource.com/272938 Reviewed-by: Alec Berg Reviewed-by: Randall Spangler --- chip/lm4/i2c.c | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'chip/lm4/i2c.c') 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, ®, 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; -- cgit v1.2.1