atmel: common: Add function to display via DM_VIDEO's API
Add a function to display the company's logo and board information via the API from DM_VIDEO. This function can be shared by other atmel boards, so locate it in board/atmel/common folder. Signed-off-by: Wenyou Yang <wenyou.yang@microchip.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
d330e04d9d
commit
82e0646af7
3 changed files with 74 additions and 0 deletions
|
@ -37,5 +37,6 @@ void redirect_int_from_saic_to_aic(void);
|
||||||
void configure_2nd_sram_as_l2_cache(void);
|
void configure_2nd_sram_as_l2_cache(void);
|
||||||
|
|
||||||
int at91_set_ethaddr(int offset);
|
int at91_set_ethaddr(int offset);
|
||||||
|
int at91_video_show_board_info(void);
|
||||||
|
|
||||||
#endif /* AT91_COMMON_H */
|
#endif /* AT91_COMMON_H */
|
||||||
|
|
|
@ -8,4 +8,5 @@
|
||||||
obj-y += board.o
|
obj-y += board.o
|
||||||
ifndef CONFIG_SPL_BUILD
|
ifndef CONFIG_SPL_BUILD
|
||||||
obj-$(CONFIG_I2C_EEPROM) += mac_eeprom.o
|
obj-$(CONFIG_I2C_EEPROM) += mac_eeprom.o
|
||||||
|
obj-$(CONFIG_DM_VIDEO) += video_display.o
|
||||||
endif
|
endif
|
||||||
|
|
72
board/atmel/common/video_display.c
Normal file
72
board/atmel/common/video_display.c
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017 Microchip
|
||||||
|
* Wenyou Yang <wenyou.yang@microchip.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0+
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <common.h>
|
||||||
|
#include <atmel_lcd.h>
|
||||||
|
#include <dm.h>
|
||||||
|
#include <nand.h>
|
||||||
|
#include <version.h>
|
||||||
|
#include <video.h>
|
||||||
|
#include <video_console.h>
|
||||||
|
#include <asm/io.h>
|
||||||
|
#include <asm/arch/clk.h>
|
||||||
|
|
||||||
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
int at91_video_show_board_info(void)
|
||||||
|
{
|
||||||
|
ulong dram_size, nand_size;
|
||||||
|
int i;
|
||||||
|
u32 len = 0;
|
||||||
|
char buf[255];
|
||||||
|
char *corp = "2017 Microchip Technology Inc.\n";
|
||||||
|
char temp[32];
|
||||||
|
struct udevice *dev, *con;
|
||||||
|
const char *s;
|
||||||
|
vidinfo_t logo_info;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
len += sprintf(&buf[len], "%s\n", U_BOOT_VERSION);
|
||||||
|
memcpy(&buf[len], corp, strlen(corp));
|
||||||
|
len += strlen(corp);
|
||||||
|
len += sprintf(&buf[len], "%s CPU at %s MHz\n", get_cpu_name(),
|
||||||
|
strmhz(temp, get_cpu_clk_rate()));
|
||||||
|
|
||||||
|
dram_size = 0;
|
||||||
|
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
|
||||||
|
dram_size += gd->bd->bi_dram[i].size;
|
||||||
|
|
||||||
|
nand_size = 0;
|
||||||
|
#ifdef CONFIG_NAND_ATMEL
|
||||||
|
for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
|
||||||
|
nand_size += nand_info[i]->size;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
len += sprintf(&buf[len], "%ld MB SDRAM, %ld MB NAND\n",
|
||||||
|
dram_size >> 20, nand_size >> 20);
|
||||||
|
|
||||||
|
ret = uclass_get_device(UCLASS_VIDEO, 0, &dev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
microchip_logo_info(&logo_info);
|
||||||
|
ret = video_bmp_display(dev, logo_info.logo_addr,
|
||||||
|
logo_info.logo_x_offset,
|
||||||
|
logo_info.logo_y_offset, false);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ret = uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
vidconsole_position_cursor(con, 0, logo_info.logo_height);
|
||||||
|
for (s = buf, i = 0; i < len; s++, i++)
|
||||||
|
vidconsole_put_char(con, *s);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue