diff options
author | Aseda Aboagye <aaboagye@google.com> | 2018-01-04 19:07:13 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2018-02-01 00:48:12 +0000 |
commit | cded70332856ca2fa611738a3aa57b551ef26142 (patch) | |
tree | f658fdaba8897caa62457c31beb7e455dcbc41b5 | |
parent | 3db335a6985315fb8a38fdbdce736870268fe6c2 (diff) | |
download | chrome-ec-cded70332856ca2fa611738a3aa57b551ef26142.tar.gz |
cr50: Don't touch EC reset for USB-EC SPI bridge.
Cr50 should not automatically touch the EC reset when enabling the
USB-EC SPI bridge. Otherwise, this could interefere with ECs that might
have internal SPI flash and need to have their resets deasserted in
order to access the internal SPI flash.
This commits simply removes the assertion of EC reset when enabling the
USB-EC SPI bridge. The user or external scripts should control the
resets as necessary using servo or the cr50 console.
BUG=b:71548795,b:71557464
BRANCH=None
TEST=Flash meowth cr50. Verify that I can flash the EC using a
servo_v4.
TEST=Repeat above test with a servo_micro.
TEST=Repeat above test with a SuzyQable.
Change-Id: I114c34df43cf1e8ba622e75c3e6ecf517afc40a4
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/850865
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
(cherry picked from commit 8d1d243134b7234a6df5558e715ea497e0fb97b9)
Reviewed-on: https://chromium-review.googlesource.com/896756
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r-- | board/cr50/usb_spi.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/board/cr50/usb_spi.c b/board/cr50/usb_spi.c index 31b900109f..75dcae9d8e 100644 --- a/board/cr50/usb_spi.c +++ b/board/cr50/usb_spi.c @@ -17,13 +17,21 @@ static void disable_ec_ap_spi(void) { - /* Configure SPI GPIOs */ - gpio_set_level(GPIO_AP_FLASH_SELECT, 0); + int was_ap_spi_en = gpio_get_level(GPIO_AP_FLASH_SELECT); + + /* Disable EC SPI access. */ gpio_set_level(GPIO_EC_FLASH_SELECT, 0); - /* Release AP and EC */ - deassert_ec_rst(); - deassert_sys_rst(); + /* Disable AP SPI access. */ + if (was_ap_spi_en) { + /* + * The fact that AP SPI access was enabled means that the EC was + * held in reset. Therefore, it needs to be released here. + */ + gpio_set_level(GPIO_AP_FLASH_SELECT, 0); + deassert_ec_rst(); + deassert_sys_rst(); + } } static void enable_ec_spi(void) @@ -32,8 +40,11 @@ static void enable_ec_spi(void) gpio_set_level(GPIO_AP_FLASH_SELECT, 0); gpio_set_level(GPIO_EC_FLASH_SELECT, 1); - /* Hold EC in reset. This will also hold the AP in reset. */ - assert_ec_rst(); + /* + * Note that we don't hold the EC in reset here. This is because some + * ECs with internal SPI flash cannot be held in reset in order to + * access the flash. + */ } static void enable_ap_spi(void) |