public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] DFU support for qspi on dra7xx
@ 2015-10-20  9:51 Vignesh R
  2015-10-20  9:52 ` [U-Boot] [PATCH 1/2] dfu: dfu_sf: Pass duplicate devstr to parse_dev Vignesh R
  2015-10-20  9:52 ` [U-Boot] [PATCH 2/2] ARM: dra7xx_evm: Add DFU support for qspi flash Vignesh R
  0 siblings, 2 replies; 9+ messages in thread
From: Vignesh R @ 2015-10-20  9:51 UTC (permalink / raw)
  To: u-boot


Hi,

This patch series adds DFU support to update firmware on qspi flash on
DRA74 EVM. 
The first patch fixes a bug in DFU SF backend. Second patch adds enables
CONFIG_DFU_SF and adds dfu-alt_info string to support qspi partitions.

Tested on DRA74 EVM by flashing MLO and u-boot.img to QSPI flash using
via DFU and then booting the board in QSPI boot mode.

Vignesh R (2):
  dfu: dfu_sf: Pass duplicate devstr to parse_dev
  ARM: dra7xx_evm: Add DFU support for qspi flash

 drivers/dfu/dfu_sf.c         |  4 +++-
 include/configs/dra7xx_evm.h | 16 +++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

-- 
2.6.2

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

* [U-Boot] [PATCH 1/2] dfu: dfu_sf: Pass duplicate devstr to parse_dev
  2015-10-20  9:51 [U-Boot] [PATCH 0/2] DFU support for qspi on dra7xx Vignesh R
@ 2015-10-20  9:52 ` Vignesh R
  2015-10-20 15:45   ` Tom Rini
  2015-10-20  9:52 ` [U-Boot] [PATCH 2/2] ARM: dra7xx_evm: Add DFU support for qspi flash Vignesh R
  1 sibling, 1 reply; 9+ messages in thread
From: Vignesh R @ 2015-10-20  9:52 UTC (permalink / raw)
  To: u-boot

parse_dev() alters the string pointed by devstr parameter. Due to this
subsequent parsing of sf entities will fail, as string pointed by devstr
is no longer valid sf dev arguments.
Fix this by passing pointer to the copy of the string to parse_dev
instead of pointer to the actual devstr.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 drivers/dfu/dfu_sf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c
index 7646c6b7270c..9702eeea202a 100644
--- a/drivers/dfu/dfu_sf.c
+++ b/drivers/dfu/dfu_sf.c
@@ -115,8 +115,10 @@ 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);
+	dfu->data.sf.dev = parse_dev(devstr_bkup);
+	free(devstr_bkup);
 	if (!dfu->data.sf.dev)
 		return -ENODEV;
 
-- 
2.6.2

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

* [U-Boot] [PATCH 2/2] ARM: dra7xx_evm: Add DFU support for qspi flash
  2015-10-20  9:51 [U-Boot] [PATCH 0/2] DFU support for qspi on dra7xx Vignesh R
  2015-10-20  9:52 ` [U-Boot] [PATCH 1/2] dfu: dfu_sf: Pass duplicate devstr to parse_dev Vignesh R
