Sheng-Liang Pan has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/78265?usp=email )
Change subject: mb/google/dedede/var/taranza: Add wait for HPD function ......................................................................
mb/google/dedede/var/taranza: Add wait for HPD function
Add delay to wait for HPD ready to continue boot in ramstage to avoid no display in DEV screen and recovery screen.
BUG=b:303547403 TEST=type-c minitor can display in DEV screen and recovery screen
Signed-off-by: Sheng-Liang Pan sheng-liang.pan@quanta.corp-partner.google.com Change-Id: Iefe3a819c94cd1e89c8e0a87fe221e4b5dbafe12 --- M src/mainboard/google/dedede/variants/taranza/ramstage.c 1 file changed, 40 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/78265/1
diff --git a/src/mainboard/google/dedede/variants/taranza/ramstage.c b/src/mainboard/google/dedede/variants/taranza/ramstage.c index afb3fc7..c2b3629 100644 --- a/src/mainboard/google/dedede/variants/taranza/ramstage.c +++ b/src/mainboard/google/dedede/variants/taranza/ramstage.c @@ -1,6 +1,34 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <bootmode.h> +#include <baseboard/gpio.h> #include <baseboard/variants.h> +#include <console/console.h> +#include <delay.h> +#include <ec/google/chromeec/ec.h> +#include <gpio.h> +#include <intelblocks/gpio.h> +#include <timer.h> + +#define GPIO_USB_HPD GPP_A16 + +static void wait_for_hpd(gpio_t gpio, long timeout) +{ + struct stopwatch sw; + + printk(BIOS_INFO, "Waiting for HPD\n"); + stopwatch_init_msecs_expire(&sw, timeout); + while (!gpio_get(gpio)) { + if (stopwatch_expired(&sw)) { + printk(BIOS_WARNING, + "HPD not ready after %ldms. Abort.\n", timeout); + return; + } + mdelay(200); + } + printk(BIOS_INFO, "HPD ready after %lld ms\n", + stopwatch_duration_msecs(&sw)); +}
/* * Psys_pmax considerations @@ -33,3 +61,15 @@ { variant_update_psys_power_limits(&psys_config); } + +void variant_display_init(void) +{ + static const long display_timeout_ms = 3000; + + if (display_init_required() + && !gpio_get(GPIO_USB_HPD)) { + /* This has to be done before FSP-S runs. */ + if (google_chromeec_wait_for_displayport(display_timeout_ms)) + wait_for_hpd(GPIO_USB_HPD, display_timeout_ms); + } +}