Skip to contentSkip to conversation

DFU on am35xx_evm (against u-boot-usb)

PATCH New Pantelis Antoniou 3 participants 32 messages Nov 27, 2012 – Nov 29, 2012 USB

lore
Share & tools
lore
#0 lore raw

cover DFU on am35xx_evm (against u-boot-usb)

This patchset fixes various problems in the u-boot DFU implementation and supports it on the am35xx_evm.

This patchset is against the u-boot-usb tree.

Pantelis Antoniou (9):
[usb-gadget] Remove obsolete header file [usb-gadget] Fix bug when both DFU & ETHER are defined [dfu] Only perform DFU board_usb_init() for TRATS [dfu] Fix crash when wrong number of arguments given [dfu] Generate appropriate responses for DFU [dfu] Properly zero out timeout value
[dfu] Add a partition type target
[dfu] Issue connect/disconnect as appropriate [am335x_evm] Add DFU config

 common/cmd_dfu.c               |  5 ++++-
 drivers/dfu/dfu_mmc.c          | 29 +++++++++++++++++++++++++++++
 drivers/usb/gadget/Makefile    | 13 +++++++++++--
 drivers/usb/gadget/composite.c |  9 +++++++++
 drivers/usb/gadget/ep0.c       |  1 +
 drivers/usb/gadget/f_dfu.c     |  4 +++-
 drivers/usb/gadget/g_dnl.c     |  9 ++++++++-
 include/configs/am335x_evm.h   | 27 +++++++++++++++++++++++++++
 include/g_dnl.h                |  1 -
 9 files changed, 92 insertions(+), 6 deletions(-)
Signature · 1 line
1.7.12
#1 lore raw

PATCH 1/9 Remove obsolete header file

usbdescriptors.h conflicts with linux/usb/ch9.h
Remove it.

---
 drivers/usb/gadget/f_dfu.c | 1 -
 include/g_dnl.h            | 1 -
 2 files changed, 2 deletions(-)
drivers/usb/gadget/f_dfu.c +0 -1
index 3ec4c65..10547e3 100644
@@ -25,7 +25,6 @@
 #include <malloc.h>
 
 #include <linux/usb/ch9.h>
-#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
 
include/g_dnl.h +0 -1
index 0ec7440..f47395f 100644
@@ -22,7 +22,6 @@
 #define __G_DOWNLOAD_H_
 
 #include <linux/usb/ch9.h>
-#include <usbdescriptors.h>
 #include <linux/usb/gadget.h>
 
 int g_dnl_register(const char *s);
Signature · 1 line
1.7.12
#2 lore raw

PATCH 1/9 Remove obsolete header file

Quoted 4 lines · Pantelis Antoniou

usbdescriptors.h conflicts with linux/usb/ch9.h
Remove it.

Seeing as this change is required to fix building of trats in u-boot-usb as well now, I am applying this now. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121127/b5203433/attachment.pgp>
#3 lore raw

PATCH 1/9 Remove obsolete header file

Dear Tom Rini,

Quoted 8 lines · Pantelis Antoniou
Quoted 4 lines

usbdescriptors.h conflicts with linux/usb/ch9.h
Remove it.

Seeing as this change is required to fix building of trats in u-boot-usb as well now, I am applying this now. Thanks!

Only this or the whole series?

Best regards,
Marek Vasut

#4 lore raw

PATCH 1/9 Remove obsolete header file

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 6 lines · Marek Vasut

Dear Tom Rini,

Quoted 4 lines
Quoted 2 lines · Pantelis Antoniou

usbdescriptors.h conflicts with linux/usb/ch9.h Remove it.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Signed-off-by: Pantelis Antoniou
<[email protected]>

Seeing as this change is required to fix building of trats in u-boot-usb as well now, I am applying this now. Thanks!

Only this or the whole series?

Only this patch. The rest of the series is new functionality that is past the merge window, so should be staged for the new MW. 1/9 fixes a bug exposed by Ilya's update.

- --
Tom

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQtX6ZAAoJENk4IS6UOR1WoI8P/2K5SmZl6VVNWzeusp31nk7w mH4//X1+LfTg1oUX/v1xPTJGvpN8rEVcXZis/Q4HwymIEKHoG22OaP6SJqudo78P HQjz0jSgvsOcMZhobZVCp2UpuHhC/a6iBLBUAvyRDUfCtfVRZBJU17nalMM1oLps TyixMaHJYgCnU66WpNusTTK0qht9/tkjYEu1FmWJejngAKiwvbq1dZRsl+9qxB8L C4WHeh3Zw3AQa19yIqIGVMsHxE5vuO1KwW0cJlkmwcRaxObFZYluYoTpSGQGbVXk uVLbCerW/yNqmBmFGIHRAM5d5Uojoou5UdmGFfpHvYL4M/S4aHjHOXDjIEUa+Ef/ wpUpKN2WMMZUAaAzeQc9YNAr2bzNrpN5MruZ6bc+9Yr3w9vaFkcXWV5Mq5ZlgZEi CXfbDFqyJ7ODYG9cYt4i7YNczkjd0QGN1Oswqmorjd3nQ2QF+b7IAzJWAvh+KKC3 N/loGkZiI68LB3le22FJVKtOD6MPZUsrXQ6ms8lqezHMcve+uxw9F5f3k0HQTFts Q4zDdZ3JzcGjpl0bhQ6UJe4Pg/+xYzlij5eeCYD9WW8JIY1ZGxXrQuezYFUCn69J ed8NaTaZeUjqejOF3ucwIdR9ptnxZmdG6+6n4RDZEJTn8/K/9nfKpuEFyu9LkF6I KqfwCGTXhBwODdr0dE2Z
=kS/y
-----END PGP SIGNATURE-----

#5 lore raw

PATCH 2/9 Fix bug when both DFU & ETHER are defined

In reply to Pantelis Antoniou

When both CONFIG_USB_GADGET & CONFIG_USB_ETHER are defined the makefile links objects twice.

Detect this and fix it with a not very elegant way in the makefile. Revisit and clean it later.

---
 drivers/usb/gadget/Makefile | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/usb/gadget/Makefile +11 -2
index 040eaba..15206cd 100644
@@ -26,14 +26,23 @@ include $(TOPDIR)/config.mk
 LIB	:= $(obj)libusb_gadget.o
 
 # new USB gadget layer dependencies
+
+# ugh; ugh; ugh common objects included twice
+ifdef CONFIG_USB_GADGET
+   COBJS-y += epautoconf.o config.o usbstring.o
+else
+  ifdef CONFIG_USB_ETHER
+     COBJS-y += epautoconf.o config.o usbstring.o
+  endif
+endif
+
 ifdef CONFIG_USB_GADGET
-COBJS-y += epautoconf.o config.o usbstring.o
 COBJS-$(CONFIG_USB_GADGET_S3C_UDC_OTG) += s3c_udc_otg.o
 COBJS-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o
 COBJS-$(CONFIG_DFU_FUNCTION) += f_dfu.o
 endif
 ifdef CONFIG_USB_ETHER
-COBJS-y += ether.o epautoconf.o config.o usbstring.o
+COBJS-y += ether.o
 COBJS-$(CONFIG_USB_ETH_RNDIS) += rndis.o
 COBJS-$(CONFIG_MV_UDC)	+= mv_udc.o
 COBJS-$(CONFIG_CPU_PXA25X) += pxa25x_udc.o
Signature · 1 line
1.7.12
#6 lore raw

PATCH 2/9 Fix bug when both DFU & ETHER are defined

Dear Pantelis Antoniou,

Quoted 18 lines

When both CONFIG_USB_GADGET & CONFIG_USB_ETHER are defined the makefile links objects twice.

Detect this and fix it with a not very elegant way in the makefile. Revisit and clean it later.

---
 drivers/usb/gadget/Makefile | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/usb/gadget/Makefile +0 -0
index 040eaba..15206cd 100644
@@ -26,14 +26,23 @@ include $(TOPDIR)/config.mk
 LIB	:= $(obj)libusb_gadget.o
 

drivers/usb/gadget/Makefile include $(TOPDIR)/config.mk · line 37

Quoted 10 lines
drivers/usb/gadget/Makefile +9 -0
 # new USB gadget layer dependencies
+
+# ugh; ugh; ugh common objects included twice
+ifdef CONFIG_USB_GADGET
+   COBJS-y += epautoconf.o config.o usbstring.o
+else
+  ifdef CONFIG_USB_ETHER
+     COBJS-y += epautoconf.o config.o usbstring.o
+  endif
+endif

COBJS-$(CONFIG_ST) += st.o
COBJS-$(CONFIG_ST_ELSE) += st_else.o

if (both selected)
scream and die.

drivers/usb/gadget/Makefile include $(TOPDIR)/config.mk · line 48

Quoted 13 lines
drivers/usb/gadget/Makefile +2 -2
+
 ifdef CONFIG_USB_GADGET
-COBJS-y += epautoconf.o config.o usbstring.o
 COBJS-$(CONFIG_USB_GADGET_S3C_UDC_OTG) += s3c_udc_otg.o
 COBJS-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o
 COBJS-$(CONFIG_DFU_FUNCTION) += f_dfu.o
 endif
 ifdef CONFIG_USB_ETHER
-COBJS-y += ether.o epautoconf.o config.o usbstring.o
+COBJS-y += ether.o
 COBJS-$(CONFIG_USB_ETH_RNDIS) += rndis.o
 COBJS-$(CONFIG_MV_UDC)	+= mv_udc.o
 COBJS-$(CONFIG_CPU_PXA25X) += pxa25x_udc.o

Best regards,
Marek Vasut

#7 lore raw

PATCH 2/9 Fix bug when both DFU & ETHER are defined

Hi Marek,

Quoted 34 lines · Marek Vasut

Dear Pantelis Antoniou,

Quoted 19 lines

When both CONFIG_USB_GADGET & CONFIG_USB_ETHER are defined the makefile links objects twice.

Detect this and fix it with a not very elegant way in the makefile. Revisit and clean it later.

---
drivers/usb/gadget/Makefile | 13 +++++++++++--

1 file changed, 11 insertions(+), 2 deletions(-)
drivers/usb/gadget/Makefile +0 -0
index 040eaba..15206cd 100644
@@ -26,14 +26,23 @@ include $(TOPDIR)/config.mk

LIB := $(obj)libusb_gadget.o

# new USB gadget layer dependencies

drivers/usb/gadget/Makefile include $(TOPDIR)/config.mk · line 37

Quoted 9 lines
drivers/usb/gadget/Makefile +9 -0
+
+# ugh; ugh; ugh common objects included twice
+ifdef CONFIG_USB_GADGET
+   COBJS-y += epautoconf.o config.o usbstring.o
+else
+  ifdef CONFIG_USB_ETHER
+     COBJS-y += epautoconf.o config.o usbstring.o
+  endif
+endif

COBJS-$(CONFIG_ST) += st.o
COBJS-$(CONFIG_ST_ELSE) += st_else.o

Quoted 3 lines

if (both selected)
scream and die.

I fail to see how that would work for the problem at hand, namely that if both CONFIG_USB_GADGET & CONFIG_USB_ETHER are defined epautoconf.o config.o usbstring.o are linked twice.

The proper thing to do would be to have a config symbol enabled when either CONFIG_USB_GADGET & CONFIG_USB_ETHER are defined.

Something like

#if defined(CONFIG_USB_GADGET) || defined(CONFIG_USB_ETHER) #define CONFIG_USB_GADGET_PLUMPING
#endif

in a header file someplace and do

COBJS-$(CONFIG_USB_GADGET_PLUMPING) += epautoconf.o config.o usbstring.o

etc.

This would require putting it either in every board file, or in a core usb header.

The patch was the least intrusive method.

Regards

-- Pantelis

Quoted 16 lines
Quoted 10 lines

+
ifdef CONFIG_USB_GADGET
-COBJS-y += epautoconf.o config.o usbstring.o COBJS-$(CONFIG_USB_GADGET_S3C_UDC_OTG) += s3c_udc_otg.o COBJS-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o COBJS-$(CONFIG_DFU_FUNCTION) += f_dfu.o
endif
ifdef CONFIG_USB_ETHER

drivers/usb/gadget/Makefile +1 -1
-COBJS-y += ether.o epautoconf.o config.o usbstring.o
+COBJS-y += ether.o
Quoted 3 lines

COBJS-$(CONFIG_USB_ETH_RNDIS) += rndis.o
COBJS-$(CONFIG_MV_UDC) += mv_udc.o
COBJS-$(CONFIG_CPU_PXA25X) += pxa25x_udc.o

Best regards,
Marek Vasut

#8 lore raw

PATCH 2/9 Fix bug when both DFU & ETHER are defined

Dear Pantelis Antoniou,

Quoted 37 lines

Hi Marek,

Quoted 34 lines · Marek Vasut

Dear Pantelis Antoniou,

Quoted 19 lines

When both CONFIG_USB_GADGET & CONFIG_USB_ETHER are defined the makefile links objects twice.

Detect this and fix it with a not very elegant way in the makefile. Revisit and clean it later.

---
drivers/usb/gadget/Makefile | 13 +++++++++++--

1 file changed, 11 insertions(+), 2 deletions(-)
drivers/usb/gadget/Makefile +0 -0
index 040eaba..15206cd 100644
@@ -26,14 +26,23 @@ include $(TOPDIR)/config.mk

LIB := $(obj)libusb_gadget.o

# new USB gadget layer dependencies

drivers/usb/gadget/Makefile include $(TOPDIR)/config.mk · line 37

Quoted 9 lines
drivers/usb/gadget/Makefile +9 -0
+
+# ugh; ugh; ugh common objects included twice
+ifdef CONFIG_USB_GADGET
+   COBJS-y += epautoconf.o config.o usbstring.o
+else
+  ifdef CONFIG_USB_ETHER
+     COBJS-y += epautoconf.o config.o usbstring.o
+  endif
+endif

COBJS-$(CONFIG_ST) += st.o
COBJS-$(CONFIG_ST_ELSE) += st_else.o

Quoted 6 lines
Quoted 2 lines

if (both selected)
scream and die.

I fail to see how that would work for the problem at hand, namely that if both CONFIG_USB_GADGET & CONFIG_USB_ETHER are defined epautoconf.o config.o usbstring.o are linked twice.

Ah, now I understand the problem at hand.

Quoted 10 lines

The proper thing to do would be to have a config symbol enabled when either CONFIG_USB_GADGET & CONFIG_USB_ETHER are defined.

Something like

#if defined(CONFIG_USB_GADGET) || defined(CONFIG_USB_ETHER) #define CONFIG_USB_GADGET_PLUMPING
#endif

in a header file someplace and do

Can you not do "or" in conditional expression in Makefile?

Quoted 10 lines

COBJS-$(CONFIG_USB_GADGET_PLUMPING) += epautoconf.o config.o usbstring.o

etc.

This would require putting it either in every board file, or in a core usb header.

The patch was the least intrusive method.

Regards

[...]

#9 lore raw

PATCH 3/9 Only perform DFU board_usb_init() for TRATS

In reply to Pantelis Antoniou

USB initialization shouldn't happen for all the boards.

---
 common/cmd_dfu.c | 3 +++
 1 file changed, 3 insertions(+)
common/cmd_dfu.c +3 -0
index 01d6b3a..327c738 100644
@@ -55,7 +55,10 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		goto done;
 	}
 
+#ifdef CONFIG_TRATS
 	board_usb_init();
+#endif
+
 	g_dnl_register(s);
 	while (1) {
 		if (ctrlc())
Signature · 1 line
1.7.12
#10 lore raw

PATCH 3/9 Only perform DFU board_usb_init() for TRATS

Dear Pantelis Antoniou,

Quoted 12 lines

USB initialization shouldn't happen for all the boards.

---
 common/cmd_dfu.c | 3 +++
 1 file changed, 3 insertions(+)
common/cmd_dfu.c +0 -0
index 01d6b3a..327c738 100644

common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, · line 61

Quoted 7 lines
common/cmd_dfu.c +3 -0
@@ -55,7 +55,10 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc,
 char * const argv[]) goto done;
 	}
 
+#ifdef CONFIG_TRATS
 	board_usb_init();
+#endif
+

It's common code:

1) Why is it called "board_usb_init()" ? Does this have anything to do with usb host?

2) Make it __weak, then if it's undefined for your board, something default will be called.

common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 64

Quoted 3 lines
common/cmd_dfu.c +0 -0
 	g_dnl_register(s);
 	while (1) {
 		if (ctrlc())

Best regards,
Marek Vasut

#11 lore raw

PATCH 3/9 Only perform DFU board_usb_init() for TRATS

Hi Marek,

Quoted 24 lines · Marek Vasut

Dear Pantelis Antoniou,

Quoted 12 lines

USB initialization shouldn't happen for all the boards.

---
common/cmd_dfu.c | 3 +++

1 file changed, 3 insertions(+)
common/cmd_dfu.c +0 -0
index 01d6b3a..327c738 100644

common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, · line 61

Quoted 7 lines
common/cmd_dfu.c +3 -0
@@ -55,7 +55,10 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc,
 char * const argv[]) goto done;
 	}
 
+#ifdef CONFIG_TRATS
 	board_usb_init();
+#endif
+

It's common code:

Quoted 3 lines

1) Why is it called "board_usb_init()" ? Does this have anything to do with usb host?

No idea. It makes no sense to me, but it was there from the original DFU poster. I don't have a TRATS board to test it anyway, but I didn't want to affect it.

Quoted 3 lines

2) Make it __weak, then if it's undefined for your board, something default will be called.

I see no reason why it should even exist. Perhaps we should ask the original poster.

Quoted 6 lines

common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 64

Quoted 3 lines
common/cmd_dfu.c +0 -0
 	g_dnl_register(s);
 	while (1) {
 		if (ctrlc())

Best regards,
Marek Vasut

Regards

-- Pantelis

#12 lore raw

PATCH 3/9 Only perform DFU board_usb_init() for TRATS

Dear Pantelis Antoniou,

Quoted 30 lines

Hi Marek,

Quoted 27 lines · Marek Vasut

Dear Pantelis Antoniou,

Quoted 12 lines

USB initialization shouldn't happen for all the boards.

---
common/cmd_dfu.c | 3 +++

1 file changed, 3 insertions(+)
common/cmd_dfu.c +0 -0
index 01d6b3a..327c738 100644

common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int · line 64

Quoted 10 lines
common/cmd_dfu.c +3 -0
@@ -55,7 +55,10 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int
 argc, char * const argv[]) goto done;
 
 	}
 
+#ifdef CONFIG_TRATS
 
 	board_usb_init();
 
+#endif
+

It's common code:

Quoted 6 lines
Quoted 2 lines

1) Why is it called "board_usb_init()" ? Does this have anything to do with usb host?

No idea. It makes no sense to me, but it was there from the original DFU poster. I don't have a TRATS board to test it anyway, but I didn't want to affect it.

Can you please rename it to a more sensible name then?

Quoted 5 lines
Quoted 2 lines

2) Make it __weak, then if it's undefined for your board, something default will be called.

I see no reason why it should even exist. Perhaps we should ask the original poster.