@ 2015-10-20  9:52 ` Vignesh R
  2015-10-20 10:37   ` Lukasz Majewski
  2015-10-20 15:45   ` Tom Rini
  1 sibling, 2 replies; 9+ messages in thread
From: Vignesh R @ 2015-10-20  9:52 UTC (permalink / raw)
  To: u-boot

This adds support to update firmware on qspi flash using DFU.

On device:
=> setenv dfu_alt_info ${dfu_alt_info_qspi}
=> dfu 0 sf 0:0

On host:
$ sudo dfu-util -l
$ sudo dfu-util -D MLO -a MLO
$ sudo dfu-util -D u-boot.img -a u-boot.img

Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 include/configs/dra7xx_evm.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h
index 6e32de854619..cb9544b49efb 100644
--- a/include/configs/dra7xx_evm.h
+++ b/include/configs/dra7xx_evm.h
@@ -82,11 +82,24 @@
 	"fdt ram 0x80f80000 0x80000;" \
 	"ramdisk ram 0x81000000 0x4000000\0"
 
+#define DFU_ALT_INFO_QSPI \
+	"dfu_alt_info_qspi=" \
+	"MLO raw 0x0 0x010000;" \
+	"MLO.backup1 raw 0x010000 0x010000;" \
+	"MLO.backup2 raw 0x020000 0x010000;" \
+	"MLO.backup3 raw 0x030000 0x010000;" \
+	"u-boot.img raw 0x040000 0x0100000;" \
+	"u-boot-spl-os raw 0x140000 0x080000;" \
+	"u-boot-env raw 0x1C0000 0x010000;" \
+	"u-boot-env.backup raw 0x1D0000 0x010000;" \
+	"kernel raw 0x1E0000 0x800000\0"
+
 #define DFUARGS \
 	"dfu_bufsiz=0x10000\0" \
 	DFU_ALT_INFO_MMC \
 	DFU_ALT_INFO_EMMC \
-	DFU_ALT_INFO_RAM
+	DFU_ALT_INFO_RAM \
+	DFU_ALT_INFO_QSPI
 
 /* Fastboot */
 #define CONFIG_USB_FUNCTION_FASTBOOT
@@ -207,6 +220,7 @@
 
 #define CONFIG_DFU_MMC
 #define CONFIG_DFU_RAM
+#define CONFIG_DFU_SF
 
 /* SATA */
 #define CONFIG_BOARD_LATE_INIT
-- 
2.6.2

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

* [U-Boot] [PATCH 2/2] ARM: dra7xx_evm: Add DFU support for qspi flash
  2015-10-20  9:52 ` [U-Boot] [PATCH 2/2] ARM: dra7xx_evm: Add DFU support for qspi flash Vignesh R
@ 2015-10-20 10:37   ` Lukasz Majewski
  2015-10-20 10:46     ` Vignesh R
  2015-10-20 15:45   ` Tom Rini
  1 sibling, 1 reply; 9+ messages in thread
From: Lukasz Majewski @ 2015-10-20 10:37 UTC (permalink / raw)
  To: u-boot

Hi Vignesh,

> This adds support to update firmware on qspi flash using DFU.
> 
> On device:
> => setenv dfu_alt_info ${dfu_alt_info_qspi}
> => dfu 0 sf 0:0
> 
> On host:
> $ sudo dfu-util -l
> $ sudo dfu-util -D MLO -a MLO
> $ sudo dfu-util -D u-boot.img -a u-boot.img

This patch series seems ok. I just have one question regarding dfu-util:

sudo dfu-util -D MLO -a MLO

Is the above correct?

Shouldn't it be sudo dfu-util -a 0 -D MLO 
where alt setting 0 corresponds to MLO?

> 
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
>  include/configs/dra7xx_evm.h | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/include/configs/dra7xx_evm.h
> b/include/configs/dra7xx_evm.h index 6e32de854619..cb9544b49efb 100644
> --- a/include/configs/dra7xx_evm.h
> +++ b/include/configs/dra7xx_evm.h
> @@ -82,11 +82,24 @@
>  	"fdt ram 0x80f80000 0x80000;" \
>  	"ramdisk ram 0x81000000 0x4000000\0"
>  
> +#define DFU_ALT_INFO_QSPI \
> +	"dfu_alt_info_qspi=" \
> +	"MLO raw 0x0 0x010000;" \
> +	"MLO.backup1 raw 0x010000 0x010000;" \
> +	"MLO.backup2 raw 0x020000 0x010000;" \
> +	"MLO.backup3 raw 0x030000 0x010000;" \
> +	"u-boot.img raw 0x040000 0x0100000;" \
> +	"u-boot-spl-os raw 0x140000 0x080000;" \
> +	"u-boot-env raw 0x1C0000 0x010000;" \
> +	"u-boot-env.backup raw 0x1D0000 0x010000;" \
> +	"kernel raw 0x1E0000 0x800000\0"
> +
>  #define DFUARGS \
>  	"dfu_bufsiz=0x10000\0" \
>  	DFU_ALT_INFO_MMC \
>  	DFU_ALT_INFO_EMMC \
> -	DFU_ALT_INFO_RAM
> +	DFU_ALT_INFO_RAM \
> +	DFU_ALT_INFO_QSPI
>  
>  /* Fastboot */
>  #define CONFIG_USB_FUNCTION_FASTBOOT
> @@ -207,6 +220,7 @@
>  
>  #define CONFIG_DFU_MMC
>  #define CONFIG_DFU_RAM
> +#define CONFIG_DFU_SF
>  
>  /* SATA */
>  #define CONFIG_BOARD_LATE_INIT



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH 2/2] ARM: dra7xx_evm: Add DFU support for qspi flash
  2015-10-20 10:37   ` Lukasz Majewski
@ 2015-10-20 10:46     ` Vignesh R
  2015-10-20 11:06       ` Lukasz Majewski
  0 siblings, 1 reply; 9+ messages in thread
From: Vignesh R @ 2015-10-20 10:46 UTC (permalink / raw)
  To: u-boot

Hi Lukasz,

On 10/20/2015 04:07 PM, Lukasz Majewski wrote:
> Hi Vignesh,
> 
>> This adds support to update firmware on qspi flash using DFU.
>>
>> On device:
>> => setenv dfu_alt_info ${dfu_alt_info_qspi}
>> => dfu 0 sf 0:0
>>
>> On host:
>> $ sudo dfu-util -l
>> $ sudo dfu-util -D MLO -a MLO
>> $ sudo dfu-util -D u-boot.img -a u-boot.img
> 
> This patch series seems ok. I just have one question regarding dfu-util:
> 
> sudo dfu-util -D MLO -a MLO
> 
> Is the above correct?
> 
> Shouldn't it be sudo dfu-util -a 0 -D MLO 
> where alt setting 0 corresponds to MLO?
> 

According to man page of dfu-util 0.5 (supports DFU v1.0):
"-a"  can be used Specify the Altsetting of the DFU Interface by name or
by number

So since "MLO" is the name for alt setting 0 both
sudo dfu-util -D MLO -a MLO  and
sudo dfu-util -a 0 -D MLO  are correct.

I used the above format as its easier for reading. Thanks!

>>
>> Signed-off-by: Vignesh R <vigneshr@ti.com>
>> ---
>>  include/configs/dra7xx_evm.h | 16 +++++++++++++++-
>>  1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/configs/dra7xx_evm.h
>> b/include/configs/dra7xx_evm.h index 6e32de854619..cb9544b49efb 100644
>> --- a/include/configs/dra7xx_evm.h
>> +++ b/include/configs/dra7xx_evm.h
>> @@ -82,11 +82,24 @@
>>  	"fdt ram 0x80f80000 0x80000;" \
>>  	"ramdisk ram 0x81000000 0x4000000\0"
>>  
>> +#define DFU_ALT_INFO_QSPI \
>> +	"dfu_alt_info_qspi=" \
>> +	"MLO raw 0x0 0x010000;" \
>> +	"MLO.backup1 raw 0x010000 0x010000;" \
>> +	"MLO.backup2 raw 0x020000 0x010000;" \
>> +	"MLO.backup3 raw 0x030000 0x010000;" \
>> +	"u-boot.img raw 0x040000 0x0100000;" \
>> +	"u-boot-spl-os raw 0x140000 0x080000;" \
>> +	"u-boot-env raw 0x1C0000 0x010000;" \
>> +	"u-boot-env.backup raw 0x1D0000 0x010000;" \
>> +	"kernel raw 0x1E0000 0x800000\0"
>> +
>>  #define DFUARGS \
>>  	"dfu_bufsiz=0x10000\0" \
>>  	DFU_ALT_INFO_MMC \
>>  	DFU_ALT_INFO_EMMC \
>> -	DFU_ALT_INFO_RAM
>> +	DFU_ALT_INFO_RAM \
>> +	DFU_ALT_INFO_QSPI
>>  
>>  /* Fastboot */
>>  #define CONFIG_USB_FUNCTION_FASTBOOT
>> @@ -207,6 +220,7 @@
>>  
>>  #define CONFIG_DFU_MMC
>>  #define CONFIG_DFU_RAM
>> +#define CONFIG_DFU_SF
>>  
>>  /* SATA */
>>  #define CONFIG_BOARD_LATE_INIT
> 
> 
> 

-- 
Regards
Vignesh

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

