From ab40b9196977de2c37e37fc28e98bea4596460a7 Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Fri, 4 Sep 2015 10:14:18 -0700 Subject: chromeec: Add kconfig entry for EC PD support Add a kconfig entry to indicate that a board has a PD chip and try to put it in RO mode before the EC during early init. BUG=chrome-os-partner:40635 BRANCH=none TEST=emerge-glados coreboot Change-Id: I170271de9b929fcb73d6b0e09171385a6d23f153 Signed-off-by: Patrick Georgi Original-Commit-Id: 17e2d13261f4e35a8148039e324e22ec1da64b3c Original-Change-Id: I44eed5401beb1dc286e316cf0cc958da791580a5 Original-Signed-off-by: Duncan Laurie Original-Reviewed-on: https://chromium-review.googlesource.com/297747 Original-Reviewed-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/11571 Reviewed-by: Alexandru Gagniuc Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/ec/google/chromeec/Kconfig | 6 ++++++ src/ec/google/chromeec/ec.c | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ec/google/chromeec/Kconfig b/src/ec/google/chromeec/Kconfig index 25cc0e4b24..2a86f33362 100644 --- a/src/ec/google/chromeec/Kconfig +++ b/src/ec/google/chromeec/Kconfig @@ -47,6 +47,12 @@ config EC_GOOGLE_CHROMEEC_MEC help Microchip EC variant for LPC register access. +config EC_GOOGLE_CHROMEEC_PD + depends on EC_GOOGLE_CHROMEEC + def_bool n + help + Indicates that Google's Chrome USB PD chip is present. + config EC_GOOGLE_CHROMEEC_SPI depends on EC_GOOGLE_CHROMEEC def_bool n diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index de58d9750e..e1006dcefc 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -163,9 +163,14 @@ void google_chromeec_check_ec_image(int expected_type) /* Check for recovery mode and ensure EC is in RO */ void google_chromeec_early_init(void) { - /* If in recovery ensure EC is running RO firmware. */ - if (recovery_mode_enabled()) { - google_chromeec_check_ec_image(EC_IMAGE_RO); + if (IS_ENABLED(CONFIG_CHROMEOS)) { + /* Check USB PD chip state first */ + if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC_PD)) + google_chromeec_early_pd_init(); + + /* If in recovery ensure EC is running RO firmware. */ + if (recovery_mode_enabled()) + google_chromeec_check_ec_image(EC_IMAGE_RO); } } -- cgit v1.2.3