summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2019-11-26 18:28:29 -0700
committerCommit Bot <commit-bot@chromium.org>2019-11-27 21:26:52 +0000
commit1edeb2b8169143e5233df02b1bd758d64267a039 (patch)
tree3a9d5422e8c774bd8de7c95bb1f70246f746469e
parent5908893e03d878d4b3486449bb8adc2a1e8ae19b (diff)
downloadchrome-ec-1edeb2b8169143e5233df02b1bd758d64267a039.tar.gz
trembyle: Update GPIO and I2C to match HW changes
BUG=b:145246560 BRANCH=none TEST=AP still boots ok Change-Id: I0110c7041ab9d2ba2df3107341524c792af2ca5d Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1939786 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
-rw-r--r--baseboard/zork/baseboard.c8
-rw-r--r--baseboard/zork/baseboard.h6
-rw-r--r--board/trembyle/board.c19
-rw-r--r--board/trembyle/board.h6
-rw-r--r--board/trembyle/gpio.inc19
5 files changed, 41 insertions, 17 deletions
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c
index 448403b072..abac4e7daf 100644
--- a/baseboard/zork/baseboard.c
+++ b/baseboard/zork/baseboard.c
@@ -126,8 +126,8 @@ const struct i2c_port_t i2c_ports[] = {
.name = "power",
.port = I2C_PORT_BATTERY,
.kbps = 100,
- .scl = GPIO_EC_I2C_POWER_CBI_SCL,
- .sda = GPIO_EC_I2C_POWER_CBI_SDA,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA,
},
{
.name = "mux",
@@ -147,8 +147,8 @@ const struct i2c_port_t i2c_ports[] = {
.name = "sensor",
.port = I2C_PORT_SENSOR,
.kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA,
+ .scl = GPIO_EC_I2C_SENSOR_CBI_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_CBI_SDA,
},
{
.name = "ap_audio",
diff --git a/baseboard/zork/baseboard.h b/baseboard/zork/baseboard.h
index 74dd43b747..27bdd944cd 100644
--- a/baseboard/zork/baseboard.h
+++ b/baseboard/zork/baseboard.h
@@ -191,12 +191,12 @@
#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_CHARGER NPCX_I2C_PORT2_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT2_0
+#define I2C_PORT_CHARGER I2C_PORT_BATTERY
#define I2C_PORT_USB_MUX NPCX_I2C_PORT3_0
#define I2C_PORT_THERMAL NPCX_I2C_PORT4_1
#define I2C_PORT_SENSOR NPCX_I2C_PORT5_0
-#define I2C_PORT_ACCEL NPCX_I2C_PORT5_0
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_EEPROM I2C_PORT_SENSOR
#define I2C_PORT_AP_AUDIO NPCX_I2C_PORT6_1
#define I2C_PORT_AP_HDMI NPCX_I2C_PORT7_0
diff --git a/board/trembyle/board.c b/board/trembyle/board.c
index e4e06c70f1..4b8194aaa2 100644
--- a/board/trembyle/board.c
+++ b/board/trembyle/board.c
@@ -13,12 +13,31 @@
#include "power.h"
#include "power_button.h"
#include "switch.h"
+#include "system.h"
#include "usb_charge.h"
#include "gpio_list.h"
+/* These GPIOs moved. Temporarily detect and support the V0 HW. */
+enum gpio_signal GPIO_PCH_PWRBTN_L = GPIO_EC_FCH_PWR_BTN_L;
+enum gpio_signal GPIO_PCH_SYS_PWROK = GPIO_EC_FCH_PWROK;
+
void board_update_sensor_config_from_sku(void)
{
+ int data;
+
+ /*
+ * If the CBI EEPROM is found on the battery I2C port then we are
+ * running on V0 HW so re-map the GPIOs that moved.
+ */
+ if ((system_get_sku_id() == 0)
+ && (i2c_read8(I2C_PORT_BATTERY, I2C_ADDR_EEPROM_FLAGS, 0, &data)
+ == EC_SUCCESS)) {
+ ccprints("V0 HW detected");
+ GPIO_PCH_PWRBTN_L = GPIO_EC_FCH_PWR_BTN_L_V0;
+ GPIO_PCH_SYS_PWROK = GPIO_EC_FCH_PWROK_V0;
+ }
+
/* Enable Gyro interrupts */
gpio_enable_interrupt(GPIO_6AXIS_INT_L);
}
diff --git a/board/trembyle/board.h b/board/trembyle/board.h
index 6c0d3a95be..5feefee1ba 100644
--- a/board/trembyle/board.h
+++ b/board/trembyle/board.h
@@ -42,11 +42,9 @@
#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
@@ -58,6 +56,10 @@
#ifndef __ASSEMBLER__
+/* These GPIOs moved. Temporarily detect and support the V0 HW. */
+extern enum gpio_signal GPIO_PCH_PWRBTN_L;
+extern enum gpio_signal GPIO_PCH_SYS_PWROK;
+
enum battery_type {
BATTERY_AP18F4M,
BATTERY_TYPE_COUNT,
diff --git a/board/trembyle/gpio.inc b/board/trembyle/gpio.inc
index 6f0596af44..85de6ca3eb 100644
--- a/board/trembyle/gpio.inc
+++ b/board/trembyle/gpio.inc
@@ -37,9 +37,11 @@ GPIO(EC_AP_INT_ODL, PIN(A, 3), GPIO_ODR_HIGH) /* Sensor MKBP event to SOC */
GPIO(EN_PWR_A, PIN(B, 7), GPIO_OUT_LOW) /* Enable Power */
GPIO(EC_EDP_BL_DISABLE, PIN(A, 2), GPIO_OUT_HIGH) /* Enable Backlight */
GPIO(EC_ENTERING_RW, PIN(E, 5), GPIO_OUT_LOW) /* EC Entering RW */
-GPIO(EC_FCH_PWR_BTN_L, PIN(8, 6), GPIO_OUT_HIGH) /* Power Button to SOC */
+GPIO(EC_FCH_PWR_BTN_L, PIN(6, 2), GPIO_OUT_HIGH) /* Power Button to SOC */
+GPIO(EC_FCH_PWR_BTN_L_V0, PIN(8, 6), GPIO_OUT_HIGH) /* Power Button to SOC */
GPIO(EC_FCH_RSMRST_L, PIN(A, 1), GPIO_OUT_LOW) /* RSMRST# to SOC */
-GPIO(EC_FCH_PWROK, PIN(7, 5), GPIO_OUT_LOW) /* Power OK to SOC */
+GPIO(EC_FCH_PWROK, PIN(D, 3), GPIO_OUT_LOW) /* Power OK to SOC */
+GPIO(EC_FCH_PWROK_V0, PIN(7, 5), GPIO_OUT_LOW) /* Power OK to SOC */
GPIO(EC_FCH_WAKE_L, PIN(0, 3), GPIO_OUT_HIGH) /* Wake SOC */
GPIO(EC_SYS_RST_L, PIN(C, 7), GPIO_ODR_HIGH) /* Cold Reset to SOC */
GPIO(USB_C0_TCPC_RST_L, PIN(E, 1), GPIO_OUT_HIGH) /* C0 TCPC Reset */
@@ -65,14 +67,15 @@ IOEX(USB_A0_CHARGE_EN_L, EXPIN(USBC_PORT_C0, 1, 6), GPIO_OUT_HIGH) /* A0 5V High
IOEX(USB_A1_RETIMER_EN, EXPIN(USBC_PORT_C1, 0, 0), GPIO_OUT_HIGH) /* A1 Retimer Enable */
IOEX(USB_A1_RETIMER_RST_DB, EXPIN(USBC_PORT_C1, 0, 1), GPIO_OUT_LOW) /* A1 Retimer Reset */
-IOEX(MST_HPD_IN, EXPIN(USBC_PORT_C1, 0, 2), GPIO_OUT_LOW) /* HPD to MST Hub */
+IOEX(USB_C1_HPD_IN_DB, EXPIN(USBC_PORT_C1, 0, 2), GPIO_OUT_LOW) /* C1 HPD */
IOEX(MST_HPD_OUT, EXPIN(USBC_PORT_C1, 0, 3), GPIO_INPUT) /* HPD from MST Hub */
IOEX(USB_C1_TCPC_FASTSW_CTL_EN, EXPIN(USBC_PORT_C1, 0, 4), GPIO_OUT_LOW) /* C1 FastSwitch Control */
IOEX(HDMI_CONN_HPD_3V3_DB, EXPIN(USBC_PORT_C1, 1, 0), GPIO_INPUT) /* HDMI HPD */
IOEX(USB_C1_MUX_RST_DB, EXPIN(USBC_PORT_C1, 1, 1), GPIO_OUT_LOW) /* C1 Mux Reset */
IOEX(USB_C1_SBU_FAULT_DB_ODL, EXPIN(USBC_PORT_C1, 1, 2), GPIO_INPUT) /* C1 SBU Fault */
IOEX(USB_C1_PPC_EN_L, EXPIN(USBC_PORT_C1, 1, 3), GPIO_OUT_LOW) /* C1 PPC Enable */
-IOEX(USB_C1_DATA_EN, EXPIN(USBC_PORT_C1, 1, 5), GPIO_OUT_HIGH) /* HDMI Retimer Enable */
+IOEX(HDMI_DATA_EN_DB, EXPIN(USBC_PORT_C1, 1, 4), GPIO_OUT_HIGH) /* HDMI Retimer Enable */
+IOEX(USB_C1_DATA_EN, EXPIN(USBC_PORT_C1, 1, 5), GPIO_OUT_HIGH) /* C1 Retimer Enable */
IOEX(EN_USB_A1_5V_DB, EXPIN(USBC_PORT_C1, 1, 6), GPIO_OUT_LOW) /* A1 5V Source Enable */
IOEX(USB_A1_CHARGE_EN_DB_L, EXPIN(USBC_PORT_C1, 1, 7), GPIO_OUT_HIGH) /* A1 5V High Current Enable */
@@ -86,14 +89,14 @@ GPIO(EC_I2C_USB_A0_C0_SCL, PIN(B, 5), GPIO_INPUT)
GPIO(EC_I2C_USB_A0_C0_SDA, PIN(B, 4), GPIO_INPUT)
GPIO(EC_I2C_USB_A1_C1_SCL, PIN(9, 0), GPIO_INPUT)
GPIO(EC_I2C_USB_A1_C1_SDA, PIN(8, 7), GPIO_INPUT)
-GPIO(EC_I2C_POWER_CBI_SCL, PIN(9, 2), GPIO_INPUT)
-GPIO(EC_I2C_POWER_CBI_SDA, PIN(9, 1), GPIO_INPUT)
+GPIO(EC_I2C_POWER_SCL, PIN(9, 2), GPIO_INPUT)
+GPIO(EC_I2C_POWER_SDA, PIN(9, 1), GPIO_INPUT)
GPIO(EC_I2C_USBC_AP_MUX_SCL, PIN(D, 1), GPIO_INPUT)
GPIO(EC_I2C_USBC_AP_MUX_SDA, PIN(D, 0), GPIO_INPUT)
GPIO(FCH_SIC, PIN(F, 3), GPIO_INPUT)
GPIO(FCH_SID, PIN(F, 2), GPIO_INPUT)
-GPIO(EC_I2C_SENSOR_SCL, PIN(3, 3), GPIO_INPUT | GPIO_SEL_1P8V)
-GPIO(EC_I2C_SENSOR_SDA, PIN(3, 6), GPIO_INPUT | GPIO_SEL_1P8V)
+GPIO(EC_I2C_SENSOR_CBI_SCL, PIN(3, 3), GPIO_INPUT)
+GPIO(EC_I2C_SENSOR_CBI_SDA, PIN(3, 6), GPIO_INPUT)
GPIO(FCH_I2C_AUDIO_SCL, PIN(E, 4), GPIO_INPUT | GPIO_SEL_1P8V)
GPIO(FCH_I2C_AUDIO_SDA, PIN(E, 3), GPIO_INPUT | GPIO_SEL_1P8V)
GPIO(FCH_I2C_HDMI_HUB_3V3_SCL, PIN(B, 3), GPIO_INPUT)