* [U-Boot] [PATCH 2/2] ARM: dra7xx_evm: Add DFU support for qspi flash
  2015-10-20 10:46     ` Vignesh R
@ 2015-10-20 11:06       ` Lukasz Majewski
  0 siblings, 0 replies; 9+ messages in thread
From: Lukasz Majewski @ 2015-10-20 11:06 UTC (permalink / raw)
  To: u-boot

Hi Vignesh,

> Hi Lukasz,
> 
> On 10/20/2015 04:07 PM, Lukasz Majewski wrote:
> > Hi Vignesh,
> > 
> >> This adds support to update firmware on qspi flash using DFU.
> >>
> >> On device:
> >> => setenv dfu_alt_info ${dfu_alt_info_qspi}
> >> => dfu 0 sf 0:0
> >>
> >> On host:
> >> $ sudo dfu-util -l
> >> $ sudo dfu-util -D MLO -a MLO
> >> $ sudo dfu-util -D u-boot.img -a u-boot.img
> > 
> > This patch series seems ok. I just have one question regarding
> > dfu-util:
> > 
> > sudo dfu-util -D MLO -a MLO
> > 
> > Is the above correct?
> > 
> > Shouldn't it be sudo dfu-util -a 0 -D MLO 
> > where alt setting 0 corresponds to MLO?
> > 
> 
> According to man page of dfu-util 0.5 (supports DFU v1.0):
> "-a"  can be used Specify the Altsetting of the DFU Interface by name
> or by number
> 
> So since "MLO" is the name for alt setting 0 both
> sudo dfu-util -D MLO -a MLO  and
> sudo dfu-util -a 0 -D MLO  are correct.
> 
> I used the above format as its easier for reading. Thanks!

I'm using dfu-util for few years now and I was not aware of this :-).

I will test this patch set and then submit PR to Marek.

Thanks for your work!

> 
> >>
> >> Signed-off-by: Vignesh R <vigneshr@ti.com>
> >> ---
> >>  include/configs/dra7xx_evm.h | 16 +++++++++++++++-
> >>  1 file changed, 15 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/include/configs/dra7xx_evm.h
> >> b/include/configs/dra7xx_evm.h index 6e32de854619..cb9544b49efb
> >> 100644 --- a/include/configs/dra7xx_evm.h
> >> +++ b/include/configs/dra7xx_evm.h
> >> @@ -82,11 +82,24 @@
> >>  	"fdt ram 0x80f80000 0x80000;" \
> >>  	"ramdisk ram 0x81000000 0x4000000\0"
> >>  
> >> +#define DFU_ALT_INFO_QSPI \
> >> +	"dfu_alt_info_qspi=" \
> >> +	"MLO raw 0x0 0x010000;" \
> >> +	"MLO.backup1 raw 0x010000 0x010000;" \
> >> +	"MLO.backup2 raw 0x020000 0x010000;" \
> >> +	"MLO.backup3 raw 0x030000 0x010000;" \
> >> +	"u-boot.img raw 0x040000 0x0100000;" \
> >> +	"u-boot-spl-os raw 0x140000 0x080000;" \
> >> +	"u-boot-env raw 0x1C0000 0x010000;" \
> >> +	"u-boot-env.backup raw 0x1D0000 0x010000;" \
> >> +	"kernel raw 0x1E0000 0x800000\0"
> >> +
> >>  #define DFUARGS \
> >>  	"dfu_bufsiz=0x10000\0" \
> >>  	DFU_ALT_INFO_MMC \
> >>  	DFU_ALT_INFO_EMMC \
> >> -	DFU_ALT_INFO_RAM
> >> +	DFU_ALT_INFO_RAM \
> >> +	DFU_ALT_INFO_QSPI
> >>  
> >>  /* Fastboot */
> >>  #define CONFIG_USB_FUNCTION_FASTBOOT
> >> @@ -207,6 +220,7 @@
> >>  
> >>  #define CONFIG_DFU_MMC
> >>  #define CONFIG_DFU_RAM
> >> +#define CONFIG_DFU_SF
> >>  
> >>  /* SATA */
> >>  #define CONFIG_BOARD_LATE_INIT
> > 
> > 
> > 
> 



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH 1/2] dfu: dfu_sf: Pass duplicate devstr to parse_dev
  2015-10-20  9:52 ` [U-Boot] [PATCH 1/2] dfu: dfu_sf: Pass duplicate devstr to parse_dev Vignesh R
@ 2015-10-20 15:45   ` Tom Rini
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2015-10-20 15:45 UTC (permalink / raw)
  To: u-boot