Please do it then

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
	g_dnl_register(s);
	while (1) {
	
		if (ctrlc())

Best regards,
Marek Vasut

Regards

-- Pantelis

Best regards,
Marek Vasut

#13 lore raw

PATCH 4/9 Fix crash when wrong number of arguments given

In reply to Pantelis Antoniou

Fix obvious crash when not enough arguments are given to the dfu command.

---
 common/cmd_dfu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/cmd_dfu.c +1 -1
index 327c738..83ef324 100644
@@ -50,7 +50,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (ret)
 		return CMD_RET_FAILURE;
 
-	if (strcmp(argv[3], "list") == 0) {
+	if (argc > 3 && strcmp(argv[3], "list") == 0) {
 		dfu_show_entities();
 		goto done;
 	}
Signature · 1 line
1.7.12
#14 lore raw

PATCH 5/9 Generate appropriate responses for DFU

In reply to Pantelis Antoniou

Make sure appropriate responses for the DFU protocal are generated.

---
 drivers/usb/gadget/composite.c | 9 +++++++++
 drivers/usb/gadget/ep0.c       | 1 +
 2 files changed, 10 insertions(+)
drivers/usb/gadget/composite.c +9 -0
index ebb5131..1ae318c 100644
@@ -773,6 +773,15 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
 			if (value >= 0)
 				value = min(w_length, (u16) value);
 			break;
+
+#ifdef CONFIG_DFU_FUNCTION
+		case DFU_DT_FUNC:	/* DFU */
+			value = config_desc(cdev, w_value);
+			if (value >= 0)
+				value = min(w_length, (u16) value);
+			break;
+#endif
+
 		default:
 			goto unknown;
 		}
drivers/usb/gadget/ep0.c +1 -0
index aa8f916..971d846 100644
@@ -221,6 +221,7 @@ static int ep0_get_descriptor (struct usb_device_instance *device,
 		break;
 
 	case USB_DESCRIPTOR_TYPE_CONFIGURATION:
+	case USB_DESCRIPTOR_TYPE_OTHER_SPEED_CONFIGURATION:
 		{
 			struct usb_configuration_descriptor
 				*configuration_descriptor;
Signature · 1 line
1.7.12
#15 lore raw

PATCH 5/9 Generate appropriate responses for DFU

Dear Pantelis Antoniou,

Quoted 2 lines

Make sure appropriate responses for the DFU protocal are generated.

I dont understand this patch, please explain it properly in the commit message.

Quoted 31 lines
---
 drivers/usb/gadget/composite.c | 9 +++++++++
 drivers/usb/gadget/ep0.c       | 1 +
 2 files changed, 10 insertions(+)
(quoted diff) +0 -0

b/drivers/usb/gadget/composite.c index ebb5131..1ae318c 100644

drivers/usb/gadget/composite.c +9 -0
@@ -773,6 +773,15 @@ composite_setup(struct usb_gadget *gadget, const
 struct usb_ctrlrequest *ctrl) if (value >= 0)
 				value = min(w_length, (u16) value);
 			break;
+
+#ifdef CONFIG_DFU_FUNCTION
+		case DFU_DT_FUNC:	/* DFU */
+			value = config_desc(cdev, w_value);
+			if (value >= 0)
+				value = min(w_length, (u16) value);
+			break;
+#endif
+
 		default:
 			goto unknown;
 		}
drivers/usb/gadget/ep0.c +0 -0
index aa8f916..971d846 100644

drivers/usb/gadget/ep0.c static int ep0_get_descriptor (struct · line 227

Quoted 7 lines
drivers/usb/gadget/ep0.c +1 -0
@@ -221,6 +221,7 @@ static int ep0_get_descriptor (struct
 usb_device_instance *device, break;
 
 	case USB_DESCRIPTOR_TYPE_CONFIGURATION:
+	case USB_DESCRIPTOR_TYPE_OTHER_SPEED_CONFIGURATION:
 		{
 			struct usb_configuration_descriptor
 				*configuration_descriptor;

Best regards,
Marek Vasut

#16 lore raw

PATCH 5/9 Generate appropriate responses for DFU

Hi Marek,

Quoted 7 lines · Marek Vasut

Dear Pantelis Antoniou,

Quoted 2 lines

Make sure appropriate responses for the DFU protocal are generated.

I dont understand this patch, please explain it properly in the commit message.

Turns out this is not even quite correct... Updated patchset in a little bit.

Quoted 41 lines
Quoted 31 lines

---
drivers/usb/gadget/composite.c | 9 +++++++++
drivers/usb/gadget/ep0.c | 1 +

2 files changed, 10 insertions(+)
(quoted diff) +0 -0

b/drivers/usb/gadget/composite.c index ebb5131..1ae318c 100644

drivers/usb/gadget/composite.c +9 -0
@@ -773,6 +773,15 @@ composite_setup(struct usb_gadget *gadget, const
 struct usb_ctrlrequest *ctrl) if (value >= 0)
 				value = min(w_length, (u16) value);
 			break;
+
+#ifdef CONFIG_DFU_FUNCTION
+		case DFU_DT_FUNC:	/* DFU */
+			value = config_desc(cdev, w_value);
+			if (value >= 0)
+				value = min(w_length, (u16) value);
+			break;
+#endif
+
 		default:
 			goto unknown;
 		}
drivers/usb/gadget/ep0.c +0 -0
index aa8f916..971d846 100644

drivers/usb/gadget/ep0.c static int ep0_get_descriptor (struct · line 227

Quoted 7 lines
drivers/usb/gadget/ep0.c +1 -0
@@ -221,6 +221,7 @@ static int ep0_get_descriptor (struct
 usb_device_instance *device, break;
 
 	case USB_DESCRIPTOR_TYPE_CONFIGURATION:
+	case USB_DESCRIPTOR_TYPE_OTHER_SPEED_CONFIGURATION:
 		{
 			struct usb_configuration_descriptor
 				*configuration_descriptor;

Best regards,
Marek Vasut

#17 lore raw

PATCH 6/9 Properly zero out timeout value

In reply to Pantelis Antoniou

Zero out timeout value; letting it filled with undefined values ends up with the dfu host hanging.

---
 drivers/usb/gadget/f_dfu.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/gadget/f_dfu.c +3 -0
index 10547e3..a322ae5 100644
@@ -164,6 +164,9 @@ static void handle_getstatus(struct usb_request *req)
 
 	/* send status response */
 	dstat->bStatus = f_dfu->dfu_status;
+	dstat->bwPollTimeout[0] = 0;
+	dstat->bwPollTimeout[1] = 0;
+	dstat->bwPollTimeout[2] = 0;
 	dstat->bState = f_dfu->dfu_state;
 	dstat->iString = 0;
 }
Signature · 1 line
1.7.12
#18 lore raw

PATCH 6/9 Properly zero out timeout value

Dear Pantelis Antoniou,

Quoted 13 lines

Zero out timeout value; letting it filled with undefined values ends up with the dfu host hanging.

---
 drivers/usb/gadget/f_dfu.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/gadget/f_dfu.c +0 -0
index 10547e3..a322ae5 100644

drivers/usb/gadget/f_dfu.c static void handle_getstatus(struct usb_request *req) · line 169

Quoted 6 lines
drivers/usb/gadget/f_dfu.c +3 -0
@@ -164,6 +164,9 @@ static void handle_getstatus(struct usb_request *req)
 
 	/* send status response */
 	dstat->bStatus = f_dfu->dfu_status;
+	dstat->bwPollTimeout[0] = 0;
+	dstat->bwPollTimeout[1] = 0;
+	dstat->bwPollTimeout[2] = 0;

What about calling memset() here ?

drivers/usb/gadget/f_dfu.c static void handle_getstatus(struct usb_request *req) · line 172

Quoted 3 lines
drivers/usb/gadget/f_dfu.c +0 -0
 	dstat->bState = f_dfu->dfu_state;
 	dstat->iString = 0;
 }

Best regards,
Marek Vasut

#19 lore raw

PATCH 6/9 Properly zero out timeout value

Hi Marek,

Quoted 16 lines · Marek Vasut

Dear Pantelis Antoniou,

Quoted 14 lines

Zero out timeout value; letting it filled with undefined values ends up with the dfu host hanging.

---
drivers/usb/gadget/f_dfu.c | 3 +++

1 file changed, 3 insertions(+)
drivers/usb/gadget/f_dfu.c +0 -0
index 10547e3..a322ae5 100644
@@ -164,6 +164,9 @@ static void handle_getstatus(struct usb_request *req)
 
Quoted 8 lines

drivers/usb/gadget/f_dfu.c static void handle_getstatus(struct usb_request *req) · line 169

Quoted 5 lines
drivers/usb/gadget/f_dfu.c +3 -0
 	/* send status response */
 	dstat->bStatus = f_dfu->dfu_status;
+	dstat->bwPollTimeout[0] = 0;
+	dstat->bwPollTimeout[1] = 0;
+	dstat->bwPollTimeout[2] = 0;

What about calling memset() here ?

I would memset the whole structure just to be safe, but it seems that this is just 3 instructions. memset would take more. Either way works for me.

Quoted 6 lines

drivers/usb/gadget/f_dfu.c static void handle_getstatus(struct usb_request *req) · line 172

Quoted 3 lines
drivers/usb/gadget/f_dfu.c +0 -0
 	dstat->bState = f_dfu->dfu_state;
 	dstat->iString = 0;
 }

Best regards,
Marek Vasut

Regards

-- Pantelis

#20 lore raw

PATCH 6/9 Properly zero out timeout value

Dear Pantelis Antoniou,

Quoted 23 lines

Hi Marek,

Quoted 20 lines · Marek Vasut

Dear Pantelis Antoniou,

Quoted 18 lines

Zero out timeout value; letting it filled with undefined values ends up with the dfu host hanging.

---
drivers/usb/gadget/f_dfu.c | 3 +++

1 file changed, 3 insertions(+)
drivers/usb/gadget/f_dfu.c +0 -0
index 10547e3..a322ae5 100644
@@ -164,6 +164,9 @@ static void handle_getstatus(struct usb_request
 *req)
 
 	/* send status response */
 	dstat->bStatus = f_dfu->dfu_status;
 
Quoted 8 lines
Quoted 5 lines

drivers/usb/gadget/f_dfu.c static void handle_getstatus(struct usb_request *req) · line 169

Quoted 3 lines
drivers/usb/gadget/f_dfu.c +3 -0
+	dstat->bwPollTimeout[0] = 0;
+	dstat->bwPollTimeout[1] = 0;
+	dstat->bwPollTimeout[2] = 0;

What about calling memset() here ?

I would memset the whole structure just to be safe, but it seems that this is just 3 instructions. memset would take more. Either way works for me.

Can you verify that please?

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
drivers/usb/gadget/f_dfu.c +0 -0
 	dstat->bState = f_dfu->dfu_state;
	dstat->iString = 0;

}

Best regards,
Marek Vasut

Regards

-- Pantelis

Best regards,
Marek Vasut

#21 lore raw

PATCH 7/9 Add a partition type target

In reply to Pantelis Antoniou

Dealing with raw block numbers with the dfu is very annoying. Introduce a partition method.

---
 drivers/dfu/dfu_mmc.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
drivers/dfu/dfu_mmc.c +29 -0
index 5d504df..3733b21 100644
@@ -153,6 +153,10 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, void *buf, long *len)
 
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
+	int dev, part;
+	struct mmc *mmc;
+	block_dev_desc_t *blk_dev;
+	disk_partition_t partinfo;
 	char *st;
 
 	dfu->dev_type = DFU_DEV_MMC;
@@ -166,8 +170,33 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 		dfu->layout = DFU_FS_FAT;
 	} else if (!strcmp(st, "ext4")) {
 		dfu->layout = DFU_FS_EXT4;
+	} else if (!strcmp(st, "part")) {
+
+		dfu->layout = DFU_RAW_ADDR;
+
+		dev = simple_strtoul(s, &s, 10);
+		part = simple_strtoul(++s, &s, 10);
+
+		mmc = find_mmc_device(dev);
+		if (mmc == NULL || mmc_init(mmc)) {
+			printf("%s: could not find mmc device #%d!\n", __func__, dev);
+			return -1;
+		}
+
+		blk_dev = &mmc->block_dev;
+		if (get_partition_info(blk_dev, part, &partinfo) != 0) {
+			printf("%s: could not find partition #%d on mmc device #%d!\n",
+					__func__, part, dev);
+			return -1;
+		}
+
+		dfu->data.mmc.lba_start = partinfo.start;
+		dfu->data.mmc.lba_size = partinfo.size;
+		dfu->data.mmc.lba_blk_size = partinfo.blksz;
+
 	} else {
 		printf("%s: Memory layout (%s) not supported!\n", __func__, st);
+		return -1;
 	}
 
 	if (dfu->layout == DFU_FS_EXT4 || dfu->layout == DFU_FS_FAT) {
Signature · 1 line
1.7.12
#22 lore raw

PATCH 7/9 Add a partition type target

Dear Pantelis Antoniou,

Quoted 25 lines

Dealing with raw block numbers with the dfu is very annoying. Introduce a partition method.

---
 drivers/dfu/dfu_mmc.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
drivers/dfu/dfu_mmc.c +4 -0
index 5d504df..3733b21 100644
@@ -153,6 +153,10 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, void
 *buf, long *len)
 
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
+	int dev, part;
+	struct mmc *mmc;
+	block_dev_desc_t *blk_dev;
+	disk_partition_t partinfo;
 	char *st;
 
drivers/dfu/dfu_mmc.c +0 -0
 	dfu->dev_type = DFU_DEV_MMC;

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char · line 178

Quoted 9 lines
drivers/dfu/dfu_mmc.c +6 -0
@@ -166,8 +170,33 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char
 *s) dfu->layout = DFU_FS_FAT;
 	} else if (!strcmp(st, "ext4")) {
 		dfu->layout = DFU_FS_EXT4;
+	} else if (!strcmp(st, "part")) {
+
+		dfu->layout = DFU_RAW_ADDR;
+
+		dev = simple_strtoul(s, &s, 10);
+		part = simple_strtoul(++s, &s, 10);

++s ... this is unreadable and definitelly prone to breakage.

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)

