From patchwork Tue Aug 25 13:10:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume GARDET X-Patchwork-Id: 510496 X-Patchwork-Delegate: trini@ti.com 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 A17EC1401AD for ; Tue, 25 Aug 2015 23:10:43 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D4EB94B693; Tue, 25 Aug 2015 15:10:40 +0200 (CEST) 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 8S3Um_Q4myPT; Tue, 25 Aug 2015 15:10:40 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 10A584B67F; Tue, 25 Aug 2015 15:10:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 385494B67F for ; Tue, 25 Aug 2015 15:10:37 +0200 (CEST) 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 y_mVj29rWkpB for ; Tue, 25 Aug 2015 15:10:37 +0200 (CEST) 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 smtp2-g21.free.fr (smtp2-g21.free.fr [212.27.42.2]) by theia.denx.de (Postfix) with ESMTPS id 0C0E54B67D for ; Tue, 25 Aug 2015 15:10:34 +0200 (CEST) Received: from OLI01.site (unknown [82.244.147.214]) by smtp2-g21.free.fr (Postfix) with ESMTP id 2A0C54B002C; Tue, 25 Aug 2015 15:10:33 +0200 (CEST) From: Guillaume GARDET To: u-boot@lists.denx.de Date: Tue, 25 Aug 2015 15:10:26 +0200 Message-Id: <1440508226-8455-1-git-send-email-guillaume.gardet@free.fr> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <55D3F480.5080809@wwwdotorg.org> References: <55D3F480.5080809@wwwdotorg.org> Cc: Guillaume GARDET Subject: [U-Boot] [PATCH V2] ARM: rpi: Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support and enable it to set 'board_rev' and 'board_name' envs. 'board_rev' can be used in scripts to determine what board we are running on and 'board_name' for pretty printing. Signed-off-by: Guillaume GARDET Cc: Stephen Warren Acked-by: Stephen Warren --- Changes in V2: * Move setenvs to set_board_info() function * Expand patch log board/raspberrypi/rpi/rpi.c | 13 +++++++++++++ include/configs/rpi-common.h | 1 + 2 files changed, 14 insertions(+) diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index d21750e..dc6f096 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -236,10 +236,23 @@ static void set_usbethaddr(void) return; } +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +static void set_board_info(void) +{ + char str_rev[11]; + sprintf(str_rev, "0x%X", rpi_board_rev); + setenv("board_rev", str_rev); + setenv("board_name", models[rpi_board_rev].name); +} +#endif /* CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG */ + int misc_init_r(void) { set_fdtfile(); set_usbethaddr(); +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + set_board_info(); +#endif return 0; } diff --git a/include/configs/rpi-common.h b/include/configs/rpi-common.h index 8830a10..17237cf 100644 --- a/include/configs/rpi-common.h +++ b/include/configs/rpi-common.h @@ -133,6 +133,7 @@ #include /* Environment */ +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG #define ENV_DEVICE_SETTINGS \ "stdin=serial,lcd\0" \ "stdout=serial,lcd\0" \