summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ec/google/chromeec/Kconfig7
-rw-r--r--src/ec/google/chromeec/ec_spi.c5
2 files changed, 12 insertions, 0 deletions
diff --git a/src/ec/google/chromeec/Kconfig b/src/ec/google/chromeec/Kconfig
index bec12fb10a..32a42133f2 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 4b3e587266..d11348cff7 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);