[PATCH] dfu: dfu_sf: Add support for multiple flashes

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@denx.de Cc: Lukasz Majewski lukma@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];

On Tue, 14 Sep 2021 05:27:51 +0200 Marek Vasut marex@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@denx.de Cc: Lukasz Majewski lukma@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;
} else if (CONFIG_IS_ENABLED(DFU_SF_PART) && (!strcmp(st, "part") || !strcmp(st, "partubi"))) { char mtd_id[32];dfu->data.sf.size = dfu->data.sf.dev->size;
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

On Tue, Sep 14, 2021 at 05:27:51AM +0200, Marek Vasut 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@denx.de Cc: Lukasz Majewski lukma@denx.de Reviewed-by: Lukasz Majewski lukma@denx.de
This breaks support for: dfu_alt_info=sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x20 0000
as used in the eficapsule update tests.

On 10/26/21 12:12 AM, Tom Rini wrote:
On Tue, Sep 14, 2021 at 05:27:51AM +0200, Marek Vasut 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@denx.de Cc: Lukasz Majewski lukma@denx.de Reviewed-by: Lukasz Majewski lukma@denx.de
This breaks support for: dfu_alt_info=sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x20 0000
as used in the eficapsule update tests.
See [PATCH v2] dfu: dfu_sf: Add support for multiple flashes

On Tue, Oct 26, 2021 at 12:18:55AM +0200, Marek Vasut wrote:
On 10/26/21 12:12 AM, Tom Rini wrote:
On Tue, Sep 14, 2021 at 05:27:51AM +0200, Marek Vasut 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@denx.de Cc: Lukasz Majewski lukma@denx.de Reviewed-by: Lukasz Majewski lukma@denx.de
This breaks support for: dfu_alt_info=sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x20 0000
as used in the eficapsule update tests.
See [PATCH v2] dfu: dfu_sf: Add support for multiple flashes
Ah thanks, sorry.

On Tue, Oct 26, 2021 at 12:18:55AM +0200, Marek Vasut wrote:
On 10/26/21 12:12 AM, Tom Rini wrote:
On Tue, Sep 14, 2021 at 05:27:51AM +0200, Marek Vasut 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@denx.de Cc: Lukasz Majewski lukma@denx.de Reviewed-by: Lukasz Majewski lukma@denx.de
This breaks support for: dfu_alt_info=sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x20 0000
as used in the eficapsule update tests.
See [PATCH v2] dfu: dfu_sf: Add support for multiple flashes
And based on the final comment there, v2 can be ignored?

On 10/26/21 12:21 AM, Tom Rini wrote:
On Tue, Oct 26, 2021 at 12:18:55AM +0200, Marek Vasut wrote:
On 10/26/21 12:12 AM, Tom Rini wrote:
On Tue, Sep 14, 2021 at 05:27:51AM +0200, Marek Vasut 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@denx.de Cc: Lukasz Majewski lukma@denx.de Reviewed-by: Lukasz Majewski lukma@denx.de
This breaks support for: dfu_alt_info=sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x20 0000
as used in the eficapsule update tests.
See [PATCH v2] dfu: dfu_sf: Add support for multiple flashes
And based on the final comment there, v2 can be ignored?
No, they are slightly different things. The DFU SF does not require MTD support, like DFU MTD does, so DFU SF is smaller in size.
participants (3)
-
Lukasz Majewski
-
Marek Vasut
-
Tom Rini