summaryrefslogtreecommitdiffstats
path: root/common/fb_mmc.c
Commit message (Collapse)AuthorAgeFilesLines
* fastboot: sparse: implement reserve()Steve Rae2016-06-271-0/+7
| | | | | | | | | | In order to process the CHUNK_TYPE_DONT_CARE properly, there is a requirement to be able to 'reserve' a specified number of blocks in the storage media. Because of the special handling of "bad blocks" in NAND devices, this is implemented in a storage abstraction function. Signed-off-by: Steve Rae <srae@broadcom.com> Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
* fastboot: sparse: resync common/image-sparse.c (part 2)Steve Rae2016-06-271-24/+16
| | | | | | | | | | | | | | | | - update fastboot_okay() and fastboot_fail() This file originally came from upstream code. While retaining the storage abstraction feature, this is the second set of the changes required to resync with the cmd_flash_mmc_sparse_img() in the file aboot.c from https://us.codeaurora.org/cgit/quic/la/kernel/lk/plain/app/aboot/aboot.c?h=LE.BR.1.2.1 Signed-off-by: Steve Rae <srae@broadcom.com>
* fastboot: sparse: resync common/image-sparse.c (part 1)Steve Rae2016-06-271-22/+10
| | | | | | | | | | | | | | This file originally came from upstream code. While retaining the storage abstraction feature, this is the first set of the changes required to resync with the cmd_flash_mmc_sparse_img() in the file aboot.c from https://us.codeaurora.org/cgit/quic/la/kernel/lk/plain/app/aboot/aboot.c?h=LE.BR.1.2.1 Signed-off-by: Steve Rae <srae@broadcom.com>
* fastboot: sparse: remove session-id logicSteve Rae2016-06-271-5/+3
| | | | | | | This "session-id" alogrithm is not required, and currently corrupts the stored image whenever more the one "session" is required. Signed-off-by: Steve Rae <srae@broadcom.com>
* dm: block: Adjust device calls to go through helpers functionSimon Glass2016-03-141-2/+3
| | | | | | | | | | | | To ease conversion to driver model, add helper functions which deal with calling each block device method. With driver model we can reimplement these functions with the same arguments. Use inline functions to avoid increasing code size on some boards. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
* dm: block: Rename device number member dev to devnumSimon Glass2016-03-141-2/+2
| | | | | | | | | This is a device number, and we want to use 'dev' to mean a driver model device. Rename the member. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
* dm: part: Rename some partition functionsSimon Glass2016-03-141-5/+5
| | | | | | | | Rename three partition functions so that they start with part_. This makes it clear what they relate to. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com>
* dm: blk: Rename get_dev() to blk_get_dev()Simon Glass2016-03-141-2/+2
| | | | | | | | | The current name is too generic. Add a 'blk_' prefix to aid searching and make its purpose clearer. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
* dm: Drop the block_dev_desc_t typedefSimon Glass2016-03-141-6/+6
| | | | | | | | | Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long and causes 80-column violations, rename it to struct blk_desc. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
* block: pass block dev not num to read/write/erase()Stephen Warren2016-01-131-4/+3
| | | | | | | | | | | This will allow the implementation to make use of data in the block_dev structure beyond the base device number. This will be useful so that eMMC block devices can encompass the HW partition ID rather than treating this out-of-band. Equally, the existence of the priv field is crying out for this patch to exist. Signed-off-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* mmc: Use lldiv() for 64-bit division in write_raw_image()Siarhei Siamashka2015-11-121-1/+2
| | | | | | | | | | | | | This fixes compilation problems when using a hardfloat toolchain on ARM, which manifest themselves as "libgcc.a(_udivmoddi4.o) uses VFP register arguments, u-boot does not". These problems have been reported in the U-Boot mailing list: http://lists.denx.de/pipermail/u-boot/2015-October/230314.html http://lists.denx.de/pipermail/u-boot/2015-October/231908.html Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* sparse: Rename the file and headerMaxime Ripard2015-11-121-1/+1
| | | | | | | | | | | | The Android sparse image format is currently supported through a file called aboot, which isn't really such a great name, since the sparse image format is only used for transferring data with fastboot. Rename the file and header to a file called "sparse", which also makes it consistent with the header defining the image structures. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* fastboot: Implement flashing session counterMaxime Ripard2015-11-121-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* sparse: Implement storage abstractionMaxime Ripard2015-11-121-4/+41
| | | | | | | | | | | The current sparse image parser relies heavily on the MMC layer, and doesn't allow any other kind of storage medium to be used. Rework the parser to support any kind of storage medium, as long as there is an implementation for it. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* fastboot: Move fastboot response functions to fastboot coreMaxime Ripard2015-11-121-28/+17
| | | | | | | | | | The functions and a few define to generate a fastboot message to be sent back to the host were so far duplicated among the users. Move them all to a common place. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* fastboot: check for alias when looking up partition by nameMichael Scott2015-04-141-2/+24
| | | | | | | | | | | | | | | | | Implement an alias name check for devices where GPT limitations prevent user-friendly partition names such as "boot", "system" and "cache". Or, where the actual partition name doesn't match a standard partition name used commonly with fastboot. To set an alias, add an environment setting as follows: fastboot_partition_alias_<alias partition name>=<actual partition name> Example: fastboot_partition_alias_boot=LNX Signed-off-by: Michael Scott <michael.scott@linaro.org> Acked-by: Steve Rae <srae@broadcom.com> Cc: Steve Rae <srae@broadcom.com> Cc: Lukasz Majewski <l.majewski@samsung.com>
* fastboot: Correct fastboot_fail and fastboot_okay stringsDileep Katta2015-02-251-2/+2
| | | | | | | | | | | If the string is copied without NULL termination using strncpy(), then strncat() on the next line, may concatenate the string after some stale (or random) data, if the response string was not zero-initialized. Signed-off-by: Dileep Katta <dileep.katta@linaro.org> Reviewed-by: Steve Rae <srae@broadcom.com> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
* usb: gadget: fastboot: Add fastboot eraseDileep Katta2015-02-251-0/+56
| | | | | | | | | | | | Adds the fastboot erase functionality, to erase a partition specified by name. The erase is performed based on erase group size, to avoid erasing other partitions. The start address and the size is aligned to the erase group size for this. Currently only supports erasing from eMMC. Signed-off-by: Dileep Katta <dileep.katta@linaro.org> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
* fastboot: handle flash write to GPT partitionsSteve Rae2014-12-181-3/+23
| | | | | | | | | | | Implement a feature to allow fastboot to write the downloaded image to the space reserved for the Protective MBR and the Primary GUID Partition Table. Additionally, prepare and write the Backup GUID Partition Table. Signed-off-by: Steve Rae <srae@broadcom.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> [Test HW: Exynos4412 - Trats2]
* usb/gadget: fastboot: implement sparse formatSteve Rae2014-09-241-10/+22
| | | | | | | - add capability to "fastboot flash" with sparse format images Signed-off-by: Steve Rae <srae@broadcom.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
* usb/gadget: fastboot: add eMMC support for flash commandSteve Rae2014-09-241-0/+80
- add support for 'fastboot flash' command for eMMC devices Signed-off-by: Steve Rae <srae@broadcom.com>
OpenPOWER on IntegriCloud