Quoted 4 lines
drivers/dfu/dfu_mmc.c +4 -0
+
+		mmc = find_mmc_device(dev);
+		if (mmc == NULL || mmc_init(mmc)) {
+			printf("%s: could not find mmc device #%d!\n", __func__, 

dev);

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)

Quoted 6 lines
drivers/dfu/dfu_mmc.c +6 -0
+			return -1;
+		}
+
+		blk_dev = &mmc->block_dev;
+		if (get_partition_info(blk_dev, part, &partinfo) != 0) {
+			printf("%s: could not find partition #%d on mmc device 

#%d!\n",

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char · line 190

Quoted 2 lines
drivers/dfu/dfu_mmc.c +2 -0
+					__func__, part, dev);
+			return -1;

Try using regular errno.h ... fix all around.

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s) · line 199

Quoted 9 lines
drivers/dfu/dfu_mmc.c +7 -0
+		}
+
+		dfu->data.mmc.lba_start = partinfo.start;
+		dfu->data.mmc.lba_size = partinfo.size;
+		dfu->data.mmc.lba_blk_size = partinfo.blksz;
+
 	} else {
 		printf("%s: Memory layout (%s) not supported!\n", __func__, st);
+		return -1;

This is new ... does it fit into this patch at all?

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s) · line 202

Quoted 3 lines
drivers/dfu/dfu_mmc.c +0 -0
 	}
 
 	if (dfu->layout == DFU_FS_EXT4 || dfu->layout == DFU_FS_FAT) {

Best regards,
Marek Vasut

#23 lore raw

PATCH 7/9 Add a partition type target

Hi Marek,

Quoted 25 lines · Marek Vasut

Dear Pantelis Antoniou,

Quoted 23 lines

Dealing with raw block numbers with the dfu is very annoying. Introduce a partition method.

---
drivers/dfu/dfu_mmc.c | 29 +++++++++++++++++++++++++++++

1 file changed, 29 insertions(+)
drivers/dfu/dfu_mmc.c +4 -0
index 5d504df..3733b21 100644
@@ -153,6 +153,10 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, void
 *buf, long *len)
 
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
+	int dev, part;
+	struct mmc *mmc;
+	block_dev_desc_t *blk_dev;
+	disk_partition_t partinfo;
 	char *st;
 
