u-boot-brain/drivers/usb/gadget
Maxime Ripard 6c9e00eebf fastboot: Implement flashing session counter
The fastboot flash command that writes an image to a partition works in
several steps:

1 - Retrieve the maximum size the device can download through the
    "max-download-size" variable

2 - Retrieve the partition type through the "partition-type:%s" variable,
    that indicates whether or not the partition needs to be erased (even
    though the fastboot client has minimal support for that)

3a - If the image is smaller than what the device can handle, send the image
     and flash it.

3b - If the image is larger than what the device can handle, create a
     sparse image, and split it in several chunks that would fit. Send the
     chunk, flash it, repeat until we have no more data to send.

However, in the 3b case, the subsequent transfers have no particular
identifiers, the protocol just assumes that you would resume the writes
where you left it.

While doing so works well, it also means that flashing two subsequent
images on the same partition (for example because the user made a mistake)
would not work withouth flashing another partition or rebooting the board,
which is not really intuitive.

Since we have always the same pattern, we can however maintain a counter
that will be reset every time the client will retrieve max-download-size,
and incremented after each buffer will be flashed, that will allow us to
tell whether we should simply resume the flashing where we were, or start
back at the beginning of the partition.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2015-11-12 13:17:32 -05:00
..
udc Various Makefiles: Add SPDX-License-Identifier tags 2015-11-10 09:19:52 -05:00
at91_udc.c usb: gadget: at91_udc: add at91_udc into U-Boot 2015-09-11 09:35:40 +02:00
at91_udc.h usb: gadget: at91_udc: add at91_udc into U-Boot 2015-09-11 09:35:40 +02:00
atmel_usba_udc.c usb: modify usb_gadget_handle_interrupts to take controller index 2015-04-14 05:48:11 +02:00
atmel_usba_udc.h USB: gadget: add atmel usba udc driver 2013-09-24 17:51:35 +02:00
bcm_udc_otg_phy.c usb: gadget: bcm_udc_otg files 2015-07-22 08:57:54 +02:00
bcm_udc_otg.h usb: gadget: bcm_udc_otg files 2015-07-22 08:57:54 +02:00
ci_udc.c usb: ci_udc: fix emissions of ZLPs 2015-09-12 20:24:42 +02:00
ci_udc.h ci_udc: Update the ci_udc driver to support bulk transfers 2015-05-29 12:41:04 +02:00
composite.c usb: gadget: don't leak configs when unbinding 2015-09-11 17:15:21 -04:00
config.c usb: gadget: config: fix unaligned access issues 2013-09-24 17:51:35 +02:00
core.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
designware_udc.c linux/kernel.h: sync min, max, min3, max3 macros with Linux 2014-11-23 06:48:30 -05:00
ep0.c cosmetic: replace MIN, MAX with min, max 2014-09-24 18:30:29 -04:00
ep0.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
epautoconf.c usb: dwc3: gadget: add common endpoint configuration for dwc3 udc driver 2015-04-14 05:48:12 +02:00
ether.c Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header 2015-09-11 17:15:20 -04:00
f_dfu.c usb: gadget: f_dfu: Add get_alt function to pass the USB compliance test 2015-01-18 12:31:00 +01:00
f_dfu.h usb: dfu: f_dfu: Provide infrastructure to adjust DFU's Poll Timeout value 2013-12-18 19:53:19 +01:00
f_fastboot.c fastboot: Implement flashing session counter 2015-11-12 13:17:32 -05:00
f_mass_storage.c usb: f_mass_storage: sleep_thread: decrease the interval for check ctrlc() 2015-06-08 15:26:00 +02:00
f_thor.c usb: lthor: Specify correct parameter for sizeof type 2015-11-03 17:29:54 +01:00
f_thor.h f_thor: Dont perform reset at the end of thor 2015-09-07 13:41:03 +02:00
fotg210.c usb: modify usb_gadget_handle_interrupts to take controller index 2015-04-14 05:48:11 +02:00
g_dnl.c usb: gadget: don't leak configs when unbinding 2015-09-11 17:15:21 -04:00
gadget_chips.h usb: musb-new: CONFIG_MUSB prefix replacement with CONFIG_USB_MUSB 2015-08-05 17:20:34 +02:00
Makefile usb: gadget: at91_udc: add at91_udc into U-Boot 2015-09-11 09:35:40 +02:00
mpc8xx_udc.c cosmetic: replace MIN, MAX with min, max 2014-09-24 18:30:29 -04:00
ndis.h USB: Add USB RNDIS gadget protocol 2011-02-19 20:32:37 +01:00
pxa25x_udc.c usb: modify usb_gadget_handle_interrupts to take controller index 2015-04-14 05:48:11 +02:00
pxa25x_udc.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
pxa27x_udc.c usb: pxa27x_udc: clean-up include file order 2015-08-24 20:30:38 +02:00
regs-otg.h driver:usb:s3c_udc: add support for Exynos4x12 2013-12-02 11:22:32 +09:00
rndis.c net: Add ethernet FCS length macro in net.h 2015-03-24 21:22:37 -06:00
rndis.h USB-RNDIS: Send RNDIS state on disconnecting 2011-02-19 20:32:38 +01:00
s3c_udc_otg_phy.c usb: s3c-otg: Split out PHY control 2014-11-07 16:32:02 +01:00
s3c_udc_otg_xfer_dma.c linux/kernel.h: sync min, max, min3, max3 macros with Linux 2014-11-23 06:48:30 -05:00
s3c_udc_otg.c usb: modify usb_gadget_handle_interrupts to take controller index 2015-04-14 05:48:11 +02:00
storage_common.c lib, linux: move linux specific defines to linux/compat.h 2014-08-25 19:25:03 -04:00
usbstring.c usb: handle NULL table in usb_gadget_get_string 2014-04-30 10:30:57 +02:00