From 1106bcce0df6569a93a36a02326e1eb34b181068 Mon Sep 17 00:00:00 2001 From: Seunghwan Kim Date: Fri, 17 Dec 2021 15:57:52 +0900 Subject: mb/google/dedede/var/bugzzy: Initialize display signals on user mode Bugzzy uses panel-built-in touch screen, it needs to set panel power and reset signal to high for touch screen to work. On user mode, coreboot doesn't initialize graphics since there is no screen display before OS. So we would add a WA to initialize required signals on user mode. It takes under 30 ms delay on booting time. BUG=b:205496327 BRANCH=dedede TEST=Verified touch screen worked with test coreboot and test touch screen 028D firmware Signed-off-by: Seunghwan Kim Change-Id: Iaa4d16deb932f43ae1ab33ff5b4e74120ab670db Reviewed-on: https://review.coreboot.org/c/coreboot/+/60190 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian Reviewed-by: Tim Wawrzynczak --- .../google/dedede/variants/bugzzy/Makefile.inc | 1 + .../google/dedede/variants/bugzzy/ramstage.c | 59 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 src/mainboard/google/dedede/variants/bugzzy/ramstage.c (limited to 'src/mainboard/google/dedede') diff --git a/src/mainboard/google/dedede/variants/bugzzy/Makefile.inc b/src/mainboard/google/dedede/variants/bugzzy/Makefile.inc index fd60a18b69..74121943dd 100644 --- a/src/mainboard/google/dedede/variants/bugzzy/Makefile.inc +++ b/src/mainboard/google/dedede/variants/bugzzy/Makefile.inc @@ -1,5 +1,6 @@ ## SPDX-License-Identifier: GPL-2.0-or-later ramstage-y += gpio.c +ramstage-y += ramstage.c smm-y += variant.c diff --git a/src/mainboard/google/dedede/variants/bugzzy/ramstage.c b/src/mainboard/google/dedede/variants/bugzzy/ramstage.c new file mode 100644 index 0000000000..7844b6e360 --- /dev/null +++ b/src/mainboard/google/dedede/variants/bugzzy/ramstage.c @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static void panel_power_on(uintptr_t igd_bar) +{ + setbits32((void *)(igd_bar + PCH_PP_CONTROL), PANEL_POWER_ON); +} + +static void panel_reset_assert(uintptr_t igd_bar) +{ + clrsetbits32((void *)(igd_bar + PCH_GPIOB), + GPIO_CLOCK_VAL_OUT, + GPIO_CLOCK_DIR_MASK | GPIO_CLOCK_DIR_OUT | GPIO_CLOCK_VAL_MASK); +} + +static void panel_reset_deassert(uintptr_t igd_bar) +{ + const uint32_t data32 = GPIO_CLOCK_VAL_OUT | + GPIO_CLOCK_DIR_MASK | GPIO_CLOCK_DIR_OUT | GPIO_CLOCK_VAL_MASK; + setbits32((void *)(igd_bar + PCH_GPIOB), data32); +} + +/* + * Bugzzy uses panel-built-in touch screen, it needs to set panel power and + * reset signal to high for touch screen to work. + * On user mode, coreboot doesn't initialize graphics since there is no screen + * display before OS. We would add this WA to initialize required signals on + * user mode. + */ +static void wa_init_display_signal(void *unused) +{ + struct device *igd_dev = pcidev_path_on_root(SA_DEVFN_IGD); + uintptr_t igd_bar; + + if (display_init_required() || !igd_dev) + return; + + igd_bar = find_resource(igd_dev, PCI_BASE_ADDRESS_0)->base; + if (!igd_bar) + return; + + panel_power_on(igd_bar); + mdelay(20); + panel_reset_deassert(igd_bar); + mdelay(2); + panel_reset_assert(igd_bar); + mdelay(2); + panel_reset_deassert(igd_bar); +} + +BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY, wa_init_display_signal, NULL); -- cgit v1.2.3