From: Tom Rini <trini@konsulko.com>
To: "Pali Rohár" <pali@kernel.org>
Cc: Jaehoon Chung <jh80.chung@samsung.com>, u-boot@lists.denx.de
Subject: Re: [PATCH v2 u-boot] mmc: spl: Make partition choice in default_spl_mmc_emmc_boot_partition() more explicit
Date: Thu, 6 Jul 2023 13:42:18 -0400 [thread overview]
Message-ID: <20230706174218.GB7930@bill-the-cat> (raw)
In-Reply-To: <20230706173502.2796-1-pali@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 4049 bytes --]
On Thu, Jul 06, 2023 at 07:35:02PM +0200, Pali Rohár wrote:
> To make eMMC partition choosing in default_spl_mmc_emmc_boot_partition()
> function better understandable, rewrite it via explicit switch-case code
> pattern.
>
> Also add a warning when eMMC EXT_CSD[179] register is configured by user to
> value which is not suitable for eMMC booting and SPL do not know how to
> interpret it.
>
> Note that when booting from eMMC device via EXT_CSD[179] register is
> explicitly disabled then SPL still loads and boots from this eMMC device
> from User Area partition. This behavior was not changed in this commit and
> should be revisited in the future.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> Changes in v2:
> * Disable showing warning on sama5d2_xplained due to size restrictions
> ---
> This patch depends on another patch:
> mmc: spl: Add comments for default_spl_mmc_emmc_boot_partition()
> https://patchwork.ozlabs.org/project/uboot/patch/20230404202805.8523-1-pali@kernel.org/
> ---
> common/spl/Kconfig | 7 +++++++
> common/spl/spl_mmc.c | 46 ++++++++++++++++++++++++++++++++++++--------
> 2 files changed, 45 insertions(+), 8 deletions(-)
>
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 865571d4579c..0574d22b3b25 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -855,6 +855,13 @@ config SPL_MMC_WRITE
> help
> Enable write access to MMC and SD Cards in SPL
>
> +config SPL_MMC_WARNINGS
> + bool "Print MMC warnings"
> + depends on SPL_MMC
> + default y if !TARGET_SAMA5D2_XPLAINED
> + help
> + Print SPL MMC warnings. You can disable this option to reduce SPL size.
> +
>
> config SPL_MPC8XXX_INIT_DDR
> bool "Support MPC8XXX DDR init"
> diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
> index f7a42a11477d..ec424ceded0e 100644
> --- a/common/spl/spl_mmc.c
> +++ b/common/spl/spl_mmc.c
> @@ -408,15 +408,45 @@ int default_spl_mmc_emmc_boot_partition(struct mmc *mmc)
> *
> * Note: See difference between EXT_CSD_EXTRACT_PARTITION_ACCESS
> * and EXT_CSD_EXTRACT_BOOT_PART, specially about User area value.
> - *
> - * FIXME: When booting from this eMMC device is explicitly
> - * disabled then we use User area for booting. This is incorrect.
> - * Probably we should skip this eMMC device and select the next
> - * one for booting. Or at least throw warning about this fallback.
> */
> - part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
> - if (part == 7)
> - part = 0;
> + if (mmc->part_config == MMCPART_NOAVAILABLE)
> + part = 0; /* If partitions are not supported then we have only User Area partition */
> + else {
> + switch(EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config)) {
> + case 0: /* Booting from this eMMC device is disabled */
> +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
> +#ifdef CONFIG_SPL_MMC_WARNINGS
> + puts("spl: WARNING: Booting from this eMMC device is disabled in EXT_CSD[179] register\n");
> + puts("spl: WARNING: Continuing anyway and selecting User Area partition for booting\n");
> +#else
> + puts("spl: mmc: fallback to user area\n");
> +#endif
> +#endif
> + /* FIXME: This is incorrect and probably we should select next eMMC device for booting */
> + part = 0;
> + break;
> + case 1: /* Boot partition 1 is used for booting */
> + part = 1;
> + break;
> + case 2: /* Boot partition 2 is used for booting */
> + part = 2;
> + break;
> + case 7: /* User area is used for booting */
> + part = 0;
> + break;
> + default: /* Other values are reserved */
> +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
> +#ifdef CONFIG_SPL_MMC_WARNINGS
> + puts("spl: WARNING: EXT_CSD[179] register is configured to boot from Reserved value\n");
> + puts("spl: WARNING: Selecting User Area partition for booting\n");
> +#else
> + puts("spl: mmc: fallback to user area\n");
> +#endif
> +#endif
> + part = 0;
> + break;
> + }
> + }
> #endif
Please just use debug() for these messages.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
next prev parent reply other threads:[~2023-07-06 17:42 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 [this message]
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 ` [PATCH u-boot 3/4] sunxi: eMMC: Add comments explaining mapping between bootpart and mmc_switch_part() Pali Rohár
2023-04-14 10:48 ` 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=20230706174218.GB7930@bill-the-cat \
--to=trini@konsulko.com \
--cc=jh80.chung@samsung.com \
--cc=pali@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox