summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Tsai <josh_tsai@compal.corp-partner.google.com>2020-04-14 13:44:29 +0800
committerCommit Bot <commit-bot@chromium.org>2020-04-15 03:59:41 +0000
commit3976d0336d74a78f70562fa4506a2c3a360d7de8 (patch)
tree9cd285df0f779f74515ef89894041770a7c19615
parent2daf48c4146649729e6a369608a52168e0849764 (diff)
downloadchrome-ec-3976d0336d74a78f70562fa4506a2c3a360d7de8.tar.gz
Volteer/baseboard: Move I2C bus configuration to variant
Because the Halvor I2C bus setup is different than other Volteer boards Use this change to move I2c configure from baseboard to variant. BUG=none BRANCH=none TEST=make buildall Change-Id: I3a5e0c885f2e0c609a2456c6b493af9e6ecee4f9 Signed-off-by: Josh Tsai <josh_tsai@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2147760 Reviewed-by: Ruby Lee <ruby_lee@compal.corp-partner.google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r--baseboard/volteer/baseboard.c48
-rw-r--r--baseboard/volteer/baseboard.h16
-rw-r--r--board/halvor/board.c48
-rw-r--r--board/halvor/board.h16
-rw-r--r--board/malefor/board.c48
-rw-r--r--board/malefor/board.h16
-rw-r--r--board/volteer/board.c48
-rw-r--r--board/volteer/board.h16
8 files changed, 192 insertions, 64 deletions
diff --git a/baseboard/volteer/baseboard.c b/baseboard/volteer/baseboard.c
index 7358fbfa13..d8b0c0d1e9 100644
--- a/baseboard/volteer/baseboard.c
+++ b/baseboard/volteer/baseboard.c
@@ -116,54 +116,6 @@ struct keyboard_scan_config keyscan_config = {
};
/******************************************************************************/
-/* I2C port map configuration */
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C0_SENSOR_SCL,
- .sda = GPIO_EC_I2C0_SENSOR_SDA,
- },
- {
- .name = "usb_c0",
- .port = I2C_PORT_USB_C0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C1_USB_C0_SCL,
- .sda = GPIO_EC_I2C1_USB_C0_SDA,
- },
- {
- .name = "usb_c1",
- .port = I2C_PORT_USB_C1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C2_USB_C1_SCL,
- .sda = GPIO_EC_I2C2_USB_C1_SDA,
- },
- {
- .name = "usb_1_mix",
- .port = I2C_PORT_USB_1_MIX,
- .kbps = 100,
- .scl = GPIO_EC_I2C3_USB_1_MIX_SCL,
- .sda = GPIO_EC_I2C3_USB_1_MIX_SDA,
- },
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C5_POWER_SCL,
- .sda = GPIO_EC_I2C5_POWER_SDA,
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C7_EEPROM_SCL,
- .sda = GPIO_EC_I2C7_EEPROM_SDA,
- },
-};
-const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
-/******************************************************************************/
/* Charger Chip Configuration */
const struct charger_config_t chg_chips[] = {
{
diff --git a/baseboard/volteer/baseboard.h b/baseboard/volteer/baseboard.h
index 1c8435619c..ec11150db7 100644
--- a/baseboard/volteer/baseboard.h
+++ b/baseboard/volteer/baseboard.h
@@ -229,22 +229,6 @@
#define PD_MAX_VOLTAGE_MV 20000
-/* I2C Bus Configuration */
-#define CONFIG_I2C
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define CONFIG_I2C_MASTER
-
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
diff --git a/board/halvor/board.c b/board/halvor/board.c
index c0466dec76..4d7e1d73e5 100644
--- a/board/halvor/board.c
+++ b/board/halvor/board.c
@@ -58,3 +58,51 @@ __override bool board_is_tbt_usb4_port(int port)
*/
return port == USBC_PORT_C1;
}
+
+/******************************************************************************/
+/* I2C port map configuration */
+const struct i2c_port_t i2c_ports[] = {
+ {
+ .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C0_SENSOR_SCL,
+ .sda = GPIO_EC_I2C0_SENSOR_SDA,
+ },
+ {
+ .name = "usb_c0",
+ .port = I2C_PORT_USB_C0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C1_USB_C0_SCL,
+ .sda = GPIO_EC_I2C1_USB_C0_SDA,
+ },
+ {
+ .name = "usb_c1",
+ .port = I2C_PORT_USB_C1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C2_USB_C1_SCL,
+ .sda = GPIO_EC_I2C2_USB_C1_SDA,
+ },
+ {
+ .name = "usb_1_mix",
+ .port = I2C_PORT_USB_1_MIX,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C3_USB_1_MIX_SCL,
+ .sda = GPIO_EC_I2C3_USB_1_MIX_SDA,
+ },
+ {
+ .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C5_POWER_SCL,
+ .sda = GPIO_EC_I2C5_POWER_SDA,
+ },
+ {
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C7_EEPROM_SCL,
+ .sda = GPIO_EC_I2C7_EEPROM_SDA,
+ },
+};
+const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/halvor/board.h b/board/halvor/board.h
index f5040aaa4f..713548714d 100644
--- a/board/halvor/board.h
+++ b/board/halvor/board.h
@@ -87,6 +87,22 @@
#undef CONFIG_FANS
#undef CONFIG_VOLUME_BUTTONS
+/* I2C Bus Configuration */
+#define CONFIG_I2C
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define CONFIG_I2C_MASTER
+
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
diff --git a/board/malefor/board.c b/board/malefor/board.c
index 82ade2013b..3748286868 100644
--- a/board/malefor/board.c
+++ b/board/malefor/board.c
@@ -221,3 +221,51 @@ const struct mft_t mft_channels[] = {
},
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
+
+/******************************************************************************/
+/* I2C port map configuration */
+const struct i2c_port_t i2c_ports[] = {
+ {
+ .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C0_SENSOR_SCL,
+ .sda = GPIO_EC_I2C0_SENSOR_SDA,
+ },
+ {
+ .name = "usb_c0",
+ .port = I2C_PORT_USB_C0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C1_USB_C0_SCL,
+ .sda = GPIO_EC_I2C1_USB_C0_SDA,
+ },
+ {
+ .name = "usb_c1",
+ .port = I2C_PORT_USB_C1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C2_USB_C1_SCL,
+ .sda = GPIO_EC_I2C2_USB_C1_SDA,
+ },
+ {
+ .name = "usb_1_mix",
+ .port = I2C_PORT_USB_1_MIX,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C3_USB_1_MIX_SCL,
+ .sda = GPIO_EC_I2C3_USB_1_MIX_SDA,
+ },
+ {
+ .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C5_POWER_SCL,
+ .sda = GPIO_EC_I2C5_POWER_SDA,
+ },
+ {
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C7_EEPROM_SCL,
+ .sda = GPIO_EC_I2C7_EEPROM_SDA,
+ },
+};
+const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/malefor/board.h b/board/malefor/board.h
index 49082742ab..83c3283bfa 100644
--- a/board/malefor/board.h
+++ b/board/malefor/board.h
@@ -93,6 +93,22 @@
#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
+/* I2C Bus Configuration */
+#define CONFIG_I2C
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define CONFIG_I2C_MASTER
+
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
diff --git a/board/volteer/board.c b/board/volteer/board.c
index 525e2242f7..dd418de1c1 100644
--- a/board/volteer/board.c
+++ b/board/volteer/board.c
@@ -125,3 +125,51 @@ const struct mft_t mft_channels[] = {
},
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
+
+/******************************************************************************/
+/* I2C port map configuration */
+const struct i2c_port_t i2c_ports[] = {
+ {
+ .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C0_SENSOR_SCL,
+ .sda = GPIO_EC_I2C0_SENSOR_SDA,
+ },
+ {
+ .name = "usb_c0",
+ .port = I2C_PORT_USB_C0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C1_USB_C0_SCL,
+ .sda = GPIO_EC_I2C1_USB_C0_SDA,
+ },
+ {
+ .name = "usb_c1",
+ .port = I2C_PORT_USB_C1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C2_USB_C1_SCL,
+ .sda = GPIO_EC_I2C2_USB_C1_SDA,
+ },
+ {
+ .name = "usb_1_mix",
+ .port = I2C_PORT_USB_1_MIX,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C3_USB_1_MIX_SCL,
+ .sda = GPIO_EC_I2C3_USB_1_MIX_SDA,
+ },
+ {
+ .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C5_POWER_SCL,
+ .sda = GPIO_EC_I2C5_POWER_SDA,
+ },
+ {
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C7_EEPROM_SCL,
+ .sda = GPIO_EC_I2C7_EEPROM_SDA,
+ },
+};
+const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/volteer/board.h b/board/volteer/board.h
index 3c7bd930a9..4832be6469 100644
--- a/board/volteer/board.h
+++ b/board/volteer/board.h
@@ -85,6 +85,22 @@
#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
+/* I2C Bus Configuration */
+#define CONFIG_I2C
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define CONFIG_I2C_MASTER
+
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h"