summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-04-26 14:36:38 -0700
committerChromeBot <chrome-bot@google.com>2013-04-30 11:45:52 -0700
commit0a6b7620d6b4ba1a50500a75db3e76162eac5ce0 (patch)
tree8f55cf2a2ee6469981bd27924349bf80de0f295e /board
parentc08e0ade765bf69fb9ab3f62305a84a4d3d34c1d (diff)
downloadchrome-ec-0a6b7620d6b4ba1a50500a75db3e76162eac5ce0.tar.gz
Move i2cread and i2cwrite functions to i2c_common
Also moves the handy i2cscan command to i2c_common. The platform-dependent interface is now i2c_xfer(). Still more to do in follow-up CLs; for example, i2c_read_string() has platform-dependent implementation, and the i2c/i2cread console commands aren't common yet. BUG=chrome-os-partner:18969 BRANCH=none TEST=i2cscan on link, spring Change-Id: Ia53d57beaa157bece293a4262257e20b4107589e Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49492 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Daniel Erat <derat@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/daisy/board.c6
-rw-r--r--board/daisy/board.h1
-rw-r--r--board/pit/board.c5
-rw-r--r--board/pit/board.h1
-rw-r--r--board/snow/board.c5
-rw-r--r--board/snow/board.h1
-rw-r--r--board/spring/board.c5
-rw-r--r--board/spring/board.h1
8 files changed, 25 insertions, 0 deletions
diff --git a/board/daisy/board.c b/board/daisy/board.c
index 0961df5a2f..72f601abb1 100644
--- a/board/daisy/board.c
+++ b/board/daisy/board.c
@@ -96,6 +96,12 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"KB_OUT12", GPIO_C, (1<<7), GPIO_KB_OUTPUT, NULL},
};
+/* I2C ports */
+const struct i2c_port_t i2c_ports[I2C_PORTS_USED] = {
+ {"0", 0, 100},
+ {"1", 1, 100},
+};
+
/* Auto detect I2C host port
* Daisy board has two I2C ports, I2C1(0) and I2C2(1), that can be configured
* as host. PMU chip is connected directly to the EC, and hence can be used
diff --git a/board/daisy/board.h b/board/daisy/board.h
index eed6d5df7a..d5826f4265 100644
--- a/board/daisy/board.h
+++ b/board/daisy/board.h
@@ -56,6 +56,7 @@
#define I2C_PORT_BATTERY I2C_PORT_HOST
#define I2C_PORT_CHARGER I2C_PORT_HOST
#define I2C_PORT_SLAVE 1
+#define I2C_PORTS_USED 2 /* Since host could be on either 0 or 1 */
/* Timer selection */
#define TIM_CLOCK_MSB 3
diff --git a/board/pit/board.c b/board/pit/board.c
index 54d5a96980..c7c124df6d 100644
--- a/board/pit/board.c
+++ b/board/pit/board.c
@@ -86,6 +86,11 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"KB_OUT12", GPIO_A, (1<<13), GPIO_KB_OUTPUT, NULL},
};
+/* I2C ports */
+const struct i2c_port_t i2c_ports[I2C_PORTS_USED] = {
+ {"host", I2C_PORT_HOST, 100},
+};
+
void board_config_post_gpio_init(void)
{
/* I2C SCL/SDA on PB10-11 and PB6-7 */
diff --git a/board/pit/board.h b/board/pit/board.h
index 8c246d3f3e..1009ef490a 100644
--- a/board/pit/board.h
+++ b/board/pit/board.h
@@ -62,6 +62,7 @@
#define I2C_PORT_BATTERY I2C_PORT_HOST
#define I2C_PORT_CHARGER I2C_PORT_HOST
#define I2C_PORT_SLAVE 1
+#define I2C_PORTS_USED 1
/* Timer selection */
#define TIM_CLOCK_MSB 3
diff --git a/board/snow/board.c b/board/snow/board.c
index 4efe5dab39..0f911e03fd 100644
--- a/board/snow/board.c
+++ b/board/snow/board.c
@@ -93,6 +93,11 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"KB_OUT12", GPIO_C, (1<<7), GPIO_KB_OUTPUT, NULL},
};
+/* I2C ports */
+const struct i2c_port_t i2c_ports[I2C_PORTS_USED] = {
+ {"host", I2C_PORT_HOST, 100},
+};
+
void board_config_pre_init(void)
{
uint32_t val;
diff --git a/board/snow/board.h b/board/snow/board.h
index 9d14ef939e..517509abcb 100644
--- a/board/snow/board.h
+++ b/board/snow/board.h
@@ -58,6 +58,7 @@
#define I2C_PORT_BATTERY I2C_PORT_HOST
#define I2C_PORT_CHARGER I2C_PORT_HOST
#define I2C_PORT_SLAVE 1
+#define I2C_PORTS_USED 1
#define GPIO_AP_CLAIM GPIO_SPI1_NSS /* AP claims bus */
#define GPIO_EC_CLAIM GPIO_SPI1_MISO /* EC claims bus */
diff --git a/board/spring/board.c b/board/spring/board.c
index a81e38cf5f..40118cc309 100644
--- a/board/spring/board.c
+++ b/board/spring/board.c
@@ -107,6 +107,11 @@ const struct adc_t adc_channels[ADC_CH_COUNT] = {
[ADC_CH_USB_DN_SNS] = {"USB_DN_SNS", 3300, 4096, 0, STM32_AIN(4)},
};
+/* I2C ports */
+const struct i2c_port_t i2c_ports[I2C_PORTS_USED] = {
+ {"host", I2C_PORT_HOST, 100},
+};
+
void board_config_pre_init(void)
{
uint32_t val;
diff --git a/board/spring/board.h b/board/spring/board.h
index 5fd7c0b878..69b942a94a 100644
--- a/board/spring/board.h
+++ b/board/spring/board.h
@@ -58,6 +58,7 @@
#define I2C_PORT_BATTERY I2C_PORT_HOST
#define I2C_PORT_CHARGER I2C_PORT_HOST
#define I2C_PORT_SLAVE 1
+#define I2C_PORTS_USED 1
/* Low battery threshold. In mAh. */
#define BATTERY_AP_OFF_LEVEL 1