[PATCH] dfu: dfu_sf: Add support for multiple flashes
Lukasz Majewski
lukma at denx.de
Tue Sep 14 11:31:48 CEST 2021
On Tue, 14 Sep 2021 05:27:51 +0200
Marek Vasut <marex at denx.de> wrote:
> Add dfu_alt_info option which allows specifying multiple SPI flashes
> as an alt info. The syntax is as follows:
>
> altname sf bus:cs[:speed[:mode]]
>
> Example:
> dfu_alt_info=qspi0 sf 0:0;qspi1 sf 0:1
>
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Lukasz Majewski <lukma at denx.de>
> ---
> drivers/dfu/dfu_sf.c | 21 +++++++++++++++------
> 1 file changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c
> index b72493ced86..d246e1b21ff 100644
> --- a/drivers/dfu/dfu_sf.c
> +++ b/drivers/dfu/dfu_sf.c
> @@ -168,22 +168,31 @@ static struct spi_flash *parse_dev(char *devstr)
> int dfu_fill_entity_sf(struct dfu_entity *dfu, char *devstr, char *s)
> {
> char *st;
> - char *devstr_bkup = strdup(devstr);
> -
> - dfu->data.sf.dev = parse_dev(devstr_bkup);
> - free(devstr_bkup);
> - if (!dfu->data.sf.dev)
> - return -ENODEV;
>
> dfu->dev_type = DFU_DEV_SF;
> dfu->max_buf_size = dfu->data.sf.dev->sector_size;
>
> st = strsep(&s, " ");
> if (!strcmp(st, "raw")) {
> + char *devstr_bkup = strdup(devstr);
> + dfu->data.sf.dev = parse_dev(devstr_bkup);
> + free(devstr_bkup);
> + if (!dfu->data.sf.dev)
> + return -ENODEV;
> +
> dfu->layout = DFU_RAW_ADDR;
> dfu->data.sf.start = hextoul(s, &s);
> s++;
> dfu->data.sf.size = hextoul(s, &s);
> + } else if (!strcmp(st, "sf")) {
> + st = strsep(&s, " ");
> + dfu->data.sf.dev = parse_dev(st);
> + if (!dfu->data.sf.dev)
> + return -ENODEV;
> +
> + dfu->layout = DFU_RAW_ADDR;
> + dfu->data.sf.start = 0;
> + dfu->data.sf.size = dfu->data.sf.dev->size;
> } else if (CONFIG_IS_ENABLED(DFU_SF_PART) &&
> (!strcmp(st, "part") || !strcmp(st, "partubi"))) {
> char mtd_id[32];
Reviewed-by: Lukasz Majewski <lukma at 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 at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210914/4eb35b76/attachment.sig>
More information about the U-Boot
mailing list