Re: [u-boot PATCH 3/3] k3-am642-evm-u-boot: Use binman to generate u-boot.img and tispl.bin

2022-05-30 Thread Roger Quadros
Hi,

On 27/05/2022 20:50, Alper Nebi Yasak wrote:
> On 26/05/2022 17:15, Tom Rini wrote:
>> On Thu, May 26, 2022 at 10:28:45AM +0300, Roger Quadros wrote:
>>> Any thoughts on how to get the new ti-secure etype work with atf-bl31 and
>>> tee-os etypes so that it can take the data output of those entries and 
>>> create
>>> a signed binary with filenames from those entries or atf-bl31-path and
>>> tee-os-path?
>>>
>>> Can something like this work?
>>>
>>> ti-secure {
>>> atf-bl31 {
>>> filename = "bl31.bin";
>>> };
>>> }
>>>
>>> We could probably get rid of filename property from ti-secure etype and use
>>> blob for regular files.
>>>
>>> ti-secure {
>>> blob {
>>> filename = "somefile.ext";
>>> }
>>> }
> 
> This would definitely work, see etype/mkimage.py for example. I'd prefer
> to know the file-format details (and maybe replicate them in binman) if
> you could afford to publish them, though...

This is a question to Nishanth/Andrew.

> 
> 
> Sorry I couldn't look at either series yet, but I see mentions of
> k3_fit_atf.sh, so let me point out another series [1][2] that might also
> interest you:
> 
> [1] [RESEND, RFC 0/8] Integration of sysfw and tispl with U-Boot
> https://lore.kernel.org/u-boot/20220406122919.6104-1-n-fran...@ti.com/
> 
> [2] [PATCH RFC v2 00/11] Integration of sysfw, tispl and tiboot3
> https://lore.kernel.org/u-boot/20220506043759.8193-1-n-fran...@ti.com/

Thanks for this pointer. I will review those patches and see how we can
consolidate.

cheers,
-roger


Re: [PATCH 3/3] ARM: dts: at91: sam9x60ek: fix eeprom compatible

2022-05-30 Thread Heiko Schocher
Hello Eugen,

On 26.05.22 16:04, Eugen Hristev wrote:
> The memory on this board is microchip 24aa025e48 which is compatible with
> at24c02 with a page size of 16.
> Fix the compatible accordingly.
> 
> Reported-by: Sergiu Moga 
> Signed-off-by: Eugen Hristev 
> Tested-by: Sergiu Moga 
> ---
> Hi,
> 
> I will also send a patch to Linux to fix this

Thanks!

> 
> Eugen
> 
>  arch/arm/dts/sam9x60ek.dts | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Heiko Schocher 

bye,
Heiko
-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


Re: [PATCH 2/3] misc: i2c_eeprom: remove 24aa02e48

2022-05-30 Thread Heiko Schocher
Hello Eugen,

On 26.05.22 16:04, Eugen Hristev wrote:
> This compatible does not exist in the bindings.
> All occurences in DT have been replaced by at24c02 which is equivalent.
> 
> Fixes: 7264066707 ("misc: i2c_eeprom: Add compatible for 24AA02E48")
> Signed-off-by: Eugen Hristev 
> ---
>  drivers/misc/i2c_eeprom.c | 8 
>  1 file changed, 8 deletions(-)

Reviewed-by: Heiko Schocher 

bye,
Heiko
-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


Re: [PATCH 1/3] ARM: dts: at91: replace microchip,24aa02e48 with atmel,at24c02

2022-05-30 Thread Heiko Schocher
Hello Eugen,

On 26.05.22 16:18, eugen.hris...@microchip.com wrote:
> On 5/26/22 5:11 PM, Michael Walle wrote:
> 
> [snip]
> 
>>> @@ -92,7 +92,7 @@
>>>   status = "okay";
>>>
>>>   i2c_eeprom: i2c_eeprom@50 {
>>
>> Nit: that one should actually be just "eeprom@50".
> 
> Hi Michael,
> 
> That's true, but my patch just changes the compatible .
> 
> With time, I want to completely sync the DT with Linux. It will take 
> some effort, but I am gathering the pieces of the puzzle slowly.
> 
> Thanks !

Fine with me.

Reviewed-by: Heiko Schocher 

bye,
Heiko
> 
> Eugen
> 
> 
>>
>> -michael
>>
>>> - compatible = "microchip,24aa02e48";
>>> + compatible = "atmel,24c02"; /* 
>>> EEPROM is 2Kbits microchip
>>> 24aa02e48 */
>>>   reg = <0x50>;
>>>   };
>>>   };
> 

-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de


Re: [PATCH v2 2/2] rockchip: Add option to prevent booting on power plug-in

2022-05-30 Thread Jaehoon Chung
On 5/28/22 03:18, Chris Morgan wrote:
> From: Chris Morgan 
> 
> For Rockchip boards with the all rk8xx series PMICs (excluding the
> rk808), it is sometimes desirable to not boot whenever the device is
> plugged in. An example would be for the Odroid Go Advance.
> 
> This provides a configurable option to check the PMIC says it was
> powered because of a plug-in event. If the value is 1 and this option
> is selected, the device shuts down shortly after printing a message
> to console stating the reason why it's shutting down. Powering up the
> board with the power button is not affected.
> 
> This patch parallels the work done in the following patch series:
> https://lore.kernel.org/u-boot/20220121133732.2397273-1-andre.przyw...@arm.com/
> 
> Signed-off-by: Chris Morgan 

Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
>  arch/arm/mach-rockchip/Kconfig | 10 ++
>  drivers/power/pmic/rk8xx.c | 34 ++
>  include/power/rk8xx_pmic.h |  3 +++
>  3 files changed, 47 insertions(+)
> 
> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> index 18aff5480b..c561a77e6a 100644
> --- a/arch/arm/mach-rockchip/Kconfig
> +++ b/arch/arm/mach-rockchip/Kconfig
> @@ -361,6 +361,16 @@ config ROCKCHIP_BOOT_MODE_REG
> The Soc will enter to different boot mode(defined in 
> asm/arch-rockchip/boot_mode.h)
> according to the value from this register.
>  
> +config ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON
> + bool "Disable device boot on power plug-in"
> + depends on PMIC_RK8XX
> + default n
> + ---help---
> +   Say Y here to prevent the device from booting up because of a plug-in
> +   event. When set, the device will boot briefly to determine why it was
> +   powered on, and if it was determined because of a plug-in event
> +   instead of a button press event it will shut back off.
> +
>  config ROCKCHIP_STIMER
>   bool "Rockchip STIMER support"
>   default y
> diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c
> index 1ffbecc02a..25ef621f8d 100644
> --- a/drivers/power/pmic/rk8xx.c
> +++ b/drivers/power/pmic/rk8xx.c
> @@ -51,6 +51,38 @@ U_BOOT_DRIVER(rk8xx_sysreset) = {
>   .ops= _sysreset_ops,
>  };
>  
> +/* In the event of a plug-in and the appropriate option has been
> + * selected, we simply shutdown instead of continue the normal boot
> + * process. Please note the rk808 is not supported as it doesn't
> + * have the appropriate register.
> + */
> +void rk8xx_off_for_plugin(struct udevice *dev)
> +{
> + struct rk8xx_priv *priv = dev_get_priv(dev);
> +
> + switch (priv->variant) {
> + case RK805_ID:
> + case RK816_ID:
> + case RK818_ID:
> + if (pmic_reg_read(dev, RK8XX_ON_SOURCE) & RK8XX_ON_PLUG_IN) {
> + printf("Power Off due to plug-in event\n");
> + pmic_clrsetbits(dev, REG_DEVCTRL, 0, BIT(0));
> + }
> + break;
> + case RK809_ID:
> + case RK817_ID:
> + if (pmic_reg_read(dev, RK817_ON_SOURCE) & RK8XX_ON_PLUG_IN) {
> + printf("Power Off due to plug-in event\n");
> + pmic_clrsetbits(dev, RK817_REG_SYS_CFG3, 0,
> + BIT(0));
> + }
> + break;
> + default:
> + printf("PMIC RK%x: Cannot read boot reason.\n",
> +priv->variant);
> + }
> +}
> +
>  static struct reg_data rk817_init_reg[] = {
>  /* enable the under-voltage protection,
>   * the under-voltage protection will shutdown the LDO3 and reset the PMIC
> @@ -211,6 +243,8 @@ static int rk8xx_probe(struct udevice *dev)
>  pmic_reg_read(dev, on_source),
>  pmic_reg_read(dev, off_source));
>   printf("\n");
> + if (CONFIG_IS_ENABLED(ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON))
> + rk8xx_off_for_plugin(dev);
>  
>   return 0;
>  }
> diff --git a/include/power/rk8xx_pmic.h b/include/power/rk8xx_pmic.h
> index 8ff0af35c5..3cbfc02195 100644
> --- a/include/power/rk8xx_pmic.h
> +++ b/include/power/rk8xx_pmic.h
> @@ -214,6 +214,9 @@ enum {
>  #define RK817_ON_SOURCE  0xf5
>  #define RK817_OFF_SOURCE 0xf6
>  
> +#define RK8XX_ON_PWRON   BIT(7)
> +#define RK8XX_ON_PLUG_IN BIT(6)
> +
>  struct reg_data {
>   u8 reg;
>   u8 val;



Re: [PATCH v2] board: gateworks: venice: add GW7903 PMIC

2022-05-30 Thread Jaehoon Chung
On 5/28/22 02:22, Tim Harvey wrote:
> The GW7903 has a BD71847 PMIC on I2C1. Adjust the model compare strings
> to add it.
> 
> Signed-off-by: Tim Harvey 
> Reviewed-by: Fabio Estevam 

Reviewed-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

> ---
> v2: fixed typo in commit log and added Fabio's rb tag
> ---
>  board/gateworks/venice/spl.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/board/gateworks/venice/spl.c b/board/gateworks/venice/spl.c
> index 7e3e91e1d9cc..ae460296cb99 100644
> --- a/board/gateworks/venice/spl.c
> +++ b/board/gateworks/venice/spl.c
> @@ -175,11 +175,12 @@ static int power_init_board(void)
>   }
>  
>   else if ((!strncmp(model, "GW7901", 6)) ||
> -  (!strncmp(model, "GW7902", 6))) {
> - if (!strncmp(model, "GW7901", 6))
> - ret = uclass_get_device_by_seq(UCLASS_I2C, 1, );
> - else
> +  (!strncmp(model, "GW7902", 6)) ||
> +  (!strncmp(model, "GW7903", 6))) {
> + if (!strncmp(model, "GW7902", 6))
>   ret = uclass_get_device_by_seq(UCLASS_I2C, 0, );
> + else
> + ret = uclass_get_device_by_seq(UCLASS_I2C, 1, );
>   if (ret) {
>   printf("PMIC: failed I2C2 probe: %d\n", ret);
>   return ret;



[PATCH 07/10] board: sl28: implement additional bootsources

2022-05-30 Thread Michael Walle
The board is able to boot from the following source:
 - user-updateble SPI flash
 - write-protected part of the same SPI flash
 - eMMC
 - SD card

Implement the needed function hooks to support all of these boot
sources.

Signed-off-by: Michael Walle 
---
 board/kontron/sl28/common.c| 22 
 board/kontron/sl28/sl28.c  | 23 
 board/kontron/sl28/sl28.h  | 16 ++
 board/kontron/sl28/spl.c   | 38 +-
 configs/kontron_sl28_defconfig |  5 -
 5 files changed, 102 insertions(+), 2 deletions(-)
 create mode 100644 board/kontron/sl28/sl28.h

diff --git a/board/kontron/sl28/common.c b/board/kontron/sl28/common.c
index 33c6843c3f..331de29bae 100644
--- a/board/kontron/sl28/common.c
+++ b/board/kontron/sl28/common.c
@@ -2,6 +2,9 @@
 
 #include 
 #include 
+#include 
+
+#include "sl28.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -9,3 +12,22 @@ u32 get_lpuart_clk(void)
 {
return gd->bus_clk / CONFIG_SYS_FSL_LPUART_CLK_DIV;
 }
+
+enum boot_source sl28_boot_source(void)
+{
+   u32 rcw_src = in_le32(DCFG_BASE + DCFG_PORSR1) & DCFG_PORSR1_RCW_SRC;
+
+   switch (rcw_src) {
+   case DCFG_PORSR1_RCW_SRC_SDHC1:
+   return BOOT_SOURCE_SDHC;
+   case DCFG_PORSR1_RCW_SRC_SDHC2:
+   return BOOT_SOURCE_MMC;
+   case DCFG_PORSR1_RCW_SRC_I2C:
+   return BOOT_SOURCE_I2C;
+   case DCFG_PORSR1_RCW_SRC_FSPI_NOR:
+   return BOOT_SOURCE_SPI;
+   default:
+   debug("unknown bootsource (%08x)\n", rcw_src);
+   return BOOT_SOURCE_UNKNOWN;
+   }
+}
diff --git a/board/kontron/sl28/sl28.c b/board/kontron/sl28/sl28.c
index 32e9694b77..54719cc01c 100644
--- a/board/kontron/sl28/sl28.c
+++ b/board/kontron/sl28/sl28.c
@@ -24,6 +24,8 @@
 #include 
 #include 
 
+#include "sl28.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
@@ -60,6 +62,27 @@ int board_eth_init(struct bd_info *bis)
return pci_eth_init(bis);
 }
 
+enum env_location env_get_location(enum env_operation op, int prio)
+{
+   enum boot_source src = sl28_boot_source();
+
+   if (prio)
+   return ENVL_UNKNOWN;
+
+   if (!CONFIG_IS_ENABLED(ENV_IS_IN_SPI_FLASH))
+   return ENVL_NOWHERE;
+
+   /* write and erase always operate on the environment */
+   if (op == ENVOP_SAVE || op == ENVOP_ERASE)
+   return ENVL_SPI_FLASH;
+
+   /* failsafe boot will always use the compiled-in default environment */
+   if (src == BOOT_SOURCE_SPI)
+   return ENVL_NOWHERE;
+
+   return ENVL_SPI_FLASH;
+}
+
 static int __sl28cpld_read(uint reg)
 {
struct udevice *dev;
diff --git a/board/kontron/sl28/sl28.h b/board/kontron/sl28/sl28.h
new file mode 100644
index 00..7f0105049c
--- /dev/null
+++ b/board/kontron/sl28/sl28.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef __SL28_H
+#define __SL28_H
+
+enum boot_source {
+   BOOT_SOURCE_UNKNOWN,
+   BOOT_SOURCE_SDHC,
+   BOOT_SOURCE_MMC,
+   BOOT_SOURCE_I2C,
+   BOOT_SOURCE_SPI,
+};
+
+enum boot_source sl28_boot_source(void);
+
+#endif
diff --git a/board/kontron/sl28/spl.c b/board/kontron/sl28/spl.c
index 0e6ad5f37e..b1fefc22b2 100644
--- a/board/kontron/sl28/spl.c
+++ b/board/kontron/sl28/spl.c
@@ -5,6 +5,9 @@
 #include 
 #include 
 #include 
+#include 
+
+#include "sl28.h"
 
 #define DCFG_RCWSR25 0x160
 #define GPINFO_HW_VARIANT_MASK 0xff
@@ -58,7 +61,40 @@ int board_fit_config_name_match(const char *name)
 
 void board_boot_order(u32 *spl_boot_list)
 {
-   spl_boot_list[0] = BOOT_DEVICE_SPI;
+   enum boot_source src = sl28_boot_source();
+
+   switch (src) {
+   case BOOT_SOURCE_SDHC:
+   spl_boot_list[0] = BOOT_DEVICE_MMC2;
+   break;
+   case BOOT_SOURCE_SPI:
+   case BOOT_SOURCE_I2C:
+   spl_boot_list[0] = BOOT_DEVICE_SPI;
+   break;
+   case BOOT_SOURCE_MMC:
+   spl_boot_list[0] = BOOT_DEVICE_MMC1;
+   break;
+   default:
+   panic("unexpected bootsource (%d)\n", src);
+   break;
+   }
+}
+
+unsigned int spl_spi_get_uboot_offs(struct spi_flash *flash)
+{
+   enum boot_source src = sl28_boot_source();
+
+   switch (src) {
+   case BOOT_SOURCE_SPI:
+   return 0x00;
+   case BOOT_SOURCE_I2C:
+   return 0x23;
+   default:
+   panic("unexpected bootsource (%d)\n", src);
+   break;
+   }
+}
+
 }
 
 int board_early_init_f(void)
