summaryrefslogtreecommitdiff
path: root/include/gpio.h
diff options
context:
space:
mode:
authorli feng <li1.feng@intel.com>2015-07-21 23:48:15 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-07-25 14:49:31 +0000
commit1c7baaf71f842874e80d7260ac725c2296239271 (patch)
tree0aec6090ee0e6f10a1d3082c2dfec25d660fd88a /include/gpio.h
parent15135076e20dc5168a7e61ffe90967cf162e5767 (diff)
downloadchrome-ec-1c7baaf71f842874e80d7260ac725c2296239271.tar.gz
I2C: i2c_raw_mode() should only touch I2C port specified
After I2C unwedge, *all* I2C ports will be re-initialized in i2c_raw_mode() by gpio_config_module(MODULE_I2C, 1); This means *all* I2C pins will be programmed as GPIO then enable I2C alternate function. If I2C Unwedge happened while there is an active I2C transacation on another port, the active I2C transaction will be corrupted, since the pins will be temporary programmed as GPIO Output High. BUG=chrome-os-partner:40519 TEST=Warm-reboot test on Cyan EVT and no discharging while AC is on. BRANCH=none Change-Id: I3be1d5c60bf4ab385bc077202406ec7abd8b2add Signed-off-by: li feng <li1.feng@intel.com> Reviewed-on: https://chromium-review.googlesource.com/287493 Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Denny Iriawan <denny.iriawan@intel.com>
Diffstat (limited to 'include/gpio.h')
-rw-r--r--include/gpio.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/gpio.h b/include/gpio.h
index 1374e85981..5ffb1bd0ab 100644
--- a/include/gpio.h
+++ b/include/gpio.h
@@ -122,6 +122,18 @@ void gpio_pre_init(void);
void gpio_config_module(enum module_id id, int enable);
/**
+ * Enable/disable alternate function for pins
+ *
+ * @param id module ID of pins
+ * @param port Port of pins
+ * @param pin_mask Bit mask of pins
+ * @param enable Enable alternate functions if 1; high-Z pins if 0
+ * @return EC_SUCCESS, or non-zero if pins are not found.
+ * */
+int gpio_config_pins(enum module_id id,
+ uint32_t port, uint32_t pin_mask, int enable);
+
+/**
* Get the current value of a signal.
*
* @param signal Signal to get