summaryrefslogtreecommitdiff
path: root/include/dfu.h
Commit message (Collapse)AuthorAgeLines
* dfu: mmc: Provide support for eMMC boot partition accessLukasz Majewski2014-05-15-0/+3
| | | | | | | | | | | | | | Before this patch it was only possible to access the default eMMC HW partition. By partition selection I mean the access to eMMC via the ext_csd[179] register programming. It sometimes happens that it is necessary to write to other partitions. This patch adds extra attribute to "raw" sub type of the dfu_alt_info environment variable (e.g. boot-mmc.bin raw 0x0 0x200 mmcpart 1;) It saves the original boot value and restores it after storing the file. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
* dfu, nand: add medium specific polltimeout functionHeiko Schocher2014-05-08-0/+1
| | | | | | | | | | | | | | | | | | add a possibility to add a medium specific polltimeout function. So it is possible to define different poll timeouts. Used on nand medium, for setting the DFU_MANIFEST_POLL_TIMEOUT only on nand ubi partitions, which is currently the only usecase. Change-Id: If1db5f49b32d93fefa7481e8dfe5b7ccc0e65af4 Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Marek Vasut <marex@denx.de> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Reviewed-by: Marek Vasut <marex@denx.de> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
* USB: gadget: added a saner gadget downloader registration APIMateusz Zalega2014-05-05-7/+0
| | | | | | | | | | Preprocessor definitions and hardcoded implementation selection in g_dnl core were replaced by a linker list made of (usb_function_name, bind_callback) pairs. Signed-off-by: Mateusz Zalega <m.zalega@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Marek Vasut <marex@denx.de>
* dfu: mmc: raw data write fixMateusz Zalega2014-05-05-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | When user attempted to perform a raw write using DFU (vide dfu_fill_entity_mmc) with MMC interface not initialized before, get_mmc_blk_size() reported invalid (zero) block size - it wasn't possible to write ie. a new u-boot image. This commit fixes that by initializing MMC device before use in dfu_fill_entity_mmc(). While fixing initialization sequence, I had to change about half of dfu_fill_entity_mmc's body, so I refactored it on the way to make it, IMHO, considerably more comprehensible. Being left as dead code, get_mmc_blk_size() was removed. Tested on Samsung Goni. Signed-off-by: Mateusz Zalega <m.zalega@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Tom Rini <trini@ti.com> Cc: Minkyu Kang <mk7.kang@samsung.com>
* usb: dfu: introduce dfuMANIFEST stateHeiko Schocher2014-03-23-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 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 ( http://www.usb.org/developers/devclass_docs/usbdfu10.pdf ) 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. Signed-off-by: Heiko Schocher <hs@denx.de> 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>
* usb, dfu: extract flush code into seperate functionHeiko Schocher2014-03-23-0/+1
| | | | | | | | | | | move the flushing code into an extra function dfu_flush(), so it can be used from other code. Signed-off-by: Heiko Schocher <hs@denx.de> 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>
* usb: dfu: f_dfu: Provide infrastructure to adjust DFU's Poll Timeout valueLukasz Majewski2013-12-18-0/+3
| | | | | | | | | | | It is necessary to deter the host from sending subsequent DFU_GETSTATUS request in the case of e.g. writing the buffer to medium. Here the timeout is increased when we fill up the whole buffer. This delay allows eMMC memory to perform its internal operations. Otherwise we end up with HOST's error regarding GET_STATUS receive timeout. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
* dfu: Export allocated dfu buffer sizeLukasz Majewski2013-12-18-0/+1
| | | | | | | The method for exporting size of allocated buffer is provided. It is afterwards used by USB's dfu function code. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
* dfu:core: Export dfu_{get|free}_buf functionsLukasz Majewski2013-10-20-0/+2
| | | | | | | | Define the dfu_get_buf() and dfu_free_buf() as global functions. They are necessary for zero copy buffer management, when DFU backend is used for storing data. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
* dfu:core: Find DFU alt setting number by passing its nameLukasz Majewski2013-10-20-0/+1
| | | | | | | New function - dfu_get_alt() - has been added to dfu core. If present, it returns alt setting's number corresponding to passed name. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
* usb:g_dnl:dfu: Download gadget and DFU function code clean upLukasz Majewski2013-09-24-0/+9
| | | | | | | | | | | | The download gadget code and DFU function lacks of proper declarations for the case when a target board wants to use only one of available usb functions. Moreover the relevant declarations have been moved to consistent localization (like <dfu.h>). Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de>
* dfu: ram supportAfzal Mohammed2013-09-24-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DFU spec mentions it as a method to upgrade firmware (software stored in writable non-volatile memory). It also says other potential uses of DFU is beyond scope of the spec. Here such a beyond the scope use is being attempted - directly pumping binary images from host via USB to RAM. This facility is a developer centric one in that it gives advantage over upgrading non-volatile memory for testing new images every time during development and/or testing. Directly putting image onto RAM would speed up upgrade process. This and convenience was the initial thoughts that led to doing this, speed improvement over MMC was only 1 second though - 6 sec on RAM as opposed to 7 sec on MMC in beagle bone, perhaps enabling cache and/or optimizing DFU framework to avoid multiple copy for ram (if worth) may help, and on other platforms and other boot media like NAND maybe improvement would be higher. And for a platform that doesn't yet have proper DFU suppport for non-volatile media's, DFU to RAM can be used. Another minor advantage would be to increase life of mmc/nand as it would be less used during development/testing. usage: <image name> ram <start address> <size> eg. kernel ram 0x81000000 0x1000000 Downloading images to RAM using DFU is not something new, this is acheived in openmoko also. DFU on RAM can be used for extracting RAM contents to host using dfu upload. Perhaps this can be extended to io for squeezing out register dump through usb, if it is worth. Signed-off-by: Afzal Mohammed <afzal.mohd.ma@gmail.com> Cc: Heiko Schocher <hs@denx.de> Cc: Marek Vasut <marex@denx.de> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Cc: Gerhard Sittig <gsi@denx.de> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Heiko Schocher <hs@denx.de>
* dfu: unify mmc/nand read/write ops enumAfzal Mohammed2013-09-24-0/+5
| | | | | | | | | | | | | | | MMC and NAND independently defines same enumerators for read/write. Unify them by defining enum in dfu header. RAM support that is being added newly also can make use of it. Signed-off-by: Afzal Mohammed <afzal.mohd.ma@gmail.com> Cc: Heiko Schocher <hs@denx.de> Cc: Marek Vasut <marex@denx.de> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Heiko Schocher <hs@denx.de>
* dfu: Extract common DFU code to handle "dfu_alt_info" environment variableLukasz Majewski2013-09-24-0/+1
| | | | | | | | | | | New dfu_init_env_entities() function has been extracted from cmd_dfu.c and stored at dfu core. This is a dfu centric code, so it shall be processed in the core. Change-Id: I756c5de922fa31399d8804eaadc004ee98844ec2 Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Heiko Schocher <hs@denx.de>
* dfu: Make maximum DFU file size equal to default DFU data bufferLukasz Majewski2013-09-24-1/+1
| | | | | | | | | | | | | Up till now the DFU maximum file size (to be written to e.g. eMMC) was different from the DFU data buffer size. It caused errors when one buffer was smaller than data to be written. Now, the maximum DFU file size is equal to default DFU buffer size. In spite of this, user is still able to manually adjust those default values. Change-Id: Ied75d0f7b59588ebd79dae9a22af801d36622216 Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
* dfu, nand, ubi: add partubi alt settings for updating ubi partitionHeiko Schocher2013-08-26-0/+2
| | | | | | | | | | | | | | | | | | | | updating an ubi partition needs a completely erased mtd partition, see: http://lists.infradead.org/pipermail/linux-mtd/2011-May/035416.html So, add partubi alt setting for the dfu_alt_info environment variable to mark this partition as an ubi partition. In case we update an ubi partition, we erase after flashing the image into the partition, the remaining sektors. Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Cc: Tom Rini <trini@ti.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Marek Vasut <marex@denx.de> Cc: Wolfgang Denk <wd@denx.de> Cc: Scott Wood <scottwood@freescale.com>
* dfu: Implementation of target reset after communication with dfu-util's -R ↵Lukasz Majewski2013-07-29-0/+2
| | | | | | | | | | | | | | switch This patch extends dfu code to support transmission with -R switch specified at dfu-util. When -R is specified, the extra USB_REQ_DFU_DETACH request is sent after successful data transmission. Then dfu resources are released and reset command is issued. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-24-13/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* dfu: make data buffer size configurableHeiko Schocher2013-06-30-1/+3
| | | | | | | | | | | | | | | | Dfu transfer uses a buffer before writing data to the raw storage device. Make the size (in bytes) of this buffer configurable through environment variable "dfu_bufsiz". Defaut value is configurable through CONFIG_SYS_DFU_DATA_BUF_SIZE Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Cc: Tom Rini <trini@ti.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Marek Vasut <marex@denx.de> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Tom Rini <trini@ti.com>
* dfu: NAND specific routines for DFU operationPantelis Antoniou2013-04-10-0/+23
| | | | | | | | Support for NAND storage devices to work with the DFU framework. Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com> Signed-off-by: Tom Rini <trini@ti.com> Acked-by: Scott Wood <scottwood@freescale.com>
* dfu: Change indentation of defines in <dfu.h>Tom Rini2013-04-10-3/+3
| | | | Signed-off-by: Tom Rini <trini@ti.com>
* dfu: Support larger than memory transfers.Pantelis Antoniou2013-04-10-2/+22
| | | | | | | | | | | | | | | | | | | Previously we didn't support upload/download larger than available memory. This is pretty bad when you have to update your root filesystem for example. This patch removes that limitation (and the crashes when you transfered any file larger than 4MB) by making raw image writes be done in chunks and making file maximum size be configurable. The sequence number is a 16 bit counter; make sure we handle rollover correctly. This fixes the wrong transfers for large (> 256MB) images. Also utilize a variable to handle initialization, so that we don't rely on just the counter sent by the host. Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com> Signed-off-by: Tom Rini <trini@ti.com>
* dfu: Increase DFU buffer size from 4MiB to 8MiBŁukasz Majewski2013-04-08-1/+1
| | | | | | | | Increase size of DMA buffer from 4MiB to 8MiB. This is necessary due to uImage size increase. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
* dfu: DFU backend implementationLukasz Majewski2012-09-01-0/+103
New, separate driver at ./drivers/dfu has been added. It allows platform and storage independent operation of DFU. It has been extended to use new MMC level of command abstraction. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Marek Vasut <marex@denx.de>