diff options
author | Mary Ruthven <mruthven@chromium.org> | 2017-05-15 16:18:16 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-05-16 20:55:50 -0700 |
commit | 2c33693bb3d6fd82c8ad0758ffe70cd11ba7c12a (patch) | |
tree | 70aa39c4c0d8b4e61b6fc2f1d797b143ce8e83c9 | |
parent | 9fd645a0051fcf5e19a2cafe74aa2016897cd86b (diff) | |
download | chrome-ec-2c33693bb3d6fd82c8ad0758ffe70cd11ba7c12a.tar.gz |
cr50: remove code that was used to work around sys_rst issues
Cr50 holds the EC in reset when it wants to flash the EC or AP. This
will trigger a pulse on the tpm reset signal. In early Cr50 versions
when the tpm was reset we would reboot cr50, so we added some code to
prevent cr50 from resetting itself when the update was going on.
sys_rst_asserted would check if there was an update going on and ignore
the signal if update in progress was true. At the end of the update the
deferred function was used to reset Cr50 after the update was complete.
None of this is needed anymore. We can just release the EC from reset at
the end of the update. This change removes usb_spi_update_in_progress
and the deferred update_finished.
BUG=b:35571516
BRANCH=none
TEST=flash the bob ec and ap using ccd.
Change-Id: I79416dba178c06bbc7289ad96968ee4e61947c4c
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/506571
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r-- | board/cr50/usb_spi.c | 36 | ||||
-rw-r--r-- | chip/g/usb_spi.h | 6 |
2 files changed, 1 insertions, 41 deletions
diff --git a/board/cr50/usb_spi.c b/board/cr50/usb_spi.c index ff4055ff98..5ae47d7dbe 100644 --- a/board/cr50/usb_spi.c +++ b/board/cr50/usb_spi.c @@ -14,8 +14,6 @@ #define CPRINTS(format, args...) cprints(CC_USB, format, ## args) -static uint8_t update_in_progress; - static void disable_ec_ap_spi(void) { /* Configure SPI GPIOs */ @@ -50,38 +48,14 @@ static void enable_ap_spi(void) assert_ec_rst(); } -int usb_spi_update_in_progress(void) -{ - return update_in_progress; -} - -static void update_finished(void) -{ - update_in_progress = 0; - - /* - * The AP and EC are reset in usb_spi_enable so the TPM is in a bad - * state. Use resetting the EC to reset the entire system including the - * TPM. - */ - assert_ec_rst(); - usleep(200); - deassert_ec_rst(); -} -DECLARE_DEFERRED(update_finished); - int usb_spi_board_enable(struct usb_spi_config const *config) { - hook_call_deferred(&update_finished_data, -1); - /* Prevent SPI access if the console is currently locked. */ if (console_is_restricted()) { CPRINTS("usb_spi access denied (console is restricted."); return EC_ERROR_ACCESS_DENIED; } - update_in_progress = 1; - disable_ec_ap_spi(); if (config->state->enabled_host == USB_SPI_EC) @@ -112,7 +86,6 @@ void usb_spi_board_disable(struct usb_spi_config const *config) { CPRINTS("usb_spi disable"); spi_enable(CONFIG_SPI_FLASH_PORT, 0); - disable_ec_ap_spi(); /* Disconnect SPI peripheral to tri-state pads */ /* Disable internal pull up */ @@ -127,14 +100,7 @@ void usb_spi_board_disable(struct usb_spi_config const *config) GWRITE(PINMUX, DIOA8_SEL, GC_PINMUX_GPIO0_GPIO8_SEL); GWRITE(PINMUX, DIOA14_SEL, GC_PINMUX_GPIO0_GPIO9_SEL); - /* - * TODO(crosbug.com/p/52366): remove once sys_rst just resets the TPM - * instead of cr50. - * Resetting the EC and AP cause sys_rst to be asserted currently that - * will cause cr50 to do a soft reset. Delay the end of the transaction - * to prevent cr50 from resetting during a series of usb_spi calls. - */ - hook_call_deferred(&update_finished_data, 1 * SECOND); + disable_ec_ap_spi(); } int usb_spi_interface(struct usb_spi_config const *config, diff --git a/chip/g/usb_spi.h b/chip/g/usb_spi.h index 9d198a7dc2..bdd4fbcd24 100644 --- a/chip/g/usb_spi.h +++ b/chip/g/usb_spi.h @@ -236,10 +236,4 @@ int usb_spi_interface(struct usb_spi_config const *config, int usb_spi_board_enable(struct usb_spi_config const *config); void usb_spi_board_disable(struct usb_spi_config const *config); -/* - * Returns true if SPI update is running, needed to properly handle SYS_RST_L - * input state changes. - */ -int usb_spi_update_in_progress(void); - #endif /* __CROS_EC_USB_SPI_H */ |