Skip to contentSkip to conversation

DFU support for qspi on dra7xx

PATCH New Vignesh R 3 participants 9 messages Oct 20, 2015

lore
Share & tools
lore

Vignesh R

author
#0 lore raw

cover DFU support for qspi on dra7xx

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(-)
Signature · 1 line
2.6.2
author
#1 lore raw

PATCH 1/2 dfu: dfu_sf: Pass duplicate devstr to parse_dev

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.

---
 drivers/dfu/dfu_sf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dfu/dfu_sf.c +3 -1
index 7646c6b7270c..9702eeea202a 100644
@@ -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;
 
Signature · 1 line
2.6.2
#2 lore raw

PATCH 1/2 dfu: dfu_sf: Pass duplicate devstr to parse_dev

Quoted 7 lines · Vignesh R

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.

Signature · 8 lines
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>
author
#3 lore raw

PATCH 2/2 ARM: dra7xx_evm: Add DFU support for qspi flash

In reply to Vignesh R

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
---
 include/configs/dra7xx_evm.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
include/configs/dra7xx_evm.h +15 -1
index 6e32de854619..cb9544b49efb 100644
@@ -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
Signature · 1 line
2.6.2
#4 lore raw

PATCH 2/2 ARM: dra7xx_evm: Add DFU support for qspi flash

Hi Vignesh,

Quoted 10 lines

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?

Quoted 44 lines
---
 include/configs/dra7xx_evm.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/configs/dra7xx_evm.h index 6e32de854619..cb9544b49efb 100644

include/configs/dra7xx_evm.h +15 -1
@@ -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
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
author
#5 lore raw

PATCH 2/2 ARM: dra7xx_evm: Add DFU support for qspi flash

Hi Lukasz,

Quoted 13 lines · Lukasz Majewski

Hi Vignesh,

Quoted 10 lines

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
Quoted 9 lines

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!

Quoted 47 lines
Quoted 44 lines
---
 include/configs/dra7xx_evm.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/configs/dra7xx_evm.h index 6e32de854619..cb9544b49efb 100644

include/configs/dra7xx_evm.h +15 -1
@@ -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
Signature · 2 lines
Regards
Vignesh
#6 lore raw

PATCH 2/2 ARM: dra7xx_evm: Add DFU support for qspi flash

Hi Vignesh,

Quoted 31 lines

Hi Lukasz,

Quoted 16 lines · Lukasz Majewski

Hi Vignesh,

Quoted 10 lines

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:

Quoted 7 lines

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

Quoted 5 lines

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!

Quoted 49 lines
Quoted 48 lines
Quoted 45 lines
---
 include/configs/dra7xx_evm.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/configs/dra7xx_evm.h index 6e32de854619..cb9544b49efb 100644 --- a/include/configs/dra7xx_evm.h
+++ b/include/configs/dra7xx_evm.h

include/configs/dra7xx_evm.h +15 -1
@@ -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
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#7 lore raw

PATCH 2/2 ARM: dra7xx_evm: Add DFU support for qspi flash

In reply to Vignesh R
Quoted 6 lines · Vignesh R

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

Quoted 6 lines

On host:

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

Lukasz, can you just pull this in along with 1/2 when you do that? Thanks!

Signature · 8 lines
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>
#8 lore raw

PATCH 2/2 ARM: dra7xx_evm: Add DFU support for qspi flash

Hi Tom,

Quoted 13 lines · Vignesh R
Quoted 12 lines

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
Quoted 4 lines
Quoted 1 line

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.

Quoted 2 lines

Thanks!

Signature · 5 lines
Best regards,

Lukasz Majewski

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