diff options
author | Hsu Wei-Cheng <mojahsu@chromium.org> | 2021-08-06 08:30:09 +0000 |
---|---|---|
committer | Hsu Wei-Cheng <mojahsu@chromium.org> | 2021-08-06 09:21:42 +0000 |
commit | c0121aadfa214f124f20e50c9fe2552f09d77dd1 (patch) | |
tree | f1bcf93aa08a9e17ebba245f07692d4c3cdbd0af | |
parent | a867f0d358d6f5689545b9a80cdce7cbe768362d (diff) | |
download | chrome-ec-c0121aadfa214f124f20e50c9fe2552f09d77dd1.tar.gz |
Revert "dartmonkey: Reintroduce sleep lines to RO"
This reverts commit 565833feea83ca23d0c16a1c01bbc4a3c42d02c6.
Reason for revert: It may broke CQ
BUG=b:195718112
Original change's description:
> dartmonkey: Reintroduce sleep lines to RO
>
> Change https://crrev.com/c/2657778 removed the sleep lines from RO
> in an effort to minimize the RO complexity.
> Most notably, this isolated the deep-sleep/low-power-idle
> logic to RW only.
>
> Unfortunately, the sleep lines also control whether the SPI host interface
> is listening, which allows it to ignore spurious communication.
>
> It seems safer to reinstate the the sleep line with low power idle
> active and directly disable CONFIG_LOW_POWER_IDLE in subsequent CL.
>
> We reinstate the sleep line gpio logic from the following:
> crrev.com/c1b5095aa8404709bb447bd7a58f262d7d471a01/board/nocturne_fp/board.c
> This is the parent commit to the CL that refactors the sleep lines.
>
> Considering dartmonkey has a sleep line modification for dev boards,
> we keep this in RW only. Since nearly all functionality would need
> to be conditioned and communicated between RO and RW, I decided to
> just create a clean break between RO and RW board init. The original
> board.c no longer spans both RO and RW, there are exclusive board_ro.c
> and board_rw.c files.
>
> BRANCH=none
> BUG=b:178746753
> TEST=# Connect servo_micro and J-Link to an icetower board.
> make proj-dartmonkey -j
> sudo servod --board=icetower
> ./util/flash_jlink.py --board=dartmonkey --image=./build/dartmonkey/ec.bin
> # Unplug J-Link and unplug/replug servo connector.
>
> dut-control fpmcu_slp:off fpmcu_slp_alt:off
> dut-control pp3300_dx_mcu_mw # Should be more than 40mw
> dut-control fpmcu_slp:on fpmcu_slp_alt:off
> dut-control pp3300_dx_mcu_mw # Should be less than 10mw
> dut-control fpmcu_slp:off fpmcu_slp_alt:on
> dut-control pp3300_dx_mcu_mw # Should be less than 10mw
> dut-control fpmcu_slp:on fpmcu_slp_alt:on
> dut-control pp3300_dx_mcu_mw # Should be less than 10mw
> dut-control fpmcu_slp:off fpmcu_slp_alt:off
>
> minicom -D$(dut-control -o raw_fpmcu_console_uart_pty)
> > reboot ro
> # Ctrl-A Q
>
> # RO does not have the code to adjust to SLP_ALT_DEV_L, thus
> # it will use SLP_ALT_L, which is 0. This means it will always
> # think sleep is asserted.
> dut-control fpmcu_slp:off fpmcu_slp_alt:off
> dut-control pp3300_dx_mcu_mw # Should be less than 10mw
> minicom -D$(dut-control -o raw_fpmcu_console_uart_pty)
> > gpioget
> # Should see SLP_L=1, SLP_ALT_L=0, and SLP_ALT_DEV_L=1
> > reboot
> > fpenroll
> > fpmatch
> # Ctrl-A Q
>
> Signed-off-by: Craig Hesling <hesling@chromium.org>
> Change-Id: Ibb2c8052bc4fb776c5e1c172eeb1f3faf356a147
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3052750
> Commit-Queue: Josie Nordrum <josienordrum@google.com>
> Reviewed-by: Josie Nordrum <josienordrum@google.com>
Bug: b:178746753
Change-Id: I923d515ec8d10e9a2f90b87966e83b2a4190b931
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3077588
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Hsu Wei-Cheng <mojahsu@chromium.org>
Auto-Submit: Hsu Wei-Cheng <mojahsu@chromium.org>
-rw-r--r-- | board/nocturne_fp/board.c | 37 | ||||
-rw-r--r-- | board/nocturne_fp/board.h | 2 | ||||
-rw-r--r-- | board/nocturne_fp/board_ro.c | 77 | ||||
-rw-r--r-- | board/nocturne_fp/board_rw.c | 16 | ||||
-rw-r--r-- | board/nocturne_fp/board_rw.h | 3 | ||||
-rw-r--r-- | board/nocturne_fp/build.mk | 2 | ||||
-rw-r--r-- | board/nocturne_fp/gpio.inc | 3 | ||||
-rw-r--r-- | board/nocturne_fp/gpio_rw.inc | 3 |
8 files changed, 45 insertions, 98 deletions
diff --git a/board/nocturne_fp/board.c b/board/nocturne_fp/board.c new file mode 100644 index 0000000000..819c1c53e0 --- /dev/null +++ b/board/nocturne_fp/board.c @@ -0,0 +1,37 @@ +/* Copyright 2017 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. + */ +/* Meowth Fingerprint MCU configuration */ + +#include "common.h" +#include "hooks.h" +#include "registers.h" +#include "spi.h" +#include "system.h" +#include "task.h" + +/** + * Disable restricted commands when the system is locked. + * + * @see console.h system.c + */ +int console_is_restricted(void) +{ + return system_is_locked(); +} + +#include "gpio_list.h" + +/* Initialize board. */ +static void board_init(void) +{ + if (IS_ENABLED(SECTION_IS_RW)) { + board_init_rw(); + } else { + /* No suspend-based power management in RO. */ + disable_sleep(SLEEP_MASK_AP_RUN); + hook_notify(HOOK_CHIPSET_RESUME); + } +} +DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); diff --git a/board/nocturne_fp/board.h b/board/nocturne_fp/board.h index 6da68130df..c30b4b76e0 100644 --- a/board/nocturne_fp/board.h +++ b/board/nocturne_fp/board.h @@ -186,8 +186,6 @@ #include "gpio_signal.h" #include "board_rw.h" -void slp_event(enum gpio_signal signal); - #endif /* !__ASSEMBLER__ */ #endif /* __BOARD_H */ diff --git a/board/nocturne_fp/board_ro.c b/board/nocturne_fp/board_ro.c deleted file mode 100644 index 7f20002435..0000000000 --- a/board/nocturne_fp/board_ro.c +++ /dev/null @@ -1,77 +0,0 @@ -/* Copyright 2017 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. - */ -/* Meowth Fingerprint MCU configuration */ - -#include "common.h" -#include "hooks.h" -#include "registers.h" -#include "spi.h" -#include "system.h" -#include "task.h" - -#ifndef SECTION_IS_RO -#error "This file should only be built for RO." -#endif - - -/** - * Disable restricted commands when the system is locked. - * - * @see console.h system.c - */ -int console_is_restricted(void) -{ - return system_is_locked(); -} - -#include "gpio_list.h" - -static void ap_deferred(void) -{ - /* - * Behavior: - * AP Active (ex. Intel S0): SLP_L is 1 - * AP Suspend (ex. Intel S0ix): SLP_L is 0 - * The alternative SLP_ALT_L should be pulled high at all the times. - * - * Legacy Intel behavior: - * in S3: SLP_ALT_L is 0 and SLP_L is X. - * in S0ix: SLP_ALT_L is X and SLP_L is 0. - * in S0: SLP_ALT_L is 1 and SLP_L is 1. - * in S5/G3, the FP MCU should not be running. - */ - int running = gpio_get_level(GPIO_SLP_ALT_L) && - gpio_get_level(GPIO_SLP_L); - - if (running) { /* AP is S0 */ - disable_sleep(SLEEP_MASK_AP_RUN); - hook_notify(HOOK_CHIPSET_RESUME); - } else { /* AP is suspend/S0ix/S3 */ - hook_notify(HOOK_CHIPSET_SUSPEND); - enable_sleep(SLEEP_MASK_AP_RUN); - } -} -DECLARE_DEFERRED(ap_deferred); - -/* PCH power state changes */ -void slp_event(enum gpio_signal signal) -{ - hook_call_deferred(&ap_deferred_data, 0); -} - -void board_init(void) -{ - /* Enable interrupt on PCH power signals */ - gpio_enable_interrupt(GPIO_SLP_ALT_L); - gpio_enable_interrupt(GPIO_SLP_L); - - /* - * Enable the SPI slave interface if the PCH is up. - * Do not use hook_call_deferred(), because ap_deferred() will be - * called after tasks with priority higher than HOOK task (very late). - */ - ap_deferred(); -} -DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); diff --git a/board/nocturne_fp/board_rw.c b/board/nocturne_fp/board_rw.c index 0a7b38b97d..657f155a4a 100644 --- a/board/nocturne_fp/board_rw.c +++ b/board/nocturne_fp/board_rw.c @@ -19,18 +19,6 @@ #error "This file should only be built for RW." #endif -/** - * Disable restricted commands when the system is locked. - * - * @see console.h system.c - */ -int console_is_restricted(void) -{ - return system_is_locked(); -} - -#include "gpio_list.h" - /* SPI devices */ struct spi_device_t spi_devices[] = { /* Fingerprint sensor (SCLK at 4Mhz) */ @@ -96,7 +84,7 @@ static void spi_configure(enum fp_sensor_spi_select spi_select) spi_enable(&spi_devices[0], 1); } -void board_init(void) +void board_init_rw(void) { enum fp_sensor_spi_select spi_select = get_fp_sensor_spi_select(); @@ -123,7 +111,6 @@ void board_init(void) /* Enable interrupt on PCH power signals */ gpio_enable_interrupt(gpio_slp_alt_l); gpio_enable_interrupt(GPIO_SLP_L); - /* * Enable the SPI slave interface if the PCH is up. * Do not use hook_call_deferred(), because ap_deferred() will be @@ -131,4 +118,3 @@ void board_init(void) */ ap_deferred(); } -DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); diff --git a/board/nocturne_fp/board_rw.h b/board/nocturne_fp/board_rw.h index 6ef7cc29b4..29e304f115 100644 --- a/board/nocturne_fp/board_rw.h +++ b/board/nocturne_fp/board_rw.h @@ -7,8 +7,11 @@ #define __CROS_EC_BOARD_NOCTURNE_FP_BOARD_RW_H void fps_event(enum gpio_signal signal); +void slp_event(enum gpio_signal signal); /* Defined in ro_workarounds.c */ void wp_event(enum gpio_signal signal); +void board_init_rw(void); + #endif /* __CROS_EC_BOARD_NOCTURNE_FP_BOARD_RW_H */ diff --git a/board/nocturne_fp/build.mk b/board/nocturne_fp/build.mk index b367d5e90e..f6fd9fe3d9 100644 --- a/board/nocturne_fp/build.mk +++ b/board/nocturne_fp/build.mk @@ -10,7 +10,7 @@ CHIP_FAMILY:=stm32h7 CHIP_VARIANT:=stm32h7x3 board-rw=ro_workarounds.o board_rw.o -board-ro=board_ro.o +board-y=board.o # If we're mocking the sensor detection for testing (so we can test # sensor/transport permutations in the unit tests), don't build the real sensor # detection. diff --git a/board/nocturne_fp/gpio.inc b/board/nocturne_fp/gpio.inc index ff94e4f8f7..7e90ef0da4 100644 --- a/board/nocturne_fp/gpio.inc +++ b/board/nocturne_fp/gpio.inc @@ -5,9 +5,6 @@ */ /* Interrupts */ -GPIO_INT(SLP_L, PIN(D,13), GPIO_INT_BOTH, slp_event) -GPIO_INT(SLP_ALT_L, PIN(A,11), GPIO_INT_BOTH, slp_event) -GPIO_INT(SLP_ALT_DEV_L, PIN(D,14), GPIO_INT_BOTH, slp_event) GPIO_INT(SPI1_NSS, PIN(A, 4), GPIO_INPUT, spi_event) /* Inputs */ diff --git a/board/nocturne_fp/gpio_rw.inc b/board/nocturne_fp/gpio_rw.inc index 088ce22f32..65036abe14 100644 --- a/board/nocturne_fp/gpio_rw.inc +++ b/board/nocturne_fp/gpio_rw.inc @@ -10,6 +10,9 @@ /* Interrupts */ GPIO_INT(FPS_INT, PIN(A, 0), GPIO_INT_RISING, fps_event) +GPIO_INT(SLP_L, PIN(D,13), GPIO_INT_BOTH, slp_event) +GPIO_INT(SLP_ALT_L, PIN(A,11), GPIO_INT_BOTH, slp_event) +GPIO_INT(SLP_ALT_DEV_L, PIN(D,14), GPIO_INT_BOTH, slp_event) #ifdef APPLY_RESET_LOOP_FIX GPIO_INT(WP, PIN(B, 7), GPIO_INT_BOTH, wp_event) |