[PATCH 04/15] nand: spl_loaders: Only read enough pages to load the image
Michael Nazzareno Trimarchi
michael at amarulasolutions.com
Sun Oct 29 14:08:00 CET 2023
Hi
On Sun, Oct 29, 2023 at 4:48 AM Sean Anderson <seanga2 at gmail.com> wrote:
>
> All other implementations of nand_spl_load_image only read as many pages as
> are necessary to load the image. However, nand_spl_loaders.c loads the full
> block. Align it with other load functions so that it is easier to
> determine how large of a load buffer we need.
>
> Signed-off-by: Sean Anderson <seanga2 at gmail.com>
> ---
>
> drivers/mtd/nand/raw/nand_spl_loaders.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/raw/nand_spl_loaders.c b/drivers/mtd/nand/raw/nand_spl_loaders.c
> index 8848cb27db9..f071b5b57f5 100644
> --- a/drivers/mtd/nand/raw/nand_spl_loaders.c
> +++ b/drivers/mtd/nand/raw/nand_spl_loaders.c
> @@ -12,8 +12,11 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
> while (block <= lastblock) {
> if (!nand_is_bad_block(block)) {
> /* Skip bad blocks */
> - while (page < SYS_NAND_PAGE_COUNT) {
> + while (size && page < SYS_NAND_PAGE_COUNT) {
> nand_read_page(block, page, dst);
> +
> + size -= min(size, CONFIG_SYS_NAND_PAGE_SIZE -
> + page_offset);
> /*
> * When offs is not aligned to page address the
> * extra offset is copied to dst as well. Copy
> --
> 2.37.1
>
Reviewed-by: Michael Trimarchi <michael at amarulasolutions.com>
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael at amarulasolutions.com
__________________________________
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info at amarulasolutions.com
www.amarulasolutions.com
More information about the U-Boot
mailing list