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 5F2C4C77B60 for ; Tue, 4 Apr 2023 19:26:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8F85185D1E; Tue, 4 Apr 2023 21:26:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="ss6jdkIO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1D1E685AEC; Tue, 4 Apr 2023 21:26:08 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6BBE585D1E for ; Tue, 4 Apr 2023 21:26:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A141B6391C; Tue, 4 Apr 2023 19:25:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E281CC433D2; Tue, 4 Apr 2023 19:25:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680636358; bh=sryYE0yxiK7bpQFUMtg33rGDDIFctzi2VDzi2wOm3Wk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ss6jdkIOiAv79LNvkqg80hA7TP01Ry8O1x9uQ2BpeicZC5h+R2FGFvpLvvVp4QgvS DVLCnTNmJZJSczSGoOJUJQdEnCsEseBCVrY/eiBsCNJntrZXjJzUhwXVKI10YbkqV3 UpJB515aVfmGdLytoFapGRyQqRtYKnD3Wm4Q+eB/m6tQtsOnGNGuf8BZKYJ0epgJbB VsY1TSj7vcSpkbQgwNtHZfVY3ewUNKLAfc5vzZD9JjdUmwR2fmxWwOH9W/GI4FHyQx PilAz4Ut7mRQPirOptbmbfLpHmNLt3+j4lgT2WYDAJnpymBCMctNZECQZA3yrOVTUU dEvo1YG1TRZ7g== Received: by pali.im (Postfix) id 0D93CCD5; Tue, 4 Apr 2023 21:25:54 +0200 (CEST) Date: Tue, 4 Apr 2023 21:25:54 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Marek Vasut Cc: u-boot@lists.denx.de, Fedor Ross , Jaehoon Chung , Peng Fan Subject: Re: [PATCH v3 2/2] spl: mmc: Pass eMMC HW partition 7 through Message-ID: <20230404192554.tomt56cdsxn6qhwh@pali> References: <20230404180515.49821-1-marex@denx.de> <20230404180515.49821-2-marex@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230404180515.49821-2-marex@denx.de> User-Agent: NeoMutt/20180716 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 On Tuesday 04 April 2023 20:05:15 Marek Vasut wrote: > The eMMC HW partition 0 and 7 both mean USER HW partition. This is not truth! > 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 > --- > V2: Initialize the part variable, else it is passed uninitialized to > mmc_load_image_raw_sector(..raw_sect + spl_mmc_raw_uboot_offset(part)); > and that prevents pine64 from booting. Interestingly enough, there > is no warning emitted, which sounds like a compiler bug. > V3: Update on u-boot/master > --- > 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 f1f87d78ba7..865c395b9fe 100644 > --- a/common/spl/spl_mmc.c > +++ b/common/spl/spl_mmc.c > @@ -412,7 +412,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 = 0, hw_part = 0; > int mmc_dev; > > /* Perform peripheral init only once for an mmc device */ > @@ -437,11 +437,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; ... and so this change will break accessing eMMC part 7 / GP4. > > 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 > @@ -471,7 +472,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 > -- > 2.39.2 >