blob: 231ed879731051b8f8dadecb99a3f0f6bf84ba0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2017 Google Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <bootmode.h>
#include <console/console.h>
#include <delay.h>
#include <ec/google/chromeec/ec.h>
#include <gpio.h>
#include <mainboard/google/fizz/gpio.h>
#include <soc/gpio.h>
#include <soc/ramstage.h>
#include <timer.h>
#include "gpio.h"
#define GPIO_HDMI_HPD GPP_E13
#define GPIO_DP_HPD GPP_E14
/* TODO: This can be moved to common directory */
static void wait_for_hpd(gpio_t gpio, long timeout)
{
struct stopwatch sw;
printk(BIOS_INFO, "Waiting for HPD\n");
gpio_input(gpio);
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 %lu ms\n",
stopwatch_duration_msecs(&sw));
}
void mainboard_silicon_init_params(FSP_SIL_UPD *params)
{
static const long display_timeout_ms = 3000;
/* This is reconfigured back to whatever FSP-S expects by
gpio_configure_pads. */
gpio_input(GPIO_HDMI_HPD);
if (display_init_required() && !gpio_get(GPIO_HDMI_HPD)) {
/* This has to be done before FSP-S runs. */
if (google_chromeec_wait_for_displayport(display_timeout_ms))
wait_for_hpd(GPIO_DP_HPD, display_timeout_ms);
}
gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table));
}
|