public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH resend 2/2] env: add CONFIG_ENV_SECT_SIZE_AUTO
Date: Sun, 18 Apr 2021 08:46:06 -0400	[thread overview]
Message-ID: <20210418124606.GT1310@bill-the-cat> (raw)
In-Reply-To: <20210414185143.4148401-3-rasmus.villemoes@prevas.dk>

On Wed, Apr 14, 2021 at 08:51:43PM +0200, Rasmus Villemoes wrote:

> This is roughly the U-Boot side equivalent to commit
> e282c422e0 (tools: fw_env: use erasesize from MEMGETINFO ioctl). The
> motivation is the case where one has a board with several revisions,
> where the SPI flashes have different erase sizes.
> 
> In our case, we have an 8K environment, and the flashes have erase
> sizes of 4K (newer boards) and 64K (older boards). Currently, we must
> set CONFIG_ENV_SECT_SIZE to 64K to make the code work on the older
> boards, but for the newer ones, that ends up wasting quite a bit of
> time reading/erasing/restoring the last 56K.
> 
> At first, I wanted to allow setting CONFIG_ENV_SECT_SIZE to 0 to mean
> "use the erase size the chip reports", but that config
> option is used in a number of preprocessor conditionals, and shared
> between ENV_IS_IN_FLASH and ENV_IS_IN_SPI_FLASH.
> 
> So instead, introduce a new boolean config option, which for now can
> only be used with ENV_IS_IN_SPI_FLASH. If left off, there's no change
> in behaviour.
> 
> The only slightly annoying detail is that, when selected, the compiler
> is apparently not smart enough to see that the the saved_size and
> saved_offset variables are only used under the same "if (sect_size >
> CONFIG_ENV_SIZE)" condition as where they are computed, so we need to
> initialize them to 0 to avoid "may be used uninitialized" warnings.
> 
> On our newer boards with the 4K erase size, saving the environment now
> takes 0.080 seconds instead of 0.53 seconds, which directly translates
> to that much faster boot time since our logic always causes the
> environment to be written during boot.
> 
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210418/85813240/attachment.sig>

      reply	other threads:[~2021-04-18 12:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 18:51 [PATCH resend 0/2] add CONFIG_ENV_SECT_SIZE_AUTO Rasmus Villemoes
2021-04-14 18:51 ` [PATCH resend 1/2] env/sf.c: use a variable to hold the sector size Rasmus Villemoes
2021-04-18 12:46   ` Tom Rini
2021-04-14 18:51 ` [PATCH resend 2/2] env: add CONFIG_ENV_SECT_SIZE_AUTO Rasmus Villemoes
2021-04-18 12:46   ` Tom Rini [this message]

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=20210418124606.GT1310@bill-the-cat \
    --to=trini@konsulko.com \
    --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