All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dfu: dfu_sf: Add support for multiple flashes
@ 2021-09-14  3:27 Marek Vasut
  2021-09-14  9:31 ` Lukasz Majewski
  2021-10-25 22:12 ` Tom Rini
  0 siblings, 2 replies; 7+ messages in thread
From: Marek Vasut @ 2021-09-14  3:27 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Lukasz Majewski

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];
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] dfu: dfu_sf: Add support for multiple flashes
  2021-09-14  3:27 [PATCH] dfu: dfu_sf: Add support for multiple flashes Marek Vasut
@ 2021-09-14  9:31 ` Lukasz Majewski
  2021-10-25 22:12 ` Tom Rini
  1 sibling, 0 replies; 7+ messages in thread
From: Lukasz Majewski @ 2021-09-14  9:31 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 2171 bytes --]

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;
> +		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@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 --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dfu: dfu_sf: Add support for multiple flashes
  2021-09-14  3:27 [PATCH] dfu: dfu_sf: Add support for multiple flashes Marek Vasut
  2021-09-14  9:31 ` Lukasz Majewski
@ 2021-10-25 22:12 ` Tom Rini
  2021-10-25 22:18   ` Marek Vasut
  1 sibling, 1 reply; 7+ messages in thread
From: Tom Rini @ 2021-10-25 22:12 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Lukasz Majewski

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

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.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dfu: dfu_sf: Add support for multiple flashes
  2021-10-25 22:12 ` Tom Rini
@ 2021-10-25 22:18   ` Marek Vasut
  2021-10-25 22:19     ` Tom Rini
  2021-10-25 22:21     ` Tom Rini
  0 siblings, 2 replies; 7+ messages in thread
From: Marek Vasut @ 2021-10-25 22:18 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, Lukasz Majewski

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dfu: dfu_sf: Add support for multiple flashes
  2021-10-25 22:18   ` Marek Vasut
@ 2021-10-25 22:19     ` Tom Rini
  2021-10-25 22:21     ` Tom Rini
  1 sibling, 0 replies; 7+ messages in thread
From: Tom Rini @ 2021-10-25 22:19 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Lukasz Majewski

[-- Attachment #1: Type: text/plain, Size: 852 bytes --]

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.


-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dfu: dfu_sf: Add support for multiple flashes
  2021-10-25 22:18   ` Marek Vasut
  2021-10-25 22:19     ` Tom Rini
@ 2021-10-25 22:21     ` Tom Rini
  2021-10-25 22:34       ` Marek Vasut
  1 sibling, 1 reply; 7+ messages in thread
From: Tom Rini @ 2021-10-25 22:21 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Lukasz Majewski

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]

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?

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dfu: dfu_sf: Add support for multiple flashes
  2021-10-25 22:21     ` Tom Rini
@ 2021-10-25 22:34       ` Marek Vasut
  0 siblings, 0 replies; 7+ messages in thread
From: Marek Vasut @ 2021-10-25 22:34 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, Lukasz Majewski

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-25 22:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14  3:27 [PATCH] dfu: dfu_sf: Add support for multiple flashes Marek Vasut
2021-09-14  9:31 ` Lukasz Majewski
2021-10-25 22:12 ` Tom Rini
2021-10-25 22:18   ` Marek Vasut
2021-10-25 22:19     ` Tom Rini
2021-10-25 22:21     ` Tom Rini
2021-10-25 22:34       ` Marek Vasut

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.