public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mario Kicherer <dev@kicherer.org>
To: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de, sbabic@denx.de, festevam@gmail.com,
	uboot-imx@nxp.com, daniel.schwierzeck@gmail.com,
	weijie.gao@mediatek.com, GSS_MTK_Uboot_upstream@mediatek.com,
	rick@andestech.com, ycliang@andestech.com
Subject: Re: [PATCH v2 1/2] spl: spl_nor: add BOOT_DEVICE_NOR2 as alternative SPL_LOAD_IMAGE_METHOD
Date: Fri, 27 Jan 2023 17:56:48 +0100	[thread overview]
Message-ID: <cd0d283def8d625f308243ea95ef48e8@kicherer.org> (raw)
In-Reply-To: <Y9LRzntw7PlH+IGR@bill-the-cat>

Hello Tom,

On 2023-01-26 20:17, Tom Rini wrote:
> This breaks a lot of platforms, as it only covers a few of the cases
> where BOOT_DEVICE_NOR is listed. I would also really like to see how
> this ends up being used in the board specific case as I do wonder if we
> can't solve this some other way that won't have impact so many other
> platforms.  Thanks!

Hm, I did a grep through the source code and that were the only places
where the new value is used as part of an enum. BOOT_DEVICE_NOR is used
in more places but they also #define this themselves - if I did not
miss something.

Furthermore, BOOT_DEVICE_NOR2 will not be used by default. A board has
to define its own board_boot_order() function like this to use the new
BOOT_DEVICE_NOR2 value:

void board_boot_order(u32 *spl_boot_list)
{
	spl_boot_list[0] = BOOT_DEVICE_NOR;
	spl_boot_list[1] = BOOT_DEVICE_NOR2;
}

If they do not explicitly add BOOT_DEVICE_NOR2, they should not be
affected by this patch, as far as I understood the code. I tried to
model this similar to the BOOT_DEVICE_MMC1 and _MMC2 values.

Then, they can also define an own spl_nor_get_uboot_base() like the
following that should return an address where U-Boot tries to load
a valid image:

unsigned long spl_nor_get_uboot_base(struct spl_boot_device *bootdev)
{
         if (bootdev->boot_device == BOOT_DEVICE_NOR) {
                 /* first address that is tried */
                 return UBOOT_PARTITION_1_IN_NOR;
         else if (bootdev->boot_device == BOOT_DEVICE_NOR2) {
                 /*
                  * if loading of the first image failed for whatever
                  * reason, try this address as well:
                  */
                 return UBOOT_PARTITION_2_IN_NOR;
         }
}

With this patch, it is possible to provide a fallback U-Boot image like
above or to use an A/B slot scheme in case a bootloader update could be
necessary in the field in the future.

Best regards,
Mario

  reply	other threads:[~2023-01-27 16:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 15:28 [PATCH v2 0/2] spl: spl_nor: add alternative SPL_LOAD_IMAGE_METHOD Mario Kicherer
2023-01-19 15:28 ` [PATCH v2 1/2] spl: spl_nor: add BOOT_DEVICE_NOR2 as " Mario Kicherer
2023-01-26 19:17   ` Tom Rini
2023-01-27 16:56     ` Mario Kicherer [this message]
2023-01-27 17:10       ` Tom Rini
2023-01-27 17:55         ` Mario Kicherer
2023-01-27 17:58           ` Tom Rini
2023-01-30 10:17             ` Mario Kicherer
2023-01-19 15:28 ` [PATCH v2 2/2] spl: spl_nor: add spl_boot_device parameter to spl_nor_get_uboot_base() Mario Kicherer

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=cd0d283def8d625f308243ea95ef48e8@kicherer.org \
    --to=dev@kicherer.org \
    --cc=GSS_MTK_Uboot_upstream@mediatek.com \
    --cc=daniel.schwierzeck@gmail.com \
    --cc=festevam@gmail.com \
    --cc=rick@andestech.com \
    --cc=sbabic@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    --cc=weijie.gao@mediatek.com \
    --cc=ycliang@andestech.com \
    /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