
on nand flash using ubi, after the download of the new image into the flash, the "rest" of the nand sectors get erased while flushing the medium. With current u-boot version dfu-util may show:
Starting download: [##################################################] finished! state(7) = dfuMANIFEST, status(0) = No error condition is present unable to read DFU status
as dfu_get_status is not answered while erasing sectors, if erasing needs some time.
So do the following changes to prevent this:
- introduce dfuManifest state According to dfu specification [1] section 7: "the device enters the dfuMANIFEST-SYNC state and awaits the solicitation of the status report by the host. Upon receipt of the anticipated DFU_GETSTATUS, the device enters the dfuMANIFEST state, where it completes its reprogramming operations."
- when stepping into dfuManifest state, sending a PollTimeout DFU_MANIFEST_POLL_TIMEOUT in ms, to the host, so the host (dfu-util) waits the PollTimeout before sending a get_status again.
Patch 0002-usb-dfu-introduce-dfuMANIFEST-state.patch shows following checkpatch errors, but I think they are OK, as the hole file uses CamelCase for the statenames as this in sync with [1]
CHECK: Avoid CamelCase: <DFU_STATE_dfuMANIFEST> #103: FILE: drivers/usb/gadget/f_dfu.c:190: + f_dfu->dfu_state = DFU_STATE_dfuMANIFEST;
CHECK: Avoid CamelCase: <DFU_STATE_dfuIDLE> #156: FILE: drivers/usb/gadget/f_dfu.c:491: + f_dfu->dfu_state = DFU_STATE_dfuIDLE;
CHECK: Avoid CamelCase: <DFU_STATE_dfuERROR> #166: FILE: drivers/usb/gadget/f_dfu.c:501: + f_dfu->dfu_state = DFU_STATE_dfuERROR;
total: 0 errors, 0 warnings, 3 checks, 133 lines checked
NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE NETWORKING_BLOCK_COMMENT_STYLE USLEEP_RANGE
[1]: http://www.usb.org/developers/devclass_docs/usbdfu10.pdf
Heiko Schocher (3): usb, dfu: extract flush code into seperate function usb: dfu: introduce dfuMANIFEST state am335x, dfu: add DFU_MANIFEST_POLL_TIMEOUT to the siemens boards
README | 5 +++ drivers/dfu/dfu.c | 45 +++++++++++++------------ drivers/usb/gadget/f_dfu.c | 60 +++++++++++++++++++++++++++++----- include/configs/siemens-am33x-common.h | 1 + include/dfu.h | 4 +++ 5 files changed, 86 insertions(+), 29 deletions(-)
Cc: Lukasz Majewski l.majewski@samsung.com Cc: Kyungmin Park kyungmin.park@samsung.com Cc: Marek Vasut marex@denx.de