From: Jonas Rebmann <jre@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH] ARM: boards: colibri-imx6: make BBU setting independent of DT alias
Date: Mon, 27 Jan 2025 16:24:50 +0100 [thread overview]
Message-ID: <72a19f3e-fb25-43bd-aba8-72ad37a580b6@pengutronix.de> (raw)
In-Reply-To: <20250127110252.735402-1-a.fatoum@pengutronix.de>
Hi Ahmad,
On 1/27/25 12:02 PM, Ahmad Fatoum wrote:
> Different baseboards may shuffle around the eMMC/SD aliases differently
> and thus the barebox update handler registration may not be correct
> across all of them.
>
> Instead of hardcoding the eMMC device and SD device, let's derive the
> correct index dynamically at runtime using the mapping that the barebox
> bootsource code is already using.
>
> Reported-by: Jonas Rebmann <jre@pengutronix.de>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Reviewed-by: Jonas Rebmann <jre@pengutronix.de>
> ---
> Jonas, can you give this a test and see if it works for you?
Works as it should, thank you!
> ---
> arch/arm/boards/toradex-colibri-imx6/board.c | 24 +++++++++++++++++---
> 1 file changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/boards/toradex-colibri-imx6/board.c b/arch/arm/boards/toradex-colibri-imx6/board.c
> index f3a6173e5064..5771b08cbacb 100644
> --- a/arch/arm/boards/toradex-colibri-imx6/board.c
> +++ b/arch/arm/boards/toradex-colibri-imx6/board.c
> @@ -9,6 +9,14 @@
> #include <mach/imx/imx6.h>
> #include <mfd/imx6q-iomuxc-gpr.h>
>
> +/*
> + * The upstream device tree shuffles around the eMMC/SD indices, so the
> + * board code here takes care to use the numbering of the SoC reference
> + * manual
> + */
> +#define COLIBRI_MMC_INSTANCE_SD 0
> +#define COLIBRI_MMC_INSTANCE_EMMC 2
> +
> static void eth_init(void)
> {
> void __iomem *iomux = IOMEM(MX6_IOMUXC_BASE_ADDR);
> @@ -22,9 +30,19 @@ static void eth_init(void)
>
> static int colibri_imx6_probe(struct device *dev)
> {
> - imx6_bbu_internal_mmcboot_register_handler("emmc", "/dev/mmc0",
> - BBU_HANDLER_FLAG_DEFAULT);
> - imx6_bbu_internal_mmc_register_handler("sd", "/dev/mmc1", 0);
> + int emmc_alias, sd_alias;
> +
> + emmc_alias = bootsource_of_alias_xlate(BOOTSOURCE_MMC, COLIBRI_MMC_INSTANCE_EMMC);
> + if (emmc_alias >= 0)
> + imx6_bbu_internal_mmcboot_register_handler("emmc",
> + basprintf("/dev/mmc%u", emmc_alias),
> + BBU_HANDLER_FLAG_DEFAULT);
> +
> + sd_alias = bootsource_of_alias_xlate(BOOTSOURCE_MMC, COLIBRI_MMC_INSTANCE_SD);
> + if (sd_alias >= 0)
> + imx6_bbu_internal_mmc_register_handler("sd",
> + basprintf("/dev/mmc%u", sd_alias),
> + 0);
>
> barebox_set_hostname("colibri-imx6");
>
next prev parent reply other threads:[~2025-01-27 15:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-27 11:02 Ahmad Fatoum
2025-01-27 15:24 ` Jonas Rebmann [this message]
2025-01-28 10:08 ` Sascha Hauer
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=72a19f3e-fb25-43bd-aba8-72ad37a580b6@pengutronix.de \
--to=jre@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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