diff --git a/configs/kontron_sl28_defconfig b/configs/kontron_sl28_defconfig
index dc8c28f8cc..7e5c1fc064 100644
--- a/configs/kontron_sl28_defconfig
+++ b/configs/kontron_sl28_defconfig
@@ -12,6 +12,7 @@ CONFIG_ENV_SECT_SIZE=0x1
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1028a-kontron-sl28"
 CONFIG_SPL_TEXT_BASE=0x1801
 CONFIG_SYS_FSL_SDHC_CLK_DIV=1

[PATCH 10/10] board: sl28: remove COUNTER_FREQUENCY_REAL

2022-05-30 Thread Michael Walle
The frequency of the system counter is static which is given by the
COUNTER_FREQUENCY option. Remove COUNTER_FREQUENCY_REAL.

Signed-off-by: Michael Walle 
---
 include/configs/kontron_sl28.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/configs/kontron_sl28.h b/include/configs/kontron_sl28.h
index 0cc543716a..b7d2edb75b 100644
--- a/include/configs/kontron_sl28.h
+++ b/include/configs/kontron_sl28.h
@@ -39,8 +39,6 @@
 /* serial port */
 #define CONFIG_SYS_NS16550_CLK  (get_bus_freq(0) / 2)
 
-#define COUNTER_FREQUENCY_REAL (get_board_sys_clk() / 4)
-
 /* SPL */
 #define CONFIG_SPL_BSS_START_ADDR  0x8010
 #define CONFIG_SPL_BSS_MAX_SIZE0x0010
-- 
2.30.2



[PATCH 08/10] board: sl28: add user friendly names for the boot sources

2022-05-30 Thread Michael Walle
During startup the SPL will print where the u-boot proper is read from.
Instead of using the default names, provide more user friendly names.

Signed-off-by: Michael Walle 
---
 board/kontron/sl28/spl.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/board/kontron/sl28/spl.c b/board/kontron/sl28/spl.c
index b1fefc22b2..ffaf517a8b 100644
--- a/board/kontron/sl28/spl.c
+++ b/board/kontron/sl28/spl.c
@@ -95,6 +95,22 @@ unsigned int spl_spi_get_uboot_offs(struct spi_flash *flash)
}
 }
 
+const char *spl_board_loader_name(u32 boot_device)
+{
+   enum boot_source src = sl28_boot_source();
+
+   switch (src) {
+   case BOOT_SOURCE_SDHC:
+   return "SD card (Test mode)";
+   case BOOT_SOURCE_SPI:
+   return "Failsafe SPI flash";
+   case BOOT_SOURCE_I2C:
+   return "SPI flash";
+   case BOOT_SOURCE_MMC:
+   return "eMMC";
+   default:
+   return "(unknown)";
+   }
 }
 
 int board_early_init_f(void)
-- 
2.30.2



[PATCH 09/10] board: sl28: support dynamic prompts

2022-05-30 Thread Michael Walle
Depending on the boot source, set different CLI prompts. This will help
the user to figure out in which mode the bootloader was started. There
are two special modes: failsafe and SDHC boot.

Signed-off-by: Michael Walle 
---
 board/kontron/sl28/sl28.c  | 20 
 configs/kontron_sl28_defconfig |  1 +
 2 files changed, 21 insertions(+)

diff --git a/board/kontron/sl28/sl28.c b/board/kontron/sl28/sl28.c
index 54719cc01c..0576b3eae4 100644
--- a/board/kontron/sl28/sl28.c
+++ b/board/kontron/sl28/sl28.c
@@ -126,8 +126,28 @@ static void stop_recovery_watchdog(void)
wdt_stop(dev);
 }
 
+static void sl28_set_prompt(void)
+{
+   enum boot_source src = sl28_boot_source();
+
+   switch (src) {
+   case BOOT_SOURCE_SPI:
+   env_set("PS1", "[FAILSAFE] => ");
+   break;
+   case BOOT_SOURCE_SDHC:
+   env_set("PS1", "[SDHC] => ");
+   break;
+   default:
+   env_set("PS1", NULL);
+   break;
+   }
+}
+
 int fsl_board_late_init(void)
 {
+   if (IS_ENABLED(CONFIG_CMDLINE_PS_SUPPORT))
+   sl28_set_prompt();
+
/*
 * Usually, the after a board reset, the watchdog is enabled by
 * default. This is to supervise the bootloader boot-up. Therefore,
diff --git a/configs/kontron_sl28_defconfig b/configs/kontron_sl28_defconfig
index 7e5c1fc064..3d142d5470 100644
--- a/configs/kontron_sl28_defconfig
+++ b/configs/kontron_sl28_defconfig
@@ -42,6 +42,7 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x900
 CONFIG_SPL_MPC8XXX_INIT_DDR=y
 CONFIG_SPL_SPI_LOAD=y
+CONFIG_CMDLINE_PS_SUPPORT=y
 CONFIG_CMD_ASKENV=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_NVEDIT_EFI=y
-- 
2.30.2



[PATCH 03/10] board: sl28: set CPO value

2022-05-30 Thread Michael Walle
With a 8GiB memory board, it seems that the "very unlikely event" of a
DDR initialization with non-optimal values are not really that unlikely.
It happens in about every other reboot. As described in erratum
A-009942, preset the DEBUG_28 register with an optimal value. The value
iself depends on the memory configuration of the board, but the used
value seems to work well for all variants.

Signed-off-by: Michael Walle 
---
 board/kontron/sl28/ddr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/board/kontron/sl28/ddr.c b/board/kontron/sl28/ddr.c
index 41426996ab..d75b23e54c 100644
--- a/board/kontron/sl28/ddr.c
+++ b/board/kontron/sl28/ddr.c
@@ -54,6 +54,9 @@ static fsl_ddr_cfg_regs_t __maybe_unused ddr_cfg_regs = {
 
.ddr_cdr1   = 0x8004,
.ddr_cdr2   = 0xbc01,
+
+   /* Erratum A-009942, set optimal CPO value */
+   .debug[28]  = 0x00700040,
 };
 
 int fsl_initdram(void)
-- 
2.30.2



[PATCH 06/10] board: sl28: rename include guard macro

2022-05-30 Thread Michael Walle
Avoid name clashes with an include file on board level.

Signed-off-by: Michael Walle 
---
 include/configs/kontron_sl28.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/configs/kontron_sl28.h b/include/configs/kontron_sl28.h
index c47b5940fb..0cc543716a 100644
--- a/include/configs/kontron_sl28.h
+++ b/include/configs/kontron_sl28.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 
-#ifndef __SL28_H
-#define __SL28_H
+#ifndef __SL28_CONFIG_H
+#define __SL28_CONFIG_H
 
 #include 
 #include 
@@ -87,4 +87,4 @@
ENV_MEM_LAYOUT_SETTINGS \
BOOTENV
 
-#endif /* __SL28_H */
+#endif /* __SL28_CONFIG_H */
-- 
2.30.2



[PATCH 05/10] board: sl28: support 8 GiB memory

2022-05-30 Thread Michael Walle
The board supports up to 8 GiB memory. The memory is soldered on the
board but the configuration is equivalent to a dual chip select, dual
rank DIMM module.

Signed-off-by: Michael Walle 
---
 board/kontron/sl28/ddr.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/board/kontron/sl28/ddr.c b/board/kontron/sl28/ddr.c
index ed799c6e34..315d9f99c7 100644
--- a/board/kontron/sl28/ddr.c
+++ b/board/kontron/sl28/ddr.c
@@ -73,6 +73,13 @@ int fsl_initdram(void)
case GPPORCR1_MEM_4GB_CS0_1:
dram_size = 0x1ULL;
break;
+   case GPPORCR1_MEM_8GB_CS0_1:
+   dram_size = 0x2ULL;
+   ddr_cfg_regs.cs[0].bnds = 0x00ff;
+   ddr_cfg_regs.cs[0].config = 0x80044403;
+   ddr_cfg_regs.cs[1].bnds = 0x010001ff;
+   ddr_cfg_regs.cs[1].config = 0x80044403;
+   break;
case GPPORCR1_MEM_512MB_CS0:
dram_size = 0x2000;
fallthrough; /* for now */
@@ -82,7 +89,6 @@ int fsl_initdram(void)
case GPPORCR1_MEM_4GB_CS0_2:
dram_size = 0x1ULL;
fallthrough; /* for now */
-   case GPPORCR1_MEM_8GB_CS0_1:
case GPPORCR1_MEM_8GB_CS0_1_2_3:
dram_size = 0x2ULL;
fallthrough; /* for now */
-- 
2.30.2



[PATCH 04/10] board: sl28: remove unneeded ddr config parameter

2022-05-30 Thread Michael Walle
config_2 doesn't need to be set to zero because that is already the
default value.

Signed-off-by: Michael Walle 
---
 board/kontron/sl28/ddr.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/board/kontron/sl28/ddr.c b/board/kontron/sl28/ddr.c
index d75b23e54c..ed799c6e34 100644
--- a/board/kontron/sl28/ddr.c
+++ b/board/kontron/sl28/ddr.c
@@ -69,7 +69,6 @@ int fsl_initdram(void)
dram_size = 0x8000;
ddr_cfg_regs.cs[1].bnds = 0;
ddr_cfg_regs.cs[1].config = 0;
-   ddr_cfg_regs.cs[1].config_2 = 0;
break;
case GPPORCR1_MEM_4GB_CS0_1:
dram_size = 0x1ULL;
-- 
2.30.2



[PATCH 02/10] armv8: layerscape: spl: mark OCRAM as non-secure

2022-05-30 Thread Michael Walle
By default the OCRAM is marked as secure. While the SPL runs in EL3 and
thus can access it, DMA devices cannot. Mark the whole OCRAM as
non-secure.
This will fix MMC and SD card boot on LS1028A when using SPL instead of
TF-A.

Signed-off-by: Michael Walle 
---
 arch/arm/cpu/armv8/fsl-layerscape/spl.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/spl.c 
b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
index 5f09ef0a4a..f57ab85dab 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/spl.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
@@ -67,11 +67,22 @@ void spl_board_init(void)
 #endif
 }
 
