ryu: libpayload: Set fb address in dc register

Since display controller and panel configuration is done
in coreboot but the frame buffer address is not
available until payload stage, it is needed to have a
function in libpayload to set fb address and enable window
in dc registers.

BRANCH=none
BUG=chrome-os-partner:31936
TEST=build and test on ryu

Change-Id: Ib5fe9da4d8257d616e13c5556ec25d8b900d60e3
Signed-off-by: Jimmy Zhang <jimmzhang@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/226406
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Jimmy Zhang 2014-10-29 11:12:40 -07:00 committed by chrome-internal-fetch
commit e83de6429c
4 changed files with 82 additions and 0 deletions

View file

@ -45,6 +45,7 @@ CONFIG_LP_8250_MMIO32_SERIAL_CONSOLE=y
# CONFIG_LP_SERIAL_ACS_FALLBACK is not set
CONFIG_LP_VIDEO_CONSOLE=y
CONFIG_LP_COREBOOT_VIDEO_CONSOLE=y
CONFIG_LP_TEGRA_VIDEO_CONSOLE_INIT=y
# CONFIG_LP_PC_KEYBOARD is not set
#

View file

@ -65,6 +65,9 @@ libc-$(CONFIG_LP_GEODELX_VIDEO_CONSOLE) += video/font8x16.c
libc-$(CONFIG_LP_COREBOOT_VIDEO_CONSOLE) += video/corebootfb.c
libc-$(CONFIG_LP_COREBOOT_VIDEO_CONSOLE) += video/font8x16.c
# Tegra132 framebuffer init driver
libc-$(CONFIG_LP_TEGRA_VIDEO_CONSOLE_INIT) += video/tegra.c
libc-$(CONFIG_LP_STORAGE) += storage/storage.c
libc-$(CONFIG_LP_STORAGE_ATA) += storage/ata.c
libc-$(CONFIG_LP_STORAGE_ATAPI) += storage/atapi.c

View file

@ -0,0 +1,63 @@
/*
* Copyright 2014 Google Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <libpayload.h>
#include <coreboot_tables.h>
#include <video_console.h>
#define write32(val, addr) *(volatile uint32_t *)addr = val
#define read32(addr) *(volatile uint32_t *)addr
#define WIN_ENABLE (1 << 30)
#define TEGRA_DC_WIN_OPTIONS 0x54201c00
#define TEGRA_DC_FB_START 0x54202000
struct video_console tegra_video_console;
static int tegra_fb_init(void)
{
uint32_t value;
if ((lib_sysinfo.framebuffer == NULL) ||
!(lib_sysinfo.framebuffer->physical_address))
return -1;
write32(((uint32_t)lib_sysinfo.framebuffer->physical_address),
TEGRA_DC_FB_START);
value = read32(TEGRA_DC_WIN_OPTIONS);
write32((value | WIN_ENABLE), TEGRA_DC_WIN_OPTIONS);
/*
* This is not a full functional video driver. The return value here
* must be non-zero so that upper layer can continue scaning to find
* the real video driver.
*/
return -1;
}
struct video_console tegra_video_console = {
.init = tegra_fb_init,
};

View file

@ -43,8 +43,23 @@ extern struct video_console coreboot_video_console;
extern struct video_console vga_video_console;
#endif
#ifdef CONFIG_LP_TEGRA_VIDEO_CONSOLE_INIT
extern struct video_console tegra_video_console;
#endif
static struct video_console *console_list[] =
{
/*
* tegra_video_console only provides the init function to do a few
* dc configuration settings. Since it is not a full-fledged video
* driver, its init function will not return success so that
* function video_init() can find the real video driver. Also
* tegra_video_console must be placed at first position in this
* console_list[] to ensure the tegra init function is being called.
*/
#ifdef CONFIG_LP_TEGRA_VIDEO_CONSOLE_INIT
&tegra_video_console,
#endif
#ifdef CONFIG_LP_GEODELX_VIDEO_CONSOLE
&geodelx_video_console,
#endif