summaryrefslogtreecommitdiff
path: root/include/i2c_bitbang.h
diff options
context:
space:
mode:
authorJun Lin <CHLin56@nuvoton.com>2021-09-15 18:10:31 +0800
committerCommit Bot <commit-bot@chromium.org>2021-10-05 21:11:46 +0000
commit6c04fcf77da3166983496eadf987d45400fdfef4 (patch)
treea80c2b079d63537aa40e87c1caa6bca0a4f7563a /include/i2c_bitbang.h
parent0241b0f8f9c59cf7dfc43d3cbbb3572b021144e3 (diff)
downloadchrome-ec-6c04fcf77da3166983496eadf987d45400fdfef4.tar.gz
i2c: Use bitbang mode for pre-task i2c transactions
In Intel ADL+_RVP, the keyboard is scanned by a discrete I/O expander IC and it is connected to EC via the I2C interface. EC needs to initialize the IC via I2C transaction before the task scheduling starts. It may cause the system panic if the EC's I2C driver is implemented by task-event-based. With this CL, if any of the I2C ports that need pre-task I2C transaction are defined as bitbang ports along with regular I2C ports will switch to the bitbang (GPIO) mode before the task starts and will again switch back to event based I2C upon task initialization. BRANCH=none BUG=b:199374643 TEST=issue an I2C transaction before the task scheduling starts; make sure the transaction success without panic on npcx9_evb. TEST=pass "make buildall" Signed-off-by: Jun Lin <CHLin56@nuvoton.com> Change-Id: I65460d2b612328f25bce60561bbb82995dd1cfdf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3161869 Tested-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'include/i2c_bitbang.h')
-rw-r--r--include/i2c_bitbang.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/i2c_bitbang.h b/include/i2c_bitbang.h
index f3c07baf76..d550f1a582 100644
--- a/include/i2c_bitbang.h
+++ b/include/i2c_bitbang.h
@@ -12,6 +12,14 @@ extern const struct i2c_drv bitbang_drv;
extern const struct i2c_port_t i2c_bitbang_ports[];
extern const unsigned int i2c_bitbang_ports_used;
+/**
+ * Enable I2C raw mode for the ports which need pre-task
+ * I2C transactions in bitbang mode.
+ *
+ * @param enable Enable/disable the I2C raw mode
+ */
+void enable_i2c_raw_mode(bool enable);
+
/* expose static functions for testing */
#ifdef TEST_BUILD
int bitbang_start_cond(const struct i2c_port_t *i2c_port);