aboutsummaryrefslogtreecommitdiff
path: root/cmd/mvebu
AgeCommit message (Collapse)AuthorFilesLines
2023-10-26cmd: mvebu/bubt: move eMMC data-partition uboot from LBA-0 to 4096Josua Mayer1-2/+9
A38x bootrom only searches 2 sectors when booting from eMMC, irregardless of data or boot partition: 0 & 4096. For eMMC boot partitions sector 0 is fine, but on data partition it conflicts with MBR. Change bubt command default to 4096 for eMMC data partition only, to allow using an MBR partition table on the eMMC data partition while also booting from it. Signed-off-by: Josua Mayer <josua@solid-run.com> Reviewed-by: Stefan Roese <sr@denx.de>
2023-04-13cmd: mvebu/bubt: a38x: Do not hardcode SATA block size to 512Pali Rohár1-2/+5
Find SATA block device by blk_get_devnum_by_uclass_id() function and read from it the real block size of the SATA disk. In case of error, fallback back to 512 bytes. Signed-off-by: Pali Rohár <pali@kernel.org>
2023-04-10mmc: Use EXT_CSD_EXTRACT_BOOT_PART() macro for extracting boot partPali Rohár1-2/+1
Mask macro PART_ACCESS_MASK filter out access bits of emmc register and macro EXT_CSD_EXTRACT_BOOT_PART() extracts boot part bits of emmc register. So use EXT_CSD_EXTRACT_BOOT_PART() when extracting boot partition. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-01cmd: mvebu/bubt: Enable command by defaultPali Rohár1-0/+1
This makes updating of u-boot/firmware on Marvell boards easier. Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01cmd: mvebu/bubt: Fix warnings: unused variable 'secure_mode' and ↵Pali Rohár1-2/+5
'fuse_read_u64' defined but not used 'secure_mode' and 'fuse_read_u64' are used only on A38x and A37xx. Fixes: f7b0bbca2b62 ("cmd: mvebu/bubt: Check for A38x/A37xx OTP secure bits and secure boot") Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01cmd: mvebu/bubt: Better guess default MVEBU_*_BOOT optionPali Rohár1-0/+4
For 32-bit Armada boards which use SPL we can determinate boot device from existing MVEBU_SPL_BOOT_DEVICE_* option. For all other boards (e.g. 64-bit Armada) default option still needs to be set manually. Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01cmd: mvebu/bubt: Set correct default image name for 32-bit Armada SoCsPali Rohár1-0/+1
32-bit Armada SoCs uses u-boot binary packed in kwbimage format. Name of the image is in CONFIG_BUILD_TARGET option. So use it as a default option in Kconfig. Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01cmd: mvebu/bubt: Check also A8K boot image checksumPali Rohár1-3/+11
Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01cmd: mvebu/bubt: Do not modify image in A8K check_image_header()Pali Rohár1-5/+1
Change checksum verification code so it does require to modify image. Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01cmd: mvebu/bubt: Mark all local symbols as staticPali Rohár1-4/+4
There is no need to export these local functions and structures. Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01cmd: mvebu/bubt: Rename variable image_size to hdr_sizePali Rohár1-5/+5
Variable image_size contains size of the header, not size of the whole image. Rename this variable to reflect content. Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01cmd: mvebu/bubt: Add support for reading image from the SATA disk partitionPali Rohár1-2/+37
This change allows to load boot image from the first SATA/SCSI device partition and burn it to board boot location (e.g. SPI-NOR). This is particularly when storage device is not handled by U-Boot as USB mass storage (which is already supported by bubt) but as SATA/SCSI device. Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01cmd: mvebu/bubt: Add support for writing image to SATA diskPali Rohár2-1/+120
All 32-bit Armada SoCs and also 64-bit Armada 3720 SoC can load and boot firmware from SATA disk. This adds support for updating firmware binary for these SoCs. On 32-bit Armada SoC is firmware stored at sector 1 and on Armada 3720 is stored at MBR partition 0x4d or GPT partition with type GUID 6828311A-BA55-42A4-BCDE-A89BB5EDECAE (Marvell Armada 3700 Boot partition). Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01cmd: mvebu/bubt: Add support for selecting eMMC HW partitionPali Rohár1-5/+48
Support for burning into the correct eMMC HW boot partition was broken and removed in commit 96be2f072768 ("mvebu: bubt: Drop dead code"). Reimplement this functionality and bring it back again. Fixes: 96be2f072768 ("mvebu: bubt: Drop dead code") Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01cmd: mvebu/bubt: Fix parsing SATA kwbimagePali Rohár1-7/+1
Despite the official specification, Marvell BootROM does not interpret srcaddr from SATA image as number of sectors the beginning of the hard drive, but as number of sectors relative to the main header. Reject invalid and accept valid SATA images. Fixes: 5a0653493307 ("cmd: mvebu/bubt: Check for A38x image data checksum") Signed-off-by: Pali Rohár <pali@kernel.org>
2023-03-01cmd: mvebu/bubt: Fix parsing SDIO kwbimagePali Rohár1-3/+0
Despite the official specification, Marvell BootROM does not interpret srcaddr from SDIO image as offset in number of sectors (like for SATA image), but as offset in bytes (like for all other images except SATA). To ensure that we do not store invalid SDIO image to the boot location (read by the Marvell BootROM), we need to check that image is valid and srcaddr is intepreted in bytes, in the same way as it is done by Marvell BootROM. This fixes rejecting valid and accepting invalid SDIO images by bubt command. Fixes: 5a0653493307 ("cmd: mvebu/bubt: Check for A38x image data checksum") Signed-off-by: Pali Rohár <pali@kernel.org>
2023-01-11cmd: change the return value when argc errorShenlin Liang1-1/+1
When the number of parameters is wrong, the return value should be processed in the same way as other cmds, return CMD_RET_USAGE so that it can print the information. Signed-off-by: Shenlin Liang <liangshenlin@eswincomputing.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-19Merge branch 'master' into nextTom Rini2-9/+166
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ár2-8/+121
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ár2-0/+10
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>
2022-05-16cmd: mvebu: Hide bubt specific options when bubt is disabledPali Rohár1-0/+4
CONFIG_MVEBU_NAND_BOOT, CONFIG_MVEBU_SPI_BOOT, CONFIG_MVEBU_MMC_BOOT and CONFIG_MVEBU_UBOOT_DFLT_NAME are unused when CONFIG_CMD_MVEBU_BUBT is not enabled. So hide them. 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-09-16Merge tag 'v2021.10-rc4' into nextTom Rini1-0/+1
Prepare v2021.10-rc4 Signed-off-by: Tom Rini <trini@konsulko.com> # gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT # gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C # gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate] # Conflicts: # board/Arcturus/ucp1020/spl.c # cmd/mvebu/Kconfig # common/Kconfig.boot # common/image-fit.c # configs/UCP1020_defconfig # configs/sifive_unmatched_defconfig # drivers/pci/Kconfig # include/configs/UCP1020.h # include/configs/sifive-unmatched.h # lib/Makefile # scripts/config_whitelist.txt
2021-09-08common: Remove unused CONFIG_FIT_SHAxxx selectorsAlexandru Gagniuc1-0/+1
Originally CONFIG_FIT_SHAxxx enabled specific SHA algos for and only for hash_calculate() in common/image-fit.c. However, since commit 14f061dcb1 ("image: Drop IMAGE_ENABLE_SHAxxx"), the correct selector was changed to CONFIG_SHAxxx. The extra "_FIT_" variants are neither used, nor needed. Remove them. One defconfig disables FIT_SHA256, which is now changed to 'SHA256'. CMD_MVEBU_BUBT needs to select select SHA256 to avoid undefined references to "sha256_*()". bubt.c needs sha256, so this selection is correct. It is not clear why this problem did not manifest before. Note that SHA selection in SPL is broken for this exact reason. There is no corresponding SPL_SHAxxx. Fixing this is is beyond the scope of this change. Also note that we make CONFIG_FIT now imply SHA256, to make up for FIT_SHA256 previously being a default y option. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> [trini: Add imply SHA256 to FIT] Signed-off-by: Tom Rini <trini@konsulko.com>
2021-08-31Kconfig: Remove all default n/no optionsMichal Simek1-1/+0
default n/no doesn't need to be specified. It is default option anyway. Signed-off-by: Michal Simek <michal.simek@xilinx.com> [trini: Rework FSP_USE_UPD portion] Signed-off-by: Tom Rini <trini@konsulko.com>
2021-08-02global: Convert simple_strtoul() with hex to hextoul()Simon Glass2-3/+3
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-05-16cmd: mvebu: Rename rx_training to mvebu_comphy_rx_trainingStefan Roese3-11/+10
Rename the misleading cmd "rx_training" to "mvebu_comphy_rx_training" to avoid confusion and mixup with DDR3/4 training. This makes it clear, that this command is platform specific and handles the COMPHY RX training. Also depend this cmd on ARMADA_8K and not TARGET_MVEBU_ARMADA_8K to make is available for OcteonTX2 CN913x. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Pali Rohár <pali@kernel.org> Cc: Marek Behun <marek.behun@nic.cz> Cc: Kostya Porotchkin <kostap@marvell.com> Cc: Nadav Haklai <nadavh@marvell.com> Acked-by: Marek Behún <marek.behun@nic.cz> Acked-by: Pali Rohár <pali@kernel.org>
2021-04-29phy: marvell: add RX training commandIgal Liberman3-1/+65
This patch adds support for running RX training using new command called "rx_training" Usage: rx_training - rx_training <cp id> <comphy id> RX training allows to improve link quality (for SFI mode) by running training sequence between us and the link partner, this allows to reach better link quality then using static configuration. Change-Id: I818fe67ccaf19a87af50d4c34a9db7d6802049a5 Signed-off-by: Igal Liberman <igall@marvell.com> Signed-off-by: Marcin Wojtas <mw@semihalf.com>
2021-04-29cmd/mvebu: fix the bubt commandKonstantin Porotchkin2-2/+2
- 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>