From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0128AC433EF for ; Wed, 13 Jul 2022 09:53:35 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6D90584449; Wed, 13 Jul 2022 11:53:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=fris.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=fris.de header.i=@fris.de header.b="zOHdfLQ7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1196E84362; Wed, 13 Jul 2022 11:53:07 +0200 (CEST) Received: from mail.fris.de (mail.fris.de [116.203.77.234]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E2E958423A for ; Wed, 13 Jul 2022 11:52:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=fris.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=frieder@fris.de Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1DB18C020E; Wed, 13 Jul 2022 11:52:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1657705976; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=jcxloaFSDyAkiBr7m3QOZW2uF7iUD8++fdW688/Wx64=; b=zOHdfLQ72/WBjSrGniTsKShgbCYTJs/4L4lDjuy/HyZgeHKQ0S2lThahYElMyxRaYJ8lip ejRLqAui6odYJbke2qZ9BqMHZs1RctzpVj/M7RcapFCCbLuqWzDRpeeM1tceUGT+4eVRck dKyZcCh6d8sWdkSUxwTMw/MtkQFmLH2smfD3d5g2DuykXBzHy67EDXDcH5Hvuh5QCcoL4r RkMaRo00eornad1ucpWGWmAdrijdnMP4zn7GEgZ3MMdJD2RTCxjNuNoVRNCroJkEoTvfDr BxI+HG93LP4sRof2iPiNeFuAHKcLHRHDteMDObWz+CNHCqZ2gBb2ouudzSlS/w== From: Frieder Schrempf To: Frieder Schrempf , u-boot@lists.denx.de Cc: Fabio Estevam , Jaehoon Chung , Simon Glass , Stefano Babic , Sughosh Ganu Subject: [PATCH 03/14] imx: kontron-sl-mx8mm: Enable environment in MMC Date: Wed, 13 Jul 2022 11:52:14 +0200 Message-Id: <20220713095229.43274-4-frieder@fris.de> In-Reply-To: <20220713095229.43274-1-frieder@fris.de> References: <20220713095229.43274-1-frieder@fris.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean From: Frieder Schrempf In case we boot from SD card or eMMC, we also want to load the environment from the according boot device. Signed-off-by: Frieder Schrempf --- board/kontron/sl-mx8mm/sl-mx8mm.c | 31 ++++++++++++++++++++++++++++++ configs/kontron-sl-mx8mm_defconfig | 1 + 2 files changed, 32 insertions(+) diff --git a/board/kontron/sl-mx8mm/sl-mx8mm.c b/board/kontron/sl-mx8mm/sl-mx8mm.c index fea93278374..416c4cbb407 100644 --- a/board/kontron/sl-mx8mm/sl-mx8mm.c +++ b/board/kontron/sl-mx8mm/sl-mx8mm.c @@ -4,10 +4,13 @@ */ #include +#include #include #include +#include #include #include +#include #include #include #include @@ -117,3 +120,31 @@ int board_init(void) { return 0; } + +enum env_location env_get_location(enum env_operation op, int prio) +{ + enum boot_device boot_dev = get_boot_device(); + + if (prio) + return ENVL_UNKNOWN; + + /* + * Make sure that the environment is loaded from + * the MMC if we are running from SD card or eMMC. + */ + if (CONFIG_IS_ENABLED(ENV_IS_IN_MMC) && + (boot_dev == SD1_BOOT || boot_dev == SD2_BOOT)) + return ENVL_MMC; + + if (CONFIG_IS_ENABLED(ENV_IS_IN_SPI_FLASH)) + return ENVL_SPI_FLASH; + + return ENVL_NOWHERE; +} + +#if defined(CONFIG_ENV_IS_IN_MMC) +int board_mmc_get_env_dev(int devno) +{ + return devno; +} +#endif diff --git a/configs/kontron-sl-mx8mm_defconfig b/configs/kontron-sl-mx8mm_defconfig index 064f7d0caf6..e6b5c8f800a 100644 --- a/configs/kontron-sl-mx8mm_defconfig +++ b/configs/kontron-sl-mx8mm_defconfig @@ -69,6 +69,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:320k(spl),1024k(u-boot),64k(env),64k(env_redundant)" CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y +CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -- 2.37.0