All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Jaehoon Chung <jh80.chung@samsung.com>,
	Peng Fan <peng.fan@nxp.com>, Stefan Roese <sr@denx.de>,
	Jagan Teki <jagan@amarulasolutions.com>,
	Andre Przywara <andre.przywara@arm.com>
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	[thread overview]
Message-ID: <20230413211057.10975-4-pali@kernel.org> (raw)
In-Reply-To: <20230413211057.10975-1-pali@kernel.org>

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 <pali@kernel.org>
---
 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


  parent reply	other threads:[~2023-04-13 21:12 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230703121637epcas1p38475ee827947796e877335866979abcb@epcas1p3.samsung.com>
2023-04-13 21:10 ` [PATCH u-boot 0/4] mmc: Explain and cleanup partition selection Pali Rohár
2023-04-13 21:10   ` [PATCH u-boot 1/4] mmc: spl: Make partition choice in default_spl_mmc_emmc_boot_partition() more explicit Pali Rohár
2023-07-06 17:35     ` [PATCH v2 u-boot] " Pali Rohár
2023-07-06 17:42       ` Tom Rini
2023-07-06 17:49         ` Pali Rohár
2023-07-06 17:52           ` Tom Rini
2023-07-07 16:46             ` Pali Rohár
2023-07-07 16:54               ` Tom Rini
2023-07-07 17:05                 ` Pali Rohár
2023-07-07 17:10                   ` Tom Rini
2023-07-07 17:56                     ` Pali Rohár
2023-07-07 18:17                       ` Tom Rini
2023-07-07 22:54     ` [PATCH v3 " Pali Rohár
2023-07-07 23:43       ` Tom Rini
2023-07-08  8:30         ` Pali Rohár
2023-07-08 15:28           ` Tom Rini
2023-07-09 13:08             ` Pali Rohár
2023-04-13 21:10   ` [PATCH u-boot 2/4] cmd: mvebu/bubt: Validate EXT_CSD[179] eMMC register in mmc_burn_image() Pali Rohár
2023-04-17  6:10     ` Stefan Roese
2023-04-17  7:05     ` Pali Rohár
2023-04-13 21:10   ` Pali Rohár [this message]
2023-04-14 10:48     ` [PATCH u-boot 3/4] sunxi: eMMC: Add comments explaining mapping between bootpart and mmc_switch_part() Andre Przywara
2023-04-13 21:10   ` [PATCH u-boot 4/4] board: purism: Use U-Boot mmc function for converting boot part to part access Pali Rohár
2023-04-16 15:00     ` Angus Ainslie
2023-07-03 12:16   ` [PATCH u-boot 0/4] mmc: Explain and cleanup partition selection Jaehoon Chung
2023-07-06 10:50     ` Pali Rohár
2023-07-06 17:39       ` Pali Rohár
2023-07-06 22:53         ` Jaehoon Chung
2023-07-06 22:57       ` Jaehoon Chung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230413211057.10975-4-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=andre.przywara@arm.com \
    --cc=jagan@amarulasolutions.com \
    --cc=jh80.chung@samsung.com \
    --cc=peng.fan@nxp.com \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.