aboutsummaryrefslogtreecommitdiff
path: root/cmd/mvebu/bubt.c
AgeCommit message (Collapse)AuthorFilesLines
2022-09-19Merge branch 'master' into nextTom Rini1-9/+165
Signed-off-by: Tom Rini <trini@konsulko.com>
2022-09-16blk: Switch over to using uclass IDsSimon Glass1-1/+1
We currently have an if_type (interface type) and a uclass id. These are closely related and we don't need to have both. Drop the if_type values and use the uclass ones instead. Maintain the existing, subtle, one-way conversion between UCLASS_USB and UCLASS_MASS_STORAGE for now, and add a comment. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-13cmd: mvebu/bubt: Check for A38x/A37xx OTP secure bits and secure bootPali Rohár1-8/+120
For obvious reasons BootROMS rejects unsigned images when secure boot is enabled in OTP secure bits. So check for OPT secure bits and do not allow flashing unsigned images when secure boot is enabled. Access to OTP via U-Boot fuse API is currently implemented only for A38x and A37xx SoCs. Additionally Armada 3700 BootROM rejects signed trusted image when secure boot is not enabled in OTP. So add also check for this case. On the other hand Armada 38x BootROM acceps images with secure boot header when secure boot is not enabled in OTP. OTP secure bits may have burned also boot device source. Check it also and reject flashing images to target storage which does not match OTP. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-09-13cmd: mvebu/bubt: Check for A38x image data checksumPali Rohár1-1/+45
Currently for A38x image is checked only header checksum. So check also for image data checksum to prevent flashing broken image. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-08-04Audit <flash.h> inclusionTom Rini1-1/+0
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-07-29cmd: mvebu/bubt: Fix cmd main return value on errorPali Rohár1-5/+5
Negative return value from cmd main function cause U-Boot to print criplic error message: exit not allowed from main input shell. Set return value on error to 1. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-07-29cmd: mvebu/bubt: Add support for sha512 checksum validation for Armada 3700Pali Rohár1-0/+9
Armada 3700 BootROM supports also images with sha512 checksums and mox-imager tool [1] generates such bootable images. Without sha512 support U-Boot bubt command just prints error message: Error: Unsupported hash_algorithm_id = 64 Error: Image header verification failed This patch adds support for sha512 checksum validation for Armada 3700 images. With it bubt prints: Image checksum...OK! [1] - https://gitlab.nic.cz/turris/mox-boot-builder.git Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-07-29cmd: mvebu/bubt: Correctly propagate failure during tftp transportPali Rohár1-1/+4
net_loop() returns signed int type and negative value represents error. tftp_read_file() returns unsigned size_t type and zero value represents error. Casting signed negative value to unsigned size_t type cause losing information about error and bubt thinks that no error happened, and continue erasing SPI-NOR which cause malfunction device. Fix this issue by correctly propagating failure during tftp transport. With this change when there is no eth link, bubt does not erase SPI-NOR anymore. => bubt Burning U-Boot image "flash-image.bin" from "tftp" to "spi" ethernet@30000 Waiting for PHY auto negotiation to complete......... TIMEOUT ! ethernet@30000: No link. Error: Failed to read file flash-image.bin from tftp Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-07-29cmd: mvebu/bubt: Verify image type for all 32-bit Aramda SoCs and Armada 3700Pali Rohár1-26/+48
Current image type verification code is specific to 32-bit Armada SoCs but used only for Armada 38x. Implement image type verification for Armada 3700 and enable Armada 38x image verification for all 32-bit Armada SoCs. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2021-12-27Convert CONFIG_ENV_SPI_BUS et al to KconfigTom Rini1-2/+2
This converts the following to Kconfig: CONFIG_ENV_SPI_BUS CONFIG_ENV_SPI_CS CONFIG_ENV_SPI_MAX_HZ CONFIG_ENV_SPI_MODE As part of this, we use Kconfig to provide the defaults now that were done in include/spi_flash.h. We also in some cases change from using CONFIG_ENV_SPI_FOO to CONFIG_SF_DEFAULT_FOO as those were the values in use anyhow as ENV was not enabled. Signed-off-by: Tom Rini <trini@konsulko.com>
2021-10-28arm: mvebu: Fix comments about kwbimage structuresPali Rohár1-1/+1
kwbimage v1 is used on more SoCs. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2021-10-28arm: mvebu: Update name of kwbimage v1 field at offset 0x2-0x3Pali Rohár1-1/+1
At this offset is stored nand page size. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2021-08-02global: Convert simple_strtoul() with hex to hextoul()Simon Glass1-1/+1
It is a pain to have to specify the value 16 in each call. Add a new hextoul() function and update the code to use it. Add a proper comment to simple_strtoul() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29cmd/mvebu: fix the bubt commandKonstantin Porotchkin1-1/+1
- fix the dependency for MMC boot (add XENON to MVEBU_MMC) - fix the bubt destination assignment (missing # in "else" case) Signed-off-by: Konstantin Porotchkin <kostap@marvell.com> Signed-off-by: Stefan Roese <sr@denx.de>
2021-02-08cmd: mvebu/bubt: Fix default options in helpPali Rohár1-3/+3
Default options depends on compile time defines. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2020-08-08Convert CONFIG_SYS_MMC_ENV_DEV et al to KconfigTom Rini1-4/+0
This converts the following to Kconfig: CONFIG_SYS_MMC_ENV_DEV CONFIG_SYS_MMC_ENV_PART Note that with this conversion we now have consistent behavior with respect to ensuring that we have always selected the correct MMC device and hardware partition. Signed-off-by: Tom Rini <trini@konsulko.com>
2020-08-06mvebu: bubt: Drop dead codeTom Rini1-15/+0
The code around CONFIG_SYS_MMC_ENV_PART has been untested since merge. This can be seen by it referencing 'mmc->part_num' which was migrated elsewhere prior to this code being merged. Cc: Joel Johnson <mrjoel@lixil.net> Cc: Stefan Roese <sr@denx.de> Signed-off-by: Tom Rini <trini@konsulko.com> Acked-by: Stefan Roese <sr@denx.de> Reviewed-by: Stefan Roese <sr@denx.de>
2020-08-06cmd: mvebu/bubt: Drop unused SPI_FLASH_PROTECTIONJagan Teki1-7/+0
SPI_FLASH_PROTECTION config item is never used in anywhere in the U-Boot tree. Drop it. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Reviewed-by: Stefan Roese <sr@denx.de>
2020-05-18command: Remove the cmd_tbl_t typedefSimon Glass1-1/+1
We should not use typedefs in U-Boot. They cannot be used as forward declarations which means that header files must include the full header to access them. Drop the typedef and rename the struct to remove the _s suffix which is now not useful. This requires quite a few header-file additions. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18common: Drop net.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Network support is used in quite a few places but it still does not warrant blanket inclusion. Note that this net.h header itself has quite a lot in it. It could be split into the driver-mode support, functions, structures, checksumming, etc. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18common: Drop flash.h from common headerSimon Glass1-0/+1
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-05-04cmd: mvebu: bubt: fix quoted string split across linesJoel Johnson1-2/+2
Update quoted string alignment to address checkpatch.pl warning originally introduced in commit f60a66ef5d7d ("cmd: mvebu: bubt: show image boot device"). Signed-off-by: Joel Johnson <mrjoel@lixil.net> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-22cmd: mvebu: bubt: show image boot deviceJoel Johnson1-1/+11
When a mismatch is found trying to write an image for one boot method to a different boot device, print an error message including the image header marked target boot device type. Signed-off-by: Joel Johnson <mrjoel@lixil.net> Reviewed-by: Stefan Roese <sr@denx.de>
2020-04-22cmd: mvebu: bubt: verify A38x target device typeJoel Johnson1-4/+48
Ensure that the device to which an image is being written includes header information indicating boot support for the destination device. This is derived from the support in the SolidRun master-a38x vendor fork. Signed-off-by: Joel Johnson <mrjoel@lixil.net> Reviewed-by: Stefan Roese <sr@denx.de>
2020-04-22cmd: mvebu: bubt: correct U-Boot spellingJoel Johnson1-3/+3
Replace "U-BOOT" text with correct spelling Signed-off-by: Joel Johnson <mrjoel@lixil.net> Reviewed-by: Stefan Roese <sr@denx.de>
2020-04-22cmd: mvebu: bubt: add A38x supportJoel Johnson1-1/+68
Add support for Armada 38x devices in bubt flashing utility. This is based on (and streamlined from) the support in the SolidRun master-a38x vendor fork. Signed-off-by: Joel Johnson <mrjoel@lixil.net> Reviewed-by: Stefan Roese <sr@denx.de>
2020-01-17common: Move the image globals into image.hSimon Glass1-0/+1
These three globals relate to image handling. Move them to the image header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17image: Rename load_addr, save_addr, save_sizeSimon Glass1-2/+4
These global variables are quite short and generic. In fact the same name is more often used locally for struct members and function arguments. Add a image_ prefix to make them easier to distinguish. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11env: Move env_get() to env.hSimon Glass1-0/+1
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>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini1-2/+1
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-01-12mmc: add a Kconfig option to enable the support for MMC write operationsJean-Jacques Hiblot1-1/+1
This allows using CONFIG_IS_ENABLED(MMC_WRITE) to compile out code needed only if write support is required. The option is added for u-boot and for SPL Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2017-08-16env: Rename getenv/_f() to env_get()Simon Glass1-1/+1
We are now using an env_ prefix for environment functions. Rename these two functions for consistency. Also add function comments in common.h. Quite a few places use getenv() in a condition context, provoking a warning from checkpatch. These are fixed up in this patch also. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-11cmd: mvebu: bubt: use get_nand_dev_by_index()Grygorii Strashko1-8/+6
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
2017-05-09arm64: mvebu: Fix the bubt comamnd NAND device supportKonstantin Porotchkin1-6/+7
Fix the NAND structures in bubt command according to latest changes in MTD API. Signed-off-by: Konstantin Porotchkin <kostap@marvell.com> Cc: Stefan Roese <sr@denx.de> Cc: Igal Liberman <igall@marvell.com> Cc: Nadav Haklai <nadavh@marvell.com> Signed-off-by: Stefan Roese <sr@denx.de>
2017-01-25arm64: mvebu: Update bubt command MMC block device accessKonstantin Porotchkin1-3/+22
Update the MMC block device access code in bubt command implementation according to the latest MMC driver changes. Change-Id: Ie852ceefa0b040ffe1362bdb7815fcea9b2d923b Signed-off-by: Konstantin Porotchkin <kostap@marvell.com> Cc: Stefan Roese <sr@denx.de> Cc: Nadav Haklai <nadavh@marvell.com> Cc: Neta Zur Hershkovits <neta@marvell.com> Cc: Omri Itach <omrii@marvell.com> Cc: Igal Liberman <igall@marvell.com> Cc: Haim Boot <hayim@marvell.com> Cc: Hanna Hawa <hannah@marvell.com>
2016-12-12arm64: mvebu: Add bubt command for flash image burnKonstantin Porotchkin1-0/+767
Add support for mvebu bubt command for flash image load, check and burn on boot device. Signed-off-by: Konstantin Porotchkin <kostap@marvell.com> Reviewed-by: Stefan Roese <sr@denx.de> Cc: Stefan Roese <sr@denx.de> Cc: Nadav Haklai <nadavh@marvell.com> Cc: Neta Zur Hershkovits <neta@marvell.com> Cc: Omri Itach <omrii@marvell.com> Cc: Igal Liberman <igall@marvell.com> Cc: Haim Boot <hayim@marvell.com> Cc: Hanna Hawa <hannah@marvell.com> Signed-off-by: Stefan Roese <sr@denx.de>