Quoted 14 lines

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char · line 178

Quoted 11 lines
	dfu->dev_type = DFU_DEV_MMC;
drivers/dfu/dfu_mmc.c +6 -0
@@ -166,8 +170,33 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char
 *s) dfu->layout = DFU_FS_FAT;
 	} else if (!strcmp(st, "ext4")) {
 		dfu->layout = DFU_FS_EXT4;
+	} else if (!strcmp(st, "part")) {
+
+		dfu->layout = DFU_RAW_ADDR;
+
+		dev = simple_strtoul(s, &s, 10);
+		part = simple_strtoul(++s, &s, 10);

++s ... this is unreadable and definitelly prone to breakage.

Just following what the existing code does. Look around this line. Perhaps we should modify that too.

Quoted 12 lines

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)

Quoted 4 lines
drivers/dfu/dfu_mmc.c +4 -0
+
+		mmc = find_mmc_device(dev);
+		if (mmc == NULL || mmc_init(mmc)) {
+			printf("%s: could not find mmc device #%d!\n", __func__, 

dev);

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)

Quoted 6 lines
drivers/dfu/dfu_mmc.c +6 -0
+			return -1;
+		}
+
+		blk_dev = &mmc->block_dev;
+		if (get_partition_info(blk_dev, part, &partinfo) != 0) {
+			printf("%s: could not find partition #%d on mmc device 

#%d!\n",

Quoted 5 lines

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char · line 190

Quoted 2 lines
drivers/dfu/dfu_mmc.c +2 -0
+					__func__, part, dev);
+			return -1;

Try using regular errno.h ... fix all around.

The whole file doesn't use errno.h at all. Changing this single thing will stick out like a sore thumb.

Quoted 12 lines

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s) · line 199

Quoted 9 lines
drivers/dfu/dfu_mmc.c +7 -0
+		}
+
+		dfu->data.mmc.lba_start = partinfo.start;
+		dfu->data.mmc.lba_size = partinfo.size;
+		dfu->data.mmc.lba_blk_size = partinfo.blksz;
+
 	} else {
 		printf("%s: Memory layout (%s) not supported!\n", __func__, st);
+		return -1;

This is new ... does it fit into this patch at all?

It should, it's an error condition and the code just blindly continued.

Quoted 6 lines

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s) · line 202

Quoted 3 lines
drivers/dfu/dfu_mmc.c +0 -0
 	}
 
 	if (dfu->layout == DFU_FS_EXT4 || dfu->layout == DFU_FS_FAT) {

Best regards,
Marek Vasut

Regards

-- Pantelis

#24 lore raw

PATCH 7/9 Add a partition type target

Dear Pantelis Antoniou,

Quoted 47 lines

Hi Marek,

Quoted 35 lines · Marek Vasut

Dear Pantelis Antoniou,

Quoted 33 lines

Dealing with raw block numbers with the dfu is very annoying. Introduce a partition method.

---
drivers/dfu/dfu_mmc.c | 29 +++++++++++++++++++++++++++++

1 file changed, 29 insertions(+)
drivers/dfu/dfu_mmc.c +4 -0
index 5d504df..3733b21 100644
@@ -153,6 +153,10 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu,
 void *buf, long *len)
 
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
+	int dev, part;
+	struct mmc *mmc;
+	block_dev_desc_t *blk_dev;
+	disk_partition_t partinfo;
 
 	char *st;
	
	dfu->dev_type = DFU_DEV_MMC;
drivers/dfu/dfu_mmc.c +0 -0
@@ -166,8 +170,33 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu,
 char *s) dfu->layout = DFU_FS_FAT;
 
 	} else if (!strcmp(st, "ext4")) {
 
 		dfu->layout = DFU_FS_EXT4;
 
Quoted 8 lines

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s) · line 178

Quoted 6 lines
drivers/dfu/dfu_mmc.c +6 -0
+	} else if (!strcmp(st, "part")) {
+
+		dfu->layout = DFU_RAW_ADDR;
+
+		dev = simple_strtoul(s, &s, 10);
+		part = simple_strtoul(++s, &s, 10);

++s ... this is unreadable and definitelly prone to breakage.

Quoted 2 lines

Just following what the existing code does. Look around this line. Perhaps we should modify that too.

Yes, that'd be really nice ... but in a separate patch please.

Quoted 16 lines
Quoted 16 lines

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)

Quoted 4 lines
drivers/dfu/dfu_mmc.c +4 -0
+
+		mmc = find_mmc_device(dev);
+		if (mmc == NULL || mmc_init(mmc)) {
+			printf("%s: could not find mmc device #%d!\n", __func__,

dev);

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)

