Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-24 Thread Marek Vasut
On 9/25/21 2:12 AM, Marek Behún wrote: On Fri, 24 Sep 2021 22:09:15 +0200 Marek Vasut wrote: I have a feeling the discussion is again banking toward "mtdparts" and "DT", which really is a solved problem, or at least we agreed upon the solution. I was trying to explain to Patrick how he can

Re: [PATCH 0/5] Apple M1 Support

2021-09-24 Thread Simon Glass
Hi Mark, On Sat, 18 Sept 2021 at 07:54, Mark Kettenis wrote: > > This series adds basic support for Apple's M1 SoC to U-Boot. > This builds a basic U-Boot that can be used as a payload > for the m1n1 boot loader being developed by the Asahi Linux > project. > > The goal here is to privide an

[PATCH u-boot-marvell] arm: mvebu: turris_omnia: fix leaked mtd device

2021-09-24 Thread Marek Behún
From: Marek Behún After getting MTD device via get_mtd_device_nm(), we need to put it with put_mtd_device(), otherwise we get Removing MTD device #0 (mx25l6405d) with use count 1 before booting kernel. Signed-off-by: Marek Behún --- board/CZ.NIC/turris_omnia/turris_omnia.c | 3 +++ 1 file

[PATCH v2 32/39] efi: Share struct efi_priv between the app and stub code

2021-09-24 Thread Simon Glass
At present each of these has its own static variable and helper functions. Move them into a shared file. Signed-off-by: Simon Glass --- (no changes since v1) include/efi.h | 21 + lib/efi/efi.c | 29 + lib/efi/efi_app.c | 21

[PATCH v2 30/39] efi: Fix ll_boot_init() operation with the app

2021-09-24 Thread Simon Glass
This should return false when the EFI app is running, since UEFI has done the required low-level init. Fix it. Signed-off-by: Simon Glass --- (no changes since v1) include/init.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/init.h b/include/init.h index

[PATCH v2 23/39] binman: Support updating the dtb in an ELF file

2021-09-24 Thread Simon Glass
WIth EFI we must embed the devicetree in an ELF image so that it is loaded as part of the executable file. We want it to include the binman definition in there also, which in some cases cannot be created until the ELF (u-boot) is built. Add an option to binman to support writing the updated dtb to

Re: [PATCH 1/1] Avoid polluting CONFIG_ namespace with board specific define.

2021-09-24 Thread Tom Rini
On Fri, Sep 10, 2021 at 08:19:19AM +0200, Kristian Amlie wrote: > Signed-off-by: Kristian Amlie > Reviewed-by: Tom Rini Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP signature

Re: [PATCH v4 1/2] tools: Refactor full help printing

2021-09-24 Thread Tom Rini
On Wed, Sep 08, 2021 at 12:38:01PM +0100, Paul Barker wrote: > Collect the code for printing the full help message of patman, buildman > and binman into a single function in patman.tools. > > Signed-off-by: Paul Barker Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP

[PATCH v2 33/39] efi: Move exit_boot_services into a function

2021-09-24 Thread Simon Glass
At present this code is inline in the app and stub. But they do the same thing. The difference is that the stub does it immediately and the app doesn't want to do it until the end (when it boots a kernel) or not at all, if returning to UEFI. Move it into a function so it can be called as needed.

[PATCH v2 27/39] x86: Don't process the kernel command line unless enabled

2021-09-24 Thread Simon Glass
If the 'bootm' command is not enabled then this code is not available and this causes a link error. Fix it. Note that for the EFI app, there is no indication of missing code. It just hangs! Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/lib/zimage.c | 13 - 1 file

[PATCH v2 34/39] efi: Check for failure when initing the app

2021-09-24 Thread Simon Glass
The stub checks for failure with efi_init(). Add this for the app as well. It is unlikely that anything can be done, but we may as well stop. Signed-off-by: Simon Glass --- (no changes since v1) lib/efi/efi_app.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git

Re: [PATCH v4 2/2] tools: Handle PAGER containing arguments

2021-09-24 Thread Tom Rini
On Wed, Sep 08, 2021 at 12:38:02PM +0100, Paul Barker wrote: > When printing full help output from a tool, we should be able to handle > a PAGER variable which includes arguments, e.g. PAGER='less -F'. > > Signed-off-by: Paul Barker Applied to u-boot/next, thanks! -- Tom signature.asc

