[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 b/tools

[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 b/tools

[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 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

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 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.o

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

2021-09-24 Thread Marek Behún
. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c | 128 - arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h | 60 -- 2 files changed, 188 deletions(-) diff --git a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c b/arch/arm/mach-mvebu

[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
speed even with missing link retraining). Compliant cards which just need longer initialization should work better after this change. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c | 128 + 1 file changed, 1 insertion(+), 127

[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
and execution addresses from SPI/NOR XIP area to DDR area 0x0080 (which is default for A38x). Signed-off-by: Pali Rohár [ refactored ] Signed-off-by: Marek Behún --- tools/kwboot.c | 8 1 file changed, 8 insertions(+) diff --git a/tools/kwboot.c b/tools/kwboot.c index 907a574bfc

[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 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 b

[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 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 a/arch/arm/mach-mvebu/serdes/a38x

[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
correctly here, then access PCI config space of the endpoint card behind this Root Port does not work. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c| 22 -- arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h| 4 ++ .../serdes/a38x

[PATCH u-boot-marvell 5/9] arm: mvebu: a38x: serdes: Don't set PCIe Common Clock Configuration

2021-09-24 Thread Marek Behún
-by: Pali Rohár Reviewed-by: Marek Behún --- .../mach-mvebu/serdes/a38x/high_speed_env_spec.c | 15 --- 1 file changed, 15 deletions(-) diff --git a/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c b/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c index a712fa8994..824f4d3e3d

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

2021-09-24 Thread Marek Behún
not be overwritten globally for all A38x devices. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c | 27 -- 1 file changed, 27 deletions(-) diff --git a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c b/arch/arm/mach-mvebu/serdes/a38x

[PATCH u-boot-marvell 3/9] arm: mvebu: a38x: serdes: Add comments for hws_pex_config() code

2021-09-24 Thread Marek Behún
From: Pali Rohár Add comments to understand what this magic code is doing. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-mvebu/serdes/a38x

[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

[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 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 07/39] tools: kwboot: Fix return type of kwboot_xm_makeblock() function

2021-09-24 Thread Marek Behún
-by: Marek Behún --- tools/kwboot.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index b9a402ca91..88353d19c0 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -347,7 +347,7 @@ kwboot_debugmsg(int tty, void *msg) return rc

[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 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 a/tools

[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 changed

[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

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

2021-09-24 Thread Marek Behún
it is required there until the CLOCAL flag is set on the tty. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún --- tools/kwboot.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index a527c79cf3..5e491f31a4 100644 --- a/tools/kwboot.c +++ b

[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 +++ b

[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
the now unnecessary break. In other failure cases return immediately. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- tools/kwboot.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index 454339db14..b9a402ca91 100644 --- a/tools

[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

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

[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 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 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 13/39] tools: kwboot: Allow non-xmodem text output from BootROM only in a specific case

2021-09-24 Thread Marek Behún
BootROM only in this case. Signed-off-by: Pali Rohár [ refactored & simplified ] Signed-off-by: Marek Behún --- tools/kwboot.c | 70 ++ 1 file changed, 53 insertions(+), 17 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c i

[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 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 insertions

[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 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 2/6] arm: a37xx: pci: Add support for accessing PCI Bridge on root bus

2021-09-25 Thread Marek Behún
() and pcie_advk_write_config() functions to correctly calculate real Aardvark bus number of the target device from U-Boot's bus number as: busno = PCI_BUS(bdf) - dev_seq(bus) Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- drivers/pci/pci-aardvark.c | 143 - 1

[PATCH u-boot-marvell 3/6] arm: a37xx: pci: Do not automatically enable bus mastering on PCI Bridge

2021-09-25 Thread Marek Behún
From: Pali Rohár Now that PCI Bridge is working for the PCIe Root Port, U-Boot's PCI_PNP code automatically enables memory access and bus mastering when needed. We do not need to enable it when setting the HW up. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- drivers/pci/pci

[PATCH u-boot-marvell 4/6] arm: a37xx: pci: Handle propagation of CRSSVE bit from PCIe Root Port

2021-09-25 Thread Marek Behún
is provided in read-only Root Capabilities register. So manually inject this CRSVIS bit into read response for that register. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- drivers/pci/pci-aardvark.c | 26 ++ include/pci.h | 4 2 files changed, 26

[PATCH u-boot-marvell 1/6] arm: a37xx: pci: Fix pcie_advk_link_up()

2021-09-25 Thread Marek Behún
From: Pali Rohár Aardvark reports Disabled and Hot Reset LTSSM states as values >= 0x20. Link is not up in these states, so fix pcie_advk_link_up() function. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- drivers/pci/pci-aardvark.c | 3 ++- 1 file changed, 2 insertions(+), 1 delet

[PATCH u-boot-marvell 0/6] A3720 PCIe enhancements

2021-09-25 Thread Marek Behún
From: Marek Behún Hello Stefan, Pali has worked on some more enhancements for Armada 3720 PCIe driver (Aardvark). The main change is adding support for accessing configuration space of the PCI Bridge on the PCIe Root Port. Linux does something similar with pci-bridge-emul. Marek Marek Behún

[PATCH u-boot-marvell 5/6] arm: a37xx: pci: Cosmetic change

2021-09-25 Thread Marek Behún
From: Marek Behún Update indentation in driver's private structure. Signed-off-by: Marek Behún --- drivers/pci/pci-aardvark.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pci/pci-aardvark.c b/drivers/pci/pci-aardvark.c index 53e9e23d4a..b4f350ca2c

[PATCH u-boot-spi v2 2/9] mtd: spi-nor-core: Check return value of write_enable() in spi_nor_erase()

2021-09-25 Thread Marek Behún
From: Marek Behún The spi_nor_erase() function does not check return value of the write_enable() call. Fix this. Signed-off-by: Marek Behún Reviewed-by: Simon Glass Reviewed-by: Jagan Teki Tested-by: Masami Hiramatsu --- drivers/mtd/spi/spi-nor-core.c | 4 +++- 1 file changed, 3 insertions

[PATCH u-boot-spi v2 8/9] mtd: mtdpart: Make mtdpart's _erase method sane

2021-09-25 Thread Marek Behún
From: Marek Behún The _erase() method of the mtdpart driver, part_erase(), currently implements offset shifting (for given mtdpart partition) in a weird way: 1. part_erase() adds partition offset to block address 2. parent driver's _erase() method is called 3. parent driver's _erase

[PATCH u-boot-spi v2 6/9] mtd: spi-nor-core: Call mtd_erase_callback() from spi_nor_erase()

2021-09-25 Thread Marek Behún
From: Marek Behún The spi_nor_erase() function does not call mtd_erase_callback() as it should. The mtdpart code currently implements the subtraction of partition offset in mtd_erase_callback(). This results in partition offset being added prior calling spi_nor_erase(), but not subtracted back

[PATCH u-boot-spi v2 3/9] mtd: spi-nor-core: Don't overwrite return value if it is non-zero

2021-09-25 Thread Marek Behún
From: Marek Behún The cleanup code of the spi_nor_erase() function overwrites the ret variable with return value of clean_bar(), even if the ret variable is already set. Fix this. Signed-off-by: Marek Behún Reviewed-by: Simon Glass Tested-by: Masami Hiramatsu --- drivers/mtd/spi/spi-nor

[PATCH u-boot-spi v2 5/9] mtd: spi-nor-core: Don't check for zero length in spi_nor_erase()

2021-09-25 Thread Marek Behún
From: Marek Behún This check is already done in mtdcore's mtd_erase(), no reason to do this here as well. Signed-off-by: Marek Behún Reviewed-by: Simon Glass Tested-by: Masami Hiramatsu --- drivers/mtd/spi/spi-nor-core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/mtd/spi

[PATCH u-boot-spi v2 7/9] mtd: spi-nor-core: Check for ctrlc() in spi_nor_erase()

2021-09-25 Thread Marek Behún
From: Marek Behún May it possible to interrupt the spi_nor_erase() function. Signed-off-by: Marek Behún Reviewed-by: Simon Glass Tested-by: Masami Hiramatsu --- drivers/mtd/spi/spi-nor-core.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers

[PATCH u-boot-spi v2 4/9] mtd: spi-nor-core: Check return value of write_disable() in spi_nor_erase()

2021-09-25 Thread Marek Behún
From: Marek Behún The cleanup code of spi_nor_erase() function calls write_disable(), but does not return it's return value even in case of failure. Fix this. Signed-off-by: Marek Behún Reviewed-by: Simon Glass Tested-by: Masami Hiramatsu --- drivers/mtd/spi/spi-nor-core.c | 4 +++- 1 file

[PATCH u-boot-spi v2 1/9] mtd: spi-nor-core: Try cleaning up in case writing BAR failed

2021-09-25 Thread Marek Behún
From: Marek Behún Use the cleanup codepath of spi_nor_erase() also in the event of failure of writing the BAR register. Signed-off-by: Marek Behún Reviewed-by: Simon Glass Reviewed-by: Jagan Teki Tested-by: Masami Hiramatsu --- drivers/mtd/spi/spi-nor-core.c | 2 +- 1 file changed, 1

[PATCH u-boot-spi v2 0/9] Fix `mtd erase` when used with mtdpart

2021-09-25 Thread Marek Behún
From: Marek Behún The original cover letter said: this patch series fixes the `mtd erase` command when used with mtdpart with a partition of non-zero offset. Currently when the `mtd erase` command is used for such a partition, it does not erase all blocks. Instead after a block is erased

[PATCH u-boot-marvell 6/6] arm: a37xx: pci: Update private structure documentation

2021-09-25 Thread Marek Behún
From: Marek Behún There were several changes for this structure but the documentation was not changed at the time. Fix this. Signed-off-by: Marek Behún --- drivers/pci/pci-aardvark.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/pci/pci

[PATCH u-boot-spi v2 9/9] mtd: Remove mtd_erase_callback() entirely

2021-09-25 Thread Marek Behún
From: Marek Behún The original purpose of mtd_erase_callback() in Linux at the time it was imported to U-Boot, was to inform the caller that erasing is done (since it was an asynchronous operation). All supplied callback methods in U-Boot do nothing, but the mtd_erase_callback() function

[PATCH u-boot-marvell 12/12] arm: mvebu: turris_omnia: Move CONFIG_SPL_DRIVERS_MISC to Kconfig

2021-10-09 Thread Marek Behún
From: Marek Behún Instead of declaring CONFIG_SPL_DRIVERS_MISC in board config header, select it in Kconfig. Signed-off-by: Marek Behún --- arch/arm/mach-mvebu/Kconfig| 1 + include/configs/turris_omnia.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach

[PATCH 4/4] Convert CONFIG_USB_EHCI_IS_TDI to Kconfig

2021-10-09 Thread Marek Behún
From: Marek Behún On mvebu this is defined if and only if !ARM64. Otherwise it is defined for boards with ARCH_MX23, ARCH_TEGRA and ARCH_ZYNQ, and also for SOC_AR934X (tplink_wdr4300). Signed-off-by: Marek Behún --- arch/arm/mach-kirkwood/include/mach/config.h | 7 --- arch/mips/mach

[PATCH 1/4] Rename CONFIG_EHCI_IS_TDI to CONFIG_USB_EHCI_IS_TDI

2021-10-09 Thread Marek Behún
From: Marek Behún In preparation for moving this option to Kconfig, rename it to be consistent with other USB EHCI Kconfig options. Signed-off-by: Marek Behún --- arch/arm/mach-kirkwood/include/mach/config.h | 2 +- drivers/usb/host/ehci-hcd.c | 2 +- include/configs

[PATCH 2/4] Convert CONFIG_USB_EHCI_MXS to Kconfig

2021-10-09 Thread Marek Behún
From: Marek Behún This option is only used for mx23evk_defconfig mx23_olinuxino_defconfig which are the only i.MX23 boards. Add depend on ARCH_MX23 and default to y. Signed-off-by: Marek Behún --- drivers/usb/host/Kconfig | 7 +++ include/configs/mxs.h| 1 - scripts

[PATCH 3/4] Drop CONFIG_USB_EHCI_KIRKWOOD

2021-10-09 Thread Marek Behún
From: Marek Behún This config option doesn't do anything. nas220 uses USB_EHCI_MARVELL. Signed-off-by: Marek Behún --- include/configs/nas220.h | 1 - scripts/config_whitelist.txt | 1 - 2 files changed, 2 deletions(-) diff --git a/include/configs/nas220.h b/include/configs/nas220.h

Re: [PATCH 1/2] arm: mvebu: Implement the mac command (Marvell hw_info)

2021-10-09 Thread Marek Behún
> > > > +config MVEBU_MAC_HW_INFO_OFFSET > > > > + hex "Marvell hw_info (mac) SPI flash offset" > > > > + depends on MVEBU_MAC_HW_INFO > > > > + default 0x3E > > > > + help > > > > + This option defines the SPI flash offset of the Marvell > > > > + hw_info area.

[PATCH u-boot-marvell 09/12] arm: mvebu: turris_omnia: Overwrite ethaddr only if invalid

2021-10-09 Thread Marek Behún
From: Marek Behún Currently we always overwrite ethaddrs with those from EEPROM. In order to allow user to use a cloned MAC address in U-Boot, change the code so that it sets ethaddr variables only if they aren't set or are invalid. Signed-off-by: Marek Behún --- board/CZ.NIC/turris_omnia

[PATCH u-boot-marvell 11/12] arm: mvebu: turris_omnia: Move SPL's SYS_MALLOC_SIMPLE to Kconfig

2021-10-09 Thread Marek Behún
From: Marek Behún Instead of declaring CONFIG_SYS_MALLOC_SIMPLE dependant on CONFIG_SPL_BUILD in board config header, select CONFIG_SPL_SYS_MALLOC_SIMPLE in Kconfig. Signed-off-by: Marek Behún --- arch/arm/mach-mvebu/Kconfig| 1 + include/configs/turris_omnia.h | 4 2 files changed

[PATCH u-boot-marvell 06/12] arm: mvebu: turris_mox: Use show_board_info()

2021-10-09 Thread Marek Behún
From: Marek Behún We are printing board information in last_stage_init(), but U-Boot has dedicated function, show_board_info(), for this. Move code which prints board information (board version, serial number, module topology, ...) to show_board_info(). Signed-off-by: Marek Behún --- board

[PATCH u-boot-marvell 08/12] arm: mvebu: turris_mox: Better check for valid ethernet addresses in env

2021-10-09 Thread Marek Behún
From: Marek Behún Currently we overwrite ethaddr and eth1addr only if these variables don't exist. Better overwrite them even if the env variable exists, but is invalid - eth_env_get_enetaddr_by_index() checks for validity. Refactor the code to use a for cycle. Signed-off-by: Marek Behún

[PATCH u-boot-marvell 10/12] arm: mvebu: turris_omnia: Use show_board_info()

2021-10-09 Thread Marek Behún
From: Marek Behún We are printing board information in checkboard() function, which is called from the default weak implementation of show_board_info(). Rename checkboard() to show_board_info(). This throws away the weak implementation of show_board_info(). Signed-off-by: Marek Behún

[PATCH u-boot-marvell 07/12] arm: mvebu: turris_mox: Always handle reset button

2021-10-09 Thread Marek Behún
From: Marek Behún Handle reset button even if we can't configure modules. This happens if we fail retrieving reset GPIO with which we can reset the modules. (Note that this GPIO is different from reset button GPIO.) Signed-off-by: Marek Behún --- board/CZ.NIC/turris_mox/turris_mox.c | 3

[PATCH u-boot-marvell 05/12] arm: mvebu: turris_mox: Cosmetic update for board config header

2021-10-09 Thread Marek Behún
From: Marek Behún Reorder the definitions in Turris MOX' board config header, drop the comment relics from when this file was copied, fix indentation. Signed-off-by: Marek Behún --- include/configs/turris_mox.h | 61 +--- 1 file changed, 22 insertions(+), 39

[PATCH u-boot-marvell 03/12] arm: mvebu: a3720: Create Kconfig option for I2C_MV

2021-10-09 Thread Marek Behún
From: Marek Behún Move the config option CONFIG_I2C_MV to a Kconfig option CONFIG_SYS_I2C_MV and move the default definition from config header files into defconfigs. Signed-off-by: Marek Behún --- configs/mvebu_db-88f3720_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig

[PATCH u-boot-marvell 04/12] arm: kirkwood, mvebu: Remove CONFIG_SYS_RESET_ADDRESS option

2021-10-09 Thread Marek Behún
From: Marek Behún This option is not used anywhere. Signed-off-by: Marek Behún --- include/configs/SBx81LIFKW.h| 5 - include/configs/SBx81LIFXCAT.h | 5 - include/configs/edminiv2.h | 6 -- include/configs/mv-common.h | 1 - include/configs

[PATCH u-boot-marvell 00/12] Small Turris MOX and Omnia changes

2021-10-09 Thread Marek Behún
From: Marek Behún Hi Stefan, these are some small changes for Turris Omnia and MOX, mainly moving options from board config header to Kconfig, but also some other. Two patchs are touching other mvebu boards. Marek Marek Behún (12): arm: mvebu: turris_mox: Drop SF_DEFAULT_MODE from

[PATCH u-boot-marvell 02/12] arm: mvebu: turris_mox: Move options to defconfig

2021-10-09 Thread Marek Behún
From: Marek Behún Move config options CONFIG_LAST_STAGE_INIT and CONFIG_DISPLAY_BOARDINFO_LATE to turris_mox_defconfig. Signed-off-by: Marek Behún --- configs/turris_mox_defconfig | 2 ++ include/configs/turris_mox.h | 7 --- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git

[PATCH u-boot-marvell 01/12] arm: mvebu: turris_mox: Drop SF_DEFAULT_MODE from defconfig

2021-10-09 Thread Marek Behún
From: Marek Behún This config option defaults to 0, so it is redundant in defconfig. Signed-off-by: Marek Behún --- configs/turris_mox_defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig index 82ad68b6a1..6ff551e477 100644

[PATCH v2 13/13] env: Move non-cmd specific env functions to env/common.c

2021-10-13 Thread Marek Behún
From: Marek Behún Move the following functions from cmd/nvedit.c to env/common.c: env_set_ulong() env_set_hex() env_get_hex() eth_env_get_enetaddr() eth_env_set_enetaddr() env_get() from_env() env_get_f() env_get_ulong() since these functions are not specific for U-Boot's CLI

[PATCH v2 11/13] env: Make return value of env_get_f() behave like sprintf() on success

2021-10-13 Thread Marek Behún
From: Marek Behún Currently the env_get_f() function's return value behaves weirdly: it returns the number of bytes written into `buf`, but whether this is excluding the terminating NULL-byte or including it depends on whether there was enough space in `buf`. Change the function to always

[PATCH v2 10/13] env: Use better name for variable in env_get_f()

2021-10-13 Thread Marek Behún
From: Marek Behún The `nxt` variable actually points to the terminating null-byte of the current env var, and the next env var is at `nxt + 1`, not `nxt`. So a better name for this variable is `end`. Signed-off-by: Marek Behún --- cmd/nvedit.c | 8 1 file changed, 4 insertions(+), 4

[PATCH v2 07/13] env: Inline env_get_char() into it's only user

2021-10-13 Thread Marek Behún
From: Marek Behún This function is a relic from the past when environment was read from underlying device one character at a time. It is used only in the case when getting an environemnt variable prior relocation, and the function is simple enough to be inlined there. Since env_get_char

[PATCH v2 09/13] env: Use string pointer instead of indexes in env_get_f()

2021-10-13 Thread Marek Behún
From: Marek Behún Since we no longer use env_get_char() to access n-th character of linearized environment data, but rather access the arrays themselves, we can convert the iteration to use string pointers instead of position indexes. Signed-off-by: Marek Behún --- cmd/nvedit.c | 34

[PATCH v2 08/13] env: Early return from env_get_f() on NULL name

2021-10-13 Thread Marek Behún
From: Marek Behún Test non-NULL name immediately, not in env_match(). Signed-off-by: Marek Behún --- cmd/nvedit.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 9f0caceadf..7c99a693ea 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c

[PATCH v2 12/13] env: Use memcpy() instead of ad-hoc code to copy variable value

2021-10-13 Thread Marek Behún
From: Marek Behún Copy the value of the found variable into given buffer with memcpy() instead of ad-hoc code. Signed-off-by: Marek Behún --- cmd/nvedit.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 8989c85d20

[PATCH v2 06/13] env: Check for terminating null-byte in env_match()

2021-10-13 Thread Marek Behún
From: Marek Behún There is a possible overflow in env_match(): if environment contains a terminating null-byte before '=' character (i.e. environment is broken), the env_match() function can access data after the terminating null-byte from parameter pointer. Example: if env_get_char() returns

[PATCH v2 04/13] env: Change env_match() to static and remove from header

2021-10-13 Thread Marek Behún
From: Marek Behún This function was used by other parts of U-Boot in the past when environment was read from underlying device one character at a time. This is not the case anymore. Signed-off-by: Marek Behún --- cmd/nvedit.c | 30 +++--- include/env.h | 11

[PATCH v2 02/13] env: Drop env_get_char_spec() and old, unused .get_char() implementations

2021-10-13 Thread Marek Behún
From: Marek Behún Commit b2cdef4861be ("env: restore old env_get_char() behaviour") dropped the .get_char() method from struct env_driver, but left the two existing implementations (eeprom and nvram) in case someone would use them by overwriting weak function env_get_char_spec

[PATCH v2 03/13] examples: api: glue: Remove comment that does not apply anymore

2021-10-13 Thread Marek Behún
From: Marek Behún This comment is not true since commit 6215bd4c1fd6 ("api: Use hashtable function for API_env_enum"). Signed-off-by: Marek Behún --- examples/api/glue.c | 5 - 1 file changed, 5 deletions(-) diff --git a/examples/api/glue.c b/examples/api/glue.c index

[PATCH v2 05/13] env: Don't match empty variable name in env_match()

2021-10-13 Thread Marek Behún
From: Marek Behún Do we really allow zero-length variable name? I guess not. Signed-off-by: Marek Behún --- cmd/nvedit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 742e0924af..e2e8a38b5d 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c

Re: [PATCH 1/2] arm: mvebu: Implement the mac command (Marvell hw_info)

2021-10-13 Thread Marek Behún
On Mon, 11 Oct 2021 18:16:02 +0200 Luka Kovacic wrote: >> eth1_mac_addr: eth1addr { >> compatible = "mac-address-string"; >> name = "eth1addr"; >> }; > > I don't see any better approach than just matching strings to retrieve > values for specific keys (for

Re: [PATCH 05/10] env: Check for terminating null-byte in env_match()

2021-10-13 Thread Marek Behún
On Tue, 12 Oct 2021 13:04:56 +0200 Marek Behún wrote: > - while (*s1 == env_get_char(i2++)) > + while (*s1 != '\0' && *s1 == env_get_char(i2++)) This check has to be done in the other order: while (*s1 == env_get_char(i2++) && *s1 != '\0') so that i2 gets i

[PATCH v2 01/13] env: Fix documentation for env_get_f()

2021-10-13 Thread Marek Behún
From: Marek Behún This function actually returns: - the number of bytes written into @buf excluding the terminating NULL-byte, if there was enough space in @buf - the number of bytes written into @buf including the terminating NULL-byte, if there wasn't enough space in @buf - -1

[PATCH v2 00/13] env_get_char() removal and env_get_f() refactor

2021-10-13 Thread Marek Behún
From: Marek Behún Hi Simon, Tom, env_get_char() is a relic from the past when env was read char-by-char from underlying device. Currently it only accesses in-memory arrays. We can remove it and access the arrays directly. This simplifies the old code of env_get_f(). Changes since v1: - use

[PATCH RFC linux] dt-bindings: nvmem: Add binding for U-Boot environment NVMEM provider

2021-10-13 Thread Marek Behún
should be used by the ethernet controller node. Signed-off-by: Marek Behún --- .../bindings/nvmem/denx,u-boot-env.yaml | 88 +++ include/dt-bindings/nvmem/u-boot-env.h| 18 2 files changed, 106 insertions(+) create mode 100644 Documentation/devicetree/bindings

[PATCH 10/10] env: Move non-cmd specific env functions to env/common.c

2021-10-12 Thread Marek Behún
From: Marek Behún Move the following functions from cmd/nvedit.c to env/common.c: env_set_ulong() env_set_hex() env_get_hex() eth_env_get_enetaddr() eth_env_set_enetaddr() env_get() from_env() env_get_f() env_get_ulong() since these functions are not specific for U-Boot's CLI

[PATCH 05/10] env: Check for terminating null-byte in env_match()

2021-10-12 Thread Marek Behún
From: Marek Behún There is a possible overflow in env_match(): if environment contains a terminating null-byte before '=' character (i.e. environment is broken), the env_match() function can access data after the terminating null-byte from parameter pointer. Example: if env_get_char() returns

[PATCH 09/10] env: Use string pointer instead of indexes in env_get_f()

2021-10-12 Thread Marek Behún
From: Marek Behún Since we no longer use env_get_char() to access n-th character of linearized environment data, but rather access the arrays themselves, we can convert the iteration to use string pointers instead of position indexes. Signed-off-by: Marek Behún --- cmd/nvedit.c | 37

[PATCH 02/10] examples: api: glue: Remove comment that does not apply anymore

2021-10-12 Thread Marek Behún
From: Marek Behún This comment is not true since commit 6215bd4c1fd6 ("api: Use hashtable function for API_env_enum"). Signed-off-by: Marek Behún --- examples/api/glue.c | 5 - 1 file changed, 5 deletions(-) diff --git a/examples/api/glue.c b/examples/api/glue.c index

[PATCH 07/10] env: Early return from env_get_f() on NULL name

2021-10-12 Thread Marek Behún
From: Marek Behún Test non-NULL name immediately, not in env_match(). Signed-off-by: Marek Behún --- cmd/nvedit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 4664b7b872..412918a000 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c

[PATCH 06/10] env: Inline env_get_char() into it's only user

2021-10-12 Thread Marek Behún
From: Marek Behún This function is a relic from the past when environment was read from underlying device one character at a time. It is used only in the case when getting an environemnt variable prior relocation, and the function is simple enough to be inlined there. Since env_get_char

<    4   5   6   7   8   9   10   11   12   13   >