aboutsummaryrefslogtreecommitdiff
path: root/drivers/fastboot/fb_mmc.c
AgeCommit message (Collapse)Author
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-07fastboot: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from this driver directory and when needed add missing include files directly. Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-07-25lib: sparse: allocate FASTBOOT_MAX_BLK_WRITE instead of small numberMattijs Korpershoek
Commit 62649165cb02 ("lib: sparse: Make CHUNK_TYPE_RAW buffer aligned") fixed cache alignment for systems with a D-CACHE. However it introduced some performance regressions [1] on system flashing huge images, such as Android. On AM62x SK EVM, we also observe such performance penalty: Sending sparse 'super' 1/2 (768793 KB) OKAY [ 23.954s] Writing 'super' OKAY [ 75.926s] Sending sparse 'super' 2/2 (629819 KB) OKAY [ 19.641s] Writing 'super' OKAY [ 62.849s] Finished. Total time: 182.474s The reason for this is that we use an arbitrary small buffer (info->blksz * 100) for transferring. Fix it by using a bigger buffer (info->blksz * FASTBOOT_MAX_BLK_WRITE) as suggested in the original's patch review [2]. With this patch, performance impact is mitigated: Sending sparse 'super' 1/2 (768793 KB) OKAY [ 23.912s] Writing 'super' OKAY [ 15.780s] Sending sparse 'super' 2/2 (629819 KB) OKAY [ 19.581s] Writing 'super' OKAY [ 17.192s] Finished. Total time: 76.569s [1] https://lore.kernel.org/r/20221118121323.4009193-1-gary.bisson@boundarydevices.com [2] https://lore.kernel.org/r/all/43e4c17c-4483-ec8e-f843-9b4c5569bd18@seco.com/ Fixes: 62649165cb02 ("lib: sparse: Make CHUNK_TYPE_RAW buffer aligned") Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-04-04drivers: fastboot: zImage flashing is not supported for v3, v4Safae Ouajih
With vendor boot image introduced in version 3 and 4 of boot image header, boot information is located in both boot image and vendor boot image. Flashing zImage is not supported for version 3 and 4 since this requires updating vendor boot image and/or generating a new image. Print an error message when the boot image header version is greater than 2. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-04-04android: boot: replace android_image_check_headerSafae Ouajih
With the new vendor boot image introduced in versions 3 and 4 of boot image header, the header check must be done for both boot image and vendor boot image. Thus, replace android_image_check_header() by is_android_boot_image_header() to only refer to boot image header check. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-04-04android: boot: rename andr_img_hdr -> andr_boot_img_hdr_v0Safae Ouajih
Android introduced boot header version 3 or 4. The header structure change with version 3 and 4 to support the new updates such as: - Introducing Vendor boot image: with a vendor ramdisk - Bootconfig feature (v4) Change andr_img_hdr struct name to maintain support for version v0, v1 and v2 while introducing version 3 and 4. Signed-off-by: Safae Ouajih <souajih@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-02-09Correct SPL use of FASTBOOT_MMC_USER_SUPPORTSimon Glass
This converts 1 usage of this option to the non-SPL form, since there is no SPL_FASTBOOT_MMC_USER_SUPPORT defined in Kconfig Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-04Audit <flash.h> inclusionTom Rini
A large number of files include <flash.h> as it used to be how various SPI flash related functions were found, or for other reasons entirely. In order to migrate some further CONFIG symbols to Kconfig we need to not include flash.h in cases where we don't have a NOR flash of some sort enabled. Furthermore, in cases where we are in common code and it doesn't make sense to try and further refactor the code itself in to new files we need to guard this inclusion. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-01-28fastboot: only look up real partition names when no alias existsMatthias Schiffer
Having U-Boot look up the passed partition name even though an alias exists is unexpected, leading to warning messages (when the alias name doesn't exist as a real partition name) or the use of the wrong partition. Change part_get_info_by_name_or_alias() to consider real partitions names only if no alias of the same name exists, allowing to use aliases to override the configuration for existing partition names. Also change one use of strcpy() to strlcpy(). Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Reviewed-by: Sean Anderson <sean.anderson@seco.com>
2022-01-19doc: replace @return by Return:Heinrich Schuchardt
Sphinx expects Return: and not @return to indicate a return value. find . -name '*.c' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; find . -name '*.h' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2021-10-12fastboot: fix partition name truncation in environment lookupMatthias Schiffer
strlcat() need to be passed the full buffer length. The incorrect call caused truncation of partition names for fastboot_raw_partition_... and fastboot_partition_alias_... env lookup to much less than PART_NAME_LEN. Fixes: 69a752983171 ("fastboot: Fix possible buffer overrun") Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Reviewed-by: Sean Anderson <seanga2@gmail.com>
2021-08-21Fix flashing of eMMC user area with FastbootOleh Kravchenko
'gpt' and 'mmc0' fastboot partitions have been treated as the same device, but it is wrong. Fill disk_partition structure with eMMC user partition info to properly flash data. Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Cc: Marek Vasut <marex@denx.de> Cc: Sean Anderson <sean.anderson@seco.com> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Sean Anderson <sean.anderson@seco.com>
2021-08-21Fix flash and erase of eMMC Boot2 with FastbootOleh Kravchenko
The current U-Boot version has the next matches for boot partitions: > mmc0boot0 to EMMC_BOOT1 > mmc0boot1 to EMMC_BOOT1 (should be EMMC_BOOT2) This patch fixes a typo for the boot partition number. Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Cc: Marek Vasut <marex@denx.de> Reviewed-by: Sean Anderson <sean.anderson@seco.com>
2021-04-12fastboot: Fix possible buffer overrunSean Anderson
This fixes several uses of strn(cpy|cat) which did not terminate their destinations properly. Fixes de1728ce4c ("fastboot: Allow u-boot-style partitions") Reported-by: Coverity Scan Signed-off-by: Sean Anderson <seanga2@gmail.com>
2021-02-26fastboot: Allow u-boot-style partitionsSean Anderson
This adds support for partitions of the form "dev.hwpart:part" and "dev#partname". This allows one to flash to eMMC boot partitions without having to use CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT. It also allows one to flash to an entire device without needing CONFIG_FASTBOOT_MMC_USER_NAME. Lastly, one can also flash MMC devices other than CONFIG_FASTBOOT_FLASH_MMC_DEV. Because devices can be specified explicitly, CONFIG_FASTBOOT_FLASH_MMC_DEV is used only when necessary for existing functionality. For those cases, fastboot_mmc_get_dev has been added as a helper function. This allows There should be no conflicts with the existing system, but just in case, I have ordered detection of these names after all existing names. The fastboot_mmc_part test has been updated for these new names. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-02-26fastboot: Move part_get_info_by_name_or_alias after raw_part_get_info_by_nameSean Anderson
This makes the next commit more readable by doing the move now. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-02-26fastboot: Remove mmcpart argument from raw_part_get_info_by_nameSean Anderson
The only thing mmcpart was used for was to pass to blk_dselect_hwpart. This calls blk_dselect_hwpart directly from raw_part_get_info_by_name. The error handling is dropped, but it is reintroduced in the next commit (albeit less specificly). Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-02-07fastboot: reinit partition after storing GPT or MBRRoman Stratiienko
In case MMC has MBR system and fastboot writes GPT, MMC is still recognized as MBR. Invoke part_init() to purge cached data and update information about partition table type. Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2021-02-07fastboot: mmc: extend flash/erase for both emmc hwpart 1 and 2Patrick Delaunay
Update the code and the configs for eMMC boot and userdata partitions acces - FASTBOOT_MMC_BOOT_SUPPORT: boot partition 1 and 2 (erase/write) - FASTBOOT_MMC_BOOT1_NAME: boot partition 1, default name="mmc0boot0" - FASTBOOT_MMC_BOOT2_NAME: boot partition 2, default name="mmc0boot1" This patch also removes the unnecessary dependency with ARCH_MEDIATEK and EFI_PARTITION. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2021-02-07fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORTPatrick Delaunay
Split userdata and boot partition support for eMMC update and correct the description (update is supported). The new configuration CONFIG_FASTBOOT_MMC_USER_SUPPORT allows to activate support of userdata partition update, based on target name=CONFIG_FASTBOOT_MMC_USER_NAME This patch also removes the unnecessary dependency with ARCH_MEDIATEK and EFI_PARTITION. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2021-01-15disk: dos: rename write_mbr_partition to write_mbr_sectorMarek Szyprowski
write_mbr_partition() function name is a bit misleading, so rename it to write_mbr_sector(). This is a preparation for adding code for writing a complete MBR partition layout. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
2020-09-01fastboot: Support defining raw partitions without a partition tableFilip Brozovic
Add support for defining raw fastboot partitions in eMMC by specifying the offset and size in an environment variable. Optionally, the eMMC hardware partition number may also be specified. This makes it possible to e.g. update only part of the eMMC boot partition, instead of having to write the entire partition. Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
2020-05-18common: Drop log.h from common headerSimon Glass
Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18common: Drop image.h from common headerSimon Glass
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18part: Drop disk_partition_t typedefSimon Glass
We should not be using typedefs and these make it harder to use forward declarations (to reduce header file inclusions). Drop the typedef. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18common: Drop flash.h from common headerSimon Glass
Move this uncommon header out of the common header. Fix up some style problems in flash.h while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-25fastboot: mt85xx: add command to flash/erase emmc hwpartmingming lee
This patch includes the following: 1. Add fastboot command to erase the whole EMMC_USER 2. Add fastboot command to flash image at EMMC_BOOT1 3. Add fastboot command to erase the whole EMMC_BOOT1 4. Enale CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT for mt8518 Signed-off-by: mingming lee <mingming.lee@mediatek.com>
2019-08-11env: Move env_get() to env.hSimon Glass
Move env_get() over to the new header file. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2019-06-14fastboot: Use const qualifier for char *part_nameSam Protsenko
In fastboot_*_get_part_info() functions we can use stronger typing by expecting const strings. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
2019-04-21fastboot: Replace literal 32 with PART_NAME_LENAlex Kiernan
Where we have to compute partition names, rather than using a hardcoded 32 for the partition name length, replace with PART_NAME_LEN. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
2019-04-21fastboot: Improve error reporting on 'getvar partition-{size, type}'Eugeniu Rosca
Currently U-Boot reports the same error message in all below cases: [A] host> fastboot getvar partition-type [B] host> fastboot getvar partition-size [C] host> fastboot getvar partition-type: [D] host> fastboot getvar partition-size: [E] host> fastboot getvar partition-type:<invalid-part> [F] host> fastboot getvar partition-size:<invalid-part> The message looks like: host> fastboot getvar partition-size: getvar:partition-size: FAILED (remote: partition not found) Finished. Total time: 0.003s Be more user friendly and output: - "partition not given" for [A-D] - "partition not found" for [E-F] Fixes: f73a7df984a9 ("net: fastboot: Merge AOSP UDP fastboot") Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Acked-by: Alex Kiernan <alex.kiernan@gmail.com>
2018-05-30net: fastboot: Merge AOSP UDP fastbootAlex Kiernan
Merge UDP fastboot support from AOSP: https://android.googlesource.com/platform/external/u-boot/+/android-o-mr1-iot-preview-8 Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Alex Deymo <deymo@google.com> Signed-off-by: Jocelyn Bohr <bohr@google.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-30fastboot: Rename public fb_ functions to fastboot_Alex Kiernan
Rename fb_mmc_flash_write/fb_mmc_erase/fb_nand_flash_write/fb_nand_erase to fastboot_... as they form a public interface Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-30fastboot: Remove FIXME for CONFIG_FASTBOOT_...NAMEAlex Kiernan
CONFIG_FASTBOOT_GPT_NAME and CONFIG_FASTBOOT_MBR_NAME are always defined by Kconfig if you're compiling this code, so remove these redundant defaults. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2018-05-30fastboot: Add missing newlinesAlex Kiernan
Add newlines so we format our output correctly. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Jocelyn Bohr <bohr@google.com>
2018-05-30fastboot: Refactor fastboot_okay/fail to take responseAlex Kiernan
Add the response string as a parameter to fastboot_okay/fail, instead of modifying a global, to match the contract expected by the AOSP U-Boot code. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2018-05-30fastboot: Move fastboot to drivers/fastbootAlex Kiernan
Separate CMD_FASTBOOT from FASTBOOT and move code and configuration to drivers/fastboot. Switch dependencies on FASTBOOT to USB_FUNCTION_FASTBOOT as anyone who wants FASTBOOT before this series wants USB_FUNCTION_FASTBOOT. Split USB_FUNCTION_FASTBOOT from FASTBOOT so they retain their existing behaviour. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>