Re: [PATCH 1/1] ARM: vexpress_ca9x4: Reintroduce board in order to use with QEMU.

2021-09-24 Thread Tom Rini
On Tue, Sep 07, 2021 at 08:37:51AM +0200, Kristian Amlie wrote: > vexpress_ca9x4 is seemingly the only board except for qemu_arm which > is able to run U-Boot correctly, using the `-M vexpress-a9` option to > QEMU. Building for qemu_arm and running qemu-system-arm with the `-M > virt` argument

Re: [PATCH] arm: use CONFIG_SUPPORT_PASSING_ATAGS

2021-09-24 Thread Tom Rini
On Fri, Sep 03, 2021 at 10:24:39AM +0200, Patrick Delaunay wrote: > Simplify the bootm and the spl code by using the new config > CONFIG_SUPPORT_PASSING_ATAGS. > > Signed-off-by: Patrick Delaunay > Reviewed-by: Tom Rini Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP

Re: [PATCHv5] drivers: tpm2: update reset gpio semantics

2021-09-24 Thread Tom Rini
On Thu, Jun 03, 2021 at 12:40:26PM +0200, Jorge Ramirez-Ortiz wrote: > Use the more generic reset-gpios property name. > > Signed-off-by: Jorge Ramirez-Ortiz > Acked-by: Michal Simek > Acked-by: Ilias Apalodimas Applied to u-boot/next, thanks! -- Tom signature.asc Description: PGP

[PATCH v2 36/39] efi: Show when allocated pages are used

2021-09-24 Thread Simon Glass
Add a message here so that both paths of memory allocation are reported. Signed-off-by: Simon Glass --- Changes in v2: - Use log_info() instead of printf() lib/efi/efi_app.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index

[PATCH v2 26/39] x86: Allow booting a kernel from the EFI app

2021-09-24 Thread Simon Glass
At present this is disabled, but it should work so long as the kernel does not need EFI services. Enable it and add a note about remaining work. Signed-off-by: Simon Glass --- Changes in v2: - Update documentation arch/x86/lib/bootm.c | 11 +++

[PATCH v2 07/39] efi: Add a script for building and testing U-Boot on UEFI

2021-09-24 Thread Simon Glass
It is quite complicating to run U-Boot on qemu since we have four different builds and they must use different versions of qemu and the UEFI binaries. Add a script to help. Signed-off-by: Simon Glass --- Changes in v2: - Add MAINTAINERS entry - Add support for creating a partition table with a

[PATCH v2 09/39] efi: Drop the OF_EMBED warning for EFI

2021-09-24 Thread Simon Glass
For the EFI app, we must embed the devicetree in the ELF file since that is the only thing that is run by UEFI. Drop the warning to avoid confusion. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to drop the OF_EMBED warning for EFI Makefile | 2 +- 1 file changed, 1

[PATCH v2 39/39] efi: Support the efi command in the app

2021-09-24 Thread Simon Glass
At present the 'efi' command only works in the EFI payload. Update it to work in the app too, so the memory map can be examined. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to support the efi command in the app cmd/Makefile | 2 +- cmd/efi.c | 46

[PATCH v2 38/39] efi: Update efi_get_next_mem_desc() to avoid needing a map

2021-09-24 Thread Simon Glass
At present this function requires a pointer to struct efi_entry_memmap but the only field used in there is the desc_size. We want to be able to use it from the app, so update it to use desc_size directly. Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/cpu/efi/payload.c | 8

[PATCH v2 37/39] efi: Allow easy selection of serial-only operation

2021-09-24 Thread Simon Glass
Add info about how to select vidconsole or serial. Also set up a demo boot command. Signed-off-by: Simon Glass --- Changes in v2: - Add a better boot command too include/configs/efi-x86_app.h | 25 + 1 file changed, 25 insertions(+) diff --git

[PATCH v2 35/39] efi: Mention that efi_info_get() is only used in the stub

2021-09-24 Thread Simon Glass
This provides access to EFI tables after U-Boot has exited boot services. It is not needed in the app since boot services remain alive and we can just call them whenever needed. Add a comment to explain this. Signed-off-by: Simon Glass --- Changes in v2: - Fix 'as' typo include/efi.h | 4