+void tzpc_init(void)
+{
+   /*
+* Mark the whole OCRAM as non-secure, otherwise DMA devices cannot
+* access it. This is for example necessary for MMC boot.
+*/
+   out_le32(TZPCR0SIZE_BASE, 0);
+}
+
 void board_init_f(ulong dummy)
 {
int ret;
 
icache_enable();
+   tzpc_init();
+
/* Clear global data */
memset((void *)gd, 0, sizeof(gd_t));
if (IS_ENABLED(CONFIG_DEBUG_UART))
-- 
2.30.2



[PATCH 01/10] armv8: layerscape: add missing RCW source defines

2022-05-30 Thread Michael Walle
A board might need to get the source of the RCW word, which is also the
boot source in most cases.

These defines are taken from the LS1028A and I expect they are the same
across the SoCs with the same chassis, after all, there was already a
reset source for NOR flash.

Signed-off-by: Michael Walle 
---
 arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h 
b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
index 863618a5f3..304cd7980a 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
@@ -230,6 +230,10 @@
 #define DCFG_BASE  0x01e0
 #define DCFG_PORSR10x000
 #define DCFG_PORSR1_RCW_SRC0xff80
+#define DCFG_PORSR1_RCW_SRC_SDHC1  0x0400
+#define DCFG_PORSR1_RCW_SRC_SDHC2  0x0480
+#define DCFG_PORSR1_RCW_SRC_I2C0x0500
+#define DCFG_PORSR1_RCW_SRC_FSPI_NOR   0x0780
 #define DCFG_PORSR1_RCW_SRC_NOR0x12f0
 #define DCFG_RCWSR12   0x12c
 #define DCFG_RCWSR12_SDHC_SHIFT24
-- 
2.30.2



[PATCH 00/10] board: sl28: various updates

2022-05-30 Thread Michael Walle
This is an update for the sl28 board which adds support for
 - 8 GiB memory variant
 - different boot sources, like eMMC, SD-card
 - dynamic prompts
 - various cleanups

Michael Walle (10):
  armv8: layerscape: add missing RCW source defines
  armv8: layerscape: spl: mark OCRAM as non-secure
  board: sl28: set CPO value
  board: sl28: remove unneeded ddr config parameter
  board: sl28: support 8 GiB memory
  board: sl28: rename include guard macro
  board: sl28: implement additional bootsources
  board: sl28: add user friendly names for the boot sources
  board: sl28: support dynamic prompts
  board: sl28: remove COUNTER_FREQUENCY_REAL

 arch/arm/cpu/armv8/fsl-layerscape/spl.c   | 11 
 .../asm/arch-fsl-layerscape/immap_lsch3.h |  4 ++
 board/kontron/sl28/common.c   | 22 
 board/kontron/sl28/ddr.c  | 12 -
 board/kontron/sl28/sl28.c | 43 +++
 board/kontron/sl28/sl28.h | 16 ++
 board/kontron/sl28/spl.c  | 54 ++-
 configs/kontron_sl28_defconfig|  6 ++-
 include/configs/kontron_sl28.h|  8 ++-
 9 files changed, 167 insertions(+), 9 deletions(-)
 create mode 100644 board/kontron/sl28/sl28.h

-- 
2.30.2



[PATCH v3 0/2] usb: dwc3: add a SPL_USB_DWC3_GENERIC option for the dwc3 driver

2022-05-30 Thread Angus Ainslie
Changes since v2:

Add a second patch to deal with CI failures due to the new options.

Changes since v1:

Updated Kconfig depends

Angus Ainslie (2):
  usb: dwc3: add a SPL_USB_DWC3_GENERIC option for the dwc3 driver
  configs: get rid of build warnings due to SPL_USB_DWC3_GENERIC

 configs/am43xx_evm_defconfig  | 2 ++
 configs/am43xx_evm_usbhost_boot_defconfig | 2 ++
 configs/am43xx_hs_evm_defconfig   | 2 ++
 configs/am57xx_hs_evm_usb_defconfig   | 2 ++
 configs/am65x_evm_a53_defconfig   | 2 ++
 configs/am65x_evm_r5_usbdfu_defconfig | 2 ++
 configs/dra7xx_evm_defconfig  | 2 ++
 configs/dra7xx_hs_evm_defconfig   | 2 ++
 configs/dra7xx_hs_evm_usb_defconfig   | 2 ++
 drivers/usb/dwc3/Kconfig  | 7 +++
 drivers/usb/dwc3/Makefile | 2 +-
 11 files changed, 26 insertions(+), 1 deletion(-)

-- 
2.34.1



[PATCH v3 2/2] configs: get rid of build warnings due to SPL_USB_DWC3_GENERIC

2022-05-30 Thread Angus Ainslie
Adding the SPL_USB_DWC3_GENERIC symbol broke some ti builds. This
should fix the builds but untested on HW.

Signed-off-by: Angus Ainslie 
---
 configs/am43xx_evm_defconfig  | 2 ++
 configs/am43xx_evm_usbhost_boot_defconfig | 2 ++
 configs/am43xx_hs_evm_defconfig   | 2 ++
 configs/am57xx_hs_evm_usb_defconfig   | 2 ++
 configs/am65x_evm_a53_defconfig   | 2 ++
 configs/am65x_evm_r5_usbdfu_defconfig | 2 ++
 configs/dra7xx_evm_defconfig  | 2 ++
 configs/dra7xx_hs_evm_defconfig   | 2 ++
 configs/dra7xx_hs_evm_usb_defconfig   | 2 ++
 9 files changed, 18 insertions(+)

diff --git a/configs/am43xx_evm_defconfig b/configs/am43xx_evm_defconfig
index 7a736b6fe1..13a305a53c 100644
--- a/configs/am43xx_evm_defconfig
+++ b/configs/am43xx_evm_defconfig
@@ -59,6 +59,7 @@ CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
 CONFIG_MISC=y
+CONFIG_SPL_MISC=y
 CONFIG_SYS_I2C_EEPROM_ADDR=0x50
 CONFIG_MMC_OMAP_HS=y
 CONFIG_MTD=y
@@ -93,6 +94,7 @@ CONFIG_USB_XHCI_OMAP=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_OMAP=y
 CONFIG_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_GENERIC=y
 CONFIG_USB_DWC3_PHY_OMAP=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
diff --git a/configs/am43xx_evm_usbhost_boot_defconfig 
b/configs/am43xx_evm_usbhost_boot_defconfig
index e844106243..b1f17c6a9e 100644
--- a/configs/am43xx_evm_usbhost_boot_defconfig
+++ b/configs/am43xx_evm_usbhost_boot_defconfig
@@ -8,6 +8,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="am437x-gp-evm"
 CONFIG_AM43XX=y
 CONFIG_SPL=y
+CONFIG_SPL_MISC=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SPL_LOAD_FIT=y
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
@@ -94,6 +95,7 @@ CONFIG_USB_XHCI_OMAP=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_OMAP=y
 CONFIG_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_GENERIC=y
 CONFIG_USB_DWC3_PHY_OMAP=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
diff --git a/configs/am43xx_hs_evm_defconfig b/configs/am43xx_hs_evm_defconfig
index d436b41a0c..206e5cf7bc 100644
--- a/configs/am43xx_hs_evm_defconfig
+++ b/configs/am43xx_hs_evm_defconfig
@@ -15,6 +15,7 @@ CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE=0x0200
 CONFIG_TI_SECURE_EMIF_PROTECTED_REGION_SIZE=0x01c0
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL=y
+CONFIG_SPL_MISC=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT_IMAGE_POST_PROCESS=y
 CONFIG_SPL_LOAD_FIT=y
@@ -97,6 +98,7 @@ CONFIG_USB_XHCI_OMAP=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_OMAP=y
 CONFIG_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_GENERIC=y
 CONFIG_USB_DWC3_PHY_OMAP=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
diff --git a/configs/am57xx_hs_evm_usb_defconfig 
b/configs/am57xx_hs_evm_usb_defconfig
index 194103a7e6..9cfc31cb9f 100644
--- a/configs/am57xx_hs_evm_usb_defconfig
+++ b/configs/am57xx_hs_evm_usb_defconfig
@@ -14,6 +14,7 @@ CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE=0x0200
 CONFIG_TI_SECURE_EMIF_PROTECTED_REGION_SIZE=0x01c0
 CONFIG_TARGET_AM57XX_EVM=y
 CONFIG_SPL=y
+CONFIG_SPL_MISC=y
 CONFIG_ENV_OFFSET_REDUND=0x28
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI=y
@@ -114,6 +115,7 @@ CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_XHCI_OMAP=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_GENERIC=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0451
diff --git a/configs/am65x_evm_a53_defconfig b/configs/am65x_evm_a53_defconfig
index 9f41b397c3..8cf24dd25f 100644
--- a/configs/am65x_evm_a53_defconfig
+++ b/configs/am65x_evm_a53_defconfig
@@ -12,6 +12,7 @@ CONFIG_ENV_SIZE=0x2
 CONFIG_ENV_OFFSET=0x68
 CONFIG_DM_GPIO=y
 CONFIG_SPL_DM_SPI=y
+CONFIG_SPL_MISC=y
 CONFIG_DEFAULT_DEVICE_TREE="k3-am654-base-board"
 CONFIG_SPL_TEXT_BASE=0x8008
 CONFIG_SPL_MMC=y
@@ -163,6 +164,7 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_GENERIC=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
diff --git a/configs/am65x_evm_r5_usbdfu_defconfig 
b/configs/am65x_evm_r5_usbdfu_defconfig
index 57cd0f35a5..0430a94a7c 100644
--- a/configs/am65x_evm_r5_usbdfu_defconfig
+++ b/configs/am65x_evm_r5_usbdfu_defconfig
@@ -3,6 +3,7 @@ CONFIG_ARCH_K3=y
 CONFIG_SYS_MALLOC_LEN=0x200
 CONFIG_SYS_MALLOC_F_LEN=0x55000
 CONFIG_SPL_GPIO=y
+CONFIG_SPL_MISC=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=2
@@ -111,6 +112,7 @@ CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_GENERIC=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index e972d3b117..f118c172fe 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -10,6 +10,7 @@ CONFIG_SPL_TEXT_BASE=0x4030
 CONFIG_OMAP54XX=y
 CONFIG_TARGET_DRA7XX_EVM=y
 CONFIG_SPL=y

[PATCH v3 1/2] usb: dwc3: add a SPL_USB_DWC3_GENERIC option for the dwc3 driver

2022-05-30 Thread Angus Ainslie
Suppress warnings when building the SPL without USB_DWC3_GENERIC

Signed-off-by: Angus Ainslie 
---
 drivers/usb/dwc3/Kconfig  | 7 +++
 drivers/usb/dwc3/Makefile | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index 62aa65bf0c..f010291d02 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -30,6 +30,13 @@ config USB_DWC3_GENERIC
  Select this for Xilinx ZynqMP and similar Platforms.
  This wrapper supports Host and Peripheral operation modes.
 
+config SPL_USB_DWC3_GENERIC
+   bool "Generic implementation of a DWC3 wrapper (aka dwc3 glue) for the 
SPL"
+   depends on SPL_DM_USB && USB_DWC3 && SPL_MISC
+   help
+ Select this for Xilinx ZynqMP and similar Platforms.
+ This wrapper supports Host and Peripheral operation modes.
+
 config USB_DWC3_MESON_G12A
bool "Amlogic Meson G12A USB wrapper"
depends on DM_USB && USB_DWC3 && ARCH_MESON
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index 0dd1ba87cd..97b4f7191c 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -9,7 +9,7 @@ obj-$(CONFIG_USB_DWC3_GADGET)   += gadget.o ep0.o
 obj-$(CONFIG_USB_DWC3_OMAP)+= dwc3-omap.o
 obj-$(CONFIG_USB_DWC3_MESON_G12A)  += dwc3-meson-g12a.o
 obj-$(CONFIG_USB_DWC3_MESON_GXL)   += dwc3-meson-gxl.o
-obj-$(CONFIG_USB_DWC3_GENERIC) += dwc3-generic.o
+obj-$(CONFIG_$(SPL_)USB_DWC3_GENERIC)  += dwc3-generic.o
 obj-$(CONFIG_USB_DWC3_UNIPHIER)+= dwc3-uniphier.o
 obj-$(CONFIG_USB_DWC3_LAYERSCAPE)  += dwc3-layerscape.o
 obj-$(CONFIG_USB_DWC3_PHY_OMAP)+= ti_usb_phy.o
-- 
2.34.1



Re: [PATCH] ubifs: Fix lockup/crash when reading files

2022-05-30 Thread Tom Rini
On Mon, May 30, 2022 at 08:11:26AM +0200, Stefan Roese wrote:
> Added Tom to Cc...
> 
> On 23.05.22 11:25, Pali Rohár wrote:
> > On Thursday 19 May 2022 10:04:31 Pali Rohár wrote:
> > > On Thursday 19 May 2022 07:01:19 Stefan Roese wrote:
> > > > On 17.05.22 22:45, Pali Rohár wrote:
> > > > > Commit b1a14f8a1c2e ("UBIFS: Change ubifsload to not read beyond the
> > > > > requested size") added optimization to do not read more bytes than it 
> > > > > is
> > > > > really needed. But this commit introduced incorrect handling of the 
> > > > > hole at
> > > > > the end of file. This logic cause U-Boot to crash or lockup when 
> > > > > trying to
> > > > > read from the ubifs filesystem.
> > > > > 
> > > > > When read_block() call returns -ENOENT error (not an error, but the 
> > > > > hole)
> > > > > then dn-> structure is not filled and contain garbage. So using of 
> > > > > dn->size
> > > > > for memcpy() argument cause that U-Boot tries to copy unspecified 
> > > > > amount of
> > > > > bytes from possible unmapped memory. Which randomly cause lockup of 
> > > > > P2020
> > > > > CPU.
> > > > > 
> > > > > Fix this issue by copying UBIFS_BLOCK_SIZE bytes from read buffer when
> > > > > dn->size is not available. UBIFS_BLOCK_SIZE is the size of the buffer
> > > > > itself and read_block() fills buffer by zeros when it returns -ENOENT.
> > > > > 
> > > > > This patch fixes ubifsload on P2020.
> > > > > 
> > > > > Fixes: b1a14f8a1c2e ("UBIFS: Change ubifsload to not read beyond the 
> > > > > requested size")
> > > > > Signed-off-by: Pali Rohár 
> > > > 
> > > > Reviewed-by: Stefan Roese 
> > 
> > Anyway, who is maintainer of fs / ubifs code and can take this bugfix patch?
> 
> Tom, could you please pick this patch up? I've seen that you've already
> assigned it to yourself in patchwork:
> 
> http://patchwork.ozlabs.org/project/uboot/patch/20220517204528.7277-1-p...@kernel.org/

I've put it in my queue, thanks.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PULL] u-boot-riscv/master

2022-05-30 Thread Tom Rini
On Sat, May 28, 2022 at 09:02:09AM +, Leo Liang wrote:
> On Fri, May 27, 2022 at 09:30:49AM -0400, Tom Rini wrote:
> > On Fri, May 27, 2022 at 02:36:29AM +, Leo Liang wrote:
> > 
> > > Hi Tom, 
> > > 
> > > The following changes since commit 
> > > 7e0edcadb09d55d5319fdc862041fd1b874476f5:
> > > 
> > >   Merge branch 'master' of 
> > > https://source.denx.de/u-boot/custodians/u-boot-sunxi (2022-05-24 
> > > 23:29:00 -0400)
> > > 
> > > are available in the Git repository at:
> > > 
> > >   https://source.denx.de/u-boot/custodians/u-boot-riscv.git
> > > 
> > > for you to fetch changes up to c544b281cd3e549a4fcbf4ba9a05a5d72c9557dd:
> > > 
> > >   riscv: qemu: Set kernel_comp_addr_r for compressed kernel (2022-05-26 
> > > 18:42:34 +0800)
> > > 
> > > CI result shows no issue: 
> > > https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/12131
> > 
> > First, I've applied this to u-boot/master now.  Second, will
> > https://patchwork.ozlabs.org/project/uboot/patch/ph7pr14mb5594fd11d1be74284f554bebce...@ph7pr14mb5594.namprd14.prod.outlook.com/
> > be coming soon?  Thanks!
> 
> Hi Tom, 
> 
> This patch you mentioned will not pass CI, and the reason for that 
> is the toolchain used for RISC-V in CI does not have corresponding 
> settings for zifencei and zicsr.
> (detailed disscussion: 
> https://patchwork.ozlabs.org/project/uboot/patch/20220128134713.2322800-1-alexandre.gh...@canonical.com/)
> (CI result: 
> https://source.denx.de/u-boot/custodians/u-boot-riscv/-/jobs/440735)
> 
> The patch looks valid, but will fail CI on 32-bit configs.
> If we use 32-bit toolchain to test 32-bit configs, then 
> problems solved.
> 
> Do you have any comments?

I guess I'm OK with saying we should use a 32bit toolchain for 32bit
riscv, if  that's how things should be handled moving forward for
everyone else.

-- 
Tom


signature.asc
Description: PGP signature


Re: Serial Download Boot on i.MX8MN EVK Board

2022-05-30 Thread Fabio Estevam
Hi Thomas,

On Mon, May 30, 2022 at 9:50 AM Thomas Schaefer
 wrote:

> But anyway, the patch above is the missing piece, now the DDR3L EVK boots 
> fine over USB.

Ok, great.

> >I am using the NXP lf_v2.4 branch instead.
>
> We are using NXP imx_5.4.47_2.2.0 branch because it is documented this way in 
> the board docs. Is there a reason why you prefer lf_v2.4 ?

Yes, lf_v2.4 allows passing the IMX_BOOT_UART_BASE as a build parameter.

Passing IMX_BOOT_UART_BASE is not needed for imx8mn-evk, but other
boards need to specify it so that a different UART port can be used
by TF-A.

Regards,

Fabio Estevam


AW: Serial Download Boot on i.MX8MN EVK Board

2022-05-30 Thread Thomas Schaefer
Hi Fabio,

>Hi Thomas,

>On Mon, May 30, 2022 at 9:01 AM Thomas Schaefer  
>wrote:
>>
>> Hi all,
>>
>> We are trying to boot our i.MX8MNano UltraLite DDR3L EVK via USB using 
>> Serial Download Mode. We are using u-boot v2022.04-rc3 with patches to 
>> support DDR3L memory on this eval system.
>
>Do you mean 2022.04-rc3 or 2022.07-rc3?

Actually I'm working on v2022.04-rc3 right now. We are waiting for Heiko's 
patch series for i.MX8MN DDR3L EVK support 
(https://patchwork.ozlabs.org/project/uboot/patch/20220415183558.149447-1-heiko.thi...@gmail.com/)
 to be merged into mainline.

>
>2022.07-rc3 has the following commit that allows booting imx8mn evk
>ddr4/lpdd4 via USB download mode:
>https://source.denx.de/u-boot/u-boot/-/commit/d175982c207bb2ace592d7985cd3f05ab99759d9
>

But anyway, the patch above is the missing piece, now the DDR3L EVK boots fine 
over USB.

>> ATF firmware used is built using imx_5.4.47_2.2.0 branch of imx-atf firmware.
>
>I am using the NXP lf_v2.4 branch instead.

We are using NXP imx_5.4.47_2.2.0 branch because it is documented this way in 
the board docs. Is there a reason why you prefer lf_v2.4 ?

>
>> In addition we are using ddr3_[di]mem_1d_201810.bin DDR training images from 
>> firmware-imx-8.10 package.
>>
>> When copying the resulting flash.bin image on SD card or eMMC, the board is 
>> booting fine to linux prompt. But when trying to boot that same image via 
>> USB when the board is in Serial Download Mode, the board hangs up when ATF 
>> firmware (bl31.bin) has finished (I have added some debug prints to BL31 to 
>> verify this).
>>
>> Are the DDR4/LPDDR4 variants of the i.MX8MNano eval kit known to boot in 
>> serial download mode?
>
>Yes, I confirm these variants boot fine via "uuu flash.bin".
>
>Regards,
>
>Fabio Estevam

Thanks a lot for your help,
Thomas


Re: Serial Download Boot on i.MX8MN EVK Board

2022-05-30 Thread Fabio Estevam
Hi Thomas,

On Mon, May 30, 2022 at 9:01 AM Thomas Schaefer
 wrote:
>
> Hi all,
>
> We are trying to boot our i.MX8MNano UltraLite DDR3L EVK via USB using Serial 
> Download Mode. We are using u-boot v2022.04-rc3 with patches to support DDR3L 
> memory on this eval system.

Do you mean 2022.04-rc3 or 2022.07-rc3?

2022.07-rc3 has the following commit that allows booting imx8mn evk
ddr4/lpdd4 via USB download mode:
https://source.denx.de/u-boot/u-boot/-/commit/d175982c207bb2ace592d7985cd3f05ab99759d9

> ATF firmware used is built using imx_5.4.47_2.2.0 branch of imx-atf firmware.

I am using the NXP lf_v2.4 branch instead.

> In addition we are using ddr3_[di]mem_1d_201810.bin DDR training images from 
> firmware-imx-8.10 package.
>
> When copying the resulting flash.bin image on SD card or eMMC, the board is 
> booting fine to linux prompt. But when trying to boot that same image via USB 
> when the board is in Serial Download Mode, the board hangs up when ATF 
> firmware (bl31.bin) has finished (I have added some debug prints to BL31 to 
> verify this).
>
> Are the DDR4/LPDDR4 variants of the i.MX8MNano eval kit known to boot in 
> serial download mode?

Yes, I confirm these variants boot fine via "uuu flash.bin".

Regards,

Fabio Estevam


Serial Download Boot on i.MX8MN EVK Board

2022-05-30 Thread Thomas Schaefer
Hi all,

We are trying to boot our i.MX8MNano UltraLite DDR3L EVK via USB using Serial 
Download Mode. We are using u-boot v2022.04-rc3 with patches to support DDR3L 
memory on this eval system.

ATF firmware used is built using imx_5.4.47_2.2.0 branch of imx-atf firmware.
In addition we are using ddr3_[di]mem_1d_201810.bin DDR training images from 
firmware-imx-8.10 package.

When copying the resulting flash.bin image on SD card or eMMC, the board is 
booting fine to linux prompt. But when trying to boot that same image via USB 
when the board is in Serial Download Mode, the board hangs up when ATF firmware 
(bl31.bin) has finished (I have added some debug prints to BL31 to verify this).

Are the DDR4/LPDDR4 variants of the i.MX8MNano eval kit known to boot in serial 
download mode?

Best regards,
Thomas

Thomas Schäfer
SW Design Engineer

Kontron Europe GmbH
Heinrich-Barth-Straße 1-1a | 66115 Saarbrücken | Germany
thomas.schae...@kontron.com



[PATCH] xilinx: fru: Replace spaces with \0 in detected revision

2022-05-30 Thread Michal Simek
Also fix board revision field where spaces are used instead of \0.
The same change was done for board name by commit 530560b6f8eb ("xilinx:
fru: Replace spaces with \0 in detected name").

Signed-off-by: Michal Simek 
---

 board/xilinx/common/board.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 5be3090c3186..629a6ee036ff 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -245,6 +245,10 @@ static int xilinx_read_eeprom_fru(struct udevice *dev, 
char *name,
}
strncpy(desc->revision, (char *)fru_data.brd.rev,
sizeof(desc->revision));
+   for (i = 0; i < sizeof(desc->revision); i++) {
+   if (desc->revision[i] == ' ')
+   desc->revision[i] = '\0';
+   }
strncpy(desc->serial, (char *)fru_data.brd.serial_number,
sizeof(desc->serial));
 
-- 
2.36.0



[PATCH v3 04/13] linker_lists: Rename sections to remove . prefix

2022-05-30 Thread Andrew Scull
Rename the sections used to implement linker lists so they begin with
'__u_boot_list' rather than '.u_boot_list'. The double underscore at the
start is still distinct from the single underscore used by the symbol
names.

Having a '.' in the section names conflicts with clang's ASAN
instrumentation which tries to add redzones between the linker list
elements, causing expected accesses to fail. However, clang doesn't try
to add redzones to user sections, which are names with all alphanumeric
and underscore characters.

Signed-off-by: Andrew Scull 
Reviewed-by: Simon Glass 
---
 arch/arc/cpu/u-boot.lds   |  4 ++--
 arch/arm/config.mk|  4 ++--
 arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds   |  4 ++--
 arch/arm/cpu/armv7/sunxi/u-boot-spl.lds   |  4 ++--
 arch/arm/cpu/armv8/u-boot-spl.lds |  4 ++--
 arch/arm/cpu/armv8/u-boot.lds |  4 ++--
 arch/arm/cpu/u-boot-spl.lds   |  4 ++--
 arch/arm/cpu/u-boot.lds   |  6 ++---
 arch/arm/mach-at91/arm926ejs/u-boot-spl.lds   |  2 +-
 arch/arm/mach-at91/armv7/u-boot-spl.lds   |  2 +-
 arch/arm/mach-omap2/u-boot-spl.lds|  4 ++--
 arch/arm/mach-orion5x/u-boot-spl.lds  |  4 ++--
 arch/arm/mach-rockchip/u-boot-tpl-v8.lds  |  4 ++--
 arch/arm/mach-zynq/u-boot-spl.lds |  4 ++--
 arch/arm/mach-zynq/u-boot.lds |  4 ++--
 arch/m68k/cpu/u-boot.lds  |  4 ++--
 arch/microblaze/cpu/u-boot-spl.lds|  4 ++--
 arch/microblaze/cpu/u-boot.lds|  4 ++--
 arch/mips/config.mk   |  2 +-
 arch/mips/cpu/u-boot-spl.lds  |  4 ++--
 arch/mips/cpu/u-boot.lds  |  4 ++--
 arch/nios2/cpu/u-boot.lds |  4 ++--
 arch/powerpc/cpu/mpc83xx/u-boot.lds   |  4 ++--
 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds   |  4 ++--
 arch/powerpc/cpu/mpc85xx/u-boot.lds   |  4 ++--
 arch/riscv/cpu/u-boot-spl.lds |  4 ++--
 arch/riscv/cpu/u-boot.lds |  4 ++--
 arch/sandbox/config.mk|  4 ++--
 arch/sandbox/cpu/u-boot-spl.lds   |  4 ++--
 arch/sandbox/cpu/u-boot.lds   |  4 ++--
 arch/sh/cpu/u-boot.lds|  4 ++--
 arch/x86/cpu/u-boot-64.lds|  6 ++---
 arch/x86/cpu/u-boot-spl.lds   |  6 ++---
 arch/x86/cpu/u-boot.lds   |  6 ++---
 arch/x86/lib/elf_ia32_efi.lds |  4 ++--
 arch/x86/lib/elf_x86_64_efi.lds   |  4 ++--
 arch/xtensa/cpu/u-boot.lds|  4 ++--
 arch/xtensa/include/asm/ldscript.h| 13 +++
 board/compulab/cm_t335/u-boot.lds |  4 ++--
 board/cssi/MCR3000/u-boot.lds |  4 ++--
 .../davinci/da8xxevm/u-boot-spl-da850evm.lds  |  2 +-
 board/qualcomm/dragonboard820c/u-boot.lds |  4 ++--
 board/samsung/common/exynos-uboot-spl.lds |  4 ++--
 board/synopsys/iot_devkit/u-boot.lds  |  4 ++--
 board/ti/am335x/u-boot.lds|  4 ++--
 board/vscom/baltos/u-boot.lds |  4 ++--
 doc/api/linker_lists.rst  | 22 +--
 doc/develop/commands.rst  |  4 ++--
 doc/develop/driver-model/of-plat.rst  |  4 ++--
 include/linker_lists.h| 18 +++
 tools/mips-relocs.c   |  9 
 51 files changed, 128 insertions(+), 122 deletions(-)

diff --git a/arch/arc/cpu/u-boot.lds b/arch/arc/cpu/u-boot.lds
index e12145c768..9f2973da65 100644
--- a/arch/arc/cpu/u-boot.lds
+++ b/arch/arc/cpu/u-boot.lds
@@ -39,8 +39,8 @@ SECTIONS
}
 
. = ALIGN(4);
-   .u_boot_list : {
-   KEEP(*(SORT(.u_boot_list*)));
+   __u_boot_list : {
+   KEEP(*(SORT(__u_boot_list*)));
}
 
. = ALIGN(4);
diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index b107b1af27..b3548ce243 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -141,11 +141,11 @@ endif
 # limit ourselves to the sections we want in the .bin.
 ifdef CONFIG_ARM64
 OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \
-   -j .u_boot_list -j .rela.dyn -j .got -j .got.plt \
+   -j __u_boot_list -j .rela.dyn -j .got -j .got.plt \
-j .binman_sym_table -j .text_rest
 else
 OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \
-   -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn \
+   -j .data -j .got -j .got.plt -j __u_boot_list -j .rel.dyn \
-j .binman_sym_table -j .text_rest
 endif
 
diff --git a/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds 
b/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
index 9a000ac5d3..c108736811 100644
--- a/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
+++ 

[PATCH v3 00/13] Fuzzing and ASAN for sandbox

2022-05-30 Thread Andrew Scull
This series introduces ASAN and a basic fuzzing infrastructure that
works with sandbox. The example fuzz test towards the end of the series
will find something pretty quickly. That something is fixed by the
series "virtio: Harden and test vring" that needs to be applied for the
final patch in this series.

There is some refactoring to stop using '.' prefixed sections. ELF
defines sections with names that contain anything that isn't
alphanumeric or an underscore as being for system use which means
clang's ASAN instrumentation happily add redzones between the contained
objects. That's not what we want for things like linker lists where the
linker script has carefully placed the sections contiguously. By
renaming the sections, clang sees them as user sections and doesn't add
instrumentation.

ASAN is left disabled by default as there are still some tests that it
triggers on and will need some more investigation to fix. It can be
enabled with CONFIG_ASAN or passing `-a ASAN` to buildman.

I abandonded the previous attempts to refactor sandbox EFI and getopt
declaration as the changes resulted in problems out of the scope of this
CL. I haven't tried to understand what EFI on sandbox should look like,
but I have found that the linker list implementation is very brittle
when up against compiler optimisation since ef123c5253 started to use
static, zero-length arrays to mark the beginning and end of lists but
the compiler see this as something it can get rid of.

>From v1:
 - corrected handling of EFI symbols by sandbox linker script
 - per comments, some renaming and explaining
 - dropped RFC for dlmalloc ASAN instrumentation (work required to improve it)
 - added patch to reduce logging noise in fuzzer

>From v2:
 - remove sandbox EFI and getopt refactoring, they obstruct the series
 - resolve a couple more ASAN errors
 - fix LTO, xtensa and MIPS builds
 - add ASAN build targets for CI

Andrew Scull (13):
  serial: sandbox: Fix buffer underflow in puts
  sandbox: Rename EFI runtime sections
  sandbox: Rename getopt sections
  linker_lists: Rename sections to remove . prefix
  sandbox: Add support for Address Sanitizer
  test/py: test_stackprotector: Disable for ASAN
  CI: Azure: Build with ASAN enabled
  fuzzing_engine: Add fuzzing engine uclass
  test: fuzz: Add framework for fuzzing
  sandbox: Decouple program entry from sandbox init
  sandbox: Add libfuzzer integration
  sandbox: Implement fuzzing engine driver
  fuzz: virtio: Add fuzzer for vring

 .azure-pipelines.yml  |  6 ++
 Kconfig   | 16 
 arch/Kconfig  |  2 +
 arch/arc/cpu/u-boot.lds   |  4 +-
 arch/arm/config.mk|  4 +-
 arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds   |  4 +-
 arch/arm/cpu/armv7/sunxi/u-boot-spl.lds   |  4 +-
 arch/arm/cpu/armv8/u-boot-spl.lds |  4 +-
 arch/arm/cpu/armv8/u-boot.lds |  4 +-
 arch/arm/cpu/u-boot-spl.lds   |  4 +-
 arch/arm/cpu/u-boot.lds   |  6 +-
 arch/arm/mach-at91/arm926ejs/u-boot-spl.lds   |  2 +-
 arch/arm/mach-at91/armv7/u-boot-spl.lds   |  2 +-
 arch/arm/mach-omap2/u-boot-spl.lds|  4 +-
 arch/arm/mach-orion5x/u-boot-spl.lds  |  4 +-
 arch/arm/mach-rockchip/u-boot-tpl-v8.lds  |  4 +-
 arch/arm/mach-zynq/u-boot-spl.lds |  4 +-
 arch/arm/mach-zynq/u-boot.lds |  4 +-
 arch/m68k/cpu/u-boot.lds  |  4 +-
 arch/microblaze/cpu/u-boot-spl.lds|  4 +-
 arch/microblaze/cpu/u-boot.lds|  4 +-
 arch/mips/config.mk   |  2 +-
 arch/mips/cpu/u-boot-spl.lds  |  4 +-
 arch/mips/cpu/u-boot.lds  |  4 +-
 arch/nios2/cpu/u-boot.lds |  4 +-
 arch/powerpc/cpu/mpc83xx/u-boot.lds   |  4 +-
 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds   |  4 +-
 arch/powerpc/cpu/mpc85xx/u-boot.lds   |  4 +-
 arch/riscv/cpu/u-boot-spl.lds |  4 +-
 arch/riscv/cpu/u-boot.lds |  4 +-
 arch/sandbox/config.mk| 21 -
 arch/sandbox/cpu/os.c | 76 +
 arch/sandbox/cpu/start.c  |  2 +-
 arch/sandbox/cpu/u-boot-spl.lds   | 10 +--
 arch/sandbox/cpu/u-boot.lds   | 32 
 arch/sandbox/dts/test.dts |  4 +
 arch/sandbox/include/asm/fuzzing_engine.h | 25 ++
 arch/sandbox/include/asm/getopt.h |  2 +-
 arch/sandbox/include/asm/main.h   | 18 
 arch/sandbox/include/asm/sections.h   |  4 +-
 arch/sandbox/lib/sections.c   |  8 +-
 arch/sh/cpu/u-boot.lds|  4 +-
 arch/x86/cpu/u-boot-64.lds|  6 +-
 arch/x86/cpu/u-boot-spl.lds   |  6 +-
 arch/x86/cpu/u-boot.lds   |  6 +-
 

Re: [PATCH] tlv_eeprom: Add missing CRC32 dependency

2022-05-30 Thread Stefan Roese

On 30.05.22 10:42, Pali Rohár wrote:

tlv_eeprom uses crc32() function, so add dependency into Kconfig.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan



---
  cmd/Kconfig | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 69c1814d24af..d513d808aa3d 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -167,6 +167,7 @@ config CMD_REGINFO
  config CMD_TLV_EEPROM
bool "tlv_eeprom"
depends on I2C_EEPROM
+   select CRC32
help
  Display and program the system EEPROM data block in ONIE Tlvinfo
  format. TLV stands for Type-Length-Value.
@@ -175,6 +176,7 @@ config SPL_CMD_TLV_EEPROM
bool "tlv_eeprom for SPL"
depends on SPL_I2C_EEPROM
select SPL_DRIVERS_MISC
+   select SPL_CRC32
help
  Read system EEPROM data block in ONIE Tlvinfo format from SPL.
  


Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de


RE: [RFC] Data structure for information handoff between firmware boot stages

2022-05-30 Thread Jose Marinho
Good morning Simon,

Thank you for reviewing the FW handoff ALP0 spec proposal, and for your 
comments.

We have integrated your comments and iterated the spec proposal to ALP1.
The ALP1 document can be obtained here: 
https://developer.arm.com/documentation/den0135/a

A quick summary of the comments you made:
- rename handoff list since it can easily be confused with the HOB list (HOB 
list = HandOff Block list): we've adopted the term "Transfer List".
- rename node to entry.
- rename Host to Application Processor (Host for embedded developers is the 
development host and so was a confusing term to denote the main processor on 
the target/board)
- rename payload to data.
- don't use CRC-32 for the checksum (it requires 1Kb of constants for a SW 
implementation): adopted a simple sum to 0 scheme (similar to ACPI tables).
- mandate entry and list alignment to 16-bytes rather than 8-bytes.
- allow entries to have arbitrary size instead of mandating multiples of 8 
bytes. (this requires a small padding area at the end of each entry whose size 
is not a multiple of 16 bytes).
- Create a new entry for a full set of ACPI tables: this requirement does not 
originate in ACPI, but it's rather a result of the legacy u-boot ACPI table 
creation code.

Hopefully this is a complete recount . Please let us know if something is 
missing.

Note that for the ACPI table aggregate, we opted to mandate an RSDP at the 
start of the entry. The RSDP then points to a RSDT or XSDT (or both).

Also, In your comments you requested an entry type specific for the TCPA or 
TPM2 ACPI tables.  This makes for a quicker TPM log retrieval.
For this release we were asked to keep the number of ACPI entry types to a 
minimum.
For now, we can leverage the generic ACPI table entry (tag_id=4) to carry the 
TCPA or TPM2 tables.
Having said this, the intent is for communities to request the entry 
definitions that they require.
Hopefully this more specific TPM2/TCPA entry can be soon integrated as a 
community contribution!

Please let us know if you (and the u-boot community) have additional comments 
on the ALP1 spec.

Kind Regards,
Jose


> -Original Message-
> From: Simon Glass 
> Sent: 03 May 2022 10:32
> To: Jose Marinho 
> Cc: u-boot@lists.denx.de; Heinrich Schuchardt ; Ilias
> Apalodimas ; Tom Rini ;
> Samer El-Haj-Mahmoud ; Manish
> Pandey2 ; nd 
> Subject: Re: [RFC] Data structure for information handoff between firmware
> boot stages
> 
> Hi Jose,
> 
> On Tue, 3 May 2022 at 02:26, Jose Marinho  wrote:
> >
> > Hi Simon,
> >
> > Thank you for reviewing the draft proposal!
> >
> > Would you be able to share your review comments on the PDF?
> > Currently the document is not in a markup form and is yet to be hosted in a
> repository. That's the intent for the long term.
> 
> Yes it looks like I can do that, so will share with you when done.
> 
> Regards,
> Simon
> 
> >
> > Cheers,
> > Jose
> >
> > > -Original Message-
> > > From: Simon Glass 
> > > Sent: 03 May 2022 08:59
> > > To: Jose Marinho 
> > > Cc: u-boot@lists.denx.de; Heinrich Schuchardt ;
> > > Ilias Apalodimas ; Tom Rini
> > > ; Samer El-Haj-Mahmoud
> > > ; Manish Pandey2
> > > ; nd 
> > > Subject: Re: [RFC] Data structure for information handoff between
> > > firmware boot stages
> > >
> > > Hi Jose,
> > >
> > > On Thu, 7 Apr 2022 at 13:23, Jose Marinho 
> wrote:
> > > >
> > > > Hi All,
> > > >
> > > > The topic of information handoff between TF-A’s BL31 and BL33
> > > > (e.g. U-boot
> > > proper, EDK2) was discussed last year in the TF-A and U-boot mailing
> > > lists [1], [2].
> > > >
> > > > Examples of information to be handed off between firmware stages
> > > > are the
> > > TPM log, HOB nodes, etc.
> > > > Having a standard data structure which is usable/supported by
> > > > every
> > > community contributes to code reuse and leads to simpler codebase
> > > maintenance.
> > > >
> > > > Some already existing data structures, such as the UEFI HOB list
> > > > [3], and the
> > > Bloblist from U-boot, were proposed to be employed for the handoffs.
> > > > There are pros and cons with both HOBs and Bloblist.
> > > > The discussion settled with a consensus that a data structure
> > > > ought to be
> > > defined which encapsulates the best traits of HOBs and Bloblist.
> > > >
> > > > Properties that the data structure should have:
> > > > - node types identified by an integer,
> > > > - easily relocatable,
> > > >
> > > > - straightforward to append new nodes,
> > > > - easy to read and append to from resource constrained environments.
> > > >
> > > > The data structure should be suitable to pass information between
> > > > different
> > > firmware stages, such as:
> > > > U-boot SPL -> BL31 -> U-boot
> > > > BL1 -> BL2 -> BL31 -> U-boot
> > > >
> > > > As requested in the ML, an initial proposal was drafted [4].
> > > > The document [4] is an initial proposal (at an alpha stage).
> > > > The document [4] is being circulated for the purpose of gathering
> > > > 

Re: [PATCH] tlv_eeprom: Add missing CRC32 dependency

2022-05-30 Thread Baruch Siach
Hi Pali,

On Mon, May 30 2022, Pali Rohár wrote:
> tlv_eeprom uses crc32() function, so add dependency into Kconfig.
>
> Signed-off-by: Pali Rohár 

Reviewed-by: Baruch Siach 

Thanks,
baruch

> ---
>  cmd/Kconfig | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 69c1814d24af..d513d808aa3d 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -167,6 +167,7 @@ config CMD_REGINFO
>  config CMD_TLV_EEPROM
>   bool "tlv_eeprom"
>   depends on I2C_EEPROM
> + select CRC32
>   help
> Display and program the system EEPROM data block in ONIE Tlvinfo
> format. TLV stands for Type-Length-Value.
> @@ -175,6 +176,7 @@ config SPL_CMD_TLV_EEPROM
>   bool "tlv_eeprom for SPL"
>   depends on SPL_I2C_EEPROM
>   select SPL_DRIVERS_MISC
> + select SPL_CRC32
>   help
> Read system EEPROM data block in ONIE Tlvinfo format from SPL.


-- 
 ~. .~   Tk Open Systems
=}ooO--U--Ooo{=
   - bar...@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -


[PATCH v2] ubifs: Fix reference count leak in ubifsumount

2022-05-30 Thread Pali Rohár
Original ubifs code was designed that after ubifs_umount() call it is
required to also call ubi_close_volume() which closes underlying UBI
volume. But U-Boot ubifs modification have not implemented it properly
which caused that ubifsumount command contains resource leak. It can be
observed by calling simple sequence of commands:

  => ubi part mtd2
  ubi0: attaching mtd2
  ...
  => ubifsmount ubi0
  => ubifsumount
  Unmounting UBIFS volume rootfs!
  => ubi detach
  ubi0 error: ubi_detach_mtd_dev: ubi0 reference count 1, destroy anyway
  ubi0: detaching mtd2
  ubi0: mtd2 is detached

Fix this issue by calling ubi_close_volume() and mutex_unlock() in
directly in ubifs_umount() function before freeing U-Boot's global
ubifs_sb. And remove duplicate calls of these two functions in remaining
places. Note that when ubifs_umount() is not called then during error
handling is still needed to call ubi_close_volume() and mutex_unlock.

With this change ubifsumount command does not throw that error anymore:

  => ubi part rootfs
  ubi0: attaching mtd2
  ...
  => ubifsmount ubi0
  => ubifsumount
  Unmounting UBIFS volume rootfs!
  => ubi detach
  ubi0: detaching mtd2
  ubi0: mtd2 is detached

Signed-off-by: Pali Rohár 
---
Changes in v2:
* Fix error handling in ubifs_fill_super()
---
 fs/ubifs/super.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index e3a4c0bca270..034c41a70356 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1757,6 +1757,8 @@ void ubifs_umount(struct ubifs_info *c)
kfree(c->bottom_up_buf);
ubifs_debugging_exit(c);
 #ifdef __UBOOT__
+   ubi_close_volume(c->ubi);
+   mutex_unlock(>umount_mutex);
/* Finally free U-Boot's global copy of superblock */
if (ubifs_sb != NULL) {
free(ubifs_sb->s_fs_info);
@@ -2058,9 +2060,9 @@ static void ubifs_put_super(struct super_block *sb)
ubifs_umount(c);
 #ifndef __UBOOT__
bdi_destroy(>bdi);
-#endif
ubi_close_volume(c->ubi);
mutex_unlock(>umount_mutex);
+#endif
 }
 #endif
 
@@ -2327,6 +2329,9 @@ static int ubifs_fill_super(struct super_block *sb, void 
*data, int silent)
 
 out_umount:
ubifs_umount(c);
+#ifdef __UBOOT__
+   goto out;
+#endif
 out_unlock:
mutex_unlock(>umount_mutex);
 #ifndef __UBOOT__
-- 
2.20.1



Re: Pull request for efi-2022-07-rc4-2

2022-05-30 Thread Pali Rohár
On Monday 30 May 2022 09:32:53 Masahisa Kojima wrote:
> Hi Heinrich,
> 
> On Mon, 30 May 2022 at 01:16, Heinrich Schuchardt  wrote:
> >
> > Dear Tom,
> >
> > this replaces pull request for efi-2022-07-rc4.
> >
> > The following changes since commit 4fe629d2e8bbda5f265e870d771b92be26e885f6:
> >
> >Merge https://source.denx.de/u-boot/custodians/u-boot-riscv
> > (2022-05-27 08:50:42 -0400)
> >
> > are available in the Git repository at:
> >
> >https://source.denx.de/u-boot/custodians/u-boot-efi.git
> > tags/efi-2022-07-rc4-2
> >
> > for you to fetch changes up to de8471a30eb399d46412b2037ba76cfa258c6115:
> >
> >bootmenu: use utf-8 for menu title (2022-05-29 13:18:18 +0200)
> >
> > Gitlab CI showed no issues:
> > https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/12157
> >
> > 
> > Pull request for efi-2022-07-rc4-2
> >
> > UEFI:
> >
> > * fix a problem in loading an image from a short-path
> > * fix building the bootmenu command for CONFIG_EFI_LOADER=n
> > * correct the bootefi command syntax
> > * add firmware management protocol to the documentation
> >
> > Others:
> >
> > * bootmenu: fix bootmenu title handling
> >
> > 
> > AKASHI Takahiro (2):
> >efi_loader: disk: add efi_disk_is_removable()
> >efi_loader: bootmgr: fix a problem in loading an image from a
> > short-path
> >
> > Bin Meng (2):
> >doc: sandbox: Correct the memory size config option
> >doc: sandbox: Add a note of disabling LTO when using gdb
> >
> > Heinrich Schuchardt (6):
> >disk: incorrect message in is_gpt_valid()
> >test: restore timeout after bootmenu unit test
> >doc/build/gcc: add more required packages
> >test: fix pylint warnings in test_efi_selftest.py
> >test: don't change console timeout in EFI selftest.
> >cmd/bootefi: correct command syntax
> >
> > Masahisa Kojima (3):
> >bootmenu: U-Boot console is enabled as default
> >lib/charset: fix compile warnings
> >bootmenu: use utf-8 for menu title
> 
> With your fix to the last patch, the bootmenu output
> is as below.
> 
>   *** U-Boot Boot Menu ***
> 
>   Boot 1. kernel=bootm 0x8200
>   Boot 2. kernel=bootm 0x8300
>   Reset board=reset
>   U-Boot console
> 
>   Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit
> 
> The menu title includes both the title and command of "bootmenu_x".
> Is it intended?

Hello! This is really not intended.

Issue is in commit:
https://source.denx.de/u-boot/custodians/u-boot-efi/-/commit/de8471a30eb399d46412b2037ba76cfa258c6115

There is line:
184 +   entry->title = strdup(option);

But it rather should be:
184 +   entry->title = strndup(option, sep-option);

> Thanks,
> Masahias Kojima
> 
> >
> > Sean Anderson (2):
> >valgrind: Disable on Risc-V
> >doc: sandbox: Add additional valgrind documentation
> >
> > Vincent Stehlé (2):
> >efi: fix documentation warnings
> >doc/efi: add firmware management protocol to the documentation
> >
> >   Kconfig|   1 +
> >   boot/Kconfig   |   7 +++
> >   cmd/Kconfig|  10 
> >   cmd/bootefi.c  |  21 +---
> >   cmd/bootmenu.c |  47 
> >   disk/part_efi.c|   4 +-
> >   doc/api/efi.rst|   6 +++
> >   doc/arch/sandbox.rst   | 107
> > +
> >   doc/build/gcc.rst  |   8 +--
> >   doc/usage/cmd/bootefi.rst  |   8 +--
> >   include/charset.h  |   2 +-
> >   include/efi_loader.h   |   3 ++
> >   lib/efi_loader/efi_bootmgr.c   | 107
> > +++--
> >   lib/efi_loader/efi_disk.c  |  27 ++
> >   lib/efi_loader/efi_firmware.c  |  10 ++--
> >   test/py/tests/test_bootmenu.py |  66 +++
> >   test/py/tests/test_efi_selftest.py |  91 ++-
> >   17 files changed, 359 insertions(+), 166 deletions(-)


Re: [PATCH] arch: mvebu: Disable by default unused peripherals in SPL

2022-05-30 Thread Pali Rohár
On Monday 30 May 2022 10:26:37 Stefan Roese wrote:
> On 30.05.22 08:31, Stefan Roese wrote:
> > On 24.05.22 10:58, Pali Rohár wrote:
> > > SPL on mvebu loads proper U-Boot from custom Marvell kwbimage format and
> > > therefore support for other binary formats is not required to be
> > > present in
> > > SPL. Boot source of proper U-Boot is defined by compile time options and
> > > therefore it is not required to enable all possible and unused
> > > peripherals
> > > in SPL by default.
> > > 
> > > This change decrease size of SPL binaries.
> > > 
> > > Signed-off-by: Pali Rohár 
> > 
> > Reviewed-by: Stefan Roese 
> > 
> > Thanks,
> > Stefan
> 
> This patch causes some regressions, like on clearfog:
> 
> $ make clearfog_defconfig
> $ make -s -j20
> = WARNING ==
> This board does not use CONFIG_TIMER (Driver Model
> for Timer drivers). Please update the board to use
> CONFIG_TIMER before the v2023.01 release. Failure to
> update by the deadline may result in board removal.
> See doc/develop/driver-model/migration.rst for more info.
> 
> /opt/kernel.org/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
> cmd/tlv_eeprom.o: in function `is_checksum_valid':
> /home/stefan/git/u-boot/u-boot-marvell/cmd/tlv_eeprom.c:114: undefined
> reference to `crc32'
> /opt/kernel.org/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd:
> cmd/tlv_eeprom.o: in function `update_crc':
> /home/stefan/git/u-boot/u-boot-marvell/cmd/tlv_eeprom.c:379: undefined
> reference to `crc32'
> make[1]: *** [scripts/Makefile.spl:525: spl/u-boot-spl] Error 1
> make: *** [Makefile:2106: spl/u-boot-spl] Error 2
> 
> Could you please have a look?

Yes! It is missing dependency in Kconfig. Now I sent patch which is
fixing it:

https://patchwork.ozlabs.org/project/uboot/patch/20220530084235.13027-1-p...@kernel.org/

> Thanks,
> Stefan
> 
> > 
> > > ---
> > >   common/spl/Kconfig  | 2 ++
> > >   disk/Kconfig    | 2 ++
> > >   drivers/mmc/Kconfig | 1 +
> > >   drivers/usb/Kconfig | 1 +
> > >   4 files changed, 6 insertions(+)
> > > 
> > > diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> > > index 50ff113cab21..0c8df271aa59 100644
> > > --- a/common/spl/Kconfig
> > > +++ b/common/spl/Kconfig
> > > @@ -218,6 +218,7 @@ config SPL_BOOTCOUNT_LIMIT
> > >   config SPL_RAW_IMAGE_SUPPORT
> > >   bool "Support SPL loading and booting of RAW images"
> > > +    default n if ARCH_MVEBU
> > >   default n if (ARCH_MX6 && (SPL_MMC || SPL_SATA))
> > >   default y
> > >   depends on !TI_SECURE_DEVICE
> > > @@ -228,6 +229,7 @@ config SPL_RAW_IMAGE_SUPPORT
> > >   config SPL_LEGACY_IMAGE_FORMAT
> > >   bool "Support SPL loading and booting of Legacy images"
> > > +    default n if ARCH_MVEBU
> > >   default y if !SPL_LOAD_FIT
> > >   depends on !TI_SECURE_DEVICE
> > >   help
> > > diff --git a/disk/Kconfig b/disk/Kconfig
> > > index 359af3b27e6d..81d8867ed7fc 100644
> > > --- a/disk/Kconfig
> > > +++ b/disk/Kconfig
> > > @@ -60,6 +60,7 @@ config DOS_PARTITION
> > >   config SPL_DOS_PARTITION
> > >   bool "Enable MS Dos partition table for SPL"
> > >   depends on SPL
> > > +    default n if ARCH_MVEBU
> > >   default n if ARCH_SUNXI
> > >   default y if DOS_PARTITION
> > >   select SPL_PARTITIONS
> > > @@ -130,6 +131,7 @@ config EFI_PARTITION_ENTRIES_OFF
> > >   config SPL_EFI_PARTITION
> > >   bool "Enable EFI GPT partition table for SPL"
> > >   depends on  SPL
> > > +    default n if ARCH_MVEBU
> > >   default n if ARCH_SUNXI
> > >   default y if EFI_PARTITION
> > >   select SPL_PARTITIONS
> > > diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> > > index f04cc44e1973..847c0ef0acc7 100644
> > > --- a/drivers/mmc/Kconfig
> > > +++ b/drivers/mmc/Kconfig
> > > @@ -45,6 +45,7 @@ config DM_MMC
> > >   config SPL_DM_MMC
> > >   bool "Enable MMC controllers using Driver Model in SPL"
> > >   depends on SPL_DM && DM_MMC
> > > +    default n if ARCH_MVEBU && !MVEBU_SPL_BOOT_DEVICE_MMC
> > >   default y
> > >   help
> > >     This enables the MultiMediaCard (MMC) uclass which supports
> > > MMC and
> > > diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
> > > index ab1d061bd0d5..075e9682c435 100644
> > > --- a/drivers/usb/Kconfig
> > > +++ b/drivers/usb/Kconfig
> > > @@ -50,6 +50,7 @@ config DM_USB
> > >   config SPL_DM_USB
> > >   bool "Enable driver model for USB host most in SPL"
> > >   depends on SPL_DM && DM_USB
> > > +    default n if ARCH_MVEBU
> > >   default y
> > >   config DM_USB_GADGET
> > 
> > Viele Grüße,
> > Stefan Roese
> > 
> 
> Viele Grüße,
> Stefan Roese
> 
> -- 
> DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de


[PATCH] tlv_eeprom: Add missing CRC32 dependency

2022-05-30 Thread Pali Rohár
tlv_eeprom uses crc32() function, so add dependency into Kconfig.

Signed-off-by: Pali Rohár 
---
 cmd/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 69c1814d24af..d513d808aa3d 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -167,6 +167,7 @@ config CMD_REGINFO
 config CMD_TLV_EEPROM
bool "tlv_eeprom"
depends on I2C_EEPROM
+   select CRC32
help
  Display and program the system EEPROM data block in ONIE Tlvinfo
  format. TLV stands for Type-Length-Value.
@@ -175,6 +176,7 @@ config SPL_CMD_TLV_EEPROM
bool "tlv_eeprom for SPL"
depends on SPL_I2C_EEPROM
select SPL_DRIVERS_MISC
+   select SPL_CRC32
help
  Read system EEPROM data block in ONIE Tlvinfo format from SPL.
 
-- 
2.20.1



Re: [PATCH] arch: mvebu: Disable by default unused peripherals in SPL

2022-05-30 Thread Stefan Roese

On 30.05.22 08:31, Stefan Roese wrote:

On 24.05.22 10:58, Pali Rohár wrote:

SPL on mvebu loads proper U-Boot from custom Marvell kwbimage format and
therefore support for other binary formats is not required to be 
present in

SPL. Boot source of proper U-Boot is defined by compile time options and
therefore it is not required to enable all possible and unused 
peripherals

in SPL by default.

This change decrease size of SPL binaries.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


This patch causes some regressions, like on clearfog:

$ make clearfog_defconfig
$ make -s -j20
= WARNING ==
This board does not use CONFIG_TIMER (Driver Model
for Timer drivers). Please update the board to use
CONFIG_TIMER before the v2023.01 release. Failure to
update by the deadline may result in board removal.
See doc/develop/driver-model/migration.rst for more info.

/opt/kernel.org/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd: 
cmd/tlv_eeprom.o: in function `is_checksum_valid':
/home/stefan/git/u-boot/u-boot-marvell/cmd/tlv_eeprom.c:114: undefined 
reference to `crc32'
/opt/kernel.org/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd: 
cmd/tlv_eeprom.o: in function `update_crc':
/home/stefan/git/u-boot/u-boot-marvell/cmd/tlv_eeprom.c:379: undefined 
reference to `crc32'

make[1]: *** [scripts/Makefile.spl:525: spl/u-boot-spl] Error 1
make: *** [Makefile:2106: spl/u-boot-spl] Error 2

Could you please have a look?

Thanks,
Stefan




---
  common/spl/Kconfig  | 2 ++
  disk/Kconfig    | 2 ++
  drivers/mmc/Kconfig | 1 +
  drivers/usb/Kconfig | 1 +
  4 files changed, 6 insertions(+)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 50ff113cab21..0c8df271aa59 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -218,6 +218,7 @@ config SPL_BOOTCOUNT_LIMIT
  config SPL_RAW_IMAGE_SUPPORT
  bool "Support SPL loading and booting of RAW images"
+    default n if ARCH_MVEBU
  default n if (ARCH_MX6 && (SPL_MMC || SPL_SATA))
  default y
  depends on !TI_SECURE_DEVICE
@@ -228,6 +229,7 @@ config SPL_RAW_IMAGE_SUPPORT
  config SPL_LEGACY_IMAGE_FORMAT
  bool "Support SPL loading and booting of Legacy images"
+    default n if ARCH_MVEBU
  default y if !SPL_LOAD_FIT
  depends on !TI_SECURE_DEVICE
  help
diff --git a/disk/Kconfig b/disk/Kconfig
index 359af3b27e6d..81d8867ed7fc 100644
--- a/disk/Kconfig
+++ b/disk/Kconfig
@@ -60,6 +60,7 @@ config DOS_PARTITION
  config SPL_DOS_PARTITION
  bool "Enable MS Dos partition table for SPL"
  depends on SPL
+    default n if ARCH_MVEBU
  default n if ARCH_SUNXI
  default y if DOS_PARTITION
  select SPL_PARTITIONS
@@ -130,6 +131,7 @@ config EFI_PARTITION_ENTRIES_OFF
  config SPL_EFI_PARTITION
  bool "Enable EFI GPT partition table for SPL"
  depends on  SPL
+    default n if ARCH_MVEBU
  default n if ARCH_SUNXI
  default y if EFI_PARTITION
  select SPL_PARTITIONS
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index f04cc44e1973..847c0ef0acc7 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -45,6 +45,7 @@ config DM_MMC
  config SPL_DM_MMC
  bool "Enable MMC controllers using Driver Model in SPL"
  depends on SPL_DM && DM_MMC
+    default n if ARCH_MVEBU && !MVEBU_SPL_BOOT_DEVICE_MMC
  default y
  help
    This enables the MultiMediaCard (MMC) uclass which supports 
MMC and

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index ab1d061bd0d5..075e9682c435 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -50,6 +50,7 @@ config DM_USB
  config SPL_DM_USB
  bool "Enable driver model for USB host most in SPL"
  depends on SPL_DM && DM_USB
+    default n if ARCH_MVEBU
  default y
  config DM_USB_GADGET


Viele Grüße,
Stefan Roese



Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de


Re: [PATCH v2 09/11] socfpga: arria10: Improve bitstream loading speed

2022-05-30 Thread Paweł Anikiel
On Fri, May 27, 2022 at 5:55 PM Simon Glass  wrote:
>
> On Thu, 26 May 2022 at 07:38, Paweł Anikiel  wrote:
> >
> > Apply some optimizations to speed up bitstream loading
> > (both for full and split periph/core bitstreams):
> >
> >  * Change the size of the first fs read, so that all the subsequent
> >reads are aligned to a specific value (called MAX_FIRST_LOAD_SIZE).
> >This value was chosen so that in subsequent reads the fat fs driver
> >doesn't have to allocate a temporary buffer in get_contents
> >(assuming 8KiB clusters).
> >
> >  * Change the buffer size to a larger value when reading to ddr
> >(but not too large, because large transfers cause a stack overflow
> >in the dwmmc driver).
>
> When the size is too large, where exactly does that stack overflow happen?

In dwmci_send_cmd (at drivers/mmc/dw_mmc.c:243). It stack-allocates a
buffer of size sizeof(struct dwmci_idmac) * (data->blocks / 8). Since
loading the bitstream is done from SPL (which is still in sram), we
only have about 100K of stack, which is not enough to load an 11MB
file in one go.


Re: [PATCH 3/3] arm: mvebu: Remove CONFIG_SPL_BOOT_DEVICE

2022-05-30 Thread Stefan Roese

On 29.05.22 01:13, Chris Packham wrote:

CONFIG_SPL_BOOT_DEVICE was made obsolete by
CONFIG_MVEBU_SPL_BOOT_DEVICE_{SPI,MMC,SATA,UART}.
CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI is the default so existing users of
CONFIG_SPL_BOOT_DEVICE can simply have the option removed.

Signed-off-by: Chris Packham 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---

  include/configs/controlcenterdc.h | 11 ---
  include/configs/db-88f6820-amc.h  | 12 
  include/configs/db-88f6820-gp.h   | 11 ---
  scripts/config_whitelist.txt  |  1 -
  4 files changed, 35 deletions(-)

diff --git a/include/configs/controlcenterdc.h 
b/include/configs/controlcenterdc.h
index a8534e59d9b1..3d7da4b2a33e 100644
--- a/include/configs/controlcenterdc.h
+++ b/include/configs/controlcenterdc.h
@@ -23,17 +23,6 @@
  #endif
  
  /* SPL */

-/*
- * Select the boot device here
- *
- * Currently supported are:
- * SPL_BOOT_SPI_NOR_FLASH  - Booting via SPI NOR flash
- * SPL_BOOT_SDIO_MMC_CARD  - Booting via SDIO/MMC card (partition 1)
- */
-#define SPL_BOOT_SPI_NOR_FLASH 1
-#define SPL_BOOT_SDIO_MMC_CARD 2
-#define CONFIG_SPL_BOOT_DEVICE SPL_BOOT_SPI_NOR_FLASH
-
  /* Defines for SPL */
  #define CONFIG_SPL_SIZE   (160 << 10)
  
diff --git a/include/configs/db-88f6820-amc.h b/include/configs/db-88f6820-amc.h

index 6538e66052aa..d044292d6b5a 100644
--- a/include/configs/db-88f6820-amc.h
+++ b/include/configs/db-88f6820-amc.h
@@ -27,18 +27,6 @@
"initrd_high=0x1000\0"
  
  /* SPL */

-/*
- * Select the boot device here
- *
- * Currently supported are:
- * SPL_BOOT_SPI_NOR_FLASH  - Booting via SPI NOR flash
- *
- * MMC is not populated on this board.
- * NAND support may be added in the future.
- */
-#define SPL_BOOT_SPI_NOR_FLASH 1
-#define CONFIG_SPL_BOOT_DEVICE SPL_BOOT_SPI_NOR_FLASH
-
  /* Defines for SPL */
  #define CONFIG_SPL_SIZE   (140 << 10)
  #define CONFIG_SPL_MAX_SIZE   (CONFIG_SPL_SIZE - 
(CONFIG_SPL_TEXT_BASE - 0x4000))
diff --git a/include/configs/db-88f6820-gp.h b/include/configs/db-88f6820-gp.h
index b4b58e0bcb8a..35ff6a876fde 100644
--- a/include/configs/db-88f6820-gp.h
+++ b/include/configs/db-88f6820-gp.h
@@ -28,17 +28,6 @@
"initrd_high=0x1000\0"
  
  /* SPL */

-/*
- * Select the boot device here
- *
- * Currently supported are:
- * SPL_BOOT_SPI_NOR_FLASH  - Booting via SPI NOR flash
- * SPL_BOOT_SDIO_MMC_CARD  - Booting via SDIO/MMC card (partition 1)
- */
-#define SPL_BOOT_SPI_NOR_FLASH 1
-#define SPL_BOOT_SDIO_MMC_CARD 2
-#define CONFIG_SPL_BOOT_DEVICE SPL_BOOT_SPI_NOR_FLASH
-
  /* Defines for SPL */
  #define CONFIG_SPL_SIZE   (140 << 10)
  #define CONFIG_SPL_MAX_SIZE   (CONFIG_SPL_SIZE - 
(CONFIG_SPL_TEXT_BASE - 0x4000))
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 25962b735f27..a8766c9755ab 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -565,7 +565,6 @@ CONFIG_SPI_HALF_DUPLEX
  CONFIG_SPI_N25Q256A_RESET
  CONFIG_SPL_BOARD_LOAD_IMAGE
  CONFIG_SPL_BOOTROM_SAVE
-CONFIG_SPL_BOOT_DEVICE
  CONFIG_SPL_BSS_MAX_SIZE
  CONFIG_SPL_BSS_START_ADDR
  CONFIG_SPL_CMT


Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de


Re: [PATCH 2/3] Convert CONFIG_FIXED_SDHCI_ALIGNED_BUFFER to Kconfig

2022-05-30 Thread Stefan Roese

On 29.05.22 01:13, Chris Packham wrote:

CONFIG_FIXED_SDHCI_ALIGNED_BUFFER is needed on some Marvell SoCs when
booting from MMC. All existing usages of this have the same value so
make this the default and have the Kconfig option depend on SPL &&
MVEBU_SPL_BOOT_DEVICE_MMC.

Signed-off-by: Chris Packham 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---

  drivers/mmc/Kconfig   | 13 +
  include/configs/clearfog.h|  7 ---
  include/configs/controlcenterdc.h |  7 ---
  include/configs/db-88f6820-gp.h   |  7 ---
  include/configs/helios4.h |  7 ---
  include/configs/turris_omnia.h|  7 ---
  scripts/config_whitelist.txt  |  1 -
  7 files changed, 13 insertions(+), 36 deletions(-)

diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index 5e2921ce41a7..c8f9709d2d49 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -484,6 +484,19 @@ config SPL_MMC_SDHCI_ADMA
  This enables support for the ADMA (Advanced DMA) defined
  in the SD Host Controller Standard Specification Version 3.00 in SPL.
  
+config FIXED_SDHCI_ALIGNED_BUFFER

+   hex "SDRAM address for fixed buffer"
+   depends on SPL && MVEBU_SPL_BOOT_DEVICE_MMC
+   default 0x0018
+   help
+ On the Marvell Armada 38x when the SPL runs it located in internal
+ SRAM which is the L2 cache locked to memory. When the MMC buffers
+ are located on the stack (or bss), the SDIO controller (SDHCI) can't
+ write into this L2 cache memory.
+
+ This specifies the address of a fixed buffer located in SDRAM that
+ will be used for all SDHCI transfers in the SPL.
+
  config MMC_SDHCI_ASPEED
bool "Aspeed SDHCI controller"
depends on ARCH_ASPEED
diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h
index 871e87c26d01..ec0f0e3ed115 100644
--- a/include/configs/clearfog.h
+++ b/include/configs/clearfog.h
@@ -56,13 +56,6 @@
  #define CONFIG_SPL_STACK  (0x4000 + ((192 - 16) << 10))
  #define CONFIG_SPL_BOOTROM_SAVE   (CONFIG_SPL_STACK + 4)
  
-#if defined(CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC) || defined(CONFIG_MVEBU_SPL_BOOT_DEVICE_SATA)

-/* SPL related MMC defines */
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER  0x0018  /* in SDRAM */
-#endif
-#endif
-
  /*
   * mv-common.h should be defined after CMD configs since it used them
   * to enable certain macros
diff --git a/include/configs/controlcenterdc.h 
b/include/configs/controlcenterdc.h
index b499d7085fd4..a8534e59d9b1 100644
--- a/include/configs/controlcenterdc.h
+++ b/include/configs/controlcenterdc.h
@@ -53,13 +53,6 @@
  #define CONFIG_SPL_STACK  (0x4000 + ((212 - 16) << 10))
  #define CONFIG_SPL_BOOTROM_SAVE   (CONFIG_SPL_STACK + 4)
  
-#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SDIO_MMC_CARD

-/* SPL related MMC defines */
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER  0x0018  /* in SDRAM */
-#endif
-#endif
-
  /*
   * Environment Configuration
   */
diff --git a/include/configs/db-88f6820-gp.h b/include/configs/db-88f6820-gp.h
index 8dc73e8b1cc9..b4b58e0bcb8a 100644
--- a/include/configs/db-88f6820-gp.h
+++ b/include/configs/db-88f6820-gp.h
@@ -53,13 +53,6 @@
  #define CONFIG_SPL_STACK  (0x4000 + ((192 - 16) << 10))
  #define CONFIG_SPL_BOOTROM_SAVE   (CONFIG_SPL_STACK + 4)
  
-#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SDIO_MMC_CARD

-/* SPL related MMC defines */
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER  0x0018  /* in SDRAM */
-#endif
-#endif
-
  /*
   * mv-common.h should be defined after CMD configs since it used them
   * to enable certain macros
diff --git a/include/configs/helios4.h b/include/configs/helios4.h
index 151ab66f4c3f..62a52e68b56a 100644
--- a/include/configs/helios4.h
+++ b/include/configs/helios4.h
@@ -56,13 +56,6 @@
  #define CONFIG_SPL_STACK  (0x4000 + ((192 - 16) << 10))
  #define CONFIG_SPL_BOOTROM_SAVE   (CONFIG_SPL_STACK + 4)
  
-#if defined(CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC) || defined(CONFIG_MVEBU_SPL_BOOT_DEVICE_SATA)

-/* SPL related MMC defines */
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER  0x0018  /* in SDRAM */
-#endif
-#endif
-
  /*
   * mv-common.h should be defined after CMD configs since it used them
   * to enable certain macros
diff --git a/include/configs/turris_omnia.h b/include/configs/turris_omnia.h
index 8119340b112f..112ddd3f4961 100644
--- a/include/configs/turris_omnia.h
+++ b/include/configs/turris_omnia.h
@@ -36,13 +36,6 @@
  #define CONFIG_SPL_STACK  (0x4000 + ((192 - 16) << 10))
  #define CONFIG_SPL_BOOTROM_SAVE   (CONFIG_SPL_STACK + 4)
  
-#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC

-/* SPL related MMC defines */
-# ifdef CONFIG_SPL_BUILD
-#  define CONFIG_FIXED_SDHCI_ALIGNED_BUFFER0x0018  /* in 

Re: [PATCH 1/3] arm: mvebu: Use MVEBU_SPL_BOOT_DEVICE instead of SPL_BOOT_DEVICE

2022-05-30 Thread Stefan Roese

On 29.05.22 01:13, Chris Packham wrote:

Update the way KWB_CFG_SEC_BOOT_DEV is determined to use
CONFIG_MVEBU_SPL_BOOT_DEVICE_{SPI,MMC} instead of
CONFIG_SPL_BOOT_DEVICE.

Signed-off-by: Chris Packham 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---

  arch/arm/mach-mvebu/Makefile | 10 ++
  1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 8bd2246325ca..61eeb9c8c186 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -65,10 +65,12 @@ KWB_REPLACE += CSK_INDEX
  KWB_CFG_CSK_INDEX = $(CONFIG_SECURED_MODE_CSK_INDEX)
  
  KWB_REPLACE += SEC_BOOT_DEV

-KWB_CFG_SEC_BOOT_DEV=$(patsubst "%",%, \
-   $(if $(findstring BOOT_SPI_NOR_FLASH,$(CONFIG_SPL_BOOT_DEVICE)),0x34) \
-   $(if $(findstring BOOT_SDIO_MMC_CARD,$(CONFIG_SPL_BOOT_DEVICE)),0x31) \
-   )
+ifneq ($(CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI),)
+   KWB_CFG_SEC_BOOT_DEV=0x34
+endif
+ifneq ($(CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC),)
+   KWB_CFG_SEC_BOOT_DEV=0x31
+endif
  
  KWB_REPLACE += SEC_FUSE_DUMP

  KWB_CFG_SEC_FUSE_DUMP = a38x


Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de


Re: [PATCH] arch: mvebu: Disable by default unused peripherals in SPL

2022-05-30 Thread Stefan Roese

On 24.05.22 10:58, Pali Rohár wrote:

SPL on mvebu loads proper U-Boot from custom Marvell kwbimage format and
therefore support for other binary formats is not required to be present in
SPL. Boot source of proper U-Boot is defined by compile time options and
therefore it is not required to enable all possible and unused peripherals
in SPL by default.

This change decrease size of SPL binaries.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  common/spl/Kconfig  | 2 ++
  disk/Kconfig| 2 ++
  drivers/mmc/Kconfig | 1 +
  drivers/usb/Kconfig | 1 +
  4 files changed, 6 insertions(+)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 50ff113cab21..0c8df271aa59 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -218,6 +218,7 @@ config SPL_BOOTCOUNT_LIMIT
  
  config SPL_RAW_IMAGE_SUPPORT

bool "Support SPL loading and booting of RAW images"
+   default n if ARCH_MVEBU
default n if (ARCH_MX6 && (SPL_MMC || SPL_SATA))
default y
depends on !TI_SECURE_DEVICE
@@ -228,6 +229,7 @@ config SPL_RAW_IMAGE_SUPPORT
  
  config SPL_LEGACY_IMAGE_FORMAT

bool "Support SPL loading and booting of Legacy images"
+   default n if ARCH_MVEBU
default y if !SPL_LOAD_FIT
depends on !TI_SECURE_DEVICE
help
diff --git a/disk/Kconfig b/disk/Kconfig
index 359af3b27e6d..81d8867ed7fc 100644
--- a/disk/Kconfig
+++ b/disk/Kconfig
@@ -60,6 +60,7 @@ config DOS_PARTITION
  config SPL_DOS_PARTITION
bool "Enable MS Dos partition table for SPL"
depends on SPL
+   default n if ARCH_MVEBU
default n if ARCH_SUNXI
default y if DOS_PARTITION
select SPL_PARTITIONS
@@ -130,6 +131,7 @@ config EFI_PARTITION_ENTRIES_OFF
  config SPL_EFI_PARTITION
bool "Enable EFI GPT partition table for SPL"
depends on  SPL
+   default n if ARCH_MVEBU
default n if ARCH_SUNXI
default y if EFI_PARTITION
select SPL_PARTITIONS
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index f04cc44e1973..847c0ef0acc7 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -45,6 +45,7 @@ config DM_MMC
  config SPL_DM_MMC
bool "Enable MMC controllers using Driver Model in SPL"
depends on SPL_DM && DM_MMC
+   default n if ARCH_MVEBU && !MVEBU_SPL_BOOT_DEVICE_MMC
default y
help
  This enables the MultiMediaCard (MMC) uclass which supports MMC and
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index ab1d061bd0d5..075e9682c435 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -50,6 +50,7 @@ config DM_USB
  config SPL_DM_USB
bool "Enable driver model for USB host most in SPL"
depends on SPL_DM && DM_USB
+   default n if ARCH_MVEBU
default y
  
  config DM_USB_GADGET


Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de


Re: [PATCH 2/2] arm: mvebu: a3720: Add NVMe to BOOT_TARGET_DEVICES list

2022-05-30 Thread Stefan Roese

On 23.05.22 11:14, Pali Rohár wrote:

Enable NVMe booting on boards which have enabled NVMe drivers.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  include/configs/mvebu_armada-37xx.h | 7 +++
  1 file changed, 7 insertions(+)

diff --git a/include/configs/mvebu_armada-37xx.h 
b/include/configs/mvebu_armada-37xx.h
index 2ed6125f5c43..d656bbc463b2 100644
--- a/include/configs/mvebu_armada-37xx.h
+++ b/include/configs/mvebu_armada-37xx.h
@@ -58,6 +58,12 @@
  #define BOOT_TARGET_DEVICES_SCSI(func)
  #endif
  
+#ifdef CONFIG_NVME

+#define BOOT_TARGET_DEVICES_NVME(func) func(NVME, nvme, 0)
+#else
+#define BOOT_TARGET_DEVICES_NVME(func)
+#endif
+
  #if defined(CONFIG_CMD_DHCP) && defined(CONFIG_CMD_PXE)
  #define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
  #else
@@ -74,6 +80,7 @@
BOOT_TARGET_DEVICES_MMC(func, 1) \
BOOT_TARGET_DEVICES_MMC(func, 0) \
BOOT_TARGET_DEVICES_USB(func) \
+   BOOT_TARGET_DEVICES_NVME(func) \
BOOT_TARGET_DEVICES_SCSI(func) \
BOOT_TARGET_DEVICES_PXE(func) \
BOOT_TARGET_DEVICES_DHCP(func)


Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de


Re: [PATCH 1/2] arm: mvebu: a3720: Set BOOT_TARGET_DEVICES list to enabled peripherals

2022-05-30 Thread Stefan Roese

On 23.05.22 11:14, Pali Rohár wrote:

This allows to compile U-Boot without some boot option for some A3720 board
which does not have that peripheral.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  include/configs/mvebu_armada-37xx.h | 42 -
  1 file changed, 36 insertions(+), 6 deletions(-)

diff --git a/include/configs/mvebu_armada-37xx.h 
b/include/configs/mvebu_armada-37xx.h
index a39db075eae9..2ed6125f5c43 100644
--- a/include/configs/mvebu_armada-37xx.h
+++ b/include/configs/mvebu_armada-37xx.h
@@ -40,13 +40,43 @@
  #define CONFIG_LBA48
  #define CONFIG_SYS_64BIT_LBA
  
+#ifdef CONFIG_MMC

+#define BOOT_TARGET_DEVICES_MMC(func, i) func(MMC, mmc, i)
+#else
+#define BOOT_TARGET_DEVICES_MMC(func, i)
+#endif
+
+#ifdef CONFIG_USB_STORAGE
+#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
+#else
+#define BOOT_TARGET_DEVICES_USB(func)
+#endif
+
+#ifdef CONFIG_SCSI
+#define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0)
+#else
+#define BOOT_TARGET_DEVICES_SCSI(func)
+#endif
+
+#if defined(CONFIG_CMD_DHCP) && defined(CONFIG_CMD_PXE)
+#define BOOT_TARGET_DEVICES_PXE(func) func(PXE, pxe, na)
+#else
+#define BOOT_TARGET_DEVICES_PXE(func)
+#endif
+
+#ifdef CONFIG_CMD_DHCP
+#define BOOT_TARGET_DEVICES_DHCP(func) func(DHCP, dhcp, na)
+#else
+#define BOOT_TARGET_DEVICES_DHCP(func)
+#endif
+
  #define BOOT_TARGET_DEVICES(func) \
-   func(MMC, mmc, 1) \
-   func(MMC, mmc, 0) \
-   func(USB, usb, 0) \
-   func(SCSI, scsi, 0) \
-   func(PXE, pxe, na) \
-   func(DHCP, dhcp, na)
+   BOOT_TARGET_DEVICES_MMC(func, 1) \
+   BOOT_TARGET_DEVICES_MMC(func, 0) \
+   BOOT_TARGET_DEVICES_USB(func) \
+   BOOT_TARGET_DEVICES_SCSI(func) \
+   BOOT_TARGET_DEVICES_PXE(func) \
+   BOOT_TARGET_DEVICES_DHCP(func)
  
  #include 
  


Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de


Re: [PATCH] ubifs: Fix lockup/crash when reading files

2022-05-30 Thread Stefan Roese

Added Tom to Cc...

On 23.05.22 11:25, Pali Rohár wrote:

On Thursday 19 May 2022 10:04:31 Pali Rohár wrote:

On Thursday 19 May 2022 07:01:19 Stefan Roese wrote:

On 17.05.22 22:45, Pali Rohár wrote:

Commit b1a14f8a1c2e ("UBIFS: Change ubifsload to not read beyond the
requested size") added optimization to do not read more bytes than it is
really needed. But this commit introduced incorrect handling of the hole at
the end of file. This logic cause U-Boot to crash or lockup when trying to
read from the ubifs filesystem.

When read_block() call returns -ENOENT error (not an error, but the hole)
then dn-> structure is not filled and contain garbage. So using of dn->size
for memcpy() argument cause that U-Boot tries to copy unspecified amount of
bytes from possible unmapped memory. Which randomly cause lockup of P2020
CPU.

Fix this issue by copying UBIFS_BLOCK_SIZE bytes from read buffer when
dn->size is not available. UBIFS_BLOCK_SIZE is the size of the buffer
itself and read_block() fills buffer by zeros when it returns -ENOENT.

This patch fixes ubifsload on P2020.

Fixes: b1a14f8a1c2e ("UBIFS: Change ubifsload to not read beyond the requested 
size")
Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 


Anyway, who is maintainer of fs / ubifs code and can take this bugfix patch?


Tom, could you please pick this patch up? I've seen that you've already
assigned it to yourself in patchwork:

http://patchwork.ozlabs.org/project/uboot/patch/20220517204528.7277-1-p...@kernel.org/

Thanks,
Stefan




---

Stefan, could you please look at this patch? Mentioned commit was
introduced by you more than 11 years ago. I'm surprised that nobody hit
this issue yet, but it looks like older U-Boot versions somehow filled
small garbage number into dn->size and did not cause U-Boot
lockup/crash.


So long ago. I don't really remember the details. IIRC, I introduced the
UBIFS support for some MIPS based board at that time. My best assumption
is, that UBIFS is rarely used in U-Boot in general.


It is used on Turris 1.x (powerpc).


Thanks,
Stefan


---
   fs/ubifs/ubifs.c | 2 ++
   1 file changed, 2 insertions(+)

diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index d6be5c947d7e..d3026e310168 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -771,40 +771,42 @@ static int do_readpage(struct ubifs_info *c, struct inode 
*inode,
buff = malloc_cache_aligned(UBIFS_BLOCK_SIZE);
if (!buff) {
printf("%s: Error, malloc fails!\n",
   __func__);
err = -ENOMEM;
break;
}
/* Read block-size into temp buffer */
ret = read_block(inode, buff, block, dn);
if (ret) {
err = ret;
if (err != -ENOENT) {
free(buff);
break;
}
}
if (last_block_size)
dlen = last_block_size;
+   else if (ret)
+   dlen = UBIFS_BLOCK_SIZE;
else
dlen = le32_to_cpu(dn->size);
/* Now copy required size back to dest */
memcpy(addr, buff, dlen);
free(buff);
} else {
ret = read_block(inode, addr, block, dn);
if (ret) {
err = ret;
if (err != -ENOENT)
break;
}
}
}
if (++i >= UBIFS_BLOCKS_PER_PAGE)
break;
block += 1;
addr += UBIFS_BLOCK_SIZE;


Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de


Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de