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 EC725C77B61 for ; Thu, 13 Apr 2023 21:12:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B4C7985DBB; Thu, 13 Apr 2023 23:12:14 +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="eQjU8Svj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B700685DEA; Thu, 13 Apr 2023 23:12:02 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (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 C2FAC85DDD for ; Thu, 13 Apr 2023 23:11:50 +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 4288A60AF1; Thu, 13 Apr 2023 21:11:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C094C433EF; Thu, 13 Apr 2023 21:11:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681420308; bh=GjES2Zj/Gm7D60XRu6M2IAtyAgolRkwQhzwMlSgP+2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eQjU8SvjHcoRfOLwguRYv7NKlx0LdpCo8SZ/pCMyf0CYfmj6ObBLOzS26UPuombzl GtxhniOju4SBsq3Qr7zbcHNiJCJ52LZZa7q/wl+Q49T6sTH2CqM7xpIl5Noa82rA/O i0otxgTG41zEIRvQU6sZOHYuKQAtnD0Q1lczQjXXt2iWrm2EzT0kt4gtbN15oTMhnR 8ki0iYqY6N3aJp174LzW7Ol8yvWhOw6MTulabSr5xDA6s8y4QoHVBC3Du00LLTn8AS zsKV9ebFc0MzoZNQkJqp4lbST3ICZdAD8w7araxUyNOpN+Ku1UjtqsEfEhKqjf+6os v9ZYycUupa2Qw== Received: by pali.im (Postfix) id 14FEA788; Thu, 13 Apr 2023 23:11:46 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Jaehoon Chung , Peng Fan , Stefan Roese , Jagan Teki , Andre Przywara Cc: u-boot@lists.denx.de Subject: [PATCH u-boot 3/4] sunxi: eMMC: Add comments explaining mapping between bootpart and mmc_switch_part() Date: Thu, 13 Apr 2023 23:10:56 +0200 Message-Id: <20230413211057.10975-4-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230413211057.10975-1-pali@kernel.org> References: <20230413211057.10975-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 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. Signed-off-by: Pali Rohár --- arch/arm/mach-sunxi/board.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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) != 0x09) return false; - /* Partition 0 is the user data partition, bootpart must be 1 or 2. */ + /* + * bootpart == 0 means that eMMC booting is disabled. + * bootpart == 1 or 2 means to boot from Boot Partition 1 or 2. + * bootpart == 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 != 1 && bootpart != 2) return false; -- 2.20.1