[PATCH v2 29/39] efi: Add comments to struct efi_priv

2021-09-24 Thread Simon Glass
This structure is uncommented. Fix it. Signed-off-by: Simon Glass --- (no changes since v1) include/efi.h | 26 +- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/include/efi.h b/include/efi.h index 908c5dc6ebd..3c215618dab 100644 --- a/include/efi.h +++

[PATCH v2 28/39] x86: efi: Add room for the binman definition in the dtb

2021-09-24 Thread Simon Glass
At present only 4KB of spare space is left in the DTB when building the EFI app. Increase this to 32KB so there is plenty of space to insert the binman definition. This cannot be expanded later (as with OF_SEPARATE) because the ELF image has already been built. Signed-off-by: Simon Glass ---

[PATCH v2 25/39] bloblist: Support allocating the bloblist

2021-09-24 Thread Simon Glass
Typically the bloblist is positioned at a fixed address in memory until relocation. This is convenient when it is set up in SPL or before relocation. But for EFI we want to set it up only when U-Boot proper is running. Add a way to allocate it using malloc() and update the documentation to cover

[PATCH v2 24/39] efi: serial: Support arrow keys

2021-09-24 Thread Simon Glass
At present only the backspace key is supported in U-Boot, when running as an EFI app. Add support for arrows, home and end as well, to make the CLI more friendly. Signed-off-by: Simon Glass --- (no changes since v1) drivers/serial/serial_efi.c | 11 +-- 1 file changed, 9

[PATCH v2 21/39] binman: Allow timeout to occur in the image or its section

2021-09-24 Thread Simon Glass
At present testThreadTimeout() assumes that the expected timeout happens first when building the section, but it can just as easily happen at the top-level image. Update the test to cope with both. Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/ftest.py | 3 +-- 1 file

[PATCH v2 22/39] binman: Tidy up comments on _DoTestFile()

2021-09-24 Thread Simon Glass
The comment for this function is missing an argument and the return value. Fix it. Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/ftest.py | 5 + 1 file changed, 5 insertions(+) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 8199a4fc7e0..39a4b94cd0b

[PATCH v2 20/39] binman: Support reading the offset of an ELF-file symbol

2021-09-24 Thread Simon Glass
Binman needs to be able to update the contents of an ELF file after it has been build. To support this, add a function to locate the position of a symbol's contents within the file. Fix the comments on bss_data.c and Symbol while we are here. Signed-off-by: Simon Glass --- (no changes since

[PATCH v2 19/39] binman: Report an error if test files fail to compile

2021-09-24 Thread Simon Glass
At present any error from the 'make' command is silently swallowed by the test system. Fix this by showing it when detected. Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/elf_test.py | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git

[PATCH v2 18/39] patman: Use a ValueError exception if tools.Run() fails

2021-09-24 Thread Simon Glass
The Exception base class is a very vague and could be confusing to the test system. Use the more specific ValueError exception instead. Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v2 17/39] efi: Locate all block devices in the app

2021-09-24 Thread Simon Glass
When starting the app, locate all block devices and make them available to U-Boot. This allows listing partitions and accessing files in filesystems. EFI also has the concept of 'disks', meaning boot media. For now, this is not obviously useful in U-Boot, but add code to at least locate these.

[PATCH v2 15/39] efi: Add EFI uclass for media

2021-09-24 Thread Simon Glass
At present UCLASS_EFI is used to represent an EFI filesystem among other things. The description of this uclass is "EFI managed devices" which is pretty vague. The only driver that uses this uclass is in fact not a real U-Boot driver, since its operations do not include a struct udevice. Rather

[PATCH v2 16/39] efi: Add a media/block driver for EFI block devices

2021-09-24 Thread Simon Glass
Add a block driver which handles read/write for EFI block devices. This driver actually already exists ('efi_block') but is not really suitable for use as a real U-Boot driver: - The operations do not provide a udevice - The code is designed for running as part of EFI loader, so uses

[PATCH v2 14/39] efi: Add video support to the app

2021-09-24 Thread Simon Glass
The current EFI video driver only works when running in the stub. In that case the stub calls boot services (before jumping to U-Boot proper) and copies the graphics info over to the efi table. This is necessary because the stub exits boot services before jumping to U-Boot. The app maintains

