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 6C798C77B78 for ; Wed, 3 May 2023 00:06:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C3E4A846B2; Wed, 3 May 2023 02:06:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gateworks.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 7B36984730; Wed, 3 May 2023 02:06:08 +0200 (CEST) Received: from finn.localdomain (finn.gateworks.com [108.161.129.64]) (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 7A2EC84735 for ; Wed, 3 May 2023 02:06:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gateworks.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=tharvey@gateworks.com Received: from 068-189-091-139.biz.spectrum.com ([68.189.91.139] helo=tharvey.pdc.gateworks.com) by finn.localdomain with esmtp (Exim 4.93) (envelope-from ) id 1pu00Q-0059KV-89; Wed, 03 May 2023 00:06:02 +0000 From: Tim Harvey To: sbabic@denx.de, Fabio Estevam Cc: u-boot@lists.denx.de, Tim Harvey Subject: [PATCH 2/5] board: gateworks: venice: dynamically determine U-Boot env partition Date: Tue, 2 May 2023 17:05:54 -0700 Message-Id: <20230503000557.2275982-3-tharvey@gateworks.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230503000557.2275982-1-tharvey@gateworks.com> References: <20230503000557.2275982-1-tharvey@gateworks.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.8 at phobos.denx.de X-Virus-Status: Clean Determine the U-Boot env hardware partition depending on the boot device. This allows the same boot firmware image to be placed on user, boot0, or boot1 without changing CONFIG_SYS_MMC_ENV_PART. Signed-off-by: Tim Harvey --- board/gateworks/venice/venice.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/board/gateworks/venice/venice.c b/board/gateworks/venice/venice.c index ca62f0be6d25..7aca75503846 100644 --- a/board/gateworks/venice/venice.c +++ b/board/gateworks/venice/venice.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -139,6 +140,20 @@ int board_mmc_get_env_dev(int devno) return devno; } +uint mmc_get_env_part(struct mmc *mmc) +{ + if (!IS_SD(mmc)) { + switch (EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config)) { + case 1: + return 1; + case 2: + return 2; + } + } + + return 0; +} + int ft_board_setup(void *fdt, struct bd_info *bd) { const char *base_model = eeprom_get_baseboard_model(); -- 2.25.1