All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 0/3] usb: dfu: introduce dfuMANIFEST state
@ 2014-03-17 10:56 Heiko Schocher
  2014-03-17 10:56 ` [U-Boot] [PATCH v2 1/3] usb, dfu: extract flush code into seperate function Heiko Schocher
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Heiko Schocher @ 2014-03-17 10:56 UTC (permalink / raw)
  To: u-boot

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

- changes for v2:
  - add Pantelis Antoniou to Cc
  - add comment from Marek Vasut
    - move comment and "if" back to dfu_write()
  - add comment from Lukasz Majewski:
    - remove unneccessary comment "end?"
    - add Readme entry for DFU_DEFAULT_POLL_TIMEOUT
    - remove unneeded flag setpolltimeout

- ToDo:
   - look if it is possible to get rid of the constant DFU_MANIFEST_POLL_TIMEOUT
     for all dfu entities. Maybe as Lukasz suggested:
     Add a callback - called e.g. (*poll_timeout) to the struct [mmc|nand]_internal_data.
     Then some helper functions would be defined at dfu_[mmc|nand].c and used at f_dfu.c
     so we can decide on a per medium/partition base, how long a PollTimeout
     would be for a dfu entity ... This can be done in a seperate
     step.

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                                 | 10 +++++++
 drivers/dfu/dfu.c                      | 42 +++++++++++++++--------------
 drivers/usb/gadget/f_dfu.c             | 48 +++++++++++++++++++++++++++++-----
 include/configs/siemens-am33x-common.h |  1 +
 include/dfu.h                          |  4 +++
 5 files changed, 79 insertions(+), 26 deletions(-)

Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>

-- 
1.8.3.1

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

end of thread, other threads:[~2014-03-18 18:21 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-17 10:56 [U-Boot] [PATCH v2 0/3] usb: dfu: introduce dfuMANIFEST state Heiko Schocher
2014-03-17 10:56 ` [U-Boot] [PATCH v2 1/3] usb, dfu: extract flush code into seperate function Heiko Schocher
2014-03-18  0:21   ` Marek Vasut
2014-03-18  6:02     ` Heiko Schocher
2014-03-18  6:55       ` Lukasz Majewski
2014-03-18 11:32         ` Marek Vasut
2014-03-18 11:31       ` Marek Vasut
2014-03-18  6:51     ` Lukasz Majewski
2014-03-18 11:33       ` Marek Vasut
2014-03-18 12:35         ` Lukasz Majewski
2014-03-18 15:23           ` Marek Vasut
2014-03-18 15:53             ` Lukasz Majewski
2014-03-18 18:21               ` Marek Vasut
2014-03-17 10:56 ` [U-Boot] [PATCH v2 2/3] usb: dfu: introduce dfuMANIFEST state Heiko Schocher
2014-03-17 10:56 ` [U-Boot] [PATCH v2 3/3] am335x, dfu: add DFU_MANIFEST_POLL_TIMEOUT to the siemens boards Heiko Schocher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.