From patchwork Fri Nov 30 23:01:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 203073 X-Patchwork-Delegate: albert.aribaud@free.fr Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 47AC32C0081 for ; Sat, 1 Dec 2012 10:02:41 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6DF2F4A128; Sat, 1 Dec 2012 00:02:29 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T4qFXTuwoNI4; Sat, 1 Dec 2012 00:02:29 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A440A4A0ED; Sat, 1 Dec 2012 00:02:07 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9F6054A054 for ; Sat, 1 Dec 2012 00:02:02 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Mrog48bg93rh for ; Sat, 1 Dec 2012 00:02:00 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-bk0-f74.google.com (mail-bk0-f74.google.com [209.85.214.74]) by theia.denx.de (Postfix) with ESMTPS id 3A5334A047 for ; Sat, 1 Dec 2012 00:01:44 +0100 (CET) Received: by mail-bk0-f74.google.com with SMTP id je9so65141bkc.3 for ; Fri, 30 Nov 2012 15:01:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=rqu+x9mI/lUWbDbAU2xns60CAelNnR4/Sa7VWbTNQMo=; b=WKz4/7M867N0rQGY1DcMz/aJQ+YRcBqTwxeVDH4V0C6hogquT09/4mkOyb07hUTG/3 RVH1SN6JRqGqnXL8Z8qnEJi8iJp0JqjxQI02+uGeIVHBrTn5GCiZG78eDS61cPtbZIwd fo5dTQV6lUbenHS1gPde2TRkym54Z6Qa3oieU5rm5XvV8wR729bIlTcJJu9MQmHKTtpK NmA5YN9b642VTGUxt1jC3UqtGEvEYMPzDxHzU6LFlxUGzjG99IdxqplCt8RpLMmXxYVv IoZ+GrT4Q3OeZbpdfUEorqM77hjGnMAoKeleEbufAglVVpOSRuMXmk1PLDSB9+fwHryF kk5Q== Received: by 10.14.208.198 with SMTP id q46mr3553043eeo.0.1354316504651; Fri, 30 Nov 2012 15:01:44 -0800 (PST) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id u8si1491363een.1.2012.11.30.15.01.44 (version=TLSv1/SSLv3 cipher=AES128-SHA); Fri, 30 Nov 2012 15:01:44 -0800 (PST) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 3C727200057; Fri, 30 Nov 2012 15:01:44 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 30684160999; Fri, 30 Nov 2012 15:01:33 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Fri, 30 Nov 2012 15:01:20 -0800 Message-Id: <1354316484-23515-7-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1354316484-23515-1-git-send-email-sjg@chromium.org> References: <1354316484-23515-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQkmHvJsTi7o+9vJFdT2CrpMPZZsdu24kf2uVmNNtyOCDv1ZXlVkMJEsEBGLBvUf4MA6GZ7bGfIgLK98SMBNrkzvbuao8OhnOSP5UOxrxSa+zHzK+YNBRn+k1HcGRm5RcZToaK4p9kS0evpaUy5PueezLhKdhDVI+iSRUei1QwD6iKmGzn8Zd1g5HZr7Cx8Oi0XkvyhM Cc: Tom Rini Subject: [U-Boot] [PATCH v2 07/10] Add option to display customised memory information X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Some boards want to report more than just memory size. For example, it might be useful to display the memory type (DDR2, DDR3) or manufacturer. Add a weak function to support this requirement, accessed through a new 'meminfo' command. Any example of the DRAM: output is below, just for illustration: SMDK5250 # meminfo DRAM: 2 GiB Elpida DDR3 @ 800MHz Signed-off-by: Simon Glass --- Changes in v2: - Rewrite customised memory info patch to use a command README | 1 + common/cmd_mem.c | 27 +++++++++++++++++++++++++++ include/common.h | 9 +++++++++ include/config_cmd_all.h | 1 + 4 files changed, 38 insertions(+), 0 deletions(-) diff --git a/README b/README index 36853e5..200edf8 100644 --- a/README +++ b/README @@ -840,6 +840,7 @@ The following options need to be configured: CONFIG_CMD_LOADS loads CONFIG_CMD_MD5SUM print md5 message digest (requires CONFIG_CMD_MEMORY and CONFIG_MD5) + CONFIG_CMD_MEMINFO * Display detailed memory information CONFIG_CMD_MEMORY md, mm, nm, mw, cp, cmp, crc, base, loop, loopw, mtest CONFIG_CMD_MISC Misc functions like sleep etc diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 4d64cff..0f3ffc8 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -33,6 +33,9 @@ #include #endif #include +#include + +DECLARE_GLOBAL_DATA_PTR; static int mod_mem(cmd_tbl_t *, int, int, int, char * const []); @@ -1203,6 +1206,22 @@ U_BOOT_CMD( #endif +#ifdef CONFIG_CMD_MEMINFO +__weak void board_show_dram(ulong size) +{ + puts("DRAM: "); + print_size(size, "\n"); +} + +static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ + board_show_dram(gd->ram_size); + + return 0; +} +#endif + U_BOOT_CMD( base, 2, 1, do_mem_base, "print or set address offset", @@ -1243,3 +1262,11 @@ U_BOOT_CMD( "[.b, .w, .l] address value delay(ms)" ); #endif /* CONFIG_MX_CYCLIC */ + +#ifdef CONFIG_CMD_MEMINFO +U_BOOT_CMD( + meminfo, 3, 1, do_mem_info, + "display memory information", + "" +); +#endif diff --git a/include/common.h b/include/common.h index 5e3c5ee..a1ab4f0 100644 --- a/include/common.h +++ b/include/common.h @@ -311,6 +311,15 @@ int mac_read_from_eeprom(void); extern u8 _binary_dt_dtb_start[]; /* embedded device tree blob */ int set_cpu_clk_info(void); +/** + * Show the DRAM size in a board-specific way + * + * This is used by boards to display DRAM information in their own way. + * + * @param size Size of DRAM (which should be displayed along with other info) + */ +void board_show_dram(ulong size); + /* common/flash.c */ void flash_perror (int); diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h index f434cd0..eadc8b7 100644 --- a/include/config_cmd_all.h +++ b/include/config_cmd_all.h @@ -53,6 +53,7 @@ #define CONFIG_CMD_LICENSE /* console license display */ #define CONFIG_CMD_LOADB /* loadb */ #define CONFIG_CMD_LOADS /* loads */ +#define CONFIG_CMD_MEMINFO /* meminfo */ #define CONFIG_CMD_MEMORY /* md mm nm mw cp cmp crc base loop mtest */ #define CONFIG_CMD_MFSL /* FSL support for Microblaze */ #define CONFIG_CMD_MII /* MII support */