[PATCH v2 13/39] efi: Add a way to obtain boot services in the app

2021-09-24 Thread Simon Glass
Add a function to return this information along with a stub for the efi_info_get() function, since calling it otherwise hangs U-Boot. Signed-off-by: Simon Glass --- (no changes since v1) include/efi.h | 8 +++- lib/efi/efi_app.c | 10 ++ 2 files changed, 17 insertions(+), 1

[PATCH v2 11/39] efi: Create a 64-bit app

2021-09-24 Thread Simon Glass
Most modern platforms use 64-bit EFI so it is useful to have a U-Boot app that runs under that. Add a (non-functional) build for this. Note that --whole-archive causes the gcc 9.2 linker to crash, so disable this for now. Once this is resolved, things should work. For now, avoid mentioning the

[PATCH v2 12/39] x86: Don't duplicate global_ptr in 64-bit EFI app

2021-09-24 Thread Simon Glass
This variable is already defined by the EFI code. Drop the duplicate definition when building a 64-bit EFI app. Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/cpu/x86_64/cpu.c | 16 arch/x86/cpu/x86_64/misc.c | 16 lib/efi/efi.c |

[PATCH v2 10/39] x86: Create a 32/64-bit selection for the app

2021-09-24 Thread Simon Glass
Most EFI implementations use 64-bit but U-Boot only supports running as a 32-bit app at present. While efi-x86_payload64 does boot from 64-bit UEFI it immediately changes back to 32-bit before starting U-Boot. In order to support a 64-bit U-Boot app, update the Kconfig to add an option for 32/64

[PATCH v2 06/39] x86: Tidy up global_data pointer for 64-bit

2021-09-24 Thread Simon Glass
Add an extern declaration so that it is possible to use this macro in files other than the one that defines it. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt --- (no changes since v1) arch/x86/cpu/x86_64/cpu.c | 3 +++ arch/x86/include/asm/global_data.h | 2 ++ 2 files

[PATCH v2 08/39] efi: Enable DM_ETH for the app

2021-09-24 Thread Simon Glass
There is no need to avoid driver model for networking. Drop this. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to enable DM_ETH for the app configs/efi-x86_app_defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/efi-x86_app_defconfig

[PATCH v2 05/39] x86: Show some EFI info with the bdinfo command

2021-09-24 Thread Simon Glass
It is useful to see some basic EFI info with the command as it forms part of the information about a board. Add a hook for this and show the table address as a start. While here, fix an invalid cast in setup_efi_info(). Note that this function is using a data structure defined by Linux so we

[PATCH v2 04/39] x86: Create a new header for EFI

2021-09-24 Thread Simon Glass
The setup routines are called from zimage but don't really belong in the zimage header. Add a new EFI header to house these. Add comments so it is clear what the functions do. Note that these functions are x86-specific. The zimage business is not used on other architectures. Signed-off-by: Simon

[PATCH v2 02/39] efi: Add a separate maintainer entry for the app

2021-09-24 Thread Simon Glass
Separate this out slightly from the payload, with a new entry. We might consider renaming EFI PAYLOAD to EFI LOADER, but that would require quite a lot of file changes. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch with maintainer entry MAINTAINERS | 7 +++ 1 file

[PATCH v2 03/39] x86: Keep symbol information in u-boot ELF file

2021-09-24 Thread Simon Glass
At present this information is stripped when linking. It is useful to keep it around. Strip it from the .efi files instead. Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/config.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/config.mk

[PATCH v2 01/39] RFC: efi: Drop code that doesn't work with driver model

2021-09-24 Thread Simon Glass
This code should never have been added as it builds a new feature on top of legacy code. This has already been improved with the dependency on BLK. Add a dependency on DM_ETH also, to avoid needing to deal with this old code. Boards which want EFI_LOADER should migrate to driver model first.

[PATCH v2 00/39] efi: Improvements to U-Boot running on top of UEFI

2021-09-24 Thread Simon Glass
At present U-Boot can be built as an EFI app, but it is really just for testing, with very few features. Instead, the payload build is used for booting on top of UEFI, where U-Boot takes over the machine immediately and supplies its own drivers. But the app could be made more useful. This series

Re: about mtd erase fix series

