From patchwork Thu Jan 5 14:28:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1721892 X-Patchwork-Delegate: jh80.chung@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=R/1+l1qV; dkim=pass (2048-bit key) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=wJb84CBO; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nnpkm6Hd6z23fC for ; Fri, 6 Jan 2023 01:29:20 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D3D3F855A9; Thu, 5 Jan 2023 15:29:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1672928947; bh=GCn2Mqso8RR8q8qup0GiIizEvFr65Gdy4F88uIeeoIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=R/1+l1qViH08ALXGomfECi4NwcHSDAJSPJytRZI54Zsc5G2AyDJf6DiSbH2subn5q D1JBiJUQCG/QvpbMmmGjDh7NiKwbLtybA+uz4C48422/WiK0F90DDc5qf2OvDQl/7S ktIegCjwviwvF0tuv8KOdgRSN6R1SgDQM/iWBF+ssFZGUdEj9iZLmTjDvlHJTUYMju N/CgyxGDpNQOcerrFqHW8xdLW8Sn65OJINvfnh347lqUUww1xXbIVkC2/9as5TG/GW HdjPwAXGYrW8j1qhzl24mv6C6XMc+qff5EtSFpN4r8T/TmK5jQZzNUkzd9hSq09MK4 iKmX9AHCvKQoQ== Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id E3A9E85248; Thu, 5 Jan 2023 15:29:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1672928941; bh=GCn2Mqso8RR8q8qup0GiIizEvFr65Gdy4F88uIeeoIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wJb84CBO8uDphOmQ9qPI7El/nObizFr7c9WT92R+//gpi6/kHjziqfgEkyW4WnF7k VAK90jM+5bVC2DVeYeSsG8IdgNtso/UHKcHrNH737IBlQm59CZOIB8F1Oj2YHJnywi 6st7KI3TgdI18GXyTjKnZV7O1ImXjl/iedftyBqOS1mJSMB8HPGnl4AzTxFHzDcNfi arMv3x1ISgaiVIwH8289yLmAUQ91c/2C5NOUir+GvSMD4mg7ziTwrAA5qK/mJlUhL3 JdUmG5z4f0kyw1DjKXhE9kH4FeJyx0aO5fQbvVOe1T51NlQludfjkv4+Yf1lZ9Duly GZdSeFb55TCJw== From: Marek Vasut To: u-boot@lists.denx.de Cc: Marek Vasut , Fedor Ross , Jaehoon Chung , Peng Fan Subject: [PATCH 2/2] spl: mmc: Pass eMMC HW partition 7 through Date: Thu, 5 Jan 2023 15:28:31 +0100 Message-Id: <20230105142831.163381-2-marex@denx.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105142831.163381-1-marex@denx.de> References: <20230105142831.163381-1-marex@denx.de> MIME-Version: 1.0 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 The eMMC HW partition 0 and 7 both mean USER HW partition. Use this as a mean of propagating A/B copy selection within USER HW partition. The spl_mmc_get_uboot_raw_sector() can detect that a USER HW partition is in use and based on whether it is 0 or 7, select appropriate sector to load from. Signed-off-by: Fedor Ross Signed-off-by: Marek Vasut --- Cc: Jaehoon Chung Cc: Peng Fan --- common/spl/spl_mmc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 8a0c7331267..d634ccb0b9a 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -420,7 +420,7 @@ int spl_mmc_load(struct spl_image_info *spl_image, static struct mmc *mmc; u32 boot_mode; int err = 0; - __maybe_unused int hw_part = 0; + __maybe_unused int part, hw_part = 0; int mmc_dev; /* Perform peripheral init only once for an mmc device */ @@ -445,11 +445,12 @@ int spl_mmc_load(struct spl_image_info *spl_image, switch (boot_mode) { case MMCSD_MODE_EMMCBOOT: hw_part = spl_mmc_emmc_boot_partition(mmc); + part = hw_part == 7 ? 0 : hw_part; if (CONFIG_IS_ENABLED(MMC_TINY)) - err = mmc_switch_part(mmc, hw_part); + err = mmc_switch_part(mmc, part); else - err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), hw_part); + err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part); if (err) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT @@ -479,7 +480,7 @@ int spl_mmc_load(struct spl_image_info *spl_image, #endif #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR err = mmc_load_image_raw_sector(spl_image, bootdev, mmc, - raw_sect + spl_mmc_raw_uboot_offset(hw_part)); + raw_sect + spl_mmc_raw_uboot_offset(part)); if (!err) return err; #endif