From patchwork Mon Feb 12 13:54:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Faiz Abbas X-Patchwork-Id: 872082 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="U9TmIj0F"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zg6bB5015z9ryk for ; Tue, 13 Feb 2018 00:53:58 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E38A3C21EC9; Mon, 12 Feb 2018 13:53:50 +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.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1BC53C21E16; Mon, 12 Feb 2018 13:53:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2CDCDC21E16; Mon, 12 Feb 2018 13:53:47 +0000 (UTC) Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by lists.denx.de (Postfix) with ESMTPS id 80736C21C2F for ; Mon, 12 Feb 2018 13:53:46 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1CDre3l014007; Mon, 12 Feb 2018 07:53:40 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518443620; bh=5GI2CrrLV6mdGyvuuYhdiAqWH9kO4WP9hg19tXN3eVg=; h=From:To:CC:Subject:Date; b=U9TmIj0F5aUqV1tuwlwtLfXKxCtEF+939jSGrfuR1UVnx0V4E/oGSq9B4ymUJLQkL 9bwUd+WumYIB7SLQxrUb9DNzA+i6VY/G0iXoSM2Pn2LKocAhECYRZp+qXi5c2XzuXD bld0Lj8uipSi9n8UPazG+j0EEpgsruTQ0lqm3LVA= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1CDreOm028601; Mon, 12 Feb 2018 07:53:40 -0600 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 07:53:40 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 07:53:39 -0600 Received: from a0230074-OptiPlex-7010.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1CDraMx013346; Mon, 12 Feb 2018 07:53:37 -0600 From: Faiz Abbas To: , Date: Mon, 12 Feb 2018 19:24:31 +0530 Message-ID: <1518443671-11417-1-git-send-email-faiz_abbas@ti.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: u-boot@lists.denx.de, faiz_abbas@ti.com Subject: [U-Boot] [PATCH v2] env: mmc/fat/ext4: make sure that the MMC sub-system is initialized before using it 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When booting from a non-MMC device, the MMC sub-system may not be initialized when the environment is first accessed. We need to make sure that the MMC sub-system is ready in even a non-MMC boot case. Therefore, initialize mmc before loading environment from it. Signed-off-by: Faiz Abbas --- Dropped Lukasz's Reviewed-by because patch has changed. I have tested this with ENV_IS_IN_FAT and ENV_IS_IN_MMC. env/ext4.c | 3 +++ env/fat.c | 3 +++ env/mmc.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/env/ext4.c b/env/ext4.c index 3f3aac5..6c69a0a 100644 --- a/env/ext4.c +++ b/env/ext4.c @@ -87,6 +87,9 @@ static int env_ext4_load(void) int err; loff_t off; + if (!strcmp(CONFIG_ENV_EXT4_INTERFACE, "mmc")) + mmc_initialize(NULL); + part = blk_get_device_part_str(CONFIG_ENV_EXT4_INTERFACE, CONFIG_ENV_EXT4_DEVICE_AND_PART, &dev_desc, &info, 1); diff --git a/env/fat.c b/env/fat.c index 35f7ab5..fdf4b7a 100644 --- a/env/fat.c +++ b/env/fat.c @@ -89,6 +89,9 @@ static int env_fat_load(void) int dev, part; int err; + if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc")) + mmc_initialize(NULL); + part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE, CONFIG_ENV_FAT_DEVICE_AND_PART, &dev_desc, &info, 1); diff --git a/env/mmc.c b/env/mmc.c index 1058b8c..6f11dec 100644 --- a/env/mmc.c +++ b/env/mmc.c @@ -273,6 +273,8 @@ static int env_mmc_load(void) ALLOC_CACHE_ALIGN_BUFFER(env_t, tmp_env1, 1); ALLOC_CACHE_ALIGN_BUFFER(env_t, tmp_env2, 1); + mmc_initialize(NULL); + mmc = find_mmc_device(dev); errmsg = init_mmc_for_env(mmc);