2021-09-24 Thread Marek Behún
On Fri, 24 Sep 2021 20:00:31 -0400 Tom Rini wrote: > On Sat, Sep 25, 2021 at 01:49:26AM +0200, Marek Behún wrote: > > > Hi Tom, Jagan, > > > > in July I resent the series > > Fix `mtd erase` when used with mtdpart > > https://patchwork.ozlabs.org/project/uboot/list/?series=253565=* > > > >

Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

2021-09-24 Thread Marek Behún
On Fri, 24 Sep 2021 22:09:15 +0200 Marek Vasut wrote: > I have a feeling the discussion is again banking toward "mtdparts" and > "DT", which really is a solved problem, or at least we agreed upon the > solution. I was trying to explain to Patrick how he can convert the ST board so that the

Re: about mtd erase fix series

2021-09-24 Thread Tom Rini
On Sat, Sep 25, 2021 at 01:49:26AM +0200, Marek Behún wrote: > Hi Tom, Jagan, > > in July I resent the series > Fix `mtd erase` when used with mtdpart > https://patchwork.ozlabs.org/project/uboot/list/?series=253565=* > > There was a build error in CI, more info at >

about mtd erase fix series

2021-09-24 Thread Marek Behún
Hi Tom, Jagan, in July I resent the series Fix `mtd erase` when used with mtdpart https://patchwork.ozlabs.org/project/uboot/list/?series=253565=* There was a build error in CI, more info at https://lists.denx.de/pipermail/u-boot/2021-July/455851.html The CI link mentioned

Re: [PATCH v2 1/3] efi_loader: add SMBIOS table measurement

2021-09-24 Thread Simon Glass
Hi Ilias, On Thu, 23 Sept 2021 at 03:17, Ilias Apalodimas wrote: > > Hi Simon, > > On Wed, 22 Sept 2021 at 19:19, Simon Glass wrote: > > > > Hi Masahisa, > > > > On Tue, 21 Sept 2021 at 01:17, Masahisa Kojima > > wrote: > > > > > > TCG PC Client spec requires to measure the SMBIOS > > > table

Re: Two jobs at once on denx-vulcan?

2021-09-24 Thread Simon Glass
Hi Tom, On Fri, 24 Sept 2021 at 08:55, Tom Rini wrote: > > On Fri, Sep 24, 2021 at 08:38:49AM -0600, Simon Glass wrote: > > Hi Tom, > > > > On Fri, 24 Sept 2021 at 08:20, Tom Rini wrote: > > > > > > On Fri, Sep 24, 2021 at 04:01:21PM +0200, Harald Seiler wrote: > > > > Hi Simon, > > > > > > > >

Re: [PATCH 5/5] serial: Rework CONFIG_SYS_BAUDRATE_TABLE

2021-09-24 Thread Tom Rini
On Fri, Sep 24, 2021 at 09:08:15PM +0200, Pali Rohár wrote: > Hello! > > On Monday 13 September 2021 18:11:38 Tom Rini wrote: > > On Mon, Sep 13, 2021 at 05:03:13PM -0500, Alex G. wrote: > > > > > > > > > On 9/13/21 4:24 PM, Tom Rini wrote: > > > > In order to move CONFIG_SYS_BAUDRATE_TABLE to

[PATCH u-boot-marvell v3 39/39] MAINTAINERS: Add entry for kwbimage / kwboot tools

2021-09-24 Thread Marek Behún
From: Marek Behún Add entry for these tools with Marek, Pali and Stefan as maintainers. Signed-off-by: Marek Behún --- MAINTAINERS | 10 ++ 1 file changed, 10 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 67c96a6045..6f103230da 100644 --- a/MAINTAINERS +++ b/MAINTAINERS

[PATCH u-boot-marvell v3 19/39] tools: kwbimage: Simplify iteration over version 1 optional headers

2021-09-24 Thread Marek Behún
From: Marek 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

[PATCH u-boot-marvell v3 38/39] doc/kwboot.1: Update man page

2021-09-24 Thread Marek Behún
From: Marek Behún Update man page for the kwboot utility. Signed-off-by: Marek Behún --- doc/kwboot.1 | 60 ++-- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/doc/kwboot.1 b/doc/kwboot.1 index 1e9ca268f7..acdea891d9 100644 ---

