From: Lukasz Majewski <lukma@denx.de>
To: Marek Vasut <marex@denx.de>
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH] dfu: dfu_sf: Read the SPI flash in 16 MiB chunks
Date: Tue, 14 Sep 2021 11:31:18 +0200 [thread overview]
Message-ID: <20210914113118.2253842c@ktm> (raw)
In-Reply-To: <20210914032651.273567-1-marex@denx.de>
[-- Attachment #1: Type: text/plain, Size: 1505 bytes --]
On Tue, 14 Sep 2021 05:26:51 +0200
Marek Vasut <marex@denx.de> wrote:
> Not all SPI flashes and controllers can do continuous transfer longer
> than 16 MiB, so perform the DFU read in 16 MiB chunks.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Lukasz Majewski <lukma@denx.de>
> ---
> drivers/dfu/dfu_sf.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c
> index 7e64ab772f0..b72493ced86 100644
> --- a/drivers/dfu/dfu_sf.c
> +++ b/drivers/dfu/dfu_sf.c
> @@ -24,8 +24,18 @@ static int dfu_get_medium_size_sf(struct
> dfu_entity *dfu, u64 *size) static int dfu_read_medium_sf(struct
> dfu_entity *dfu, u64 offset, void *buf, long *len)
> {
> - return spi_flash_read(dfu->data.sf.dev, dfu->data.sf.start +
> offset,
> - *len, buf);
> + long seglen = *len;
> + int ret;
> +
> + if (seglen > (16 << 20))
> + seglen = (16 << 20);
> +
> + ret = spi_flash_read(dfu->data.sf.dev, dfu->data.sf.start +
> offset,
> + seglen, buf);
> + if (!ret)
> + *len = seglen;
> +
> + return ret;
> }
>
> static u64 find_sector(struct dfu_entity *dfu, u64 start, u64 offset)
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-09-14 9:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-14 3:26 [PATCH] dfu: dfu_sf: Read the SPI flash in 16 MiB chunks Marek Vasut
2021-09-14 9:31 ` Lukasz Majewski [this message]
2021-10-22 22:34 ` Marek Vasut
2021-10-25 6:30 ` Lukasz Majewski
2021-10-26 13:34 ` Tom Rini
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=20210914113118.2253842c@ktm \
--to=lukma@denx.de \
--cc=marex@denx.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.