From patchwork Mon Mar 27 18:02:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 743932 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3vsMPR5XSyz9s2s for ; Tue, 28 Mar 2017 05:04:59 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 803BFC21C48; Mon, 27 Mar 2017 18:04:55 +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=0.6 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_WEB autolearn=no autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 61BCFC21C26; Mon, 27 Mar 2017 18:04:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5D590C21C26; Mon, 27 Mar 2017 18:04:52 +0000 (UTC) Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) by lists.denx.de (Postfix) with ESMTPS id A9805C21BE5 for ; Mon, 27 Mar 2017 18:04:51 +0000 (UTC) Received: by mail-pg0-f66.google.com with SMTP id 79so14830658pgf.0 for ; Mon, 27 Mar 2017 11:04:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=sots4SgO6zIs+53VXg9YS/A3sqCGSAPYpByIskDku1w=; b=mtX8Aw99msl+JH6Xc8ErJ9sbCDS4jm2dM/lboEXmEf6S8AP2wGpeYgSX+Kk8mxBM+8 XF/sk+A4cThbDlqEtRcvA6t5JGRKlcY2khGz1HftL9rJtRM7I+bpL/NXg4l/UqwwZ2tb hxRliNRZA1c3zFLcwHINOJTLZLwOy4IRwdm2ImBvvrS1QPOlh9+HN0y5Jvl9KsbLcYq7 uZCvx8hmes5pwrLXL8gnX4bDPTu9aCTPIa6PVgl1/pQ6FgNtb1B+31YVR20pFASyJRdf bIzPQRtyt2J9PTB7ZSl159vdtbK3gvpOkk4xjYXvXddkovEor2g8ylb4C6ctVGIcdKuz p+7A== X-Gm-Message-State: AFeK/H0eguwQZNn9bcaRugKFCzFG8nnRyNg+o9TaD0NfcPmcNNsP7qzriN1KTv0kYBUlzA== X-Received: by 10.98.163.17 with SMTP id s17mr26735354pfe.61.1490637890368; Mon, 27 Mar 2017 11:04:50 -0700 (PDT) Received: from localhost.localdomain ([59.95.77.37]) by smtp.gmail.com with ESMTPSA id y5sm2513951pfd.33.2017.03.27.11.04.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Mar 2017 11:04:49 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Date: Mon, 27 Mar 2017 23:32:19 +0530 Message-Id: <1490637743-18535-1-git-send-email-jagan@openedev.com> X-Mailer: git-send-email 1.9.1 Cc: Matteo Lisi Subject: [U-Boot] [PATCH 1/5] i.MX6Q: icorem6: Add modeboot env via board_late_init 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Jagan Teki Add runtime, modeboot env which is setting mmcboot, or nandboot based on the bootdevice so-that conditional macros b/w MMC and NAND for CONFIG_BOOTCOMMAND should be avoided in config files. Cc: Matteo Lisi Cc: Michael Trimarchi Cc: Stefano Babic Signed-off-by: Jagan Teki --- arch/arm/cpu/armv7/mx6/Kconfig | 1 + board/engicam/icorem6/icorem6.c | 19 +++++++++++++++++++ include/configs/imx6qdl_icore.h | 36 ++++++++++++++++-------------------- 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/arch/arm/cpu/armv7/mx6/Kconfig b/arch/arm/cpu/armv7/mx6/Kconfig index 9174136..37f271b 100644 --- a/arch/arm/cpu/armv7/mx6/Kconfig +++ b/arch/arm/cpu/armv7/mx6/Kconfig @@ -160,6 +160,7 @@ config TARGET_MX6QARM2 config TARGET_MX6Q_ICORE bool "Support Engicam i.Core" + select BOARD_LATE_INIT select MX6QDL select OF_CONTROL select DM diff --git a/board/engicam/icorem6/icorem6.c b/board/engicam/icorem6/icorem6.c index 171ec45..f78f8c9 100644 --- a/board/engicam/icorem6/icorem6.c +++ b/board/engicam/icorem6/icorem6.c @@ -205,6 +205,25 @@ int board_early_init_f(void) return 0; } +int board_late_init(void) +{ + switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >> + IMX6_BMODE_SHIFT) { + case IMX6_BMODE_SD: + case IMX6_BMODE_ESD: + setenv("modeboot", "mmcboot"); + break; + case IMX6_BMODE_NAND: + setenv("modeboot", "nandboot"); + break; + default: + setenv("modeboot", ""); + break; + } + + return 0; +} + int board_init(void) { /* Address of boot parameters */ diff --git a/include/configs/imx6qdl_icore.h b/include/configs/imx6qdl_icore.h index 5a28b15..b517e87 100644 --- a/include/configs/imx6qdl_icore.h +++ b/include/configs/imx6qdl_icore.h @@ -64,7 +64,7 @@ "fitboot=echo Booting FIT image from mmc ...; " \ "run mmcargs; " \ "bootm ${loadaddr}\0" \ - "mmcboot=echo Booting from mmc ...; " \ + "_mmcboot=run mmcargs; " \ "run mmcargs; " \ "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ "if run loadfdt; then " \ @@ -79,6 +79,20 @@ "else " \ "bootm; " \ "fi\0" \ + "mmcboot=echo Booting from mmc ...; " \ + "if mmc rescan; then " \ + "if run loadbootscript; then " \ + "run bootscript; " \ + "else " \ + "if run loadfit; then " \ + "run fitboot; " \ + "else " \ + "if run loadimage; then " \ + "run _mmcboot; " \ + "fi; " \ + "fi; " \ + "fi; " \ + "fi\0" \ "nandboot=echo Booting from nand ...; " \ "if mtdparts; then " \ "echo Starting nand boot ...; " \ @@ -90,25 +104,7 @@ "nand read ${fdt_addr} dtb 0x100000; " \ "bootm ${loadaddr} - ${fdt_addr}\0" -#ifdef CONFIG_NAND_MXS -# define CONFIG_BOOTCOMMAND "run nandboot" -#else -# define CONFIG_BOOTCOMMAND \ - "mmc dev ${mmcdev};" \ - "if mmc rescan; then " \ - "if run loadbootscript; then " \ - "run bootscript; " \ - "else " \ - "if run loadfit; then " \ - "run fitboot; " \ - "else " \ - "if run loadimage; then " \ - "run mmcboot; " \ - "fi; " \ - "fi; " \ - "fi; " \ - "fi" -#endif +#define CONFIG_BOOTCOMMAND "run $modeboot" /* Miscellaneous configurable options */ #define CONFIG_SYS_MEMTEST_START 0x80000000