[PATCH u-boot-marvell v3 33/39] tools: kwboot: Disable non-blocking mode

2021-09-24 Thread Marek Behún
From: Pali Rohár The kwboot utility does not handle EAGAIN / EBUSY errors, it expects blocking mode on tty - it uses select() to check if data is available. Disable non-blocking mode by clearing O_NDELAY flag which was set by open(). We can't just take O_NDELAY from open(), because it is

[PATCH u-boot-marvell v3 37/39] tools: kwboot: Add Pali and Marek as authors

2021-09-24 Thread Marek Behún
From: Pali Rohár Add Pali and Marek as another authors of the kwboot utility. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún --- tools/kwboot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/kwboot.c b/tools/kwboot.c index 6fa6dff04d..6a1a030308 100644 --- a/tools/kwboot.c

[PATCH u-boot-marvell v3 34/39] tools: kwboot: Cosmetic fix

2021-09-24 Thread Marek Behún
From: Marek Behún Add spaces around the | operator. Signed-off-by: Marek Behún --- tools/kwboot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index 5e491f31a4..9eb007f1bb 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -644,7

[PATCH u-boot-marvell v3 25/39] tools: kwbimage: Update comments describing kwbimage v1 structures

2021-09-24 Thread Marek Behún
From: Pali Rohár These structures are relevant for several other platforms, mention them all. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún --- tools/kwbimage.c | 3 ++- tools/kwbimage.h | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/kwbimage.c

[PATCH u-boot-marvell v3 35/39] tools: kwboot: Avoid code repetition in kwboot_img_patch()

2021-09-24 Thread Marek Behún
From: Marek Behún Change kwboot_img_patch() to avoid code repetition of setting errno to EINVAL. Signed-off-by: Marek Behún --- tools/kwboot.c | 55 ++ 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/tools/kwboot.c

[PATCH u-boot-marvell v3 36/39] tools: kwboot: Update file header

2021-09-24 Thread Marek Behún
From: Marek Behún Mention all supported platforms in file header. Signed-off-by: Marek Behún --- tools/kwboot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index 9da5b42ebf..6fa6dff04d 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c

[PATCH u-boot-marvell v3 31/39] tools: kwboot: Fix initializing tty device

2021-09-24 Thread Marek Behún
From: Pali Rohár Retrieve current terminal settings via tcgetattr(), set to raw mode with cfmakeraw(), enable receiver via CREAD and ignore modem control lines via CLOCAL. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún --- tools/kwboot.c | 9 + 1 file changed, 5 insertions(+),

[PATCH u-boot-marvell v3 32/39] tools: kwboot: Disable tty interbyte timeout

2021-09-24 Thread Marek Behún
From: Pali Rohár Function kwboot_tty_recv() has its own handling of read timeout, we don't need to do set it in tty settings. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún --- tools/kwboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/kwboot.c

[PATCH u-boot-marvell v3 21/39] tools: kwboot: Patch source address in image header

2021-09-24 Thread Marek Behún
From: Pali 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 [ refactored ] Signed-off-by: Marek Behún --- tools/kwboot.c | 40

[PATCH u-boot-marvell v3 20/39] tools: kwboot: Don't patch image header if signed

2021-09-24 Thread Marek Behún
From: Pali Rohár It is not possible to modify image with secure header due to cryptographic signature. Signed-off-by: Pali Rohár [ refactored ] Signed-off-by: Marek Behún --- tools/kwboot.c | 30 +- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git

[PATCH u-boot-marvell v3 22/39] tools: kwboot: Patch destination address to DDR area for SPI image

2021-09-24 Thread Marek Behún
From: Pali Rohár SPI/NOR kwbimage may have destination address set to 0x, 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

[PATCH u-boot-marvell v3 29/39] tools: kwboot: Allow any baudrate on Linux

