diff options
author | Craig Hesling <hesling@chromium.org> | 2020-02-14 16:19:13 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-25 22:58:09 +0000 |
commit | 9d52617b841bcf3cc8f38df7a5d36cf74b4e4c66 (patch) | |
tree | e17e9a2012b59faf27985748f60e205ad90766b8 /board/nucleo-dartmonkey/board.c | |
parent | 14a23fb197983a0066fb95199f3a5120447b7169 (diff) | |
download | chrome-ec-9d52617b841bcf3cc8f38df7a5d36cf74b4e4c66.tar.gz |
nucleo-dartmonkey: Initial board offering
This board will mirror the features of dartmonkey (fingerprint MCU),
but using the Nucleo-H743ZI dev board.
This is simply a clone of nucleo-h743zi.
BRANCH=none
BUG=b:130296790
TEST=Run on nucleo. Ensure the console works.
Change-Id: I69961147a3ef455d951b664f1c92c917f806b082
Signed-off-by: Craig Hesling <hesling@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2057973
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'board/nucleo-dartmonkey/board.c')
-rw-r--r-- | board/nucleo-dartmonkey/board.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/board/nucleo-dartmonkey/board.c b/board/nucleo-dartmonkey/board.c new file mode 100644 index 0000000000..e06408c404 --- /dev/null +++ b/board/nucleo-dartmonkey/board.c @@ -0,0 +1,64 @@ +/* Copyright 2020 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "common.h" +#include "console.h" +#include "gpio.h" +#include "hooks.h" +#include "registers.h" +#include "spi.h" +#include "system.h" +#include "task.h" +#include "util.h" + +/** + * Disable restricted commands when the system is locked. + * + * @see console.h system.c + */ +int console_is_restricted(void) +{ + return system_is_locked(); +} + +static void ap_deferred(void) +{ + /* + * in S3: SLP_S3_L is 0 and SLP_S0_L is X. + * in S0ix: SLP_S3_L is X and SLP_S0_L is 0. + * in S0: SLP_S3_L is 1 and SLP_S0_L is 1. + * in S5/G3, the FP MCU should not be running. + */ + int running = gpio_get_level(GPIO_PCH_SLP_S3_L) + && gpio_get_level(GPIO_PCH_SLP_S0_L); + + if (running) { /* S0 */ + disable_sleep(SLEEP_MASK_AP_RUN); + hook_notify(HOOK_CHIPSET_RESUME); + } else { /* S0ix/S3 */ + hook_notify(HOOK_CHIPSET_SUSPEND); + enable_sleep(SLEEP_MASK_AP_RUN); + } +} +DECLARE_DEFERRED(ap_deferred); + +/* PCH power state changes */ +static void slp_event(enum gpio_signal signal) +{ + hook_call_deferred(&ap_deferred_data, 0); +} + +#include "gpio_list.h" + +/* Initialize board. */ +static void board_init(void) +{ + /* Enable interrupt on PCH power signals */ + gpio_enable_interrupt(GPIO_PCH_SLP_S3_L); + gpio_enable_interrupt(GPIO_PCH_SLP_S0_L); + /* enable the SPI slave interface if the PCH is up */ + hook_call_deferred(&ap_deferred_data, 0); +} +DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); |