Skip to contentSkip to conversation

usb, dfu gadget: switch to dfu mode in dfu_bind

PATCH New Heiko Schocher 2 participants 2 messages Jun 25, 2013 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb, dfu gadget: switch to dfu mode in dfu_bind

- set in to_dfu_mode() f_dfu->dfu_state = DFU_STATE_dfuIDLE as after every to_dfu_mode call this is done, so move this into to_dfu_mode
- switch in dfu_bind() into dfu mode:
This fixes wrong "dfu-util -l" output, when calling "dfu-util -l" after a board reset, without doing a download before. See also discussion here:

http://lists.denx.de/pipermail/u-boot/2013-June/157272.html

Cc Lukasz Majewski <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc Tom Rini <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Samuel Egli <[email protected]>
---
 drivers/usb/gadget/f_dfu.c | 4 +++-

1 Datei ge?ndert, 3 Zeilen hinzugef?gt(+), 1 Zeile entfernt(-)

drivers/usb/gadget/f_dfu.c +3 -1
index a322ae5..178a004 100644
@@ -183,6 +183,7 @@ static inline void to_dfu_mode(struct f_dfu *f_dfu)
 {
 	f_dfu->usb_function.strings = dfu_strings;
 	f_dfu->usb_function.hs_descriptors = f_dfu->function;
+	f_dfu->dfu_state = DFU_STATE_dfuIDLE;
 }
 
 static inline void to_runtime_mode(struct f_dfu *f_dfu)
@@ -233,7 +234,6 @@ static int state_app_idle(struct f_dfu *f_dfu,
 	case USB_REQ_DFU_DETACH:
 		f_dfu->dfu_state = DFU_STATE_appDETACH;
 		to_dfu_mode(f_dfu);
-		f_dfu->dfu_state = DFU_STATE_dfuIDLE;
 		value = RET_ZLP;
 		break;
 	default:
@@ -653,6 +653,8 @@ static int dfu_bind(struct usb_configuration *c, struct usb_function *f)
 			->iInterface = id;
 	}
 
+	to_dfu_mode(f_dfu);
+
 	stringtab_dfu.strings = f_dfu->strings;
 
 	cdev->req->context = f_dfu;
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 1/1 usb, dfu gadget: switch to dfu mode in dfu_bind

Hi Heiko,

Quoted 10 lines

- set in to_dfu_mode() f_dfu->dfu_state = DFU_STATE_dfuIDLE as after every to_dfu_mode call this is done, so move this into to_dfu_mode
- switch in dfu_bind() into dfu mode:
This fixes wrong "dfu-util -l" output, when calling "dfu-util -l" after a board reset, without doing a download before. See also discussion here:

http://lists.denx.de/pipermail/u-boot/2013-June/157272.html

Test HW: Exynos4210 - Trats target

Quoted 41 lines
Cc Lukasz Majewski <[email protected]>
Cc Pantelis Antoniou <[email protected]>
Cc Tom Rini <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Samuel Egli <[email protected]>
---
 drivers/usb/gadget/f_dfu.c | 4 +++-

1 Datei ge?ndert, 3 Zeilen hinzugef?gt(+), 1 Zeile entfernt(-)

drivers/usb/gadget/f_dfu.c +3 -1
index a322ae5..178a004 100644
@@ -183,6 +183,7 @@ static inline void to_dfu_mode(struct f_dfu
 *f_dfu) {
 	f_dfu->usb_function.strings = dfu_strings;
 	f_dfu->usb_function.hs_descriptors = f_dfu->function;
+	f_dfu->dfu_state = DFU_STATE_dfuIDLE;
 }
 
 static inline void to_runtime_mode(struct f_dfu *f_dfu)
@@ -233,7 +234,6 @@ static int state_app_idle(struct f_dfu *f_dfu,
 	case USB_REQ_DFU_DETACH:
 		f_dfu->dfu_state = DFU_STATE_appDETACH;
 		to_dfu_mode(f_dfu);
-		f_dfu->dfu_state = DFU_STATE_dfuIDLE;
 		value = RET_ZLP;
 		break;
 	default:
@@ -653,6 +653,8 @@ static int dfu_bind(struct usb_configuration *c,
 struct usb_function *f) ->iInterface = id;
 	}
 
+	to_dfu_mode(f_dfu);
+
 	stringtab_dfu.strings = f_dfu->strings;
 
 	cdev->req->context = f_dfu;
Signature · 5 lines
Best regards,

Lukasz Majewski

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