2021-09-24 Thread Marek Behún
From: Pali Rohár The A38x platform supports more baudrates than just those defined by the Bn constants, and some of them are higher than the highest Bn baudrate (the highest is 4 MBd while A38x support 5.15 MBd). On Linux, add support for arbitrary baudrates. (Since there is no standard POSIX

[PATCH u-boot-marvell v3 30/39] tools: kwboot: Check whether baudrate was set to requested value

2021-09-24 Thread Marek Behún
From: Marek Behún The tcsetattr() function can return 0 even if baudrate was not changed. Check whether baudrate was changed to requested value, and in case of arbitrary baudrate, check whether the set value is within 3% tolerance. Signed-off-by: Marek Behún --- tools/kwboot.c | 32

[PATCH u-boot-marvell v3 28/39] tools: kwboot: Support higher baudrates when booting via UART

2021-09-24 Thread Marek Behún
From: Pali Rohár Add support for uploading the boot image (the data part only) at higher baudrate than the standard one. The kwboot utility already has -B option, but choosing other baudrate than the standard one (115200 Bd) can only work for debug mode, not for booting the device. The BootROM

[PATCH u-boot-marvell v3 27/39] tools: kwboot: Explicitly check against size of struct main_hdr_v1

2021-09-24 Thread Marek Behún
From: Marek 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 --- tools/kwboot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

[PATCH u-boot-marvell v3 26/39] tools: kwboot: Round up header size to 128 B when patching

2021-09-24 Thread Marek Behún
From: Pali 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

[PATCH u-boot-marvell v3 24/39] tools: kwbimage: Refactor kwbimage header size determination

2021-09-24 Thread Marek Behún
From: Marek 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

[PATCH u-boot-marvell v3 23/39] tools: kwbimage: Refactor image_version()

2021-09-24 Thread Marek Behún
From: Marek Behún Rename this function to kwbimage_version() and don't cast argument if not needed. Signed-off-by: Marek Behún --- tools/kwbimage.c | 8 tools/kwbimage.h | 4 ++-- tools/kwboot.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git

[PATCH u-boot-marvell v3 18/39] tools: kwboot: Always call kwboot_img_patch_hdr()

2021-09-24 Thread Marek Behún
From: 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 Reviewed-by: Marek Behún --- tools/kwboot.c | 23 ++- 1 file

[PATCH u-boot-marvell v3 16/39] tools: kwboot: Prevent waiting indefinitely if no xmodem reply is received

2021-09-24 Thread Marek Behún
From: Marek 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

[PATCH u-boot-marvell v3 17/39] tools: kwboot: Properly finish xmodem transfer

2021-09-24 Thread Marek Behún
From: Pali 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 [ refactored ] Signed-off-by: Marek Behún --- tools/kwboot.c | 62 -- 1 file changed, 45

[PATCH u-boot-marvell v3 13/39] tools: kwboot: Allow non-xmodem text output from BootROM only in a specific case

2021-09-24 Thread Marek Behún
From: Pali 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

[PATCH u-boot-marvell v3 15/39] tools: kwboot: Allow greater timeout when executing header code

2021-09-24 Thread Marek Behún
From: Marek 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 --- tools/kwboot.c |

[PATCH u-boot-marvell v3 14/39] tools: kwboot: Print new line after SPL output

2021-09-24 Thread Marek Behún
From: Marek 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 --- tools/kwboot.c | 11 +-- 1 file changed, 9

[PATCH u-boot-marvell v3 12/39] tools: kwboot: Use a function to check whether received byte is a Xmodem reply

2021-09-24 Thread Marek Behún
From: Marek Behún This is a non-functional change that should make the code more readable. Signed-off-by: Marek Behún --- tools/kwboot.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index 7f231c0823..2e5684b91c 100644 ---

[PATCH u-boot-marvell v3 11/39] tools: kwboot: Split sending image into header and data stages

2021-09-24 Thread Marek Behún
From: Pali 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 [ refactored ] Signed-off-by: Marek Behún --- tools/kwbimage.h | 8 +++-- tools/kwboot.c | 84

[PATCH u-boot-marvell v3 10/39] tools: kwboot: Print newline on error when progress was not completed

2021-09-24 Thread Marek Behún
From: Pali 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 Reviewed-by: Marek Behún --- tools/kwboot.c | 1 + 1 file changed, 1 insertion(+)

[PATCH u-boot-marvell v3 09/39] tools: kwboot: Fix printing progress

2021-09-24 Thread Marek Behún
From: Pali 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 Reviewed-by: Marek Behún --- tools/kwboot.c | 9 +++-- 1

[PATCH u-boot-marvell v3 06/39] tools: kwboot: Fix kwboot_xm_sendblock() function when kwboot_tty_recv() fails

2021-09-24 Thread Marek Behún
From: Pali 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

[PATCH u-boot-marvell v3 05/39] tools: kwboot: Print version information header

2021-09-24 Thread Marek Behún
From: Pali Rohár Print kwboot's (U-Boot's) version when printing usage. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- tools/kwboot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/kwboot.c b/tools/kwboot.c index 22cdd137ad..454339db14 100644 --- a/tools/kwboot.c +++

