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 734D3C7EE21 for ; Wed, 3 May 2023 00:06:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BF6828473B; Wed, 3 May 2023 02:06:13 +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 3EF1284733; Wed, 3 May 2023 02:06:09 +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 598A28472D 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 1pu00P-0059KV-Qb; Wed, 03 May 2023 00:06:01 +0000 From: Tim Harvey To: sbabic@denx.de, Fabio Estevam Cc: u-boot@lists.denx.de, Tim Harvey Subject: [PATCH 1/5] board: gateworks: venice: dynamically determine U-Boot raw sector Date: Tue, 2 May 2023 17:05:53 -0700 Message-Id: <20230503000557.2275982-2-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 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR needs to adjust for IMX8MN and IMX8MP when booting from an eMMC boot partition due to IMX BOOTROM v2 using an SPL offset of 0 for boot partitions and 32K for the user partition. In order to allow the same firmware to run on both user and boot hardware partitions adjust raw_sect dynamically at runtime. Signed-off-by: Tim Harvey --- board/gateworks/venice/spl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/board/gateworks/venice/spl.c b/board/gateworks/venice/spl.c index 4eb7bdfcee67..50056da3ee0f 100644 --- a/board/gateworks/venice/spl.c +++ b/board/gateworks/venice/spl.c @@ -327,6 +327,21 @@ int spl_board_boot_device(enum boot_device boot_dev_spl) } } +unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc, unsigned long raw_sect) +{ + if (!IS_SD(mmc)) { + switch (EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config)) { + case 1: + case 2: + if (IS_ENABLED(CONFIG_IMX8MN) || IS_ENABLED(CONFIG_IMX8MP)) + raw_sect -= 32 * 2; + break; + } + } + + return raw_sect; +} + const char *spl_board_loader_name(u32 boot_device) { switch (boot_device) { -- 2.25.1