summaryrefslogtreecommitdiff
path: root/include/i2c.h
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-10-29 10:47:21 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-30 14:33:29 -0700
commit813e56e10af48dc010dc629cb6d0c37efcb995dd (patch)
tree0fc55e5773da06559f385a84bee488245f013d68 /include/i2c.h
parente4d78afafbf5170d1ceb60f1b0043a70c3449970 (diff)
downloadchrome-ec-813e56e10af48dc010dc629cb6d0c37efcb995dd.tar.gz
stm32f0: i2c: Set timing register values by port clock source
I2C1 may be clocked by HSI or SCLK. I2C2 is always clocked by PCLK. Therefore, apply different timing register values according to the selected clock source for a port. BUG=chrome-os-partner:46188 BRANCH=None TEST=Manual on glados_pd. Verify slave i2c communication is functional. Change-Id: Icd2306d25d5863b0fc3379e46885a227efb23cca Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/309781 Commit-Ready: Gwendal Grignou <gwendal@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Diffstat (limited to 'include/i2c.h')
-rw-r--r--include/i2c.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/i2c.h b/include/i2c.h
index 674dd84e80..fdda5a0187 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -13,6 +13,17 @@
/* Flags for slave address field, in addition to the 8-bit address */
#define I2C_FLAG_BIG_ENDIAN 0x100 /* 16 byte values are MSB-first */
+/*
+ * Supported I2C CLK frequencies.
+ * TODO(crbug.com/549286): Use this enum in i2c_port_t.
+ */
+enum i2c_freq {
+ I2C_FREQ_1000KHZ = 0,
+ I2C_FREQ_400KHZ = 1,
+ I2C_FREQ_100KHZ = 2,
+ I2C_FREQ_COUNT,
+};
+
/* Data structure to define I2C port configuration. */
struct i2c_port_t {
const char *name; /* Port name */