From patchwork Fri Feb 24 10:15: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: 732072 X-Patchwork-Delegate: sbabic@denx.de 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 3vV6wz3HKnz9s7x for ; Fri, 24 Feb 2017 21:37:06 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4399CB3988; Fri, 24 Feb 2017 11:37:03 +0100 (CET) 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 2uwWoywnrM0u; Fri, 24 Feb 2017 11:37:03 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2A20CB39C0; Fri, 24 Feb 2017 11:30:42 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 995C24B8AA for ; Fri, 24 Feb 2017 11:18:23 +0100 (CET) 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 bicpH6547W65 for ; Fri, 24 Feb 2017 11:18:23 +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-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by theia.denx.de (Postfix) with ESMTPS id 2059DB38ED for ; Fri, 24 Feb 2017 11:16:12 +0100 (CET) Received: by mail-pg0-f65.google.com with SMTP id 5so2638009pgj.0 for ; Fri, 24 Feb 2017 02:16:12 -0800 (PST) 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:in-reply-to :references; bh=LWh0f/u9nG5xU+pfTht7+fYWyGv9HczMHE0AXIS2x0s=; b=qerZHtKWohNt0s5JmD4klmk/JwRZj9N6ifRvQOG4HJov5/lrS57zfBEc7fAOuFPOId TOSJkTP3ZoW2etoCwZL3HLUm4bApwB1TT0tL0l5IeF++ubgxB9b/R6u/9tZWysziD9EL 1ZqMk0N6nZV6Ydl7REag8W2F4v10JLaON7c91Qopsbt2uejfsd1RLhrmDX+AIgcm9BS3 Vp2MGX8FkOmdqC+g+1IAwnFeFoBBeCaftP7ifNiYzo83k0y45xyFhydbDE5aSYRmpNrq 4cC3fNQ5vWa/7mP4OikgNQWjG2K84dgEu/lEXroWnS5SVOIHFKkGd9IgKMx5njIx2t73 7Qkw== X-Gm-Message-State: AMke39lmR9ZEMEQO3mgKU2m3gJzrJ1oofAQxR/cVw/YZ06d2OlUMQdu3u9PRhdQAf1q/8A== X-Received: by 10.98.141.138 with SMTP id p10mr2467201pfk.111.1487931371479; Fri, 24 Feb 2017 02:16:11 -0800 (PST) Received: from localhost.localdomain ([106.220.148.189]) by smtp.gmail.com with ESMTPSA id u29sm14350288pfl.17.2017.02.24.02.16.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Feb 2017 02:16:10 -0800 (PST) From: Jagan Teki To: Stefano Babic Date: Fri, 24 Feb 2017 15:45:19 +0530 Message-Id: <1487931326-10199-9-git-send-email-jagan@openedev.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487931326-10199-1-git-send-email-jagan@openedev.com> References: <1487931326-10199-1-git-send-email-jagan@openedev.com> Cc: u-boot@lists.denx.de, Matteo Lisi Subject: [U-Boot] [PATCH v4 08/15] i.MX6UL: isiot: Add mmc_late_init 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" From: Jagan Teki Let the runtime code can set the mmcdev and mmcroot based on the devno using mmc_get_env_dev instead of defining separately in build-time configs using mmc_late_init func. Cc: Matteo Lisi Cc: Michael Trimarchi Reviewed by: Stefano Babic Signed-off-by: Jagan Teki --- board/engicam/isiotmx6ul/isiotmx6ul.c | 22 ++++++++++++++++++++++ include/configs/imx6ul_isiot.h | 2 -- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/board/engicam/isiotmx6ul/isiotmx6ul.c b/board/engicam/isiotmx6ul/isiotmx6ul.c index 0e607e0..b96e4ce 100644 --- a/board/engicam/isiotmx6ul/isiotmx6ul.c +++ b/board/engicam/isiotmx6ul/isiotmx6ul.c @@ -7,6 +7,7 @@ */ #include +#include #include #include @@ -103,6 +104,24 @@ static void setup_gpmi_nand(void) } #endif /* CONFIG_NAND_MXS */ +#ifdef CONFIG_ENV_IS_IN_MMC +static void mmc_late_init(void) +{ + char cmd[32]; + char mmcblk[32]; + u32 dev_no = mmc_get_env_dev(); + + setenv_ulong("mmcdev", dev_no); + + /* Set mmcblk env */ + sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no); + setenv("mmcroot", mmcblk); + + sprintf(cmd, "mmc dev %d", dev_no); + run_command(cmd, 0); +} +#endif + int board_late_init(void) { switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >> @@ -111,6 +130,9 @@ int board_late_init(void) case IMX6_BMODE_ESD: case IMX6_BMODE_MMC: case IMX6_BMODE_EMMC: +#ifdef CONFIG_ENV_IS_IN_MMC + mmc_late_init(); +#endif setenv("modeboot", "mmcboot"); break; case IMX6_BMODE_NAND: diff --git a/include/configs/imx6ul_isiot.h b/include/configs/imx6ul_isiot.h index 7258fed..4009648 100644 --- a/include/configs/imx6ul_isiot.h +++ b/include/configs/imx6ul_isiot.h @@ -45,9 +45,7 @@ "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ "fdt_addr=0x87800000\0" \ "boot_fdt=try\0" \ - "mmcdev=0\0" \ "mmcpart=1\0" \ - "mmcroot=/dev/mmcblk0p2 rootwait rw\0" \ "nandroot=ubi0:rootfs rootfstype=ubifs\0" \ "mmcautodetect=yes\0" \ "mmcargs=setenv bootargs console=${console},${baudrate} " \