Quoted 6 lines
drivers/dfu/dfu_mmc.c +6 -0
+			return -1;
+		}
+
+		blk_dev = &mmc->block_dev;
+		if (get_partition_info(blk_dev, part, &partinfo) != 0) {
+			printf("%s: could not find partition #%d on mmc device

#%d!\n",

Quoted 7 lines
Quoted 4 lines

drivers/dfu/dfu_mmc.c int dfu_fill_entity_mmc(struct dfu_entity *dfu, · line 193

Quoted 2 lines
drivers/dfu/dfu_mmc.c +2 -0
+					__func__, part, dev);
+			return -1;

Try using regular errno.h ... fix all around.

The whole file doesn't use errno.h at all. Changing this single thing will stick out like a sore thumb.

:-(

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/dfu/dfu_mmc.c +6 -0
+		}
+
+		dfu->data.mmc.lba_start = partinfo.start;
+		dfu->data.mmc.lba_size = partinfo.size;
+		dfu->data.mmc.lba_blk_size = partinfo.blksz;
+
 
 	} else {
Quoted 7 lines
Quoted 5 lines

drivers/dfu/dfu_mmc.c

Quoted 3 lines
		printf("%s: Memory layout (%s) not supported!\n", __func__, st);
drivers/dfu/dfu_mmc.c +1 -0
+		return -1;

This is new ... does it fit into this patch at all?

It should, it's an error condition and the code just blindly continued.

Even more :-((

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
	}
	
	if (dfu->layout == DFU_FS_EXT4 || dfu->layout == DFU_FS_FAT) {

Best regards,
Marek Vasut

Regards

-- Pantelis

#25 lore raw

PATCH 8/9 Issue connect/disconnect as appropriate

In reply to Pantelis Antoniou

Call usb_gadget_connect/usb_gadget_disconnect in g_dnl_bind/g_dnl_unbind.

---
 drivers/usb/gadget/g_dnl.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/gadget/g_dnl.c +8 -1
index 7d87050..bbbfe02 100644
@@ -83,7 +83,11 @@ static struct usb_gadget_strings *g_dnl_composite_strings[] = {
 
 static int g_dnl_unbind(struct usb_composite_dev *cdev)
 {
-	debug("%s\n", __func__);
+	struct usb_gadget *gadget = cdev->gadget;
+
+	debug("%s: calling usb_gadget_disconnect for controller '%s'\n", shortname, gadget->name);
+	usb_gadget_disconnect(gadget);
+
 	return 0;
 }
 
@@ -153,6 +157,9 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
 		device_desc.bcdDevice = __constant_cpu_to_le16(0x9999);
 	}
 
+	debug("%s: calling usb_gadget_connect for controller '%s'\n", shortname, gadget->name);
+	usb_gadget_connect(gadget);
+
 	return 0;
 
  error:
Signature · 1 line
1.7.12
#26 lore raw

PATCH 8/9 Issue connect/disconnect as appropriate

Dear Pantelis Antoniou,

Quoted 3 lines

Call usb_gadget_connect/usb_gadget_disconnect in g_dnl_bind/g_dnl_unbind.

[...]

u-boot$ ./tools/checkpatch.pl \[PATCH\ 8_9\]\ Issue\ connect_disconnect\ as\
appropriate.mbox
WARNING: line over 80 characters
#57: FILE: drivers/usb/gadget/g_dnl.c:88:
+ debug("%s: calling usb_gadget_disconnect for controller '%s'\n",
shortname, gadget->name);

WARNING: line over 80 characters
#67: FILE: drivers/usb/gadget/g_dnl.c:160:
+ debug("%s: calling usb_gadget_connect for controller '%s'\n", shortname,
gadget->name);

total: 0 errors, 2 warnings, 21 lines checked

NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE

[PATCH 8_9] Issue connect_disconnect as appropriate.mbox has style problems, please review.

If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.

... fix the other patches too

Best regards,
Marek Vasut

#27 lore raw

PATCH 8/9 Issue connect/disconnect as appropriate

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 14 lines · Marek Vasut

Dear Pantelis Antoniou,

Quoted 4 lines

Call usb_gadget_connect/usb_gadget_disconnect in
g_dnl_bind/g_dnl_unbind.

[...]

u-boot$ ./tools/checkpatch.pl \[PATCH\ 8_9\]\ Issue\
connect_disconnect\ as\ appropriate.mbox WARNING: line over 80 characters #57: FILE: drivers/usb/gadget/g_dnl.c:88: + debug("%s: calling usb_gadget_disconnect for controller '%s'\n", shortname, gadget->name);

Quoted 7 lines

WARNING: line over 80 characters #67: FILE:
drivers/usb/gadget/g_dnl.c:160: + debug("%s: calling
usb_gadget_connect for controller '%s'\n", shortname, gadget->name);

total: 0 errors, 2 warnings, 21 lines checked

Going over the limit is OK for prints to increase grepability. Unless splitting at the arguments would fix it.

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQtX8HAAoJENk4IS6UOR1WddgQAIwTWvCvLrKCAwIuPNoWQrWv SQd0Pp9cQqrEgIdNRq+qwDMO1drD40w/zZEpo21tPXtWIwHLgfEz2JAfEXRPJh0P 71hjKAQUq7Y4kkseu1Hx0qH1bmt1ILv6qZw3PHCuHGcD534kp2XegHXRnxvLho64 ucluUjcf5sYiCmp1Wfb7mRJe+qojQm6Njbx2RxyEb/5KyNuvlzYfb/Pu+QztrdYc ku52fFf4DLBhgoYcRbUaVk9GqloeZkf6UkWbwEJQjfkxS6F32sH7Ye1/F260RBe4 jbDmmhTKNe+FTftO17N0KULdeML2nRxwDP7hv1BrE/M/WoMQvSmPavZ6X+JUJ3wb pLrvRTrui3uohESiicVCsBjZyIMqd4rX58El9PzrXBIFdsvrJnfG1yopSzDLZ4Gu /QCpkkUzG5FsPwA0bc5CCmaD9vAqp5Pv9VN59K9Q949hKasOv7qmPMRKqmBFAZDg t0W7xTbh9tkOGA2oDDU6pmNAfptwIns/4FX0Gxko/3Di3BO+vW6HKqYIJND4FbEE i3JOrMrDkT1Kse3PNevSxZ2HMb2N7ALe/HnECp4wLnorRKlyavhYfqHs+lklCJDV gfaocfzxyFjzXnEpxGqlbBZpNyH65+YSZP7Y/8UCkgs1Sp9N9SzdGCobFDlmzJwa Z8ZFbT1FWw0pf9kEfYM+
=XhQi
-----END PGP SIGNATURE-----

#28 lore raw

PATCH 9/9 Add DFU config

In reply to Pantelis Antoniou

Add configuration for using DFU on the am335x_evm boards

---
 include/configs/am335x_evm.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
include/configs/am335x_evm.h +26 -0
index ab9549b..0befa34 100644
@@ -39,6 +39,8 @@
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_INITRD_TAG
 
+#define CONFIG_SYS_CACHELINE_SIZE       64
+
 /* commands to include */
 #include <config_cmd_default.h>
 
@@ -90,6 +92,7 @@
 			"setenv fdtfile am335x-evm.dtb; fi; " \
 		"if test $board_name = A335X_SK; then " \
 			"setenv fdtfile am335x-evmsk.dtb; fi\0" \
+	CONFIG_DFU_ALT
 
 #define CONFIG_BOOTCOMMAND \
 	"mmc dev ${mmcdev}; if mmc rescan; then " \
@@ -153,6 +156,28 @@
 #define CONFIG_CMD_SF
 #define CONFIG_SF_DEFAULT_SPEED		(24000000)
 
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USB_GADGET
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
+
+/* USB TI's IDs */
+#define CONFIG_USBD_HS
+#define CONFIG_G_DNL_VENDOR_NUM 0x0525
+#define CONFIG_G_DNL_PRODUCT_NUM 0xa4a7
+#define CONFIG_G_DNL_MANUFACTURER "Texas Instruments"
+
+#define CONFIG_DFU_ALT \
+	"dfu_alt_info=" \
+	"boot part 0 1;" \
+	"rootfs part 0 2;" \
+	"MLO fat 0 1;" \
+	"u-boot.img fat 0 1;" \
+	"uEnv.txt fat 0 1\0"
+
+#define CONFIG_CMD_DFU
+
  /* Physical Memory Map */
 #define CONFIG_NR_DRAM_BANKS		1		/*  1 bank of DRAM */
 #define PHYS_DRAM_1			0x80000000	/* DRAM Bank #1 */
@@ -265,6 +290,7 @@
 #define CONFIG_MUSB_GADGET
 #define CONFIG_MUSB_PIO_ONLY
 #define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_MUSB_HOST
 #define CONFIG_AM335X_USB0
 #define CONFIG_AM335X_USB0_MODE	MUSB_PERIPHERAL
Signature · 1 line
1.7.12
#29 lore raw

PATCH 9/9 Add DFU config

Dear Pantelis Antoniou,

Quoted 12 lines

Add configuration for using DFU on the am335x_evm boards

---
 include/configs/am335x_evm.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
include/configs/am335x_evm.h +0 -0
index ab9549b..0befa34 100644

include/configs/am335x_evm.h line 42

Quoted 4 lines
include/configs/am335x_evm.h +1 -0
@@ -39,6 +39,8 @@
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_INITRD_TAG
 
+#define CONFIG_SYS_CACHELINE_SIZE       64

How come you need this, isn't it configured by default for ARM ?

include/configs/am335x_evm.h line 95

Quoted 8 lines
include/configs/am335x_evm.h +1 -0
 /* commands to include */
 #include <config_cmd_default.h>
 
@@ -90,6 +92,7 @@
 			"setenv fdtfile am335x-evm.dtb; fi; " \
 		"if test $board_name = A335X_SK; then " \
 			"setenv fdtfile am335x-evmsk.dtb; fi\0" \
+	CONFIG_DFU_ALT

What's this stuff here?

Quoted 17 lines
include/configs/am335x_evm.h +11 -0
 #define CONFIG_BOOTCOMMAND \
 	"mmc dev ${mmcdev}; if mmc rescan; then " \
@@ -153,6 +156,28 @@
 #define CONFIG_CMD_SF
 #define CONFIG_SF_DEFAULT_SPEED		(24000000)
 
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USB_GADGET
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
+
+/* USB TI's IDs */
+#define CONFIG_USBD_HS
+#define CONFIG_G_DNL_VENDOR_NUM 0x0525
+#define CONFIG_G_DNL_PRODUCT_NUM 0xa4a7
+#define CONFIG_G_DNL_MANUFACTURER "Texas Instruments"

include/configs/am335x_evm.h line 179

Quoted 10 lines
include/configs/am335x_evm.h +10 -0
+
+#define CONFIG_DFU_ALT \
+	"dfu_alt_info=" \
+	"boot part 0 1;" \
+	"rootfs part 0 2;" \
+	"MLO fat 0 1;" \
+	"u-boot.img fat 0 1;" \
+	"uEnv.txt fat 0 1\0"
+
+#define CONFIG_CMD_DFU

I see ... hm. Not my call to decide.

include/configs/am335x_evm.h line 296

Quoted 11 lines
include/configs/am335x_evm.h +1 -0
  /* Physical Memory Map */
 #define CONFIG_NR_DRAM_BANKS		1		/*  1 bank of DRAM */
 #define PHYS_DRAM_1			0x80000000	/* DRAM Bank #1 */
@@ -265,6 +290,7 @@
 #define CONFIG_MUSB_GADGET
 #define CONFIG_MUSB_PIO_ONLY
 #define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW	2
 #define CONFIG_MUSB_HOST
 #define CONFIG_AM335X_USB0
 #define CONFIG_AM335X_USB0_MODE	MUSB_PERIPHERAL

Best regards,
Marek Vasut

#30 lore raw

PATCH 9/9 Add DFU config

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 14 lines · Marek Vasut

Dear Pantelis Antoniou,

Quoted 12 lines

Add configuration for using DFU on the am335x_evm boards

--- include/configs/am335x_evm.h | 26 ++++++++++++++++++++++++++

1 file changed, 26 insertions(+)
(quoted diff) +0 -0

b/include/configs/am335x_evm.h index ab9549b..0befa34 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -39,6 +39,8 @@ #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_INITRD_TAG

Quoted 3 lines
Quoted 1 line

+#define CONFIG_SYS_CACHELINE_SIZE 64

How come you need this, isn't it configured by default for ARM ?

iirc if we don't spell it out, it's 32, which isn't correct for the platform. It should be a separate patch however.

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQtX9UAAoJENk4IS6UOR1WVdUP/1RbqCpgmttzpUqYDwKkVA76 b+m6Wbo5fqzle4mKy8sKBjVZCYARdtp3VPLxcqfyY5ZjZQIezjQre7PWdPWFJiDf Yg/LoajSBxDJ2yRCgJQ4suP5lGE5lG7T0xMXE6ulIB/A4WshLJPW9IxVZT2p4iHu 93NfAY6DbKFxIze8jCJnXis8MYiAe8WCKkWmAhKt07N9Fw7L4iJcryisuG//53sq GLdxYuIsa76h+oi3D1nPOLLp1Jldp5BbtwHW9IVPHcYC6bPFebh8juRlzPJFxqPT FpUA4d1+dF95/MBAUSN7eewxs6Ic2Y6rpK7pYAUs3IXBDq9X9nCm1dyslo7nTKpv K5ARuQ2OzcqD7ZfeeSyVmWHQ9RzXLbepVcWWpjv0bgumgtujrQoPB+tgnIpeObf8 R9E2XPwCO9gOjUVVudGTZ/FcNS61vwacJhVRsQvjv4Ba6ZOC5Z/bjvKqkwKA9JP4 wY+jLvjeWJOo6ZZ4/CPeO48+i6ZYbipPEj+0YQ2yL2madKYlopNG//esLZ3g7koE ptb5nbzc0dObuAwtoqGYXIBS+i1HhsQ5c4fLOOKM69FRExC1QAoQf2KF7nbvr7RU oL28no8EIPF5QfrneK+4HapgYfdLslqlfsrqiSqnHATWAxroddTSNii/j8n2UfA0 YXlUFd7+msYT6qVdZ9dR
=QzXg
-----END PGP SIGNATURE-----

#31 lore raw

PATCH 9/9 Add DFU config

Quoted 18 lines · Tom Rini

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 14 lines · Marek Vasut

Dear Pantelis Antoniou,

Quoted 12 lines

Add configuration for using DFU on the am335x_evm boards

--- include/configs/am335x_evm.h | 26 ++++++++++++++++++++++++++

1 file changed, 26 insertions(+)
(quoted diff) +0 -0

b/include/configs/am335x_evm.h index ab9549b..0befa34 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -39,6 +39,8 @@ #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_INITRD_TAG

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

+#define CONFIG_SYS_CACHELINE_SIZE 64

How come you need this, isn't it configured by default for ARM ?

iirc if we don't spell it out, it's 32, which isn't correct for the platform. It should be a separate patch however.

OK.

Quoted 20 lines

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQtX9UAAoJENk4IS6UOR1WVdUP/1RbqCpgmttzpUqYDwKkVA76 b+m6Wbo5fqzle4mKy8sKBjVZCYARdtp3VPLxcqfyY5ZjZQIezjQre7PWdPWFJiDf Yg/LoajSBxDJ2yRCgJQ4suP5lGE5lG7T0xMXE6ulIB/A4WshLJPW9IxVZT2p4iHu 93NfAY6DbKFxIze8jCJnXis8MYiAe8WCKkWmAhKt07N9Fw7L4iJcryisuG//53sq GLdxYuIsa76h+oi3D1nPOLLp1Jldp5BbtwHW9IVPHcYC6bPFebh8juRlzPJFxqPT FpUA4d1+dF95/MBAUSN7eewxs6Ic2Y6rpK7pYAUs3IXBDq9X9nCm1dyslo7nTKpv K5ARuQ2OzcqD7ZfeeSyVmWHQ9RzXLbepVcWWpjv0bgumgtujrQoPB+tgnIpeObf8 R9E2XPwCO9gOjUVVudGTZ/FcNS61vwacJhVRsQvjv4Ba6ZOC5Z/bjvKqkwKA9JP4 wY+jLvjeWJOo6ZZ4/CPeO48+i6ZYbipPEj+0YQ2yL2madKYlopNG//esLZ3g7koE ptb5nbzc0dObuAwtoqGYXIBS+i1HhsQ5c4fLOOKM69FRExC1QAoQf2KF7nbvr7RU oL28no8EIPF5QfrneK+4HapgYfdLslqlfsrqiSqnHATWAxroddTSNii/j8n2UfA0 YXlUFd7+msYT6qVdZ9dR
=QzXg
-----END PGP SIGNATURE-----