summaryrefslogtreecommitdiff
path: root/board/puff
diff options
context:
space:
mode:
authorAndrew McRae <amcrae@google.com>2020-05-21 11:50:17 +1000
committerCommit Bot <commit-bot@chromium.org>2020-05-22 07:06:29 +0000
commit43c2f29347bc0e98ef877afb720977d594461473 (patch)
tree160826a5a3ccfe358a7f5ef2321968c57824bd67 /board/puff
parenta69d8010850bfe3860507df05d9754b38d757885 (diff)
downloadchrome-ec-43c2f29347bc0e98ef877afb720977d594461473.tar.gz
Puff: Use direct input for recovery button.
Use second input for dedicated recovery button, except for Puff version 1, which will still only use the H1 recovery button input. BUG=b:157005674 TEST=Confirm recovery button still works on Puff. BRANCH=none Change-Id: Ib4cb9ec360f56fc19ddd80ee291f779fbee5c4e4 Signed-off-by: Andrew McRae <amcrae@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2208338 Commit-Queue: Andrew McRae <amcrae@chromium.org> Tested-by: Andrew McRae <amcrae@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/puff')
-rw-r--r--board/puff/board.c52
-rw-r--r--board/puff/board.h5
-rw-r--r--board/puff/gpio.inc8
3 files changed, 40 insertions, 25 deletions
diff --git a/board/puff/board.c b/board/puff/board.c
index 187de62cc8..ee98556e3a 100644
--- a/board/puff/board.c
+++ b/board/puff/board.c
@@ -394,6 +394,28 @@ const struct ina3221_t ina3221[] = {
};
const unsigned int ina3221_count = ARRAY_SIZE(ina3221);
+static uint16_t board_version;
+static uint32_t fw_config;
+
+static void cbi_init(void)
+{
+ /*
+ * Load board info from CBI to control per-device configuration.
+ *
+ * If unset it's safe to treat the board as a proto, just C10 gating
+ * won't be enabled.
+ */
+ uint32_t val;
+
+ if (cbi_get_board_version(&val) == EC_SUCCESS && val <= UINT16_MAX)
+ board_version = val;
+ if (cbi_get_fw_config(&val) == EC_SUCCESS)
+ fw_config = val;
+ CPRINTS("Board Version: %d, F/W config: 0x%08x",
+ board_version, fw_config);
+}
+DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);
+
static void board_init(void)
{
uint8_t *memmap_batt_flags;
@@ -422,6 +444,13 @@ static void board_init(void)
/* Always claim AC is online, because we don't have a battery. */
memmap_batt_flags = host_get_memmap(EC_MEMMAP_BATT_FLAG);
*memmap_batt_flags |= EC_BATT_FLAG_AC_PRESENT;
+ /*
+ * For board version < 2, the directly connected recovery
+ * button is not available.
+ */
+ if (board_version < 2)
+ button_disable_gpio(GPIO_EC_RECOVERY_BTN_ODL);
+
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -558,29 +587,6 @@ int extpower_is_present(void)
return adp_connected;
}
-static uint16_t board_version;
-static uint32_t fw_config;
-
-
-static void cbi_init(void)
-{
- /*
- * Load board info from CBI to control per-device configuration.
- *
- * If unset it's safe to treat the board as a proto, just C10 gating
- * won't be enabled.
- */
- uint32_t val;
-
- if (cbi_get_board_version(&val) == EC_SUCCESS && val <= UINT16_MAX)
- board_version = val;
- CPRINTS("Board Version: 0x%04x", board_version);
- if (cbi_get_fw_config(&val) == EC_SUCCESS)
- fw_config = val;
- CPRINTS("Firmware config: 0x%08x", fw_config);
-}
-DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);
-
int board_is_c10_gate_enabled(void)
{
/*
diff --git a/board/puff/board.h b/board/puff/board.h
index 179e45e7bb..2d2ec31cf3 100644
--- a/board/puff/board.h
+++ b/board/puff/board.h
@@ -29,6 +29,8 @@
#define CONFIG_BOARD_HAS_RTC_RESET
#define CONFIG_BOARD_VERSION_CBI
#define CONFIG_DEDICATED_RECOVERY_BUTTON
+#define CONFIG_DEDICATED_RECOVERY_BUTTON_2
+#define CONFIG_BUTTONS_RUNTIME_CONFIG
/* TODO: (b/143496253) re-enable CEC */
/* #define CONFIG_CEC */
#define CONFIG_CRC8
@@ -248,7 +250,8 @@ enum ec_cfg_bj_power_type ec_config_get_bj_power(void);
#define GPIO_WP_L GPIO_EC_WP_ODL
#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_RECOVERY_L GPIO_H1_EC_RECOVERY_BTN_ODL
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
+#define GPIO_RECOVERY_L_2 GPIO_H1_EC_RECOVERY_BTN_ODL
#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
diff --git a/board/puff/gpio.inc b/board/puff/gpio.inc
index 9296805be5..f365e4a2fc 100644
--- a/board/puff/gpio.inc
+++ b/board/puff/gpio.inc
@@ -40,6 +40,13 @@ GPIO_INT(IMVP8_VRRDY_OD, PIN(1, 6), GPIO_INT_BOTH, power_signal_interrupt)
/* Other interrupts */
GPIO_INT(USB_C0_TCPPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, ppc_interrupt)
GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, tcpc_alert_event)
+/*
+ * Directly connected recovery button (not available on some boards).
+ */
+GPIO_INT(EC_RECOVERY_BTN_ODL, PIN(F, 1), GPIO_INT_BOTH, button_interrupt)
+/*
+ * Recovery button input from H1.
+ */
GPIO_INT(H1_EC_RECOVERY_BTN_ODL, PIN(2, 4), GPIO_INT_BOTH, button_interrupt)
GPIO_INT(BJ_ADP_PRESENT_L, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, adp_connect_interrupt)
@@ -158,4 +165,3 @@ UNUSED(PIN(D, 2)) /* C11 NC */
UNUSED(PIN(8, 6)) /* J8 NC */
UNUSED(PIN(9, 3)) /* M11 NC */
UNUSED(PIN(7, 2)) /* H6 NC */
-UNUSED(PIN(F, 1)) /* G3 NC */