From patchwork Wed Oct 20 19:16:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Salveti X-Patchwork-Id: 1544012 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=fbxiqdFz; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HZL2n2dszz9sNH for ; Thu, 21 Oct 2021 06:17:03 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4B7E98331E; Wed, 20 Oct 2021 21:16:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io 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=foundries.io header.i=@foundries.io header.b="fbxiqdFz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7DEFC80323; Wed, 20 Oct 2021 21:16:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com [IPv6:2607:f8b0:4864:20::92e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CD32D83328 for ; Wed, 20 Oct 2021 21:16:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ricardo@foundries.io Received: by mail-ua1-x92e.google.com with SMTP id q13so8731166uaq.2 for ; Wed, 20 Oct 2021 12:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/Q2n+bYh1OdIKHvWrlqB2f9cj4chiCw9jturgi3AkTU=; b=fbxiqdFzBCrhyJK88X3qguzPFXSp1pUVtApCsgLCel11zUTD6D+Zmm50ZcKc/xVcqG fBxjcN/xofnd/tuROQ6Cxwul8XSi8MJEzcxn5pSpXnICnqNI6MVwt3Ig/6RnrPhmzyas AJTDaWKW/GN7VDcJB3XCOERFEO2HE0lh8abzcDuw92/uO+dou/x9icWA3N593hcO30XE UwYYdwwR4WB/343Ozx3tBewaRtfSQaFJBlbIpZjhHOOiGYsQqw7SLPnKIARwLn2EL/9N e6zAN/pDzD+/kqqlF/f5/MPD3gWDajXQg1t5G5Vmc8z0LqaAcd549i8FcHFFuCmcNYOT ZteQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/Q2n+bYh1OdIKHvWrlqB2f9cj4chiCw9jturgi3AkTU=; b=SWspvM/qryNOuXObFWs2U7nCt+YbaWjnki4S56ZsNZwShQQRs2YP08Jb811+8luUEF m0/u8amSMF61ZsQbG0HO1Gmz6ylojiMJAsJPWO43CAPt2w1hZX413Vie6zTAeNo5kkKB eIW6epvt/MeljJL2SBiDzzpRi7rRiYNITpAMLFlp/BllDKlBBQBRM1yM00xMOAnuxT2f hagBwOXiAMBMZP/StD4atY+rxO1JuyY+SrDDNYQIBI0c3Kz1GVQfdgqNupmi5odIGxJF 8Y+NkTo3Y8rxp66JcAE/XQYyUOhAnjUeDoiSoGE0BL5A3q5liD70FFNfrh1nPUEygsFL Tzlg== X-Gm-Message-State: AOAM531X3dezWGan3L/Zg1unY2eLb9Uxglf2kd2lzeobUtpp5+fIsF7C ZayUstEv60ckgFJF+akYb3Vzy+9jZNwl X-Google-Smtp-Source: ABdhPJyG6pNQhzDcXiJGyIkFPQBcdfUa67+1myQ/kWbEUYv2Seq0Z7zm8I/Rqk8xc0fBWQwXTKY0Tw== X-Received: by 2002:a05:6130:321:: with SMTP id ay33mr1552993uab.140.1634757402119; Wed, 20 Oct 2021 12:16:42 -0700 (PDT) Received: from localhost.localdomain ([191.251.32.43]) by smtp.gmail.com with ESMTPSA id m48sm1894085vkf.50.2021.10.20.12.16.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 12:16:41 -0700 (PDT) From: Ricardo Salveti To: u-boot@lists.denx.de Cc: sbabic@denx.de, festevam@gmail.com, uboot-imx@nxp.com, peng.fan@nxp.com, ye.li@nxp.com, marex@denx.de, sjg@chromium.org, frieder.schrempf@kontron.de, oleksandr.suvorov@foundries.io, igor.opaniuk@foundries.io Subject: [PATCH] ARM: imx8m: support env in fat and ext4 Date: Wed, 20 Oct 2021 16:16:26 -0300 Message-Id: <20211020191626.3648540-1-ricardo@foundries.io> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Change boot device logic to also allow environment stored in fat and in ext4 when booting from SD or from eMMC. As the boot device check for SD and for eMMC was depending on ENV_IS_IN_MMC being defined, change the ifdef blocks at env_get_location to use IS_ENABLED instead for all modes, returning NOWHERE when no valid mode is found. Signed-off-by: Ricardo Salveti Reviewed-by: Oleksandr Suvorov Reviewed-by: Fabio Estevam --- arch/arm/mach-imx/imx8m/soc.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index f2ddc834d4b..a3ce517a104 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -1306,40 +1306,35 @@ void do_error(struct pt_regs *pt_regs, unsigned int esr) enum env_location env_get_location(enum env_operation op, int prio) { enum boot_device dev = get_boot_device(); - enum env_location env_loc = ENVL_UNKNOWN; if (prio) - return env_loc; + return ENVL_UNKNOWN; switch (dev) { -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH case QSPI_BOOT: - env_loc = ENVL_SPI_FLASH; - break; -#endif -#ifdef CONFIG_ENV_IS_IN_NAND + if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH)) + return ENVL_SPI_FLASH; + return ENVL_NOWHERE; case NAND_BOOT: - env_loc = ENVL_NAND; - break; -#endif -#ifdef CONFIG_ENV_IS_IN_MMC + if (IS_ENABLED(CONFIG_ENV_IS_IN_NAND)) + return ENVL_NAND; + return ENVL_NOWHERE; case SD1_BOOT: case SD2_BOOT: case SD3_BOOT: case MMC1_BOOT: case MMC2_BOOT: case MMC3_BOOT: - env_loc = ENVL_MMC; - break; -#endif + if (IS_ENABLED(CONFIG_ENV_IS_IN_MMC)) + return ENVL_MMC; + else if (IS_ENABLED(CONFIG_ENV_IS_IN_EXT4)) + return ENVL_EXT4; + else if (IS_ENABLED(CONFIG_ENV_IS_IN_FAT)) + return ENVL_FAT; + return ENVL_NOWHERE; default: -#if defined(CONFIG_ENV_IS_NOWHERE) - env_loc = ENVL_NOWHERE; -#endif - break; + return ENVL_NOWHERE; } - - return env_loc; } #ifndef ENV_IS_EMBEDDED