Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9217
-gerrit
commit 0ff650e8644c1987f58e848d017a4e133e2450a3 Author: David Hendricks dhendrix@chromium.org Date: Sat Sep 27 20:04:49 2014 -0700
chromeec: Add wakeup delay after SPI /CS assertion
Some ECs may require a few microseconds to ramp up their clock after being awaken by /CS assertion. This adds a Kconfig variable that can be overridden at the mainboard-level which will force a delay between asserting /CS and beginning a transfer.
BUG=chrome-os-partner:32223 BRANCH=none TEST=verified ~100us delay using logic analyzer
Change-Id: I6d9b8beaa808252f008efb10e7448afdf96d2004 Signed-off-by: Stefan Reinauer reinauer@chromium.org Original-Commit-Id: ec6b10e4e3f0362dea0dc8046cfd4e4615a42585 Original-Change-Id: Ibba356e4af18f80a7da73c96dadfda0f25251381 Original-Signed-off-by: David Hendricks dhendrix@chromium.org Original-Reviewed-on: https://chromium-review.googlesource.com/220242 Original-Reviewed-by: Julius Werner jwerner@chromium.org Original-Reviewed-by: Alexandru Stan amstan@chromium.org --- src/ec/google/chromeec/Kconfig | 7 +++++++ src/ec/google/chromeec/ec_spi.c | 5 +++++ 2 files changed, 12 insertions(+)
diff --git a/src/ec/google/chromeec/Kconfig b/src/ec/google/chromeec/Kconfig index bec12fb..32a4213 100644 --- a/src/ec/google/chromeec/Kconfig +++ b/src/ec/google/chromeec/Kconfig @@ -43,6 +43,13 @@ config EC_GOOGLE_CHROMEEC_SPI_BUS depends on EC_GOOGLE_CHROMEEC_SPI hex "SPI bus for Google's Chrome EC"
+config EC_GOOGLE_CHROMEEC_SPI_WAKEUP_DELAY_US + depends on EC_GOOGLE_CHROMEEC_SPI + int + default 0 + help + Force delay after asserting /CS to allow EC to wakeup. + config EC_GOOGLE_CHROMEEC_SPI_CHIP depends on EC_GOOGLE_CHROMEEC_SPI hex diff --git a/src/ec/google/chromeec/ec_spi.c b/src/ec/google/chromeec/ec_spi.c index 4b3e587..d11348c 100644 --- a/src/ec/google/chromeec/ec_spi.c +++ b/src/ec/google/chromeec/ec_spi.c @@ -18,6 +18,7 @@ */
#include <console/console.h> +#include <delay.h> #include "ec.h" #include "ec_commands.h" #include <spi-generic.h> @@ -50,6 +51,10 @@ static int crosec_spi_io(size_t req_size, size_t resp_size, void *context)
spi_claim_bus(slave);
+ /* Allow EC to ramp up clock after being awaken. + * See chrome-os-partner:32223 for more details. */ + udelay(CONFIG_EC_GOOGLE_CHROMEEC_SPI_WAKEUP_DELAY_US); + if (spi_xfer(slave, req_buf, req_size, NULL, 0)) { printk(BIOS_ERR, "%s: Failed to send request.\n", __func__); spi_release_bus(slave);