From mboxrd@z Thu Jan 1 00:00:00 1970 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 CF2D5C77B6E for ; Fri, 14 Apr 2023 10:49:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E4AB585AFF; Fri, 14 Apr 2023 12:49:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.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 D0544859C4; Fri, 14 Apr 2023 12:49:00 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 2CE6D85CB1 for ; Fri, 14 Apr 2023 12:48:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0388A2F4; Fri, 14 Apr 2023 03:49:42 -0700 (PDT) Received: from donnerap.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B296E3F587; Fri, 14 Apr 2023 03:48:56 -0700 (PDT) Date: Fri, 14 Apr 2023 11:48:54 +0100 From: Andre Przywara To: Pali =?UTF-8?B?Um9ow6Fy?= Cc: Jaehoon Chung , Peng Fan , Stefan Roese , Jagan Teki , u-boot@lists.denx.de Subject: Re: [PATCH u-boot 3/4] sunxi: eMMC: Add comments explaining mapping between bootpart and mmc_switch_part() Message-ID: <20230414114854.6ca4fc09@donnerap.cambridge.arm.com> In-Reply-To: <20230413211057.10975-4-pali@kernel.org> References: <20230413211057.10975-1-pali@kernel.org> <20230413211057.10975-4-pali@kernel.org> Organization: ARM X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; aarch64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 Thu, 13 Apr 2023 23:10:56 +0200 Pali Roh=C3=A1r wrote: > Mapping between bootpart taken from EXT_CSD_EXTRACT_BOOT_PART() and > Partition Access bits used by the mmc_switch_part() function may be quite > misleading. So add extended comment describing why in sunxi case is this > mapping just a simple identity. Because in generic case this mapping > requires non-trivial mapping table. Ah, indeed, many thanks for clearing this up! I missed the subtleties of bootpart meaning slightly different things between EXT_CSD_EXTRACT_BOOT_PART and mmc_switch_part(). It looks like we were quite lucky as we only care about 1 and 2 here! > Signed-off-by: Pali Roh=C3=A1r Acked-by: Andre Przywara Queued for sunxi/master. Cheers, Andre > --- > arch/arm/mach-sunxi/board.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) >=20 > diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c > index 391a65a5495f..73519f6262ec 100644 > --- a/arch/arm/mach-sunxi/board.c > +++ b/arch/arm/mach-sunxi/board.c > @@ -381,7 +381,17 @@ static bool sunxi_valid_emmc_boot(struct mmc *mmc) > (mmc->ext_csd[EXT_CSD_BOOT_BUS_WIDTH] & 0x1b) !=3D 0x09) > return false; > =20 > - /* Partition 0 is the user data partition, bootpart must be 1 or 2. */ > + /* > + * bootpart =3D=3D 0 means that eMMC booting is disabled. > + * bootpart =3D=3D 1 or 2 means to boot from Boot Partition 1 or 2. > + * bootpart =3D=3D 7 means to boot from User Area. > + * Other bootpart values are reserved. > + * mmc_switch_part() takes partition access value which is: > + * 0 for User Area; 1-2 for Boot Partition 1-2; 3 for RPMB; 4-7 for GP = 1-4. > + * We allow booting only from Boot Partition 1 or 2 so > + * bootpart mapping between EXT_CSD_EXTRACT_BOOT_PART() > + * and mmc_switch_part() is straightforward identity. > + */ > if (bootpart !=3D 1 && bootpart !=3D 2) > return false; > =20