On Tue, Oct 20, 2015 at 03:22:00PM +0530, Vignesh R wrote:

> parse_dev() alters the string pointed by devstr parameter. Due to this
> subsequent parsing of sf entities will fail, as string pointed by devstr
> is no longer valid sf dev arguments.
> Fix this by passing pointer to the copy of the string to parse_dev
> instead of pointer to the actual devstr.
> 
> Signed-off-by: Vignesh R <vigneshr@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151020/baae26ee/attachment.sig>

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

* [U-Boot] [PATCH 2/2] ARM: dra7xx_evm: Add DFU support for qspi flash
  2015-10-20  9:52 ` [U-Boot] [PATCH 2/2] ARM: dra7xx_evm: Add DFU support for qspi flash Vignesh R
  2015-10-20 10:37   ` Lukasz Majewski
@ 2015-10-20 15:45   ` Tom Rini
  2015-10-20 15:58     ` Lukasz Majewski
  1 sibling, 1 reply; 9+ messages in thread
From: Tom Rini @ 2015-10-20 15:45 UTC (permalink / raw)
  To: u-boot

On Tue, Oct 20, 2015 at 03:22:01PM +0530, Vignesh R wrote:

> This adds support to update firmware on qspi flash using DFU.
> 
> On device:
> => setenv dfu_alt_info ${dfu_alt_info_qspi}
> => dfu 0 sf 0:0
> 
> On host:
> $ sudo dfu-util -l
> $ sudo dfu-util -D MLO -a MLO
> $ sudo dfu-util -D u-boot.img -a u-boot.img
> 
> Signed-off-by: Vignesh R <vigneshr@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
Lukasz, can you just pull this in along with 1/2 when you do that?
Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151020/9d70b346/attachment.sig>

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

* [U-Boot] [PATCH 2/2] ARM: dra7xx_evm: Add DFU support for qspi flash
  2015-10-20 15:45   ` Tom Rini
@ 2015-10-20 15:58     ` Lukasz Majewski
  0 siblings, 0 replies; 9+ messages in thread
From: Lukasz Majewski @ 2015-10-20 15:58 UTC (permalink / raw)
  To: u-boot

Hi Tom,

> On Tue, Oct 20, 2015 at 03:22:01PM +0530, Vignesh R wrote:
> 
> > This adds support to update firmware on qspi flash using DFU.
> > 
> > On device:
> > => setenv dfu_alt_info ${dfu_alt_info_qspi}
> > => dfu 0 sf 0:0
> > 
> > On host:
> > $ sudo dfu-util -l
> > $ sudo dfu-util -D MLO -a MLO
> > $ sudo dfu-util -D u-boot.img -a u-boot.img
> > 
> > Signed-off-by: Vignesh R <vigneshr@ti.com>
> 
> Reviewed-by: Tom Rini <trini@konsulko.com>
> Lukasz, can you just pull this in along with 1/2 when you do that?

I've already pulled this to dfu tree, branch testing.
I will send proper PR in a few days time.

> Thanks!
> 



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

end of thread, other threads:[~2015-10-20 15:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-20  9:51 [U-Boot] [PATCH 0/2] DFU support for qspi on dra7xx Vignesh R
2015-10-20  9:52 ` [U-Boot] [PATCH 1/2] dfu: dfu_sf: Pass duplicate devstr to parse_dev Vignesh R
2015-10-20 15:45   ` Tom Rini
2015-10-20  9:52 ` [U-Boot] [PATCH 2/2] ARM: dra7xx_evm: Add DFU support for qspi flash Vignesh R
2015-10-20 10:37   ` Lukasz Majewski
2015-10-20 10:46     ` Vignesh R
2015-10-20 11:06       ` Lukasz Majewski
2015-10-20 15:45   ` Tom Rini
2015-10-20 15:58     ` Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox