From patchwork Tue Jun 7 12:03:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 69499 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1939159qgf; Tue, 7 Jun 2016 05:03:35 -0700 (PDT) X-Received: by 10.28.14.209 with SMTP id 200mr2443127wmo.7.1465301015687; Tue, 07 Jun 2016 05:03:35 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id yz7si15354461wjb.128.2016.06.07.05.03.35; Tue, 07 Jun 2016 05:03:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 51DCDA7533; Tue, 7 Jun 2016 14:03:19 +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 SbVQYYvVGrvv; Tue, 7 Jun 2016 14:03:19 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6D325A7579; Tue, 7 Jun 2016 14:03:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DC2424B91E for ; Tue, 7 Jun 2016 14:02:55 +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 21GGdCxmSbyV for ; Tue, 7 Jun 2016 14:02:55 +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 conuserg-07.nifty.com (conuserg-07.nifty.com [210.131.2.74]) by theia.denx.de (Postfix) with ESMTPS id 33B364BA5C for ; Tue, 7 Jun 2016 14:02:50 +0200 (CEST) Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id u57C2bdN019177; Tue, 7 Jun 2016 21:02:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com u57C2bdN019177 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1465300960; bh=aeQ6ql+2OlwyAhz5KjHf3BF9/6daqDTRizDHGbluMmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NLndXTGI0EBOIMtKdwayx2rEsmAl/j4m2tBxK+YqDO7NLZ1LANvEG457KeJaT/839 VFq9r3p+8ZXGH2KFIaKXmRhuJiHI6uh0NE2YgvWiUjxww8xBPOp8YEwGVDqEr/zqLT 072R8ajyfLndCYjdlAZ1taF1aD9orMDjGSAWXbc/iUU0sCAoiKK9PPnOaRXzBknmSH Y87vhLv6QWy/bE6MbWwi+vVutS+XDUpYrWIjcQeNb/BocdFDv4QWFiP4UDDLOCmUAq axHGVHmcMPoQNMpPRe2uJLBfKfpu2cpEYfDEKU1dKvJz4RMXdSKynV7LvLRtpJOawl W0OypVte/trYA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Tue, 7 Jun 2016 21:03:45 +0900 Message-Id: <1465301027-1650-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465301027-1650-1-git-send-email-yamada.masahiro@socionext.com> References: <1465301027-1650-1-git-send-email-yamada.masahiro@socionext.com> Subject: [U-Boot] [PATCH 3/5] ARM: uniphier: do not overwrite bootmode environment 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" This code auto-detects the boot mode, but it should respect the user's choice if "bootmode" environment is found in a saved set of environments. Signed-off-by: Masahiro Yamada --- arch/arm/mach-uniphier/board_late_init.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/arch/arm/mach-uniphier/board_late_init.c b/arch/arm/mach-uniphier/board_late_init.c index a454126..b3fe016 100644 --- a/arch/arm/mach-uniphier/board_late_init.c +++ b/arch/arm/mach-uniphier/board_late_init.c @@ -62,33 +62,46 @@ static int uniphier_set_fdt_file(void) return setenv("fdt_file", dtb_name); } +static int uniphier_set_bootmode(const char *bootmode) +{ + if (getenv("bootmode")) + return 0; /* do nothing if it is already set */ + + return setenv("bootenv", bootmode); +} + int board_late_init(void) { + const char *bootmode; + puts("MODE: "); switch (spl_boot_device_raw()) { case BOOT_DEVICE_MMC1: printf("eMMC Boot\n"); - setenv("bootmode", "emmcboot"); + bootmode = "emmcboot"; break; case BOOT_DEVICE_NAND: printf("NAND Boot\n"); - setenv("bootmode", "nandboot"); nand_denali_wp_disable(); + bootmode = "nandboot"; break; case BOOT_DEVICE_NOR: printf("NOR Boot\n"); - setenv("bootmode", "norboot"); + bootmode = "norboot"; break; case BOOT_DEVICE_USB: printf("USB Boot\n"); - setenv("bootmode", "usbboot"); + bootmode = "usbboot"; break; default: printf("Unknown\n"); - break; + return; } + if (uniphier_set_bootmode(bootmode)) + printf("bootmode environment was not set correctly\n"); + if (uniphier_set_fdt_file()) printf("fdt_file environment was not set correctly\n");