[PATCH u-boot-marvell v3 04/39] tools: kwboot: Refactor and fix writing buffer

2021-09-24 Thread Marek Behún
From: Marek 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

[PATCH u-boot-marvell v3 07/39] tools: kwboot: Fix return type of kwboot_xm_makeblock() function

2021-09-24 Thread Marek Behún
From: Pali 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

[PATCH u-boot-marvell v3 08/39] tools: kwboot: Fix comparison of integers with different size

2021-09-24 Thread Marek Behún
From: Marek Behún The compiler complains that we are comparing int with size_t when compiled with -W. Signed-off-by: Marek Behún --- tools/kwboot.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index 88353d19c0..3d9f73e697 100644 ---

[PATCH u-boot-marvell v3 01/39] tools: kwbimage: Fix printf format warning

2021-09-24 Thread Marek Behún
From: Marek 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

[PATCH u-boot-marvell v3 03/39] tools: kwboot: Make the quit sequence buffer const

2021-09-24 Thread Marek Behún
From: Marek Behún This buffer is never written to. Make it const. Signed-off-by: Marek Behún --- tools/kwboot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index e6e99849a7..f18f6d2134 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c

[PATCH u-boot-marvell v3 02/39] tools: kwboot: Fix buffer overflow in kwboot_terminal()

2021-09-24 Thread Marek Behún
From: 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

[PATCH u-boot-marvell v3 00/39] kwboot higher baudrate

2021-09-24 Thread Marek Behún
From: Marek Behún Hello Stefan and others, here's v3 of series adding support for booting Marvell platforms via UART (those bootable with kwboot) at higher baudrates. Tested on Turris Omnia up to 5.15 MBd, which is 44x faster than 115200 Bd. The user can direct kwboot to use higher baudrate

[PATCH u-boot-marvell 8/9] arm: mvebu: a38x: serdes: Remove unused PCIe macros and functions

2021-09-24 Thread Marek Behún
From: Pali Rohár Remove unused PCIe functions from SerDes code. They are unused and are duplicated either from generic PCIe code or from pci_mvebu.c. Remove also unused PCIe macros from SerDes code. They are just obfuscated variants of standards macros in include/pci.h or in pci_mvebu.c.

[PATCH u-boot-marvell 7/9] arm: mvebu: a38x: serdes: Don't configure PCIe cards in SerDes init code

2021-09-24 Thread Marek Behún
From: Pali Rohár This code is trying to parse PCIe config space of PCIe card connected on the other end of link and then is trying to force 5.0 GT/s speed via Target Link Speed bits in PCIe Root Port Link Control 2 Register on the local part of link if it sees that card supports 5.0 GT/s via Max

[PATCH u-boot-marvell 9/9] arm: mvebu: a38x: serdes: Update comment about PCIE*_ENABLE_* defines

2021-09-24 Thread Marek Behún
From: Pali Rohár These are part of SOC_CONTROL_REG1 register, not PEX_CAPABILITIES_REG. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH u-boot-marvell 4/9] arm: mvebu: a38x: serdes: Don't overwrite read-only SAR PCIe registers

2021-09-24 Thread Marek Behún
From: Pali Rohár Device/Port Type bits of PCIe Root Port PCI Express Capabilities Register are read-only SAR registers and are initialized according to current mode configured by PCIe controller. Changing PCIe controller mode (from Root Complex mode to Endpoint mode or the other way) is possible

[PATCH u-boot-marvell 6/9] arm: mvebu: a38x: serdes: Don't overwrite PCI device ID

2021-09-24 Thread Marek Behún
From: Pali Rohár PCI device ID is part of the PCIe controller SoC / revision. For Root Complex mode (which is the default and the only mode supported currently by U-Boot and Linux kernel), it is PCI device ID of PCIe Root Port device. If there is some issue with this device ID, it should be set

  1   2   >