summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-10-01tools: kwboot: Explicitly check against size of struct main_hdr_v1Marek Behún
Explicitly check the image size against size of struct main_hdr_v1. This way the check is more readable, since the `hdrsz` variable may semantically contain another value. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Round up header size to 128 B when patchingPali Rohár
The beginning of image data must be sent in a separate xmodem block; the block must not contain end of header with the beginning of data. Therefore we need to ensure that the image header size is a multiple of xmodem block size (which is 128 B). Read the file into a malloc()ed buffer of enough size instead of mmap()ing it. (If we are going to move the data, most of the pages will be dirty anyway.) Then move the payload if header size needs to be increased. Signed-off-by: Pali Rohár <[email protected]> [ refactored ] Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwbimage: Update comments describing kwbimage v1 structuresPali Rohár
These structures are relevant for several other platforms, mention them all. Signed-off-by: Pali Rohár <[email protected]> Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwbimage: Refactor kwbimage header size determinationMarek Behún
Add functions kwbheader_size() and kwbheader_size_for_csum(). Refactor code determining header size to use these functions. Refactor header checksum determining function. Remove stuff that is not needed anymore. This simplifies the code a little and fixes one instance of validating header size meant for checksum instead of whole header size. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwbimage: Refactor image_version()Marek Behún
Rename this function to kwbimage_version() and don't cast argument if not needed. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Patch destination address to DDR area for SPI imagePali Rohár
SPI/NOR kwbimage may have destination address set to 0xFFFFFFFF, which means that the image is not downloaded to DDR but rather it is executed directly from SPI/NOR. In this case execution address is set to SPI/NOR area. When patching image to UART type, change destination and execution addresses from SPI/NOR XIP area to DDR area 0x00800000 (which is default for A38x). Signed-off-by: Pali Rohár <[email protected]> [ refactored ] Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Patch source address in image headerPali Rohár
Some image types have source address in non-bytes unit; for example for SATA images, it is in 512 B units. We need to multiply by unit size when patching image type to UART. Signed-off-by: Pali Rohár <[email protected]> [ refactored ] Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Don't patch image header if signedPali Rohár
It is not possible to modify image with secure header due to cryptographic signature. Signed-off-by: Pali Rohár <[email protected]> [ refactored ] Signed-off-by: Marek Behún <[email protected]>
2021-10-01tools: kwbimage: Simplify iteration over version 1 optional headersMarek Behún
Create macro for_each_opt_hdr_v1 and functions opt_hdr_v1_size(), opt_hdr_v1_valid_size(), opt_hdr_v1_ext(), opt_hdr_v1_first() and opt_hdr_v1_next() to simplify iteration over version 1 optional headers. This prevents ugly code repetition and makes it nicer to read. Signed-off-by: Marek Behún <[email protected]>
2021-10-01tools: kwboot: Always call kwboot_img_patch_hdr()Pali Rohár
The kwboot_img_patch_hdr() function already decides if header patching is needed. Always call this function and deprecate the unneeded command line option `-p`. Signed-off-by: Pali Rohár <[email protected]> Reviewed-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Properly finish xmodem transferPali Rohár
After kwboot sends EOT, BootROM sends back ACK. Add code for handling this and retry sending EOT on error. Signed-off-by: Pali Rohár <[email protected]> [ refactored ] Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Prevent waiting indefinitely if no xmodem reply is receivedMarek Behún
Currently if BootROM fails to respond with ACK/NAK to a xmodem block, we will be waiting indefinitely for such response. Make sure that we only wait at most 1 second (blk_rsp_timeo) for ACK/NAK for each block in case non-xmodem text output is not being expected. Interpret this timeout expiration as NAK, to try to send the block again. On the other hand, if timeout expires without ACK while some non-xmodem output was already received (DDR training output, for example), we know that the block was received, since the code is being executed, so in this case exit with ETIMEDOUT. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Allow greater timeout when executing header codeMarek Behún
When executing header code (which contains U-Boot SPL in most cases), wait 10s after every non-xmodem character received (i.e. printed by U-Boot SPL) before timing out. Sometimes DDR training, which runs in SPL, may be slow. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Print new line after SPL outputMarek Behún
There is no separation between output from the code from binary header (U-Boot SPL in most cases) and subsequent kwboot output. Print '\n' to make distinguishing these two easier. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Allow non-xmodem text output from BootROM only in a specific casePali Rohár
When sending image header / image data, BootROM does not send any non-xmodem text output. We should therefore interpret unknown bytes in the xmodem protocol as errors and resend current packet. This should improve the transfer in case there are errors on the UART line. Text output from BootROM may only happen after whole image header is sent and before ACK for the last packet of image header is received. In this case BootROM may execute code from the image, which may interact with UART (U-Boot SPL, for example, prints stuff on UART). Print received non-xmodem output from BootROM only in this case. Signed-off-by: Pali Rohár <[email protected]> [ refactored & simplified ] Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Use a function to check whether received byte is a Xmodem replyMarek Behún
This is a non-functional change that should make the code more readable. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Split sending image into header and data stagesPali Rohár
This change is required to implement other features in kwboot. Split sending header and data parts of the image into two stages. Signed-off-by: Pali Rohár <[email protected]> [ refactored ] Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Print newline on error when progress was not completedPali Rohár
When progress was not completed, current terminal position is in progress bar. So print newline before printing error message to make error message more readable. Signed-off-by: Pali Rohár <[email protected]> Reviewed-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Fix printing progressPali Rohár
Ensure that `pos` is still in range up to the `width` so printing 100% works also for bigger images. After printing 100% progress reset it to zero, so that next progressbar can be started. Signed-off-by: Pali Rohár <[email protected]> Reviewed-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Fix comparison of integers with different sizeMarek Behún
The compiler complains that we are comparing int with size_t when compiled with -W. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Fix return type of kwboot_xm_makeblock() functionPali Rohár
Function kwboot_xm_makeblock() always returns length of xmodem block. It is always non-negative and calculated from variable with size_t type. Set return type of this function to size_t and remove dead code which checks for negative value. Signed-off-by: Pali Rohár <[email protected]> Reviewed-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Fix kwboot_xm_sendblock() function when kwboot_tty_recv() failsPali Rohár
When kwboot_tty_recv() fails or times out, it does not set the `c` variable to NAK. The variable is then compared, while it holds either an undefined value or a value from previous iteration. Set `c` to NAK so that the other side will try to resend current block, and remove the now unnecessary break. In other failure cases return immediately. Signed-off-by: Pali Rohár <[email protected]> Reviewed-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Print version information headerPali Rohár
Print kwboot's (U-Boot's) version when printing usage. Signed-off-by: Pali Rohár <[email protected]> Reviewed-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Refactor and fix writing bufferMarek Behún
There are 3 instances in kwboot.c where we need to write() a given buffer whole (iteratively writing until all data are written), and 2 of those instances are wrong, for they do not increment the buffer pointer. Refactor the code into a new function kwboot_write() where it is fixed. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Make the quit sequence buffer constMarek Behún
This buffer is never written to. Make it const. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwboot: Fix buffer overflow in kwboot_terminal()Marek Behún
The `in` variable is set to -1 in kwboot_terminal() if stdin is not a tty. In this case we should not look whether -1 is set in fd_set, for it can lead to a buffer overflow, which can be reproduced with echo "xyz" | ./tools/kwboot -t /dev/ttyUSB0 Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-10-01tools: kwbimage: Fix printf format warningMarek Behún
On 32-bit ARM the compiler complains: tools/kwbimage.c:547: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ Fix this by using %zu instead of %lu format specifier. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]>
2021-09-30Azure/GitLab CI: Update docker imageTom Rini
Rebuild our current docker image so that ca-certificates will be updated and Let's Encrypt issued certificates will work again. Signed-off-by: Tom Rini <[email protected]>
2021-09-30Azure/GitLab CI: Update docker imageTom Rini
Rebuild our current docker image so that ca-certificates will be updated and Let's Encrypt issued certificates will work again. Signed-off-by: Tom Rini <[email protected]>
2021-09-30Merge tag 'xilinx-for-v2022.01-rc1' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-microblaze into next Xilinx changes for v2022.01-rc1 zynq: - Enable capsule update for qspi and mmc - Update zed DT qspi compatible string zynqmp: - Add missing modeboot for EMMC - Add missing nand DT properties - List all eeproms for SC on vck190 - Add vck190 SC psu_init clk: - Handle only GATE type clock for Versal watchdog: - Update versal driver to handle system reset
2021-09-30Merge branch '2021-09-30-whitespace-cleanups' into nextTom Rini
- A large number of whitespace cleanups from Wolfgang
2021-09-30WS cleanup: remove SPACE(s) followed by TABWolfgang Denk
Signed-off-by: Wolfgang Denk <[email protected]>
2021-09-30WS cleanup: remove trailing white spaceWolfgang Denk
Signed-off-by: Wolfgang Denk <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2021-09-30WS cleanup: remove excessive empty linesWolfgang Denk
Signed-off-by: Wolfgang Denk <[email protected]>
2021-09-30WS cleanup: remove trailing empty linesWolfgang Denk
Signed-off-by: Wolfgang Denk <[email protected]>
2021-09-30watchdog: versal: Add support for expire nowAshok Reddy Soma
Wdt expire command makes the wdt to count least possible ticks(1) and expires immediately. Add expire_now option to the xlnx_wwdt_ops and implement it by calling xlnx_wwdt_start() with minimum possible count(1). Signed-off-by: Ashok Reddy Soma <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michal Simek <[email protected]>
2021-09-30watchdog: versal: Add support for basic window watchdogAshok Reddy Soma
Existing driver uses generic watchdog mode which generates a signal to PLM firmware, but the signal cannot be used to reset the system. Change driver to use window watchdog basic mode. This window watchdog mode generates a signal to PLM firmware which decides what action to take upon expiry of watchdog. Timeout value for xlnx_wwdt_start will come in milli seconds from wdt framework. Make changes to load count value accordingly. Add checks before loading the timer for min and max possible values. Fix authour email id of Ashok Reddy Soma to long email id. Signed-off-by: Ashok Reddy Soma <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michal Simek <[email protected]>
2021-09-30clk: versal: Enable only GATE type clocksT Karthik Reddy
Clocks should be enabled or disabled only if they are of GATE type clocks. If they are not of GATE type clocks, don't touch them. Signed-off-by: T Karthik Reddy <[email protected]> Signed-off-by: Ashok Reddy Soma <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michal Simek <[email protected]>
2021-09-30arm64: zynqmp: Add psu_init_gpl for vck190/vmk180 SCMichal Simek
Add psu_init_gpl file for getting SPL to work directly from the tree. Signed-off-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/6675723ad52d29982e62c6ca4832ed18688076cb.1632488774.git.michal.simek@xilinx.com
2021-09-30arm64: zynqmp: Define all eeproms for SC on vck190Michal Simek
There are multiple eeproms on vck190 that's why list all of them. FMC eeproms are present only when fmcs are plugged. Signed-off-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/96902661e3ab9e20b59d626e6129ccf6f3317c4d.1632488695.git.michal.simek@xilinx.com
2021-09-30arm: zynq: Use s25fl256s1 compatible string on zedboardMichal Simek
Use compatible string which is listed in the Linux kernel. Signed-off-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/49bc6b056b0f6f69d4d90351dc875a66b7e37619.1631715748.git.michal.simek@xilinx.com
2021-09-30arm64: zynqmp: Add device tree properties for nand flashAmit Kumar Mahapatra
Add ecc strength & ecc step size properties for nand flash devices, when operating in software-ecc mode. Signed-off-by: Amit Kumar Mahapatra <[email protected]> Signed-off-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/866f4b888129ff0213df9cdb51b5529b199fb7b7.1631713594.git.michal.simek@xilinx.com
2021-09-30xilinx: zynqmp: Set modeboot env variable in eMMC bootmodeAshok Reddy Soma
Set environment variable modeboot to "emmcboot" in case of eMMC boot mode. Signed-off-by: Ashok Reddy Soma <[email protected]> Signed-off-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/c61231e4b8c6118862dfc82e923211637bf29991.1631688736.git.michal.simek@xilinx.com
2021-09-30ARM: zynq: Enable capsule update for qspi and mmcMichal Simek
Generate dfu_alt_info setup at runtime for capsule update. Enabling this feature will help with upgrading boards without remembering what is where. The similar change was done for ZynqMP by commit b86f43de0be0 ("xilinx: zynqmp: Add support for runtime dfu_alt_info setup"). Code needs to be enabled by CONFIG_SET_DFU_ALT_INFO. And also enable capsule on disk for RAW firmware images with efidebug command. Two indexes are supported for SPL flow. Images can be generated like: ./tools/mkeficapsule --raw spl/boot.bin --index 1 capsule1.bin ./tools/mkeficapsule --raw u-boot.img --index 2 capsule2.bin Then place them to SD card and load them: load mmc 0 10000000 capsule1.bin && efidebug capsule update -v 10000000 load mmc 0 10000000 capsule2.bin && efidebug capsule update -v 10000000 FSBL flow will also work where only index 1 capsule is used. There should be enough space for using boot.bin with bitstream too. Zynq also support multiple boot locations in SPI or MMC but it is not wired by this patch. Signed-off-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/bea5fc75a87a5971f118b46bab4aa7ca39a629c6.1630061610.git.michal.simek@xilinx.com
2021-09-29Merge tag 'rpi-next-2021.10.2' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-raspberrypi - fix usb stopt; usb start; bug - update Nicolas email address
2021-09-29Merge https://source.denx.de/u-boot/custodians/u-boot-marvellTom Rini
- Armada8k: Fix CP0 eMMC/SDIO support (Robert)
2021-09-29arm: rpi: perform XHCI firmware upload only onceMarek Szyprowski
XHCI firmware upload must be performed only once after initializing the PCI bridge. This fixes USB stack initialization after calling "usb stop; usb start" on Raspberry Pi 4B. Signed-off-by: Marek Szyprowski <[email protected]> Reviewed-by: Nicolas Saenz Julienne <[email protected]> Signed-off-by: Matthias Brugger <[email protected]>
2021-09-29mailmap: Update mail address for Nicolas Saenz julienneNicolas Saenz Julienne
The @suse.de address doesn't exist anymore. Update it to something not dependent on my workplace. Signed-off-by: Nicolas Saenz Julienne <[email protected]> Signed-off-by: Matthias Brugger <[email protected]>
2021-09-29Merge branch 'network_master' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-net into next - Fix some non-NULL terminated strings in the networking subsystem - net: tsec: Mark tsec_get_interface as __maybe_unused
2021-09-29arm: dts: armada8040: Fix CP0 eMMC/SDIO supportRobert Marko
During the migration to a single DTSI for the CP110-s specific pinctrl compatibles were moved to the SoC DTSI as CP0 and CP1 have some specifics. Namely, CP0 eMMC/SDIO support depends on the mvebu-pinctrl driver setting the BIT(0) in eMMC PHY IO Control 0 Register to 0 in order for the connect the eMMC/SDIO PHY to the controller and not use it as a MPP pin multiplexor. So, the mvebu-pinctrl driver check specifically for the "marvell,armada-8k-cpm-pinctrl" compatible to clear the that bit. Issue is that compatibles in the 8040 DTSI were set to "marvell,8k-cpm-pinctrl" for CP0 and "marvell,8k-cps-pinctrl" for the CP1. This is obviously incorrect as the pinctrl driver does not know about these. So fix the regression by applying correct compatibles to the DTSI. Regression found and tested on the Puzzle M801 board. Fixes: a0ba97e5 ("arm: armada: dts: Use a single dtsi for cp110 die description") Signed-off-by: Robert Marko <[email protected]> Reviewed-by: Stefan Roese <[email protected]>