summaryrefslogtreecommitdiff
path: root/baseboard
diff options
context:
space:
mode:
authorRob Barnes <robbarnes@google.com>2020-12-14 12:49:25 -0700
committerCommit Bot <commit-bot@chromium.org>2020-12-17 04:11:01 +0000
commit87b36903a7906d93f42558ddf9ca5406e7bcfa40 (patch)
tree6e407ad3d05e0e2b16363d7ef4a1137b2d1facb1 /baseboard
parent5003532c49588983d235f7ffcb6c59a53c965378 (diff)
downloadchrome-ec-87b36903a7906d93f42558ddf9ca5406e7bcfa40.tar.gz
guybrush: I2C port map
Add i2c port map for guybrush. BUG=b:175593988 TEST=Build BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: Ie78b0fa5d79c4add1776ddcb8a0ee14ec8b1618f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2590564 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r--baseboard/guybrush/baseboard.c78
-rw-r--r--baseboard/guybrush/baseboard.h14
2 files changed, 92 insertions, 0 deletions
diff --git a/baseboard/guybrush/baseboard.c b/baseboard/guybrush/baseboard.c
index 0abaf54ad3..cd07a044fc 100644
--- a/baseboard/guybrush/baseboard.c
+++ b/baseboard/guybrush/baseboard.c
@@ -5,7 +5,9 @@
/* Guybrush family-specific configuration */
+#include "chipset.h"
#include "gpio.h"
+#include "i2c.h"
#include "power.h"
/* Wake Sources */
@@ -46,6 +48,82 @@ const struct power_signal_info power_signal_list[] = {
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
+const struct i2c_port_t i2c_ports[] = {
+ {
+ .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_A0_C0_SCL,
+ .sda = GPIO_EC_I2C_USB_A0_C0_SDA,
+ },
+ {
+ .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_A1_C1_SCL,
+ .sda = GPIO_EC_I2C_USB_A1_C1_SDA,
+ },
+ {
+ .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_BATT_SCL,
+ .sda = GPIO_EC_I2C_BATT_SDA,
+ },
+ {
+ .name = "usb_mux",
+ .port = I2C_PORT_USB_MUX,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USBC_MUX_SCL,
+ .sda = GPIO_EC_I2C_USBC_MUX_SDA,
+ },
+ {
+ .name = "charger",
+ .port = I2C_PORT_CHARGER,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA,
+ },
+ {
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_CBI_SCL,
+ .sda = GPIO_EC_I2C_CBI_SDA,
+ },
+ {
+ .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA,
+ },
+ {
+ .name = "soc_thermal",
+ .port = I2C_PORT_SOC_THERMAL,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SOC_SIC,
+ .sda = GPIO_EC_I2C_SOC_SID,
+ },
+};
+const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+
+int board_is_i2c_port_powered(int port)
+{
+ switch (port) {
+ case I2C_PORT_USB_MUX:
+ case I2C_PORT_SENSOR:
+ /* USB mux and sensor i2c bus is unpowered in Z1 */
+ return chipset_in_state(CHIPSET_STATE_HARD_OFF) ? 0 : 1;
+ case I2C_PORT_SOC_THERMAL:
+ /* SOC thermal i2c bus is unpowered in S0i3/S3/S5/Z1 */
+ return chipset_in_state(CHIPSET_STATE_ANY_OFF |
+ CHIPSET_STATE_ANY_SUSPEND) ? 0 : 1;
+ default:
+ return 1;
+ }
+}
+
void sbu_fault_interrupt(enum ioex_signal signal)
{
/* TODO */
diff --git a/baseboard/guybrush/baseboard.h b/baseboard/guybrush/baseboard.h
index 9d8131c4ea..86e00d26ef 100644
--- a/baseboard/guybrush/baseboard.h
+++ b/baseboard/guybrush/baseboard.h
@@ -78,6 +78,20 @@
/* BC 1.2 */
/* I2C Bus Configuration */
+#define CONFIG_I2C
+#define CONFIG_I2C_BUS_MAY_BE_UNPOWERED
+#define CONFIG_I2C_CONTROLLER
+#define CONFIG_I2C_UPDATE_IF_CHANGED
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
+#define I2C_PORT_TCPC1 NPCX_I2C_PORT1_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT4_1
+#define I2C_PORT_CHARGER I2C_PORT_POWER
+#define I2C_PORT_EEPROM NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT6_1
+#define I2C_PORT_SOC_THERMAL NPCX_I2C_PORT7_0
+#define I2C_ADDR_EEPROM_FLAGS 0x50
/* Volume Button Config */
#define CONFIG_VOLUME_BUTTONS