summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2018-01-04 19:07:13 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-11-13 06:45:40 +0000
commita3c95d7121c765429cb109b43f851f7df2491d0a (patch)
tree2d5f38325916157e887117f47ca346b36058f130
parenteaa18df9c529faa3b61858d95c8ac6906c9d2a24 (diff)
downloadchrome-ec-a3c95d7121c765429cb109b43f851f7df2491d0a.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> Reviewed-on: https://chromium-review.googlesource.com/c/1332782 Reviewed-by: Marco Chen <marcochen@chromium.org> Commit-Queue: Marco Chen <marcochen@chromium.org> Tested-by: Marco Chen <marcochen@chromium.org>
-rw-r--r--board/cr50/usb_spi.c25
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)