mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
dfu: dfu_sf: Read the SPI flash in 16 MiB chunks
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> Reviewed-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
parent
949eb228f3
commit
ca341e98c8
1 changed files with 12 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue