From patchwork Thu Feb 2 02:57:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 139070 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 8199A104785 for ; Thu, 2 Feb 2012 13:59:23 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 856EF28104; Thu, 2 Feb 2012 03:58:57 +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 ZR0XwbSQlGbd; Thu, 2 Feb 2012 03:58:57 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 54BB5280E3; Thu, 2 Feb 2012 03:58:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D0BCB280CB for ; Thu, 2 Feb 2012 03:58:34 +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 9jER1tTciT9f for ; Thu, 2 Feb 2012 03:58:34 +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-tul01m020-f172.google.com (mail-tul01m020-f172.google.com [209.85.214.172]) by theia.denx.de (Postfix) with ESMTPS id 3E283280D4 for ; Thu, 2 Feb 2012 03:58:25 +0100 (CET) Received: by mail-tul01m020-f172.google.com with SMTP id wd15so2200117obb.3 for ; Wed, 01 Feb 2012 18:58:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=DKtlC/eA3CiHwg+bNGolVQUJXI0xu0JxNApdmqYWlk0=; b=TkQIF0etF88J4+CTd3ZyytmBYnnpXJYae5MXNw8Ggcm33OaHmwdw3XdESGmtndeYzx DasYZd9PMILSsPCA2npa+uJJ5WQxcTzs72b1dX3Rdurh6F3TUxXz7qWvahgYSnrJxWSP j7H5oshAp8GG6Ve+XQYbGg5C8yfYaQQuDisw0= Received: by 10.182.37.99 with SMTP id x3mr1018214obj.31.1328151504963; Wed, 01 Feb 2012 18:58:24 -0800 (PST) Received: from rob-laptop.i.smooth-stone.com (65-36-72-55.dyn.grandenetworks.net. [65.36.72.55]) by mx.google.com with ESMTPS id y4sm1140854obj.10.2012.02.01.18.58.23 (version=SSLv3 cipher=OTHER); Wed, 01 Feb 2012 18:58:24 -0800 (PST) From: Rob Herring To: u-boot@lists.denx.de Date: Wed, 1 Feb 2012 20:57:57 -0600 Message-Id: <1328151477-8026-7-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1328151477-8026-1-git-send-email-robherring2@gmail.com> References: <1328151477-8026-1-git-send-email-robherring2@gmail.com> Cc: Rob Herring Subject: [U-Boot] [PATCH 6/6] ARM: highbank: setup env from boot source register 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 From: Rob Herring Add support to read the boot src register and set bootcmd env from the selected bootcmdX env setting. Based on Linkstation boot choice selection. Signed-off-by: Rob Herring --- board/highbank/highbank.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c index b771cc8..e2dce53 100644 --- a/board/highbank/highbank.c +++ b/board/highbank/highbank.c @@ -23,6 +23,7 @@ #include #define HB_SREG_A9_PWR_REQ 0xfff3cf00 +#define HB_SREG_A9_BOOT_SRC_STAT 0xfff3cf04 #define HB_PWR_SUSPEND 0 #define HB_PWR_SOFT_RESET 1 #define HB_PWR_HARD_RESET 2 @@ -54,8 +55,20 @@ int board_eth_init(bd_t *bis) int misc_init_r(void) { + char envbuffer[16]; + u32 boot_choice; + ahci_init(0xffe08000); scsi_scan(1); + + boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff; + sprintf(envbuffer, "bootcmd%d", boot_choice); + if (getenv(envbuffer)) { + sprintf(envbuffer, "run bootcmd%d", boot_choice); + setenv("bootcmd", envbuffer); + } else + setenv("bootcmd", ""); + return 0; }