summaryrefslogtreecommitdiff
path: root/baseboard
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2020-05-22 12:30:57 -0700
committerCommit Bot <commit-bot@chromium.org>2020-09-29 01:53:53 +0000
commitc536b8d03a72d03ee126ab56e5b032287c7f8f2e (patch)
tree75120ba536197abcbfb5801f2a8e8cd17ed00481 /baseboard
parented596967eefda1eecc1044efb60a600af5779f6b (diff)
downloadchrome-ec-c536b8d03a72d03ee126ab56e5b032287c7f8f2e.tar.gz
quiche: Add power sequencing
This CL adds a function in baseboard that will sequence through a list of gpio controlled power rails and chip resets. The table includes a delay prior to executing the next entry. The table is intended to be in board.c as the rails and delays can very much be board specific. BUG=b:167430750 BRANCH=None TEST=Verified that power rails come up and status LED is on. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I830dee9eb28d4648d274d8cbc49b6972cd70dba5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2213837 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r--baseboard/honeybuns/baseboard.c27
-rw-r--r--baseboard/honeybuns/baseboard.h20
2 files changed, 47 insertions, 0 deletions
diff --git a/baseboard/honeybuns/baseboard.c b/baseboard/honeybuns/baseboard.c
index e594d40a0c..e423d5fa16 100644
--- a/baseboard/honeybuns/baseboard.c
+++ b/baseboard/honeybuns/baseboard.c
@@ -4,8 +4,35 @@
*/
/* Honeybuns family-specific configuration */
+#include "console.h"
#include "gpio.h"
+#include "hooks.h"
+#include "timer.h"
+
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
/******************************************************************************/
+__overridable const struct power_seq board_power_seq[] = { };
+
+__overridable const size_t board_power_seq_count =
+ ARRAY_SIZE(board_power_seq);
+
+static void board_power_sequence(void)
+{
+ int i;
+ for(i = 0; i < board_power_seq_count; i++) {
+ gpio_set_level(board_power_seq[i].signal,
+ board_power_seq[i].level);
+ msleep(board_power_seq[i].delay_ms);
+ }
+}
+static void baseboard_init(void)
+{
+ /* Turn on power rails */
+ board_power_sequence();
+ CPRINTS("board: Power rails enabled");
+}
+DECLARE_HOOK(HOOK_INIT, baseboard_init, HOOK_PRIO_DEFAULT);
diff --git a/baseboard/honeybuns/baseboard.h b/baseboard/honeybuns/baseboard.h
index 1711fd1717..e67c1ebbeb 100644
--- a/baseboard/honeybuns/baseboard.h
+++ b/baseboard/honeybuns/baseboard.h
@@ -47,9 +47,29 @@
/* I2C Bus Configuration */
+/*
+ * Macros for GPIO signals used in common code that don't match the
+ * schematic names. Signal names in gpio.inc match the schematic and are
+ * then redefined here to so it's more clear which signal is being used for
+ * which purpose.
+ */
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_WP_L GPIO_EC_WP_L
#ifndef __ASSEMBLER__
+#include "gpio_signal.h"
+#include "stddef.h"
+
+struct power_seq {
+ enum gpio_signal signal; /* power/reset gpio_signal to control */
+ int level; /* level to set in power sequence */
+ unsigned int delay_ms; /* delay (in msec) after setting gpio_signal */
+};
+
+extern const struct power_seq board_power_seq[];
+extern const size_t board_power_seq_count;
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BASEBOARD_H */