From patchwork Wed Sep 13 06:58:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenyou Yang X-Patchwork-Id: 813182 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xsXcj39ngz9sNV for ; Wed, 13 Sep 2017 17:00:53 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 2FECEC223A9; Wed, 13 Sep 2017 07:00:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id AE50BC2205B; Wed, 13 Sep 2017 07:00:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0075AC22288; Wed, 13 Sep 2017 07:00:41 +0000 (UTC) Received: from eusmtp01.atmel.com (eusmtp01.atmel.com [212.144.249.242]) by lists.denx.de (Postfix) with ESMTPS id 02A8DC2205B for ; Wed, 13 Sep 2017 07:00:41 +0000 (UTC) Received: from apsmtp01.atmel.com (10.168.254.31) by eusmtp01.atmel.com (10.145.145.30) with Microsoft SMTP Server id 14.3.235.1; Wed, 13 Sep 2017 08:59:52 +0200 Received: from shaarm01.corp.atmel.com (10.168.254.13) by apsmtp01.atmel.com (10.168.254.31) with Microsoft SMTP Server id 14.3.235.1; Wed, 13 Sep 2017 15:04:15 +0800 From: Wenyou Yang To: U-Boot Mailing List Date: Wed, 13 Sep 2017 14:58:47 +0800 Message-ID: <20170913065854.26134-3-wenyou.yang@microchip.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170913065854.26134-1-wenyou.yang@microchip.com> References: <20170913065854.26134-1-wenyou.yang@microchip.com> MIME-Version: 1.0 Cc: Marek Vasut , Tom Rini Subject: [U-Boot] [PATCH v6 2/9] atmel: common: Add function to display via DM_VIDEO's API X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 Reviewed-by: Simon Glass --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None arch/arm/mach-at91/include/mach/at91_common.h | 1 + board/atmel/common/Makefile | 1 + board/atmel/common/video_display.c | 72 +++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 board/atmel/common/video_display.c diff --git a/arch/arm/mach-at91/include/mach/at91_common.h b/arch/arm/mach-at91/include/mach/at91_common.h index a95fe41610..5416eb455d 100644 --- a/arch/arm/mach-at91/include/mach/at91_common.h +++ b/arch/arm/mach-at91/include/mach/at91_common.h @@ -37,5 +37,6 @@ void redirect_int_from_saic_to_aic(void); void configure_2nd_sram_as_l2_cache(void); int at91_set_ethaddr(int offset); +int at91_video_show_board_info(void); #endif /* AT91_COMMON_H */ diff --git a/board/atmel/common/Makefile b/board/atmel/common/Makefile index 6d9c6850b5..8a6850bc19 100644 --- a/board/atmel/common/Makefile +++ b/board/atmel/common/Makefile @@ -8,4 +8,5 @@ obj-y += board.o ifndef CONFIG_SPL_BUILD obj-$(CONFIG_I2C_EEPROM) += mac_eeprom.o +obj-$(CONFIG_DM_VIDEO) += video_display.o endif diff --git a/board/atmel/common/video_display.c b/board/atmel/common/video_display.c new file mode 100644 index 0000000000..39ad619819 --- /dev/null +++ b/board/atmel/common/video_display.c @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2017 Microchip + * Wenyou Yang + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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; +}