summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2011-12-19 20:15:38 -0800
committerSimon Glass <sjg@chromium.org>2012-01-06 12:43:57 -0800
commite712ffb3ea9de6fa08b50032d772531cc607bc7e (patch)
tree8b80db5a4f1d97c79852e777c42a6d17d416625f
parentfe7814fabf738769d20491cbfa8c98b454bc621c (diff)
CHROMIUM: Support vboot without a display
This allows booting without a display, mostly as a way of calculating the time that LCD init and maintenance costs us. Perhaps we might integrate the lcd and video APIs within U-Boot - it would be a much nicer solution. With that in mind I feel it is not work refactoring this into three separate (lcd, video, none) files to implement the display API. BUG=chromium-os:22938 TEST=build and boot on Kaen Change-Id: Iea4656f8939f7f2fd78292827091de4ee379954b Reviewed-on: https://gerrit.chromium.org/gerrit/13369 Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
-rw-r--r--arch/arm/include/asm/arch-tegra/dc.h2
-rw-r--r--common/cmd_vboot_twostop.c28
-rw-r--r--lib/vbexport/display.c25
3 files changed, 47 insertions, 8 deletions
diff --git a/arch/arm/include/asm/arch-tegra/dc.h b/arch/arm/include/asm/arch-tegra/dc.h
index 0e99950680..5449f91910 100644
--- a/arch/arm/include/asm/arch-tegra/dc.h
+++ b/arch/arm/include/asm/arch-tegra/dc.h
@@ -527,4 +527,6 @@ enum {
#define H_DDA_INC_RANGE 15:0
#define V_DDA_INC_RANGE 31:16
+int tegra_lcd_check_next_stage(const void *blob, int wait);
+
#endif /* __ASM_ARCH_TEGRA_DC_H */
diff --git a/common/cmd_vboot_twostop.c b/common/cmd_vboot_twostop.c
index 2d8bf37e45..3797492357 100644
--- a/common/cmd_vboot_twostop.c
+++ b/common/cmd_vboot_twostop.c
@@ -25,6 +25,11 @@
#include <chromeos/power_management.h>
#include <usb.h>
+#ifdef CONFIG_VIDEO_TEGRA2
+/* for tegra_lcd_check_next_stage() */
+#include <asm/arch-tegra/dc.h>
+#endif
+
#include <gbb_header.h> /* for GoogleBinaryBlockHeader */
#include <tss_constants.h>
#include <vboot_api.h>
@@ -174,7 +179,6 @@ twostop_init_cparams(struct twostop_fmap *fmap, void *gbb,
static void setup_arch_unused_memory(memory_wipe_t *wipe,
crossystem_data_t *cdata, VbCommonParams *cparams)
{
- int fb_size, lcd_line_length;
struct fdt_memory config, ramoops;
if (fdt_decode_memory(gd->blob, "/memory", &config))
@@ -193,11 +197,17 @@ static void setup_arch_unused_memory(memory_wipe_t *wipe,
(uintptr_t)TEGRA_LP0_ADDR,
(uintptr_t)(TEGRA_LP0_ADDR + TEGRA_LP0_SIZE));
- /* Excludes the frame buffer. */
- fb_size = lcd_get_size(&lcd_line_length);
- memory_wipe_sub(wipe,
- (uintptr_t)gd->fb_base,
- (uintptr_t)gd->fb_base + fb_size);
+#ifdef CONFIG_LCD
+ {
+ int fb_size, lcd_line_length;
+
+ /* Excludes the frame buffer. */
+ fb_size = lcd_get_size(&lcd_line_length);
+ memory_wipe_sub(wipe,
+ (uintptr_t)gd->fb_base,
+ (uintptr_t)gd->fb_base + fb_size);
+ }
+#endif
}
#elif defined(CONFIG_SYS_COREBOOT)
@@ -290,6 +300,9 @@ twostop_init_vboot_library(firmware_storage_t *file, void *gbb,
return err;
}
+#ifdef CONFIG_VIDEO_TEGRA2
+ tegra_lcd_check_next_stage(gd->blob, 0);
+#endif
VBDEBUG(PREFIX "iparams.out_flags: %08x\n", iparams.out_flags);
if (iparams.out_flags & VB_INIT_OUT_CLEAR_RAM)
@@ -597,6 +610,9 @@ twostop_init(struct twostop_fmap *fmap, firmware_storage_t *file,
}
ret = 0;
+#ifdef CONFIG_VIDEO_TEGRA2
+ tegra_lcd_check_next_stage(gd->blob, 0);
+#endif
out:
if (ret)
diff --git a/lib/vbexport/display.c b/lib/vbexport/display.c
index c177f3bacf..2de65cd38f 100644
--- a/lib/vbexport/display.c
+++ b/lib/vbexport/display.c
@@ -10,10 +10,12 @@
#include <common.h>
#ifdef CONFIG_LCD
+#define HAVE_DISPLAY
#include <lcd.h>
#endif
#ifdef CONFIG_CFB_CONSOLE
#include <video.h>
+#define HAVE_DISPLAY
#endif
#include <chromeos/common.h>
#include <lzma/LzmaTypes.h>
@@ -36,6 +38,7 @@ struct display_callbacks {
int (*dc_display_clear) (void);
};
+#ifdef HAVE_DISPLAY
static struct display_callbacks display_callbacks_ = {
#ifdef CONFIG_LCD
.dc_get_pixel_width = lcd_get_pixel_width,
@@ -47,7 +50,7 @@ static struct display_callbacks display_callbacks_ = {
.dc_display_bitmap = lcd_display_bitmap,
.dc_display_clear = lcd_clear,
-#else
+#elif defined(CONFIG_VIDEO)
.dc_get_pixel_width = video_get_pixel_width,
.dc_get_pixel_height = video_get_pixel_height,
.dc_get_screen_columns = video_get_screen_columns,
@@ -58,11 +61,17 @@ static struct display_callbacks display_callbacks_ = {
.dc_display_clear = video_clear
#endif
};
+#endif
VbError_t VbExDisplayInit(uint32_t *width, uint32_t *height)
{
+#ifdef HAVE_DISPLAY
*width = display_callbacks_.dc_get_pixel_width();
*height = display_callbacks_.dc_get_pixel_height();
+#else
+ *width = 640;
+ *height = 480;
+#endif
return VBERROR_SUCCESS;
}
@@ -72,6 +81,7 @@ VbError_t VbExDisplayBacklight(uint8_t enable)
return VBERROR_SUCCESS;
}
+#ifdef HAVE_DISPLAY
/* Print the message on the center of LCD. */
static void print_on_center(const char *message)
{
@@ -92,9 +102,11 @@ static void print_on_center(const char *message)
for (i = i + text_length; i < screen_size; i++)
display_callbacks_.dc_puts(".");
}
+#endif
VbError_t VbExDisplayScreen(uint32_t screen_type)
{
+#ifdef HAVE_DISPLAY
/*
* Show the debug messages for development. It is a backup method
* when GBB does not contain a full set of bitmaps.
@@ -124,6 +136,7 @@ VbError_t VbExDisplayScreen(uint32_t screen_type)
screen_type);
return 1;
}
+#endif
return VBERROR_SUCCESS;
}
@@ -159,25 +172,33 @@ VbError_t VbExDecompress(void *inbuf, uint32_t in_size,
VbError_t VbExDisplayImage(uint32_t x, uint32_t y,
void *buffer, uint32_t buffersize)
{
+#ifdef HAVE_DISPLAY
int ret;
+
ret = display_callbacks_.dc_display_bitmap((ulong)buffer, x, y);
if (ret) {
VBDEBUG("LCD display error.\n");
return VBERROR_UNKNOWN;
}
-
+#endif
return VBERROR_SUCCESS;
}
VbError_t VbExDisplayDebugInfo(const char *info_str)
{
+#ifdef HAVE_DISPLAY
display_callbacks_.dc_position_cursor(0, 0);
display_callbacks_.dc_puts(info_str);
+#endif
return VBERROR_SUCCESS;
}
/* this function is not technically part of the vboot interface */
int display_clear(void)
{
+#ifdef HAVE_DISPLAY
return display_callbacks_.dc_display_clear();
+#else
+ return 0;
+#endif
}