Understanding how .config for uboot is generated in buildroot

2023-10-16 Thread Ignatius Rivaldi
Hi all,

When I edit the config file in BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE in a
buildroot recipe, how does the config statements from that file got
converted into .config file in u-boot?

The background is that we're using a custom buildroot config file at here:
https://github.com/kubos/kubos-linux-build/tree/master to build u-boot for
a space grade computer. When I added a new config statement
(CONFIG_SD_SWITCH=y) in the BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE, it doesn't
write the config statement to the .config file in the uboot build repo.

 Unfortunately the company that owns that has been acquired several times
and all the engineers there already left, so I can't just ask them

Thanks
Ignatius


Re: [PATCH v7 4/9] efi_loader: create default file boot option

2023-10-16 Thread Masahisa Kojima
Hi Heinrich,

On Mon, 16 Oct 2023 at 23:52, Heinrich Schuchardt  wrote:
>
> On 16.10.23 15:00, Masahisa Kojima wrote:
> > On Mon, 16 Oct 2023 at 21:46, Heinrich Schuchardt  
> > wrote:
> >>
> >> On 16.10.23 14:31, Ilias Apalodimas wrote:
> >>> Hi Heinrich,
> >>>
> >>> On Mon, 16 Oct 2023 at 10:06, Heinrich Schuchardt  
> >>> wrote:
> 
> 
> 
>  Am 16. Oktober 2023 08:45:21 MESZ schrieb Masahisa Kojima 
>  :
> > Current efibootmgr automatically creates the
> > boot options of all disks and partitions installing
> > EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.
> > Some of the automatically created boot options are
> > useless if the disk and partition does not have
> > the default file(e.g. EFI/BOOT/BOOTAA64.EFI).
> >
> > This commit only creates the boot option if the disk and
> > partition have the default file so that system can directly
> > boot from it.
> 
>  I don't directly see the user benefit.
> >>>
> >>> The user can add an HTTP boot option now and the installer will
> >>> automatically start.  That would allow products to ship with a single
> >>> boot option provisioned and run an installer on first boot
> >>
> >> This commit is not about HTTP. It changes how boot options for block
> >> devices are created.
> >>
> >>>
> 
>  Reading all file systems will increase the boot time. Shouldn't we avoid 
>  this?
> >>>
> >>> Any idea what would be an alternative?  But when we added the
> >>> automatic boot options we said we should avoid dynamic scanning and
> >>> store results in a file.  This is doing a similar thing.  The only
> >>> difference is that it mounts the iso image before adding the boot
> >>> option.
> >>
> >> The alternative is to keep showing boot options for block devices even
> >> if there is no BOOT.EFI file.
> >>
> >>>
> 
>  What does EDK II do?
> >>>
> >>> No Idea :)
> >>
> >>
> >> On my workstation I get generated boot options
> >>
> >> Boot0001* UEFI:CD/DVD Drive BBS(129,,0x0)
> >> Boot0003* UEFI:Removable Device BBS(130,,0x0)
> >> Boot0004* UEFI:Network Device   BBS(131,,0x0)
> >>
> >> without any media inserted and without any PXE server available.
> >
> > It is just information about how the EDK2 works.
> > When I attach the Fedora installation media on EDK2(OVMF),
> > the automatically generated boot option is as follows.
> >
> > UEFI QEMU HARDDISK QM1 : 
> > PciRoot(0x0)/Pci(0x1,0x1)/Ata(Primary,Master,0x0)
>
> An ATAPI drive typically is not removable. So I wonder why it is listed.
> Did you set the removable flag on the command line?

I guess it is not removable(actually I don't know how to set the
device as removable).
I just attached the iso image to QEMU with something like '-hda
Fedora_netinst.iso".

According to the EDK II implementation[1], the boot option is
enumerated with the following order.
  1. Removable BlockIo
  2. Fixed BlockIo
  3. Non-BlockIo SimpleFileSystem
  4. LoadFile
So boot option for the fixed device such as HDD is also automatically created.

[1] 
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c#L2150

>
> >
> > When this boot option is selected, Fedora installer automatically starts.
> > So EDK II is searching the default file on the fly.
>
> What is shown if you attach a medium without Bootaa64.efi?

The same boot option is created.
UEFI QEMU HARDDISK QM1 : PciRoot(0x0)/Pci(0x1,0x1)/Ata(Primary,Master,0x0)

Thanks,
Masahisa Kojima

>
> Best regards
>
> Heinrich
>
> >
> > Thanks,
> > Masahisa Kojima
> >
> >>
> >> Best regards
> >>
> >> Heinrich
> >>
> >>>
> >>> Thanks
> >>> /Ilias
> 
>  Does the UEFI specification warrant this change?
> 
>  Best regards
> 
>  Heinrich
> 
> >
> > Signed-off-by: Masahisa Kojima 
> > ---
> > lib/efi_loader/efi_bootmgr.c | 86 ++--
> > 1 file changed, 63 insertions(+), 23 deletions(-)
> >
> > diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
> > index a40762c74c..c8cf1c5506 100644
> > --- a/lib/efi_loader/efi_bootmgr.c
> > +++ b/lib/efi_loader/efi_bootmgr.c
> > @@ -355,40 +355,70 @@ error:
> >*/
> > static efi_status_t efi_bootmgr_enumerate_boot_option(struct 
> > eficonfig_media_boot_option *opt,
> >   efi_handle_t 
> > *volume_handles,
> > -efi_status_t count)
> > +efi_uintn_t *count)
> > {
> > -  u32 i;
> > +  u32 i, num = 0;
> > struct efi_handler *handler;
> > efi_status_t ret = EFI_SUCCESS;
> >
> > -  for (i = 0; i < count; i++) {
> > +  for (i = 0; i < *count; i++) {
> > u16 *p;
> > u16 dev_name[BOOTMENU_DEVICE_NAME_MAX];
> > char *optional_data;
> 

[PATCH] board: siemens: iot2050: Fix M.2 detection

2023-10-16 Thread Jan Kiszka
From: Jan Kiszka 

The "simpler" the logic, the higher the probability to not test and get
things wrong, again: The absence of a "-PG2" suffix is not sufficient to
derive that we are on PG1. There is also "IOT2050-ADVANCED-M2".

Finally fix that by exactly matching against the two PG1 device names.

While changing this, we can also drop the not really needed check for
!board_is_sr1 in board_is_m2 and call the boards by their names
("board_is_pg1").

Reported-and-tested-by: Bao Cheng Su 
Signed-off-by: Jan Kiszka 
---
 board/siemens/iot2050/board.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c
index e35e55fb5de..0b0686e2628 100644
--- a/board/siemens/iot2050/board.c
+++ b/board/siemens/iot2050/board.c
@@ -155,19 +155,20 @@ static bool board_is_advanced(void)
strstr((char *)info->name, "IOT2050-ADVANCED") != NULL;
 }
 
-static bool board_is_sr1(void)
+static bool board_is_pg1(void)
 {
struct iot2050_info *info = IOT2050_INFO_DATA;
 
return info->magic == IOT2050_INFO_MAGIC &&
-   strstr((char *)info->name, "-PG2") == NULL;
+   (strcmp((char *)info->name, "IOT2050-BASIC") == 0 ||
+strcmp((char *)info->name, "IOT2050-ADVANCED") == 0);
 }
 
 static bool board_is_m2(void)
 {
struct iot2050_info *info = IOT2050_INFO_DATA;
 
-   return !board_is_sr1() && info->magic == IOT2050_INFO_MAGIC &&
+   return info->magic == IOT2050_INFO_MAGIC &&
strcmp((char *)info->name, "IOT2050-ADVANCED-M2") == 0;
 }
 
@@ -217,14 +218,14 @@ void set_board_info_env(void)
}
 
if (board_is_advanced()) {
-   if (board_is_sr1())
+   if (board_is_pg1())
fdtfile = "ti/k3-am6548-iot2050-advanced.dtb";
else if(board_is_m2())
fdtfile = "ti/k3-am6548-iot2050-advanced-m2.dtb";
else
fdtfile = "ti/k3-am6548-iot2050-advanced-pg2.dtb";
} else {
-   if (board_is_sr1())
+   if (board_is_pg1())
fdtfile = "ti/k3-am6528-iot2050-basic.dtb";
else
fdtfile = "ti/k3-am6528-iot2050-basic-pg2.dtb";
-- 
2.35.3


RE: [PATCH] mmc: sdhci-cadence: Add support for Cadence sdmmc v6

2023-10-16 Thread KuanLim . Lee
Hi maintainers,

Could anyone of you help to review the patch?


> -Original Message-
> From: KuanLim.Lee 
> Sent: Tuesday, October 3, 2023 3:23 PM
> To: u-boot@lists.denx.de
> Cc: Yuklin Soo ; WeiLiang Lim
> ; Kuan Lim Lee
> ; KuanLim.Lee
> 
> Subject: [PATCH] mmc: sdhci-cadence: Add support for Cadence sdmmc v6
> 
> From: Kuan Lim Lee 
> 
> Cadence SDMMC v6 controller has a lot of changes on initialize compared to v4
> controller. PHY is needed by v6 controller.
> 
> Signed-off-by: Kuan Lim Lee 
> Reviewed-by: Alex Soo 
> Reviewed-by: Wei Liang Lim 
> ---
>  drivers/mmc/Kconfig  |  13 ++
>  drivers/mmc/Makefile |   1 +
>  drivers/mmc/sdhci-cadence.c  |  63 ++-
>  drivers/mmc/sdhci-cadence.h  |  68 +++
>  drivers/mmc/sdhci-cadence6-phy.c | 302
> +++
>  5 files changed, 396 insertions(+), 51 deletions(-)  create mode 100644
> drivers/mmc/sdhci-cadence.h  create mode 100644 drivers/mmc/sdhci-
> cadence6-phy.c
> 
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index
> de01b9687b..cec881d862 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -573,6 +573,19 @@ config MMC_SDHCI_CADENCE
> 
> If unsure, say N.
> 
> +config MMC_SDHCI_CADENCE_V6
> + bool "SDHCI support for the Cadence SD/SDIO/eMMC controller &
> driver version 6"
> + depends on BLK && DM_MMC
> + depends on MMC_SDHCI
> + depends on OF_CONTROL
> + select MMC_SDHCI_CADENCE
> + help
> +   This selects the Cadence SD/SDIO/eMMC driver version 6.
> +
> +   If you have a controller with this interface, say Y here.
> +
> +   If unsure, say N.
> +
>  config MMC_SDHCI_AM654
>   bool "SDHCI Controller on TI's Am654 devices"
>   depends on ARCH_K3
> diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile index
> 2c65c4765a..cdcce55b8b 100644
> --- a/drivers/mmc/Makefile
> +++ b/drivers/mmc/Makefile
> @@ -61,6 +61,7 @@ obj-$(CONFIG_MMC_SDHCI_ATMEL)   +=
> atmel_sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_BCM2835)  += bcm2835_sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_BCMSTB)   += bcmstb_sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_CADENCE)  += sdhci-cadence.o
> +obj-$(CONFIG_MMC_SDHCI_CADENCE_V6)   += sdhci-cadence6-phy.o
>  obj-$(CONFIG_MMC_SDHCI_AM654)+= am654_sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_IPROC)+= iproc_sdhci.o
>  obj-$(CONFIG_MMC_SDHCI_KONA) += kona_sdhci.o
> diff --git a/drivers/mmc/sdhci-cadence.c b/drivers/mmc/sdhci-cadence.c index
> 327a05ad11..d7a270e74c 100644
> --- a/drivers/mmc/sdhci-cadence.c
> +++ b/drivers/mmc/sdhci-cadence.c
> @@ -17,56 +17,7 @@
>  #include 
>  #include 
>  #include 
> -
> -/* HRS - Host Register Set (specific to Cadence) */
> -#define SDHCI_CDNS_HRS04 0x10/* PHY access port */
> -#define   SDHCI_CDNS_HRS04_ACK   BIT(26)
> -#define   SDHCI_CDNS_HRS04_RDBIT(25)
> -#define   SDHCI_CDNS_HRS04_WRBIT(24)
> -#define   SDHCI_CDNS_HRS04_RDATA GENMASK(23, 16)
> -#define   SDHCI_CDNS_HRS04_WDATA GENMASK(15, 8)
> -#define   SDHCI_CDNS_HRS04_ADDR  GENMASK(5, 0)
> -
> -#define SDHCI_CDNS_HRS06 0x18/* eMMC control */
> -#define   SDHCI_CDNS_HRS06_TUNE_UP   BIT(15)
> -#define   SDHCI_CDNS_HRS06_TUNE  GENMASK(13, 8)
> -#define   SDHCI_CDNS_HRS06_MODE  GENMASK(2, 0)
> -#define   SDHCI_CDNS_HRS06_MODE_SD   0x0
> -#define   SDHCI_CDNS_HRS06_MODE_MMC_SDR  0x2
> -#define   SDHCI_CDNS_HRS06_MODE_MMC_DDR  0x3
> -#define   SDHCI_CDNS_HRS06_MODE_MMC_HS2000x4
> -#define   SDHCI_CDNS_HRS06_MODE_MMC_HS4000x5
> -#define   SDHCI_CDNS_HRS06_MODE_MMC_HS400ES  0x6
> -
> -/* SRS - Slot Register Set (SDHCI-compatible) */
> -#define SDHCI_CDNS_SRS_BASE  0x200
> -
> -/* PHY */
> -#define SDHCI_CDNS_PHY_DLY_SD_HS 0x00
> -#define SDHCI_CDNS_PHY_DLY_SD_DEFAULT0x01
> -#define SDHCI_CDNS_PHY_DLY_UHS_SDR12 0x02
> -#define SDHCI_CDNS_PHY_DLY_UHS_SDR25 0x03
> -#define SDHCI_CDNS_PHY_DLY_UHS_SDR50 0x04
> -#define SDHCI_CDNS_PHY_DLY_UHS_DDR50 0x05
> -#define SDHCI_CDNS_PHY_DLY_EMMC_LEGACY   0x06
> -#define SDHCI_CDNS_PHY_DLY_EMMC_SDR  0x07
> -#define SDHCI_CDNS_PHY_DLY_EMMC_DDR  0x08
> -#define SDHCI_CDNS_PHY_DLY_SDCLK 0x0b
> -#define SDHCI_CDNS_PHY_DLY_HSMMC 0x0c
> -#define SDHCI_CDNS_PHY_DLY_STROBE0x0d
> -
> -/*
> - * The tuned val register is 6 bit-wide, but not the whole of the range is
> - * available.  The range 0-42 seems to be available (then 43 wraps around to 
> 0)
> - * but I am not quite sure if it is official.  Use only 0 to 39 for safety.
> - */
> -#define SDHCI_CDNS_MAX_TUNING_LOOP   40
> -
> -struct sdhci_cdns_plat {
> - struct mmc_config cfg;
> - struct mmc mmc;
> - void __iomem *hrs_addr;
> -};
> +#include "sdhci-cadence.h"
> 
>  struct 

RE: [PATCH] timer: starfive: Add Starfive timer support

2023-10-16 Thread KuanLim . Lee
Hi Simon,

Please be reminded that to give some review if it still has some issues.

> -Original Message-
> From: KuanLim.Lee
> Sent: Wednesday, October 4, 2023 5:49 PM
> To: 'Simon Glass' 
> Cc: u-boot@lists.denx.de; WeiLiang Lim 
> Subject: RE: [PATCH] timer: starfive: Add Starfive timer support
> 
> Hi Simon,
> 
> > -Original Message-
> > From: Simon Glass 
> > Sent: Wednesday, October 4, 2023 10:11 AM
> > To: KuanLim.Lee 
> > Cc: u-boot@lists.denx.de; WeiLiang Lim 
> > Subject: Re: [PATCH] timer: starfive: Add Starfive timer support
> >
> > On Tue, 19 Sept 2023 at 06:08, Kuan Lim Lee
> > 
> > wrote:
> > >
> > > Add timer driver in Starfive SoC. It is an timer that outside of CPU
> > > core and inside Starfive SoC.
> > >
> > > Signed-off-by: Kuan Lim Lee 
> > > Reviewed-by: Wei Liang Lim 
> > > ---
> > >  drivers/timer/Kconfig  |  7 +++
> > >  drivers/timer/Makefile |  1 +
> > >  drivers/timer/starfive-timer.c | 94
> > > ++
> > >  3 files changed, 102 insertions(+)
> > >  create mode 100644 drivers/timer/starfive-timer.c
> >
> > Reviewed-by: Simon Glass 
> >
> > nits below
> What are the nits?
> How do the nits to be solved?
> >
> > >
> > > diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index
> > > 915b2af160..a98be9dfae 100644
> > > --- a/drivers/timer/Kconfig
> > > +++ b/drivers/timer/Kconfig
> > > @@ -326,4 +326,11 @@ config XILINX_TIMER
> > >   Select this to enable support for the timer found on
> > >   any Xilinx boards (axi timer).
> > >
> > > +config STARFIVE_TIMER
> > > +   bool "Starfive timer support"
> > > +   depends on TIMER
> > > +   help
> > > + Select this to enable support for the timer found on
> > > + Starfive SoC.
> >
> > What resolution is the timer? How is it clocked? Is there only one channel?
> Timer will be driven by clock pulses from clocks. The clocks are defined in
> device tree.
> Four channels timer, each timer has own clock source.
> Clock source frequency is gotten by clk_get_by_index () and clk_get_rate().
> The timer counter register is a 32bits size register.
> >
> > > +
> > >  endmenu
> > > diff --git a/drivers/timer/Makefile b/drivers/timer/Makefile index
> > > 1ca74805fd..1ef814970b 100644
> > > --- a/drivers/timer/Makefile
> > > +++ b/drivers/timer/Makefile
> > > @@ -34,3 +34,4 @@ obj-$(CONFIG_MTK_TIMER)   += mtk_timer.o
> > >  obj-$(CONFIG_MCHP_PIT64B_TIMER)+= mchp-pit64b-timer.o
> > >  obj-$(CONFIG_IMX_GPT_TIMER)+= imx-gpt-timer.o
> > >  obj-$(CONFIG_XILINX_TIMER) += xilinx-timer.o
> > > +obj-$(CONFIG_STARFIVE_TIMER)   += starfive-timer.o
> > > diff --git a/drivers/timer/starfive-timer.c
> > > b/drivers/timer/starfive-timer.c new file mode 100644 index
> > > 00..816402fdbf
> > > --- /dev/null
> > > +++ b/drivers/timer/starfive-timer.c
> > > @@ -0,0 +1,94 @@
> > > +// SPDX-License-Identifier: GPL-2.0+
> > > +/*
> > > + * Copyright 2022 StarFive, Inc. All rights reserved.
> > > + *   Author: Lee Kuan Lim 
> > > + */
> > > +
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +
> > > +#defineSTF_TIMER_INT_STATUS0x00
> > > +#define STF_TIMER_CTL  0x04
> > > +#define STF_TIMER_LOAD 0x08
> > > +#define STF_TIMER_ENABLE   0x10
> > > +#define STF_TIMER_RELOAD   0x14
> > > +#define STF_TIMER_VALUE0x18
> > > +#define STF_TIMER_INT_CLR  0x20
> > > +#define STF_TIMER_INT_MASK 0x24
> > > +
> > > +struct starfive_timer_priv {
> > > +   void __iomem *base;
> > > +   u32 timer_size;
> > > +};
> > > +
> > > +static u64 notrace starfive_get_count(struct udevice *dev) {
> > > +   struct starfive_timer_priv *priv = dev_get_priv(dev);
> > > +
> > > +   /* Read decrement timer value and convert to increment value */
> > > +   return priv->timer_size - readl(priv->base +
> > > +STF_TIMER_VALUE); }
> >
> > As an enhancement, you could provide a timer_early_get_count()
> > function and an easly setup, so you can use bootstage.
> >
> Is this a must? If so, I must define some fixed address to get the timer 
> count,
> enable timer, clock source frequency because I can't get base address and
> frequency from the device tree in early stage.
> > > +
> > > +static const struct timer_ops starfive_ops = {
> > > +   .get_count = starfive_get_count, };
> > > +
> > > +static int starfive_probe(struct udevice *dev) {
> > > +   struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
> > > +   struct starfive_timer_priv *priv = dev_get_priv(dev);
> > > +   int timer_channel;
> > > +   struct clk clk;
> > > +   int ret;
> > > +
> > > +   priv->base = dev_read_addr_ptr(dev);
> > > +   if (IS_ERR(priv->base))
> >
> > if (!priv->base)
> > return -EINVAL
> >
> Noted.
> > > +   return PTR_ERR(priv->base);
> > > +
> > > +   

RE: [PATCH] spl: mmc: Resolve emmc not load image after switched hw partition

2023-10-16 Thread KuanLim . Lee
Hi maintainers,

Could anyone of you help to review the patch?

> -Original Message-
> From: KuanLim.Lee 
> Sent: Tuesday, October 3, 2023 12:17 PM
> To: u-boot@lists.denx.de
> Cc: Cheehong Ang ; WeiLiang Lim
> ; KuanLim.Lee
> 
> Subject: [PATCH] spl: mmc: Resolve emmc not load image after switched hw
> partition
> 
> When selecting MMCSD_MODE_EMMCBOOT as boot_mode, emmc do not
> load U-boot proper image after switched hardware partition.
> 
> Signed-off-by: Kuan Lim Lee 
> Reviewed-by: Chee Hong Ang 
> Reviewed-by: Wei Liang Lim 
> ---
>  common/spl/spl_mmc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index
> 20f687e138..dc8a45222b 100644
> --- a/common/spl/spl_mmc.c
> +++ b/common/spl/spl_mmc.c
> @@ -447,6 +447,9 @@ int spl_mmc_load(struct spl_image_info *spl_image,
> #endif
>   return err;
>   }
> + err = mmc_load_image_raw_sector(spl_image, bootdev, mmc,
> 0);
> + if (!err)
> + return err;
>   /* Fall through */
>   case MMCSD_MODE_RAW:
>   debug("spl: mmc boot mode: raw\n");
> --
> 2.34.1



Re: [PATCH 1/3] arm64: Use FEAT_HAFDBS to track dirty pages when available

2023-10-16 Thread Chris Packham
On Tue, Oct 17, 2023 at 12:21 AM Marc Zyngier  wrote:
>
> On Mon, 16 Oct 2023 02:42:08 +0100,
> Chris Packham  wrote:
> >
> > On Sun, Oct 15, 2023 at 10:29 AM Chris Packham  
> > wrote:
> > >
> > >
> > >
> > > On Sat, 14 Oct 2023, 11:04 am Marc Zyngier,  wrote:
> > >>
> > >> On 2023-10-13 03:40, Chris Packham wrote:
> > >> > Hi Marc, Paul,
> > >> >
> > >> > On Sat, Mar 18, 2023 at 5:23 AM Ying-Chun Liu (PaulLiu)
> > >> >  wrote:
> > >> >>
> > >> >> From: Marc Zyngier 
> > >> >>
> > >> >> Some recent arm64 cores have a facility that allows the page
> > >> >> table walker to track the dirty state of a page. This makes it
> > >> >> really efficient to perform CMOs by VA as we only need to look
> > >> >> at dirty pages.
> > >> >>
> > >> >> Signed-off-by: Marc Zyngier 
> > >> >> [ Paul: pick from the Android tree. Rebase to the upstream ]
> > >> >> Signed-off-by: Ying-Chun Liu (PaulLiu) 
> > >> >> Cc: Tom Rini 
> > >> >> Link:
> > >> >> https://android.googlesource.com/platform/external/u-boot/+/3c433724e6f830a6b2edd5ec3d4a504794887263
> > >> >
> > >> > I think this may have caused a regression for the Marvell AC5X
> > >> > board(s). I found that v2023.07 locked up at boot but v2023.01 was
> > >> > fine. The lockup seemed to be in the 'Net:' init probably just as the
> > >> > mvneta driver was being initialised.
> > >> >
> > >> > A git bisect led me to this change although for this specific change
> > >> > instead of the lockup I get a crash so maybe I'm actually hitting a
> > >> > different issue.
> > >> >
> > >> > Any thoughts as to why this may have caused problems?
> > >>
> > >> Not really. What CPUs does this platform have? What is the offending
> > >> driver doing to trigger the issue? Can you provide some level of
> > >> tracing?
> > >
> > >
> > > The Marvell AC5X is a network switch ASIC with an integrated ARMv8 CPU 
> > > (8.1 specifically I think).
> > >
> > > I think there is something that the mvneta driver is doing triggering the 
> > > issue. I have another AC5X based board without an Ethernet port that 
> > > boots just fine (this is also why I didn't notice earlier).
> > >
> > > I'll try and get some more debug out when I'm back in the office
> > >
> >
> > The thing the mvneta driver does that upsets things appears to be
> >
> > mmu_set_region_dcache_behaviour((phys_addr_t)bd_space, BD_SPACE,
> >   DCACHE_OFF);
> >
> > I can comment that line out and everything works.
>
> This leads to two questions:
>
> - is the device cache coherent, in which case it doesn't need the
>   memory being non-cacheable? If everything is OK, then why the switch
>   to device memory?

I'll be honest and say I understand less than 50% of that. The network
transfer does seem to work without the call so perhaps the device is
cache coherent but this seems to be a common thing in many drivers so
I'd assume that on such platforms this should be innocuous. It's
totally possible I haven't done a good job of setting up the CPU or
informing the rest of the system about it. I did just take a lot of
the code from the Marvell SDK and clean it up without really
understanding what most of it did.

>
> - what goes wrong when these attributes are applied? do we have to
>   split a block mapping?
>
> Instrumenting the MMU code would certainly help understanding what
> goes wrong here.

I did do that a little bit. At first I thought there was a possible
infinite loop in mmu_set_region_dcache_behaviour(). Squinting at
things you could naively say that if set_one_region() failed to find
an entry then it would loop forever but if that happened I'd have some
debug saying that it failed. Things seem to go south after
__asm_switch_ttbr(gd->arch.tlb_emerg) which did get me thinking that
perhaps the emergency tables aren't setup (or at least aren't set up
in a way that allows debug output). That's about as far as I got
debugging wise, I'll try and spend some more time digging into the MMU
code.

>
> Thanks,
>
> M.
>
> --
> Without deviation from the norm, progress is not possible.


[PATCH v2 6/6] spi: zynq_qspi: Add parallel memories support in QSPI driver

2023-10-16 Thread Venkatesh Yadav Abbarapu
Add support for parallel memories in zynq_qspi.c driver. In case of
parallel memories STRIPE bit is set and sent to the qspi ip, which will
send data bits to both the flashes in parallel. However for few commands
we should not use stripe, instead send same data to both the flashes.
Those commands are exclueded by using zynqmp_qspi_update_stripe().

Also update copyright info for this file.

Signed-off-by: Ashok Reddy Soma 
Signed-off-by: Venkatesh Yadav Abbarapu 
---
 drivers/spi/zynq_qspi.c | 140 
 include/spi.h   |   4 ++
 2 files changed, 131 insertions(+), 13 deletions(-)

diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c
index 069d2a77de..3471c301bf 100644
--- a/drivers/spi/zynq_qspi.c
+++ b/drivers/spi/zynq_qspi.c
@@ -1,7 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * (C) Copyright 2013 Xilinx, Inc.
+ * (C) Copyright 2013 - 2022, Xilinx, Inc.
  * (C) Copyright 2015 Jagan Teki 
+ * (C) Copyright 2023, Advanced Micro Devices, Inc.
  *
  * Xilinx Zynq Quad-SPI(QSPI) controller driver (master mode only)
  */
@@ -13,10 +14,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include "../mtd/spi/sf_internal.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -42,6 +45,22 @@ DECLARE_GLOBAL_DATA_PTR;
 #define ZYNQ_QSPI_TXD_00_01_OFFSET 0x80/* Transmit 1-byte inst */
 #define ZYNQ_QSPI_TXD_00_10_OFFSET 0x84/* Transmit 2-byte inst */
 #define ZYNQ_QSPI_TXD_00_11_OFFSET 0x88/* Transmit 3-byte inst */
+#define ZYNQ_QSPI_FR_QOUT_CODE 0x6B/* read instruction code */
+#define ZYNQ_QSPI_FR_DUALIO_CODE   0xBB
+
+#define QSPI_SELECT_LOWER_CS   BIT(0)
+#define QSPI_SELECT_UPPER_CS   BIT(1)
+
+/*
+ * QSPI Linear Configuration Register
+ *
+ * It is named Linear Configuration but it controls other modes when not in
+ * linear mode also.
+ */
+#define ZYNQ_QSPI_LCFG_TWO_MEM_MASK0x4000 /* QSPI Enable Bit Mask */
+#define ZYNQ_QSPI_LCFG_SEP_BUS_MASK0x2000 /* QSPI Enable Bit Mask */
+#define ZYNQ_QSPI_LCFG_U_PAGE  0x1000 /* QSPI Upper memory set */
+#define ZYNQ_QSPI_LCFG_DUMMY_SHIFT 8
 
 #define ZYNQ_QSPI_TXFIFO_THRESHOLD 1   /* Tx FIFO threshold level*/
 #define ZYNQ_QSPI_RXFIFO_THRESHOLD 32  /* Rx FIFO threshold level */
@@ -101,7 +120,12 @@ struct zynq_qspi_priv {
int bytes_to_transfer;
int bytes_to_receive;
unsigned int is_inst;
+   unsigned int is_parallel;
+   unsigned int is_stacked;
+   unsigned int is_dio;
+   unsigned int u_page;
unsigned cs_change:1;
+   unsigned is_strip:1;
 };
 
 static int zynq_qspi_of_to_plat(struct udevice *bus)
@@ -112,7 +136,6 @@ static int zynq_qspi_of_to_plat(struct udevice *bus)
 
plat->regs = (struct zynq_qspi_regs *)fdtdec_get_addr(blob,
  node, "reg");
-
return 0;
 }
 
@@ -147,6 +170,9 @@ static void zynq_qspi_init_hw(struct zynq_qspi_priv *priv)
/* Disable Interrupts */
writel(ZYNQ_QSPI_IXR_ALL_MASK, >idr);
 
+   /* Disable linear mode as the boot loader may have used it */
+   writel(0x0, >lqspicfg);
+
/* Clear the TX and RX threshold reg */
writel(ZYNQ_QSPI_TXFIFO_THRESHOLD, >txftr);
writel(ZYNQ_QSPI_RXFIFO_THRESHOLD, >rxftr);
@@ -164,12 +190,11 @@ static void zynq_qspi_init_hw(struct zynq_qspi_priv *priv)
confr |= ZYNQ_QSPI_CR_IFMODE_MASK | ZYNQ_QSPI_CR_MCS_MASK |
ZYNQ_QSPI_CR_PCS_MASK | ZYNQ_QSPI_CR_FW_MASK |
ZYNQ_QSPI_CR_MSTREN_MASK;
-   writel(confr, >cr);
 
-   /* Disable the LQSPI feature */
-   confr = readl(>lqspicfg);
-   confr &= ~ZYNQ_QSPI_LQSPICFG_LQMODE_MASK;
-   writel(confr, >lqspicfg);
+   if (priv->is_stacked)
+   confr |= 0x10;
+
+   writel(confr, >cr);
 
/* Enable SPI */
writel(ZYNQ_QSPI_ENR_SPI_EN_MASK, >enr);
@@ -180,6 +205,8 @@ static int zynq_qspi_child_pre_probe(struct udevice *bus)
struct spi_slave *slave = dev_get_parent_priv(bus);
struct zynq_qspi_priv *priv = dev_get_priv(bus->parent);
 
+   slave->multi_cs_cap = true;
+   slave->dio = priv->is_dio;
priv->max_hz = slave->max_hz;
 
return 0;
@@ -363,8 +390,8 @@ static void zynq_qspi_fill_tx_fifo(struct zynq_qspi_priv 
*priv, u32 size)
unsigned len, offset;
struct zynq_qspi_regs *regs = priv->regs;
static const unsigned offsets[4] = {
-   ZYNQ_QSPI_TXD_00_00_OFFSET, ZYNQ_QSPI_TXD_00_01_OFFSET,
-   ZYNQ_QSPI_TXD_00_10_OFFSET, ZYNQ_QSPI_TXD_00_11_OFFSET };
+   ZYNQ_QSPI_TXD_00_01_OFFSET, ZYNQ_QSPI_TXD_00_10_OFFSET,
+   ZYNQ_QSPI_TXD_00_11_OFFSET, ZYNQ_QSPI_TXD_00_00_OFFSET };
 
while ((fifocount < size) &&
(priv->bytes_to_transfer > 0)) {
@@ -386,7 +413,11 @@ static void zynq_qspi_fill_tx_fifo(struct 

[PATCH v2 4/6] spi: spi-uclass: Read chipselect and restrict capabilities

2023-10-16 Thread Venkatesh Yadav Abbarapu
From: Ashok Reddy Soma 

Read chipselect properties from DT which are populated using 'reg'
property and save it in plat->cs[] array for later use.

Also read multi chipselect capability which is used for
parallel-memories and return errors if they are passed on using DT but
driver is not capable of handling it.

Signed-off-by: Ashok Reddy Soma 
Signed-off-by: Venkatesh Yadav Abbarapu 
---
 drivers/mtd/spi/sandbox.c|  2 +-
 drivers/spi/altera_spi.c |  4 ++--
 drivers/spi/atcspi200_spi.c  |  2 +-
 drivers/spi/atmel_spi.c  |  6 +++---
 drivers/spi/bcm63xx_hsspi.c  | 42 ++--
 drivers/spi/bcm63xx_spi.c|  6 +++---
 drivers/spi/bcmbca_hsspi.c   | 34 ++---
 drivers/spi/cf_spi.c |  6 +++---
 drivers/spi/davinci_spi.c|  4 ++--
 drivers/spi/fsl_dspi.c   | 18 
 drivers/spi/fsl_espi.c   |  4 ++--
 drivers/spi/fsl_qspi.c   |  4 ++--
 drivers/spi/mpc8xxx_spi.c| 10 -
 drivers/spi/mscc_bb_spi.c|  4 ++--
 drivers/spi/mxc_spi.c|  6 +++---
 drivers/spi/npcm_fiu_spi.c   | 14 ++--
 drivers/spi/nxp_fspi.c   |  2 +-
 drivers/spi/omap3_spi.c  |  4 ++--
 drivers/spi/pic32_spi.c  |  2 +-
 drivers/spi/rk_spi.c |  4 ++--
 drivers/spi/rockchip_sfc.c   |  2 +-
 drivers/spi/spi-aspeed-smc.c | 28 
 drivers/spi/spi-mxic.c   |  6 +++---
 drivers/spi/spi-qup.c|  4 ++--
 drivers/spi/spi-sifive.c |  6 +++---
 drivers/spi/spi-sn-f-ospi.c  |  2 +-
 drivers/spi/spi-sunxi.c  |  6 +++---
 drivers/spi/spi-synquacer.c  |  4 ++--
 drivers/spi/spi-uclass.c | 21 +-
 drivers/spi/stm32_qspi.c |  2 +-
 drivers/spi/stm32_spi.c  |  4 ++--
 drivers/spi/ti_qspi.c| 14 ++--
 drivers/spi/xilinx_spi.c |  4 ++--
 drivers/spi/zynq_qspi.c  |  6 +++---
 drivers/spi/zynq_spi.c   |  6 +++---
 include/spi.h|  2 +-
 lib/acpi/acpi_device.c   |  2 +-
 37 files changed, 154 insertions(+), 143 deletions(-)

diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c
index 4fe547171a..72036d5a88 100644
--- a/drivers/mtd/spi/sandbox.c
+++ b/drivers/mtd/spi/sandbox.c
@@ -139,7 +139,7 @@ static int sandbox_sf_probe(struct udevice *dev)
return ret;
}
slave_plat = dev_get_parent_plat(dev);
-   cs = slave_plat->cs;
+   cs = slave_plat->cs[0];
debug("found at cs %d\n", cs);
 
if (!pdata->filename) {
diff --git a/drivers/spi/altera_spi.c b/drivers/spi/altera_spi.c
index 989679e881..48782f81c1 100644
--- a/drivers/spi/altera_spi.c
+++ b/drivers/spi/altera_spi.c
@@ -96,7 +96,7 @@ static int altera_spi_xfer(struct udevice *dev, unsigned int 
bitlen,
uint32_t reg, data, start;
 
debug("%s: bus:%i cs:%i bitlen:%i bytes:%i flags:%lx\n", __func__,
- dev_seq(bus), slave_plat->cs, bitlen, bytes, flags);
+ dev_seq(bus), slave_plat->cs[0], bitlen, bytes, flags);
 
if (bitlen == 0)
goto done;
@@ -111,7 +111,7 @@ static int altera_spi_xfer(struct udevice *dev, unsigned 
int bitlen,
readl(>rxdata);
 
if (flags & SPI_XFER_BEGIN)
-   spi_cs_activate(dev, slave_plat->cs);
+   spi_cs_activate(dev, slave_plat->cs[0]);
 
while (bytes--) {
if (txp)
diff --git a/drivers/spi/atcspi200_spi.c b/drivers/spi/atcspi200_spi.c
index de9c14837c..acee743653 100644
--- a/drivers/spi/atcspi200_spi.c
+++ b/drivers/spi/atcspi200_spi.c
@@ -321,7 +321,7 @@ static int atcspi200_spi_claim_bus(struct udevice *dev)
struct udevice *bus = dev->parent;
struct nds_spi_slave *ns = dev_get_priv(bus);
 
-   if (slave_plat->cs >= ns->num_cs) {
+   if (slave_plat->cs[0] >= ns->num_cs) {
printf("Invalid SPI chipselect\n");
return -EINVAL;
}
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index aec6f4eca9..e2de39d1ef 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -126,7 +126,7 @@ static int atmel_spi_claim_bus(struct udevice *dev)
struct atmel_spi_priv *priv = dev_get_priv(bus);
struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
struct at91_spi *reg_base = bus_plat->regs;
-   u32 cs = slave_plat->cs;
+   u32 cs = slave_plat->cs[0];
u32 freq = priv->freq;
u32 scbr, csrx, mode;
 
@@ -175,7 +175,7 @@ static void atmel_spi_cs_activate(struct udevice *dev)
struct udevice *bus = dev_get_parent(dev);
struct atmel_spi_priv *priv = dev_get_priv(bus);
struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
-   u32 cs = slave_plat->cs;
+   u32 cs = slave_plat->cs[0];
 
if (!dm_gpio_is_valid(>cs_gpios[cs]))
return;
@@ -190,7 +190,7 @@ static void atmel_spi_cs_deactivate(struct udevice *dev)
struct udevice *bus = dev_get_parent(dev);

[PATCH v2 5/6] spi: zynqmp_gqspi: Add parallel memories support in GQSPI driver

2023-10-16 Thread Venkatesh Yadav Abbarapu
Add support for parallel memories in zynqmp_gqspi.c driver. In case of
parallel memories STRIPE bit is set and sent to the qspi ip, which will
send data bits to both the flashes in parallel. However for few commands
we should not use stripe, instead send same data to both the flashes.
Those commands are exclueded by using zynqmp_qspi_update_stripe().

Also update copyright info for this file.

Signed-off-by: Ashok Reddy Soma 
Signed-off-by: Venkatesh Yadav Abbarapu 
---
 drivers/spi/zynqmp_gqspi.c | 142 -
 include/spi.h  |  12 
 2 files changed, 138 insertions(+), 16 deletions(-)

diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c
index ec59ef5804..620b5e4fc7 100644
--- a/drivers/spi/zynqmp_gqspi.c
+++ b/drivers/spi/zynqmp_gqspi.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * (C) Copyright 2018 Xilinx
+ * (C) Copyright 2013 - 2022, Xilinx, Inc.
+ * (C) Copyright 2023, Advanced Micro Devices, Inc.
  *
  * Xilinx ZynqMP Generic Quad-SPI(QSPI) controller driver(master mode only)
  */
@@ -23,6 +24,8 @@
 #include 
 #include 
 #include 
+#include 
+#include "../mtd/spi/sf_internal.h"
 #include 
 
 #define GQSPI_GFIFO_STRT_MODE_MASK BIT(29)
@@ -86,6 +89,9 @@
 #define SPI_XFER_ON_LOWER  1
 #define SPI_XFER_ON_UPPER  2
 
+#define GQSPI_SELECT_LOWER_CS  BIT(0)
+#define GQSPI_SELECT_UPPER_CS  BIT(1)
+
 #define GQSPI_DMA_ALIGN0x4
 #define GQSPI_MAX_BAUD_RATE_VAL7
 #define GQSPI_DFLT_BAUD_RATE_VAL   2
@@ -181,13 +187,14 @@ struct zynqmp_qspi_priv {
int bytes_to_transfer;
int bytes_to_receive;
const struct spi_mem_op *op;
+   unsigned int is_parallel;
+   unsigned int u_page;
+   unsigned int bus;
+   unsigned int stripe;
+   unsigned int flags;
+   u32 max_hz;
 };
 
-__weak int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 
value)
-{
-   return 0;
-}
-
 static int zynqmp_qspi_of_to_plat(struct udevice *bus)
 {
struct zynqmp_qspi_plat *plat = dev_get_plat(bus);
@@ -234,9 +241,30 @@ static u32 zynqmp_qspi_bus_select(struct zynqmp_qspi_priv 
*priv)
 {
u32 gqspi_fifo_reg = 0;
 
-   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS |
-GQSPI_GFIFO_CS_LOWER;
-
+   if (priv->is_parallel) {
+   if (priv->bus == SPI_XFER_ON_BOTH)
+   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS |
+GQSPI_GFIFO_UP_BUS |
+GQSPI_GFIFO_CS_UPPER |
+GQSPI_GFIFO_CS_LOWER;
+   else if (priv->bus == SPI_XFER_ON_LOWER)
+   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS |
+GQSPI_GFIFO_CS_UPPER |
+GQSPI_GFIFO_CS_LOWER;
+   else if (priv->bus == SPI_XFER_ON_UPPER)
+   gqspi_fifo_reg = GQSPI_GFIFO_UP_BUS |
+GQSPI_GFIFO_CS_LOWER |
+GQSPI_GFIFO_CS_UPPER;
+   else
+   debug("Wrong Bus selection:0x%x\n", priv->bus);
+   } else {
+   if (priv->u_page)
+   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS |
+GQSPI_GFIFO_CS_UPPER;
+   else
+   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS |
+GQSPI_GFIFO_CS_LOWER;
+   }
return gqspi_fifo_reg;
 }
 
@@ -291,7 +319,13 @@ static void zynqmp_qspi_chipselect(struct zynqmp_qspi_priv 
*priv, int is_on)
gqspi_fifo_reg |= GQSPI_SPI_MODE_SPI |
  GQSPI_IMD_DATA_CS_ASSERT;
} else {
-   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS;
+   if (priv->is_parallel)
+   gqspi_fifo_reg = GQSPI_GFIFO_UP_BUS |
+GQSPI_GFIFO_LOW_BUS;
+   else if (priv->u_page)
+   gqspi_fifo_reg = GQSPI_GFIFO_UP_BUS;
+   else
+   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS;
gqspi_fifo_reg |= GQSPI_IMD_DATA_CS_DEASSERT;
}
 
@@ -362,13 +396,16 @@ static int zynqmp_qspi_set_speed(struct udevice *bus, 
uint speed)
u32 confr;
u8 baud_rate_val = 0;
 
-   debug("%s\n", __func__);
-   if (speed > plat->frequency)
-   speed = plat->frequency;
+   /*
+* If speed == 0 or speed > max freq, then set speed to highest
+*/
+   if (!speed || speed > priv->max_hz)
+   speed = priv->max_hz;
+
+   debug("%s %d\n", __func__, speed);
+
 
if (plat->speed_hz != speed) {
-   /* Set the clock frequency */
-   /* If speed == 0, default to lowest speed */
while 

[PATCH v2 3/6] mtd: spi-nor: Add parallel and stacked memories support in read_bar and write_bar

2023-10-16 Thread Venkatesh Yadav Abbarapu
From: Ashok Reddy Soma 

Add support for parallel memories and stacked memories configuration
in read_bar and write_bar functions.

Signed-off-by: Ashok Reddy Soma 
Signed-off-by: Venkatesh Yadav Abbarapu 
---
 drivers/mtd/spi/spi-nor-core.c | 55 +-
 1 file changed, 47 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 373979d19b..264aa6080b 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -885,12 +885,32 @@ static int clean_bar(struct spi_nor *nor)
 
 static int write_bar(struct spi_nor *nor, u32 offset)
 {
-   u8 cmd, bank_sel;
+   u8 cmd, bank_sel, upage_curr;
int ret;
+   struct mtd_info *mtd = >mtd;
+
+   /* Wait until previous write command is finished */
+   if (spi_nor_wait_till_ready(nor))
+   return 1;
+
+   if (nor->flags & (SNOR_F_HAS_PARALLEL | SNOR_F_HAS_STACKED) &&
+   mtd->size <= SZ_32M)
+   return 0;
+
+   if (mtd->size <= SZ_16M)
+   return 0;
+
+   offset = offset % (u32)mtd->size;
+   bank_sel = offset >> 24;
 
-   bank_sel = offset / SZ_16M;
-   if (bank_sel == nor->bank_curr)
-   goto bar_end;
+   upage_curr = nor->spi->flags & SPI_XFER_U_PAGE;
+
+   if (!(nor->flags & SNOR_F_HAS_STACKED) && bank_sel == nor->bank_curr)
+   return 0;
+   else if (upage_curr == nor->upage_prev && bank_sel == nor->bank_curr)
+   return 0;
+   else
+   nor->upage_prev = upage_curr;
 
cmd = nor->bank_write_cmd;
write_enable(nor);
@@ -900,15 +920,19 @@ static int write_bar(struct spi_nor *nor, u32 offset)
return ret;
}
 
-bar_end:
nor->bank_curr = bank_sel;
-   return nor->bank_curr;
+
+   return write_disable(nor);
 }
 
 static int read_bar(struct spi_nor *nor, const struct flash_info *info)
 {
u8 curr_bank = 0;
int ret;
+   struct mtd_info *mtd = >mtd;
+
+   if (mtd->size <= SZ_16M)
+   return 0;
 
switch (JEDEC_MFR(info)) {
case SNOR_MFR_SPANSION:
@@ -920,15 +944,30 @@ static int read_bar(struct spi_nor *nor, const struct 
flash_info *info)
nor->bank_write_cmd = SPINOR_OP_WREAR;
}
 
+   if (nor->flags & SNOR_F_HAS_PARALLEL)
+   nor->spi->flags |= SPI_XFER_LOWER;
+
ret = nor->read_reg(nor, nor->bank_read_cmd,
-   _bank, 1);
+   _bank, 1);
if (ret) {
debug("SF: fail to read bank addr register\n");
return ret;
}
nor->bank_curr = curr_bank;
 
-   return 0;
+   // Make sure both chips use the same BAR
+   if (nor->flags & SNOR_F_HAS_PARALLEL) {
+   write_enable(nor);
+   ret = nor->write_reg(nor, nor->bank_write_cmd, _bank, 1);
+   if (ret)
+   return ret;
+
+   ret = write_disable(nor);
+   if (ret)
+   return ret;
+   }
+
+   return ret;
 }
 #endif
 
-- 
2.17.1



[PATCH v2 2/6] mtd: spi-nor: Add parallel memories support for read_sr and read_fsr

2023-10-16 Thread Venkatesh Yadav Abbarapu
From: Ashok Reddy Soma 

Add support for parallel memories flash configuration in read status
register and read flag status register functions.

Signed-off-by: Ashok Reddy Soma 
Signed-off-by: Venkatesh Yadav Abbarapu 
---
 drivers/mtd/spi/spi-nor-core.c | 50 --
 1 file changed, 36 insertions(+), 14 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index b2e5494e78..373979d19b 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -438,8 +438,9 @@ static ssize_t spi_nor_write_data(struct spi_nor *nor, 
loff_t to, size_t len,
 }
 
 /*
- * Read the status register, returning its value in the location
- * Return the status register value.
+ * Return the status register value. If the chip is parallel, then the
+ * read will be striped, so we should read 2 bytes to get the sr
+ * register value from both of the parallel chips.
  * Returns negative if error occurred.
  */
 static int read_sr(struct spi_nor *nor)
@@ -471,18 +472,29 @@ static int read_sr(struct spi_nor *nor)
if (spi_nor_protocol_is_dtr(nor->reg_proto))
op.data.nbytes = 2;
 
-   ret = spi_nor_read_write_reg(nor, , val);
-   if (ret < 0) {
-   pr_debug("error %d reading SR\n", (int)ret);
-   return ret;
+   if (nor->flags & SNOR_F_HAS_PARALLEL) {
+   op.data.nbytes = 2;
+   ret = spi_nor_read_write_reg(nor, , [0]);
+   if (ret < 0) {
+   pr_debug("error %d reading SR\n", (int)ret);
+   return ret;
+   }
+   val[0] |= val[1];
+   } else {
+   ret = spi_nor_read_write_reg(nor, , [0]);
+   if (ret < 0) {
+   pr_debug("error %d reading SR\n", (int)ret);
+   return ret;
+   }
}
 
-   return *val;
+   return val[0];
 }
 
 /*
- * Read the flag status register, returning its value in the location
- * Return the status register value.
+ * Return the flag status register value. If the chip is parallel, then
+ * the read will be striped, so we should read 2 bytes to get the fsr
+ * register value from both of the parallel chips.
  * Returns negative if error occurred.
  */
 static int read_fsr(struct spi_nor *nor)
@@ -514,13 +526,23 @@ static int read_fsr(struct spi_nor *nor)
if (spi_nor_protocol_is_dtr(nor->reg_proto))
op.data.nbytes = 2;
 
-   ret = spi_nor_read_write_reg(nor, , val);
-   if (ret < 0) {
-   pr_debug("error %d reading FSR\n", ret);
-   return ret;
+   if (nor->flags & SNOR_F_HAS_PARALLEL) {
+   op.data.nbytes = 2;
+   ret = spi_nor_read_write_reg(nor, , [0]);
+   if (ret < 0) {
+   pr_debug("error %d reading SR\n", (int)ret);
+   return ret;
+   }
+   val[0] &= val[1];
+   } else {
+   ret = spi_nor_read_write_reg(nor, , [0]);
+   if (ret < 0) {
+   pr_debug("error %d reading FSR\n", ret);
+   return ret;
+   }
}
 
-   return *val;
+   return val[0];
 }
 
 /*
-- 
2.17.1



[PATCH v2 1/6] mtd: spi-nor: Add parallel and stacked memories support

2023-10-16 Thread Venkatesh Yadav Abbarapu
From: Ashok Reddy Soma 

In parallel mode, the current implementation assumes that a maximum of
two flashes are connected. The QSPI controller splits the data evenly
between both the flashes so, both the flashes that are connected in
parallel mode should be identical.
During each operation SPI-NOR sets 0th bit for CS0 & 1st bit for CS1 in
nor->flags.

In stacked mode the current implementation assumes that a maximum of two
flashes are connected and both the flashes are of same make but can
differ in sizes. So, except the sizes all other flash parameters of both
the flashes are identical

Spi-nor will pass on the appropriate flash select flag to low level
driver, and it will select pass all the data to that particular flash.

Write operation in parallel mode are performed in page size * 2 chunks as
each write operation results in writing both the flashes. For doubling
the address space each operation is performed at addr/2 flash offset,
where addr is the address specified by the user.

Similarly for read and erase operations it will read from both flashes,
so size and offset are divided by 2 and send to flash.

Signed-off-by: Ashok Reddy Soma 
Signed-off-by: Venkatesh Yadav Abbarapu 
---
 drivers/mtd/spi/spi-nor-core.c | 280 +
 include/linux/mtd/spi-nor.h|  13 ++
 include/spi.h  |  12 ++
 3 files changed, 277 insertions(+), 28 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index db20feb4da..b2e5494e78 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -639,12 +639,17 @@ static u8 spi_nor_convert_3to4_erase(u8 opcode)
 static void spi_nor_set_4byte_opcodes(struct spi_nor *nor,
  const struct flash_info *info)
 {
+   bool shift = 0;
+
+   if (nor->flags & SNOR_F_HAS_PARALLEL)
+   shift = 1;
+
/* Do some manufacturer fixups first */
switch (JEDEC_MFR(info)) {
case SNOR_MFR_SPANSION:
/* No small sector erase for 4-byte command set */
nor->erase_opcode = SPINOR_OP_SE;
-   nor->mtd.erasesize = info->sector_size;
+   nor->mtd.erasesize = info->sector_size << shift;
break;
 
default:
@@ -965,8 +970,8 @@ static int spi_nor_erase_sector(struct spi_nor *nor, u32 
addr)
 static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
 {
struct spi_nor *nor = mtd_to_spi_nor(mtd);
+   u32 addr, len, rem, offset;
bool addr_known = false;
-   u32 addr, len, rem;
int ret, err;
 
dev_dbg(nor->dev, "at 0x%llx, len %lld\n", (long long)instr->addr,
@@ -991,6 +996,19 @@ static int spi_nor_erase(struct mtd_info *mtd, struct 
erase_info *instr)
ret = -EINTR;
goto erase_err;
}
+
+   offset = addr;
+   if (nor->flags & SNOR_F_HAS_PARALLEL)
+   offset /= 2;
+
+   if (nor->flags & SNOR_F_HAS_STACKED) {
+   if (offset >= (mtd->size / 2)) {
+   offset = offset - (mtd->size / 2);
+   nor->spi->flags |= SPI_XFER_U_PAGE;
+   } else {
+   nor->spi->flags &= ~SPI_XFER_U_PAGE;
+   }
+   }
 #ifdef CONFIG_SPI_FLASH_BAR
ret = write_bar(nor, addr);
if (ret < 0)
@@ -1394,6 +1412,9 @@ static const struct flash_info *spi_nor_read_id(struct 
spi_nor *nor)
u8  id[SPI_NOR_MAX_ID_LEN];
const struct flash_info *info;
 
+   if (nor->flags & SNOR_F_HAS_PARALLEL)
+   nor->spi->flags |= SPI_XFER_LOWER;
+
tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN);
if (tmp < 0) {
dev_dbg(nor->dev, "error %d reading JEDEC ID\n", tmp);
@@ -1418,28 +1439,57 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t 
from, size_t len,
 {
struct spi_nor *nor = mtd_to_spi_nor(mtd);
int ret;
+   u32 offset = from;
+   u32 stack_shift = 0;
+   u32 read_len = 0;
+   u32 rem_bank_len = 0;
+   u8 bank;
+   u8 is_ofst_odd = 0;
 
dev_dbg(nor->dev, "from 0x%08x, len %zd\n", (u32)from, len);
 
-   while (len) {
-   loff_t addr = from;
-   size_t read_len = len;
+   if ((nor->flags & SNOR_F_HAS_PARALLEL) && (offset & 1)) {
+   /* We can hit this case when we use file system like ubifs */
+   from = (loff_t)(from - 1);
+   len = (size_t)(len + 1);
+   is_ofst_odd = 1;
+   }
 
-#ifdef CONFIG_SPI_FLASH_BAR
-   u32 remain_len;
+   while (len) {
+   if (nor->addr_width == 3) {
+   if (nor->flags & SNOR_F_HAS_PARALLEL) {
+   bank = (u32)from / (SZ_16M << 0x01);

[PATCH v2 0/6] spi-nor: Add parallel and stacked memories support

2023-10-16 Thread Venkatesh Yadav Abbarapu
This series adds support for Xilinx qspi parallel and stacked memeories.

In parallel mode, the current implementation assumes that a maximum of
two flashes are connected. The QSPI controller splits the data evenly
between both the flashes so, both the flashes that are connected in
parallel mode should be identical.
During each operation SPI-NOR sets 0th bit for CS0 & 1st bit for CS1 in
nor->flags.

In stacked mode the current implementation assumes that a maximum of two
flashes are connected and both the flashes are of same make but can differ
in sizes. So, except the sizes all other flash parameters of both the flashes
are identical.

Spi-nor will pass on the appropriate flash select flag to low level driver,
and it will select pass all the data to that particular flash.

Write operation in parallel mode are performed in page size * 2 chunks as each
write operation results in writing both the flashes. For doubling the address
space each operation is performed at addr/2 flash offset, where addr is the
address specified by the user.

Similarly for read and erase operations it will read from both flashes, so size
and offset are divided by 2 and send to flash.

Changes in v2:
- Fixed the compilation issues.

Ashok Reddy Soma (4):
  mtd: spi-nor: Add parallel and stacked memories support
  mtd: spi-nor: Add parallel memories support for read_sr and read_fsr
  mtd: spi-nor: Add parallel and stacked memories support in read_bar
and write_bar
  spi: spi-uclass: Read chipselect and restrict capabilities

Venkatesh Yadav Abbarapu (2):
  spi: zynqmp_gqspi: Add parallel memories support in GQSPI driver
  spi: zynq_qspi: Add parallel memories support in QSPI driver

 drivers/mtd/spi/spi-nor-core.c | 385 -
 drivers/spi/altera_spi.c   |   4 +-
 drivers/spi/atcspi200_spi.c|   2 +-
 drivers/spi/atmel_spi.c|   6 +-
 drivers/spi/bcm63xx_hsspi.c|  42 ++--
 drivers/spi/bcm63xx_spi.c  |   6 +-
 drivers/spi/bcmbca_hsspi.c |  34 +--
 drivers/spi/cf_spi.c   |   6 +-
 drivers/spi/davinci_spi.c  |   4 +-
 drivers/spi/fsl_dspi.c |  18 +-
 drivers/spi/fsl_espi.c |   4 +-
 drivers/spi/fsl_qspi.c |   4 +-
 drivers/spi/mpc8xxx_spi.c  |  10 +-
 drivers/spi/mscc_bb_spi.c  |   4 +-
 drivers/spi/mxc_spi.c  |   6 +-
 drivers/spi/npcm_fiu_spi.c |  14 +-
 drivers/spi/nxp_fspi.c |   2 +-
 drivers/spi/omap3_spi.c|   4 +-
 drivers/spi/pic32_spi.c|   2 +-
 drivers/spi/rk_spi.c   |   4 +-
 drivers/spi/rockchip_sfc.c |   2 +-
 drivers/spi/spi-aspeed-smc.c   |  28 +--
 drivers/spi/spi-mxic.c |   6 +-
 drivers/spi/spi-qup.c  |   4 +-
 drivers/spi/spi-sifive.c   |   6 +-
 drivers/spi/spi-sn-f-ospi.c|   2 +-
 drivers/spi/spi-sunxi.c|   6 +-
 drivers/spi/spi-synquacer.c|   4 +-
 drivers/spi/spi-uclass.c   |  21 +-
 drivers/spi/stm32_qspi.c   |   2 +-
 drivers/spi/stm32_spi.c|   4 +-
 drivers/spi/ti_qspi.c  |  14 +-
 drivers/spi/xilinx_spi.c   |   4 +-
 drivers/spi/zynq_qspi.c| 146 +++--
 drivers/spi/zynq_spi.c |   6 +-
 drivers/spi/zynqmp_gqspi.c | 142 ++--
 include/linux/mtd/spi-nor.h|  13 ++
 include/spi.h  |  30 ++-
 38 files changed, 781 insertions(+), 220 deletions(-)

-- 
2.17.1



[PATCH] arm64: zynqmp: Introduce kria SOM defconfig

2023-10-16 Thread Venkatesh Yadav Abbarapu
Enable the initial kria SOM specific configurations like pinctrl,
pinconf etc. Also add the environment file. 

Signed-off-by: Venkatesh Yadav Abbarapu 
---
 board/xilinx/zynqmp/zynqmp_kria.env  |  71 +
 configs/xilinx_zynqmp_kria_defconfig | 230 +++
 2 files changed, 301 insertions(+)
 create mode 100644 board/xilinx/zynqmp/zynqmp_kria.env
 create mode 100644 configs/xilinx_zynqmp_kria_defconfig

diff --git a/board/xilinx/zynqmp/zynqmp_kria.env 
b/board/xilinx/zynqmp/zynqmp_kria.env
new file mode 100644
index 00..916ac2df14
--- /dev/null
+++ b/board/xilinx/zynqmp/zynqmp_kria.env
@@ -0,0 +1,71 @@
+autoload=no
+baudrate=115200
+boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} 
${prefix}${script}; source ${scriptaddr}
+boot_efi_binary=if fdt addr ${fdt_addr_r}; then bootefi bootmgr 
${fdt_addr_r};else bootefi bootmgr ${fdtcontroladdr};fi;load ${devtype} 
${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootaa64.efi; if fdt 
addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi 
${kernel_addr_r} ${fdtcontroladdr};fi
+boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any 
${scriptaddr} ${prefix}${boot_syslinux_conf}
+boot_net_usb_start=usb start
+boot_prefixes=/ /boot/
+boot_script_dhcp=boot.scr.uimg
+boot_scripts=boot.scr.uimg boot.scr
+boot_syslinux_conf=extlinux/extlinux.conf
+bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} 
${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile 
${fdtfile}; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch 
${bootp_arch};setenv bootp_vci PXEClient:Arch:00011:UNDI:003000;setenv 
bootp_arch 0xb;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} 
dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} 
${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv 
bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv 
efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci;
+bootcmd_jtag=echo JTAG: Trying to boot script at ${scriptaddr} && source 
${scriptaddr}; echo JTAG: SCRIPT FAILED: continuing...;
+bootcmd_mmc0=devnum=0; run mmc_boot
+bootcmd_mmc1=devnum=1; run mmc_boot
+bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
+bootcmd_usb0=devnum=0; run usb_boot
+bootcmd_usb1=devnum=1; run usb_boot
+bootcmd_usb2=devnum=2; run usb_boot
+bootcmd_usb3=devnum=3; run usb_boot
+bootdelay=2
+bootfstype=fat
+bootm_low=0
+bootm_size=8000
+distro_bootcmd=scsi_need_init=; for target in ${boot_targets}; do run 
bootcmd_${target}; done
+efi_dtb_prefixes=/ /dtb/ /dtb/current/
+fdt_addr_r=0x4000
+fdt_high=0x1000
+fileaddr=0x1800
+initrd_high=0x7900
+kernel_addr_r=0x1800
+load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} 
${prefix}${efi_fdtfile}
+mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
+pxefile_addr_r=0x1000
+ramdisk_addr_r=0x0210
+scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; 
for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run 
scan_dev_for_scripts; done;run scan_dev_for_efi;
+scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env 
exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if 
fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run 
scan_dev_for_boot; fi; done; setenv devplist
+scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; for prefix in 
${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} 
${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;if test -e ${devtype} 
${devnum}:${distro_bootpart} efi/boot/bootaa64.efi; then echo Found EFI 
removable media binary efi/boot/bootaa64.efi; run boot_efi_binary; echo EFI 
LOAD FAILED: continuing...; fi; setenv efi_fdtfile
+scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} 
${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; 
run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
+scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} 
${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script 
${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; 
done
+script_offset_f=0x3e8
+script_size_f=0x8
+scriptaddr=0x2000
+usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run 
scan_dev_for_boot_part; fi
+preboot=setenv boot_targets; setenv modeboot; cls; run board_setup
+
+# SOM specific boot methods
+som_cc_boot=if test ${card1_name} = SCK-KV-G; then setenv boot_targets mmc1 
usb0 usb1 usb2 usb3 pxe dhcp && run distro_bootcmd; elif test ${card1_name} = 
SCK-KR-G; then setenv boot_targets usb0 usb1 usb2 usb3 pxe dhcp && run 
distro_bootcmd; else test ${card1_name} = SCK-KD-G; setenv boot_targets usb0 
usb1 usb2 usb3 pxe dhcp && run distro_bootcmd; fi;"
+som_mmc_boot=setenv boot_targets mmc0 && 

[PULL] u-boot-sh/master

2023-10-16 Thread Marek Vasut
RZ/G2L part 1, except for two serial port patches which I had to drop as they
broke R2Dplus, they will come later via subsequent PR.

The following changes since commit 3c3f1626919cd93cbe6c56e3849937de5be18dbb:

  Merge tag 'dm-pull-13oct23' of 
https://source.denx.de/u-boot/custodians/u-boot-dm (2023-10-14 10:50:20 -0400)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-sh.git master

for you to fetch changes up to 4e65545f7a35430710ce95bdddf9d683f7a3f72a:

  board: rzg2l: Add RZ/G2L SMARC EVK board (2023-10-17 03:27:42 +0200)


Paul Barker (19):
  serial: sh: Fix compile error when lacking HSCIF support
  dt-bindings: Add RZ/G2L CPG bindings
  dt-bindings: Add RZ/G2L PFC bindings
  dt-bindings: Add RZ/G2L IRQC bindings
  arm: rmobile: Add basic RZ/G2L family support
  arm: rmobile: Add basic R9A07G044L SoC support
  clk: renesas: Add RZ/G2L & RZ/G2LC CPG driver
  arm: rmobile: Restrict PINCTRL_PFC selection to R-Car gen3/gen4
  cmd: gpio: Skip output on -ENOENT
  pinctrl: renesas: Add RZ/G2L PFC driver
  gpio: Add RZ/G2L GPIO driver
  serial: sh: Sort includes
  mmc: renesas-sdhi: Refactor probe function
  mmc: renesas-sdhi: Initialize module on RZ/G2L
  arm: rmobile: Include  in header
  arm: rmobile: Add CPU detection for RZ/G2L
  arm: rmobile: Support RZ/G2L memory map
  arm: dts: Import RZ/G2L SMARC EVK device tree
  board: rzg2l: Add RZ/G2L SMARC EVK board

 arch/arm/dts/Makefile  |3 +
 arch/arm/dts/r9a07g044.dtsi| 1273 
 arch/arm/dts/r9a07g044l2-smarc.dts |   18 +
 arch/arm/dts/r9a07g044l2.dtsi  |   13 +
 arch/arm/dts/rz-smarc-common.dtsi  |  183 +++
 arch/arm/dts/rzg2l-smarc-pinfunction.dtsi  |  137 +++
 arch/arm/dts/rzg2l-smarc-som.dtsi  |  353 ++
 arch/arm/dts/rzg2l-smarc.dtsi  |  144 +++
 arch/arm/mach-rmobile/Kconfig  |   21 +-
 arch/arm/mach-rmobile/Kconfig.rzg2l|   32 +
 arch/arm/mach-rmobile/Makefile |5 +-
 arch/arm/mach-rmobile/cpu_info-rzg2l.c |   63 +
 arch/arm/mach-rmobile/include/mach/rmobile.h   |5 +
 arch/arm/mach-rmobile/include/mach/rzg2l.h |   13 +
 arch/arm/mach-rmobile/memmap-rzg2l.c   |  127 ++
 board/renesas/rzg2l/Kconfig|   18 +
 board/renesas/rzg2l/MAINTAINERS|6 +
 board/renesas/rzg2l/Makefile   |4 +
 board/renesas/rzg2l/rzg2l.c|   67 ++
 cmd/gpio.c |4 +-
 configs/renesas_rzg2l_smarc_defconfig  |   52 +
 drivers/clk/renesas/Kconfig|9 +
 drivers/clk/renesas/Makefile   |2 +
 drivers/clk/renesas/r9a07g044-cpg.c|  384 ++
 drivers/clk/renesas/rzg2l-cpg.c|  505 
 drivers/clk/renesas/rzg2l-cpg.h|  319 +
 drivers/gpio/Kconfig   |7 +
 drivers/gpio/Makefile  |1 +
 drivers/gpio/rzg2l-gpio.c  |  170 +++
 drivers/mmc/renesas-sdhi.c |   81 +-
 drivers/pinctrl/renesas/Kconfig|9 +
 drivers/pinctrl/renesas/Makefile   |1 +
 drivers/pinctrl/renesas/rzg2l-pfc.c|  625 ++
 drivers/serial/serial_sh.c |   12 +-
 include/configs/rzg2l-smarc.h  |   14 +
 include/dt-bindings/clock/r9a07g044-cpg.h  |  220 
 .../dt-bindings/interrupt-controller/irqc-rzg2l.h  |   25 +
 include/dt-bindings/pinctrl/rzg2l-pinctrl.h|   23 +
 include/renesas/rzg2l-pfc.h|  110 ++
 39 files changed, 5045 insertions(+), 13 deletions(-)
 create mode 100644 arch/arm/dts/r9a07g044.dtsi
 create mode 100644 arch/arm/dts/r9a07g044l2-smarc.dts
 create mode 100644 arch/arm/dts/r9a07g044l2.dtsi
 create mode 100644 arch/arm/dts/rz-smarc-common.dtsi
 create mode 100644 arch/arm/dts/rzg2l-smarc-pinfunction.dtsi
 create mode 100644 arch/arm/dts/rzg2l-smarc-som.dtsi
 create mode 100644 arch/arm/dts/rzg2l-smarc.dtsi
 create mode 100644 arch/arm/mach-rmobile/Kconfig.rzg2l
 create mode 100644 arch/arm/mach-rmobile/cpu_info-rzg2l.c
 create mode 100644 arch/arm/mach-rmobile/include/mach/rzg2l.h
 create mode 100644 arch/arm/mach-rmobile/memmap-rzg2l.c
 create mode 100644 board/renesas/rzg2l/Kconfig
 create mode 100644 board/renesas/rzg2l/MAINTAINERS
 create mode 100644 board/renesas/rzg2l/Makefile
 create mode 100644 board/renesas/rzg2l/rzg2l.c
 create mode 100644 configs/renesas_rzg2l_smarc_defconfig
 create mode 100644 drivers/clk/renesas/r9a07g044-cpg.c
 create 

Re: [PATCH 3/3] ARM: imx: Add support for detecting primary/secondary bmode on MX8M

2023-10-16 Thread Marek Vasut

On 10/16/23 08:44, Stefano Babic wrote:

Hi Fedor, Marek,

On 29.07.23 17:09, Marek Vasut wrote:

From: Fedor Ross 

Implement the 'getprisec' subcommand of 'bmode' command for i.MX8M by
reading out the ROM log events. This event is set by the BootROM if it
switched to the secondary copy due to primary copy being corrupted.

Signed-off-by: Fedor Ross 
Signed-off-by: Marek Vasut 
---
Cc: Fabio Estevam 
Cc: Peng Fan 
Cc: Stefano Babic 
---
  arch/arm/mach-imx/Kconfig | 2 +-
  arch/arm/mach-imx/imx8m/soc.c | 5 +
  2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index d94b5828d0d..982d542b1c8 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -70,7 +70,7 @@ config CSF_SIZE
  config CMD_BMODE
  bool "Support the 'bmode' command"
  default y
-    depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX5
+    depends on ARCH_IMX8M || ARCH_MX7 || ARCH_MX6 || ARCH_MX5
  help
    This enables the 'bmode' (bootmode) command for forcing
    a boot from specific media.
diff --git a/arch/arm/mach-imx/imx8m/soc.c 
b/arch/arm/mach-imx/imx8m/soc.c

index 2234ef947a1..10e5aeb48a2 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -726,6 +726,11 @@ int spl_mmc_emmc_boot_partition(struct mmc *mmc)
  return part;
  }
+
+int boot_mode_getprisec(void)
+{
+    return !!imx8m_detect_secondary_image_boot();
+}
  #endif
  #if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP)



This breaks several board, I bisected imx8mm-cl-iot-gate because those 
boards don't define boot_mode_apply:


+arch/arm/mach-imx/cmd_bmode.c:86: undefined reference to `boot_mode_apply'
+make[1]: *** [Makefile:1765: u-boot] Error 139

I cannot apply this, please check and repost, thanks.


I sent a slightly more extensive V2 which passes CI.


Re: [PATCH v3 21/32] efi: Rearrange the Kconfig for CMD_BOOTEFI_BOOTMGR

2023-10-16 Thread AKASHI Takahiro
Hi Simon,

Thank you for taking my idea here.

On Mon, Oct 16, 2023 at 04:28:12PM -0600, Simon Glass wrote:
> The command should not be used to enable library functionality. Add a
> new BOOTEFI_BOOTMGR Kconfig for that. Adjust the conditions so that the
> same code is built.
> 
> Signed-off-by: Simon Glass 
> Suggested-by: AKASHI Takahiro 
> ---
> 
> Changes in v3:
> - Add new patch to rearrange the Kconfig for CMD_BOOTEFI_BOOTMGR
> 
>  cmd/Kconfig | 9 +
>  lib/efi_loader/Kconfig  | 7 +++
>  lib/efi_loader/Makefile | 2 +-
>  3 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 46e484fc08b6..3b4112d9f319 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -306,6 +306,15 @@ config CMD_BOOTI
>   help
> Boot an AArch64 Linux Kernel image from memory.
>  
> +config CMD_BOOTEFI_BOOTMGR
> + bool "UEFI Boot Manager command"
> + depends on BOOTEFI_BOOTMGR && CMD_BOOTEFI
> + default y
> + help
> +   Select this option if you want to select the UEFI binary to be booted
> +   via UEFI variables Boot, BootOrder, and BootNext. This enables the
> +   'bootefi bootmgr' command.
> +
>  config BOOTM_LINUX

Do you have any intention to put this configuration here?
Otherwise, it should be placed just after CMD_BOOTEFI.

In addition, CMD_EFICONFIG should have a dependency on BOOTEFI_BOOTMGR
rather than CMD_BOOTEFI_BOOTMGR as it is a separate command.

Thanks,
-Takahiro Akashi

>   bool "Support booting Linux OS images"
>   depends on CMD_BOOTM || CMD_BOOTZ || CMD_BOOTI
> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> index 621ed5e5b0fb..13cad6342c36 100644
> --- a/lib/efi_loader/Kconfig
> +++ b/lib/efi_loader/Kconfig
> @@ -32,15 +32,14 @@ config EFI_LOADER
>  
>  if EFI_LOADER
>  
> -config CMD_BOOTEFI_BOOTMGR
> +config BOOTEFI_BOOTMGR
>   bool "UEFI Boot Manager"
> - depends on CMDLINE
>   default y
>   select BOOTMETH_GLOBAL if BOOTSTD
>   help
> Select this option if you want to select the UEFI binary to be booted
> -   via UEFI variables Boot, BootOrder, and BootNext. This enables the
> -   'bootefi bootmgr' command.
> +   via UEFI variables Boot, BootOrder, and BootNext. You should also
> +   normally enable CMD_BOOTEFI_BOOTMGR so that the command is available.
>  
>  choice
>   prompt "Store for non-volatile UEFI variables"
> diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
> index 8d31fc61c601..0a2cb6e3c476 100644
> --- a/lib/efi_loader/Makefile
> +++ b/lib/efi_loader/Makefile
> @@ -42,7 +42,7 @@ targets += initrddump.o
>  endif
>  
>  obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
> -obj-$(CONFIG_CMD_BOOTEFI_BOOTMGR) += efi_bootmgr.o
> +obj-$(CONFIG_BOOTEFI_BOOTMGR) += efi_bootmgr.o
>  obj-y += efi_boottime.o
>  obj-y += efi_helper.o
>  obj-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += efi_capsule.o
> -- 
> 2.42.0.655.g421f12c284-goog
> 


Re: Pull request: please pull u-boot-imx-20231016

2023-10-16 Thread Tom Rini
On Mon, Oct 16, 2023 at 11:32:45PM +0200, Stefano Babic wrote:

> Hi Tom,
> 
> please pull from u-boot-imx, thanks !
> 
> The following changes since commit 3c3f1626919cd93cbe6c56e3849937de5be18dbb:
> 
>   Merge tag 'dm-pull-13oct23' of
> https://source.denx.de/u-boot/custodians/u-boot-dm (2023-10-14 10:50:20
> -0400)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-imx.git
> tags/u-boot-imx-20231016
> 
> for you to fetch changes up to b0eef7326920ff55ec22dfb86812033d84737839:
> 
>   imx8mp-evk: Add USB0 OTG support (2023-10-16 18:52:20 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] mbr: Test tweaks

2023-10-16 Thread Simon Glass
Rather than do another review on [1] I thought it better to add a patch
showing changes. This is intended to be squashed in, if acceptable.

With the patch as is, various bootstd tests fail. This is because the
test adds a new mmc6 device. There is nothing really wrong with adding
new devices, but it does require quite a few tests to be updated. It is
simpler to have mmc6 disabled by default, then just enable it for the
one test that uses it.

This patch does that and undoes the changes to blk.c and bootdev.c

[1] 
https://patchwork.ozlabs.org/project/uboot/patch/ZSNWVGTjPEt2jXn5@alg-gentoo/

Signed-off-by: Simon Glass 
---

 arch/Kconfig   |  2 ++
 arch/sandbox/dts/test.dts  |  1 +
 configs/sandbox_defconfig  |  2 --
 configs/sandbox_flattree_defconfig |  2 ++
 test/boot/bootdev.c|  2 +-
 test/cmd/mbr.c | 13 -
 test/dm/blk.c  | 44 ++
 7 files changed, 32 insertions(+), 34 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 19f2891ba1c5..4f5b75129f34 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -208,6 +208,8 @@ config SANDBOX
imply PHYSMEM
imply GENERATE_ACPI_TABLE
imply BINMAN
+   imply CMD_MBR
+   imply CMD_MMC
 
 config SH
bool "SuperH architecture"
diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 3a8c2456d401..9fe2d63dcc50 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -1101,6 +1101,7 @@
 
/* This is used for mbr tests */
mmc6 {
+   status = "disabled";
compatible = "sandbox,mmc";
filename = "mmc6.img";
};
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 01830c7bd255..a1c1a45a08a3 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -73,8 +73,6 @@ CONFIG_CMD_IDE=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_LOADM=y
 CONFIG_CMD_LSBLK=y
-CONFIG_CMD_MBR=y
-CONFIG_CMD_MMC=y
 CONFIG_CMD_MUX=y
 CONFIG_CMD_OSD=y
 CONFIG_CMD_PCI=y
diff --git a/configs/sandbox_flattree_defconfig 
b/configs/sandbox_flattree_defconfig
index 29ae4532c508..44ab80725fc7 100644
--- a/configs/sandbox_flattree_defconfig
+++ b/configs/sandbox_flattree_defconfig
@@ -47,10 +47,12 @@ CONFIG_CMD_MBR=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_OSD=y
 CONFIG_CMD_PCI=y
+CONFIG_CMD_READ=y
 CONFIG_CMD_REMOTEPROC=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_TEMPERATURE=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_WRITE=y
 CONFIG_BOOTP_DNS2=y
 CONFIG_CMD_TFTPPUT=y
 CONFIG_CMD_TFTPSRV=y
diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c
index 66c151131edb..c5f14a7a1323 100644
--- a/test/boot/bootdev.c
+++ b/test/boot/bootdev.c
@@ -128,7 +128,7 @@ static int bootdev_test_labels(struct unit_test_state *uts)
bootdev_find_by_label("fred0", , ));
 
/* Check unknown sequence number */
-   ut_asserteq(-ENOENT, bootdev_find_by_label("mmc7", , ));
+   ut_asserteq(-ENOENT, bootdev_find_by_label("mmc6", , ));
 
return 0;
 }
diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c
index 4091ea687fc5..751b16d605b7 100644
--- a/test/cmd/mbr.c
+++ b/test/cmd/mbr.c
@@ -7,11 +7,14 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 
@@ -231,6 +234,14 @@ static int mbr_test_run(struct unit_test_state *uts)
unsigned char mbr_wbuf[512], ebr_wbuf[512], rbuf[512];
char mbr_parts_buf[256];
ulong mbr_wa, ebr_wa, ra, ebr_blk, mbr_parts_max;
+   struct udevice *dev;
+   ofnode root, node;
+
+   /* Enable the mmc6 node for this test */
+   root = oftree_root(oftree_default());
+   node = ofnode_find_subnode(root, "mmc6");
+   ut_assert(ofnode_valid(node));
+   ut_assertok(lists_bind_fdt(gd->dm_root, node, , NULL, false));
 
mbr_parts_max = sizeof('\0') + 2 +
strlen(mbr_parts_header) +
diff --git a/test/dm/blk.c b/test/dm/blk.c
index 993c617832a8..799f1e4dc75b 100644
--- a/test/dm/blk.c
+++ b/test/dm/blk.c
@@ -83,12 +83,12 @@ static int dm_test_blk_usb(struct unit_test_state *uts)
ut_asserteq_ptr(usb_dev, dev_get_parent(dev));
 
/* Check we have one block device for each mass storage device */
-   ut_asserteq(7, count_blk_devices());
+   ut_asserteq(6, count_blk_devices());
 
/* Now go around again, making sure the old devices were unbound */
ut_assertok(usb_stop());
ut_assertok(usb_init());
-   ut_asserteq(7, count_blk_devices());
+   ut_asserteq(6, count_blk_devices());
ut_assertok(usb_stop());
 
return 0;
@@ -191,8 +191,6 @@ static int dm_test_blk_iter(struct unit_test_state *uts)
ut_asserteq_str("mmc1.blk", dev->name);
ut_assertok(blk_next_device_err(BLKF_REMOVABLE, ));
ut_asserteq_str("mmc0.blk", dev->name);
-   ut_assertok(blk_next_device_err(BLKF_REMOVABLE, ));
-   

[PATCH v3 32/32] sandbox: Add a test for disabling CONFIG_CMDLINE

2023-10-16 Thread Simon Glass
Now that everything is working, add a test to make sure that this
builds correctly.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Rebase on Tom's LONGHELP series
- Correct 'of' typo

 test/py/tests/test_sandbox_opts.py | 20 
 1 file changed, 20 insertions(+)
 create mode 100644 test/py/tests/test_sandbox_opts.py

diff --git a/test/py/tests/test_sandbox_opts.py 
b/test/py/tests/test_sandbox_opts.py
new file mode 100644
index ..91790b3374b4
--- /dev/null
+++ b/test/py/tests/test_sandbox_opts.py
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2022 Google LLC
+# Written by Simon Glass 
+
+import pytest
+
+import u_boot_utils as util
+
+# This is needed for Azure, since the default '..' directory is not writeable
+TMPDIR = '/tmp/test_cmdline'
+
+@pytest.mark.slow
+@pytest.mark.boardspec('sandbox')
+def test_sandbox_cmdline(u_boot_console):
+"""Test building sandbox without CONFIG_CMDLINE"""
+cons = u_boot_console
+
+out = util.run_and_log(
+cons, ['./tools/buildman/buildman', '-m', '--board', 'sandbox',
+   '-a', '~CMDLINE', '-o', TMPDIR])
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 29/32] arm: x86: Drop discarding of command linker-lists

2023-10-16 Thread Simon Glass
Since we can now cleanly disable CMDLINE when needed, drop the rules
which discard the command code.  It will not be built in the first
place.

Signed-off-by: Simon Glass 
---

(no changes since v2)

Changes in v2:
- Add new patch to drop discarding of command linker-lists

 arch/arm/cpu/u-boot.lds | 3 ---
 arch/x86/cpu/u-boot-64.lds  | 4 
 arch/x86/cpu/u-boot-spl.lds | 4 
 arch/x86/cpu/u-boot.lds | 4 
 4 files changed, 15 deletions(-)

diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
index fc4f63d83489..7724c9332c3b 100644
--- a/arch/arm/cpu/u-boot.lds
+++ b/arch/arm/cpu/u-boot.lds
@@ -14,9 +14,6 @@ OUTPUT_ARCH(arm)
 ENTRY(_start)
 SECTIONS
 {
-#ifndef CONFIG_CMDLINE
-   /DISCARD/ : { *(__u_boot_list_2_cmd_*) }
-#endif
 #if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC)
/*
 * If CONFIG_ARMV7_SECURE_BASE is true, secure code will not
diff --git a/arch/x86/cpu/u-boot-64.lds b/arch/x86/cpu/u-boot-64.lds
index d0398ff00d71..00a6d8691211 100644
--- a/arch/x86/cpu/u-boot-64.lds
+++ b/arch/x86/cpu/u-boot-64.lds
@@ -11,10 +11,6 @@ ENTRY(_start)
 
 SECTIONS
 {
-#ifndef CONFIG_CMDLINE
-   /DISCARD/ : { *(__u_boot_list_2_cmd_*) }
-#endif
-
 #ifdef CONFIG_TEXT_BASE
. = CONFIG_TEXT_BASE;   /* Location of bootcode in flash */
 #endif
diff --git a/arch/x86/cpu/u-boot-spl.lds b/arch/x86/cpu/u-boot-spl.lds
index a0a2a06a18cd..50b4b1608552 100644
--- a/arch/x86/cpu/u-boot-spl.lds
+++ b/arch/x86/cpu/u-boot-spl.lds
@@ -11,10 +11,6 @@ ENTRY(_start)
 
 SECTIONS
 {
-#ifndef CONFIG_CMDLINE
-   /DISCARD/ : { *(__u_boot_list_2_cmd_*) }
-#endif
-
. = IMAGE_TEXT_BASE;/* Location of bootcode in flash */
__text_start = .;
.text  : {
diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds
index a31f4220a000..c418ff44aa08 100644
--- a/arch/x86/cpu/u-boot.lds
+++ b/arch/x86/cpu/u-boot.lds
@@ -11,10 +11,6 @@ ENTRY(_start)
 
 SECTIONS
 {
-#ifndef CONFIG_CMDLINE
-   /DISCARD/ : { *(__u_boot_list_2_cmd_*) }
-#endif
-
. = CONFIG_TEXT_BASE;   /* Location of bootcode in flash */
__text_start = .;
 
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 31/32] treewide: Tidy up semicolon after command macros

2023-10-16 Thread Simon Glass
The U_BOOT_CMD_COMPLETE() macro has a semicolon at the end, perhaps
inadvertently. Some code has taken advantage of this.

Tidy this up by dropping the semicolon from the macro and adding it to
macro invocations as required.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Add new patch to tidy up semicolon after command macros

 board/freescale/common/vid.c | 2 +-
 board/xilinx/common/fru.c| 2 +-
 board/xilinx/versal/cmds.c   | 2 +-
 board/xilinx/zynqmp/cmds.c   | 2 +-
 cmd/btrfs.c  | 2 +-
 cmd/eeprom.c | 2 +-
 cmd/ext2.c   | 4 ++--
 cmd/fs.c | 8 
 cmd/pinmux.c | 2 +-
 cmd/qfw.c| 2 +-
 include/command.h| 2 +-
 11 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/board/freescale/common/vid.c b/board/freescale/common/vid.c
index 5ec3f2a76b19..fc5d400cfe18 100644
--- a/board/freescale/common/vid.c
+++ b/board/freescale/common/vid.c
@@ -793,4 +793,4 @@ U_BOOT_CMD(
vdd_read, 1, 0, do_vdd_read,
"read VDD",
" - Read the voltage specified in mV"
-)
+);
diff --git a/board/xilinx/common/fru.c b/board/xilinx/common/fru.c
index c916c3d6b4c8..12b21317496a 100644
--- a/board/xilinx/common/fru.c
+++ b/board/xilinx/common/fru.c
@@ -85,4 +85,4 @@ U_BOOT_CMD(
fru, 8, 1, do_fru,
"FRU table info",
fru_help_text
-)
+);
diff --git a/board/xilinx/versal/cmds.c b/board/xilinx/versal/cmds.c
index 9cc2cdcebf1c..2a74e49aedec 100644
--- a/board/xilinx/versal/cmds.c
+++ b/board/xilinx/versal/cmds.c
@@ -98,4 +98,4 @@ U_BOOT_LONGHELP(versal,
 U_BOOT_CMD(versal, 4, 1, do_versal,
   "versal sub-system",
   versal_help_text
-)
+);
diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c
index f1f3eff501e1..9524688f27d9 100644
--- a/board/xilinx/zynqmp/cmds.c
+++ b/board/xilinx/zynqmp/cmds.c
@@ -427,4 +427,4 @@ U_BOOT_CMD(
zynqmp, 9, 1, do_zynqmp,
"ZynqMP sub-system",
zynqmp_help_text
-)
+);
diff --git a/cmd/btrfs.c b/cmd/btrfs.c
index 98daea99e9ed..2843835d08b8 100644
--- a/cmd/btrfs.c
+++ b/cmd/btrfs.c
@@ -24,4 +24,4 @@ U_BOOT_CMD(btrsubvol, 3, 1, do_btrsubvol,
"list subvolumes of a BTRFS filesystem",
" \n"
" - List subvolumes of a BTRFS filesystem."
-)
+);
diff --git a/cmd/eeprom.c b/cmd/eeprom.c
index 0b6ca8c505fb..322765ad02a0 100644
--- a/cmd/eeprom.c
+++ b/cmd/eeprom.c
@@ -435,4 +435,4 @@ U_BOOT_CMD(
"The values which can be provided with the -l option are:\n"
CONFIG_EEPROM_LAYOUT_HELP_STRING"\n"
 #endif
-)
+);
diff --git a/cmd/ext2.c b/cmd/ext2.c
index 57a99516a6ac..a0ce0cf5796b 100644
--- a/cmd/ext2.c
+++ b/cmd/ext2.c
@@ -42,7 +42,7 @@ U_BOOT_CMD(
"list files in a directory (default /)",
"  [directory]\n"
"- list files from 'dev' on 'interface' in a 'directory'"
-)
+);
 
 U_BOOT_CMD(
ext2load,   6,  0,  do_ext2load,
@@ -50,4 +50,4 @@ U_BOOT_CMD(
" [ [addr [filename [bytes [pos]\n"
"- load binary file 'filename' from 'dev' on 'interface'\n"
"  to address 'addr' from ext2 filesystem."
-)
+);
diff --git a/cmd/fs.c b/cmd/fs.c
index 6044f73af5b4..46cb43dcdb5b 100644
--- a/cmd/fs.c
+++ b/cmd/fs.c
@@ -39,7 +39,7 @@ U_BOOT_CMD(
"  If 'bytes' is 0 or omitted, the file is read until the end.\n"
"  'pos' gives the file byte position to start reading from.\n"
"  If 'pos' is 0 or omitted, the file is read from the start."
-)
+);
 
 static int do_save_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
   char *const argv[])
@@ -56,7 +56,7 @@ U_BOOT_CMD(
"  'bytes' gives the size to save in bytes and is mandatory.\n"
"  'pos' gives the file byte position to start writing to.\n"
"  If 'pos' is 0 or omitted, the file is written from the start."
-)
+);
 
 static int do_ls_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
 char *const argv[])
@@ -70,7 +70,7 @@ U_BOOT_CMD(
" [ [directory]]\n"
"- List files in directory 'directory' of partition 'part' on\n"
"  device type 'interface' instance 'dev'."
-)
+);
 
 static int do_ln_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
 char *const argv[])
@@ -84,7 +84,7 @@ U_BOOT_CMD(
"  target linkname\n"
"- create a symbolic link to 'target' with the name 'linkname' on\n"
"  device type 'interface' instance 'dev'."
-)
+);
 
 static int do_fstype_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
 char *const argv[])
diff --git a/cmd/pinmux.c b/cmd/pinmux.c
index f17cf4110d9f..105f01eaafff 100644
--- a/cmd/pinmux.c
+++ b/cmd/pinmux.c
@@ -178,4 +178,4 @@ U_BOOT_CMD(pinmux, CONFIG_SYS_MAXARGS, 1, do_pinmux,
   "list - list UCLASS_PINCTRL devices\n"
   "pinmux dev 

[PATCH v3 30/32] mmc: env: Unify the U_BOOT_ENV_LOCATION conditions

2023-10-16 Thread Simon Glass
The declaration of U_BOOT_ENV_LOCATION() uses a different #ifdef
condition from the code it calls. Use the same condition to avoid a
build warning if CONFIG_CMD_SAVEENV is disabled.

Signed-off-by: Simon Glass 
---

(no changes since v2)

Changes in v2:
- Add new patch to unify the U_BOOT_ENV_LOCATION conditions

 env/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/env/mmc.c b/env/mmc.c
index cb14bbb58f13..da84cddd74f0 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -495,7 +495,7 @@ U_BOOT_ENV_LOCATION(mmc) = {
.location   = ENVL_MMC,
ENV_NAME("MMC")
.load   = env_mmc_load,
-#ifndef CONFIG_SPL_BUILD
+#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_SPL_BUILD)
.save   = env_save_ptr(env_mmc_save),
.erase  = ENV_ERASE_PTR(env_mmc_erase)
 #endif
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 28/32] sandbox: Avoid requiring cmdline

2023-10-16 Thread Simon Glass
Use 'imply' rather than 'select' for command-related options, so that
it is possible to build sandbox without CONFIG_CMDLINE enabled.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Reorder the Kconfig options a little

 arch/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 64d0a5548942..e85134e9346c 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -134,7 +134,6 @@ config SANDBOX
select ARCH_SUPPORTS_LTO
select BOARD_LATE_INIT
select BZIP2
-   select CMD_POWEROFF
select DM
select DM_EVENT
select DM_FUZZING_ENGINE
@@ -152,10 +151,8 @@ config SANDBOX
select PCI_ENDPOINT
select SPI
select SUPPORT_OF_CONTROL
-   select SYSRESET_CMD_POWEROFF
select SYS_CACHE_SHIFT_4
select IRQ
-   select SUPPORT_EXTENSION_SCAN
select SUPPORT_ACPI
imply BITREVERSE
select BLOBLIST
@@ -167,6 +164,9 @@ config SANDBOX
imply CMD_IO
imply CMD_IOTRACE
imply CMD_LZMADEC
+   imply CMD_POWEROFF
+   imply SYSRESET_CMD_POWEROFF
+   imply SUPPORT_EXTENSION_SCAN
imply CMD_SF
imply CMD_SF_TEST
imply CRC32_VERIFY
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 24/32] Add a new Kconfig for command-line entry

2023-10-16 Thread Simon Glass
At present EXPO requires CMDLINE since it uses cli_readline, which is
enabled by CMDLINE. It should be possible to enter lines of text to an
expo without having CMDLINE available.

Fix this dependency by creating a new Kconfig for cli_readline

Signed-off-by: Simon Glass 
---

Changes in v3:
- Add new patch with a Kconfig for command-line entry

 boot/Kconfig| 1 +
 cmd/Kconfig | 1 +
 common/Kconfig  | 7 +++
 common/Makefile | 2 +-
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/boot/Kconfig b/boot/Kconfig
index 2fbe70245ec9..e71de0647bc5 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -649,6 +649,7 @@ config EXPO
bool "Support for expos - groups of scenes displaying a UI"
depends on VIDEO
default y if BOOTMETH_VBE
+   select CLI_READLINE
help
  An expo is a way of presenting and collecting information from the
  user. It consists of a collection of 'scenes' of which only one is
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 3b4112d9f319..5cb45f9c025e 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -3,6 +3,7 @@ menu "Command line interface"
 config CMDLINE
bool "Support U-Boot commands"
default y
+   select CLI_READLINE
help
  Enable U-Boot's command-line functions. This provides a means
  to enter commands into U-Boot for a wide variety of purposes. It
diff --git a/common/Kconfig b/common/Kconfig
index 1ffb055744d9..df5bac646491 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1164,3 +1164,10 @@ endif
 
 config IO_TRACE
bool
+
+config CLI_READLINE
+   bool
+   help
+ Enables support for reading a line of text from the user, This
+ feature is used by the command-line interpreter and also by expo,
+ which needs to read text when textline objects are used.
diff --git a/common/Makefile b/common/Makefile
index e22ced0c507f..a9c18c61895c 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -38,7 +38,7 @@ obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o
 obj-$(CONFIG_MENU) += menu.o
 obj-$(CONFIG_UPDATE_COMMON) += update.o
 obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
-obj-$(CONFIG_CMDLINE_EDITING) += cli_cread.o
+obj-$(CONFIG_CLI_READLINE) += cli_cread.o
 obj-$(CONFIG_CMDLINE) += cli_readline.o cli_simple.o
 
 endif # !CONFIG_SPL_BUILD
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 23/32] cli: Split command-line-editing into its own file

2023-10-16 Thread Simon Glass
This features has buffers and code which is behind an #ifdef at
present. Move it into its own file, exporting functions as needed.

Drop add_idx_minus_one() since it is not used.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 boot/Kconfig  |   3 +-
 common/Makefile   |   7 +-
 common/cli_cread.c| 403 ++
 common/cli_readline.c | 384 +---
 include/cli.h |  30 
 5 files changed, 441 insertions(+), 386 deletions(-)
 create mode 100644 common/cli_cread.c

diff --git a/boot/Kconfig b/boot/Kconfig
index 6461f7ebd040..2fbe70245ec9 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -349,7 +349,8 @@ config PXE_UTILS
 
 config BOOT_DEFAULTS
bool  # Common defaults for standard boot and distroboot
-   imply USE_BOOTCOMMAND
+   depends on CMDLINE
+   imply USE_BOOTCOMMAND if !SANDBOX
select CMD_ENV_EXISTS
select CMD_EXT2
select CMD_EXT4
diff --git a/common/Makefile b/common/Makefile
index 637066ae6682..e22ced0c507f 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o
 obj-$(CONFIG_MENU) += menu.o
 obj-$(CONFIG_UPDATE_COMMON) += update.o
 obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
+obj-$(CONFIG_CMDLINE_EDITING) += cli_cread.o
 obj-$(CONFIG_CMDLINE) += cli_readline.o cli_simple.o
 
 endif # !CONFIG_SPL_BUILD
@@ -90,8 +91,10 @@ obj-y += eeprom/eeprom_field.o eeprom/eeprom_layout.o
 endif
 
 obj-y += cli.o
-obj-$(CONFIG_FSL_DDR_INTERACTIVE) += cli_getch.o cli_simple.o cli_readline.o
-obj-$(CONFIG_STM32MP1_DDR_INTERACTIVE) += cli_getch.o cli_simple.o 
cli_readline.o
+obj-$(CONFIG_FSL_DDR_INTERACTIVE) += cli_getch.o cli_simple.o cli_readline.o \
+   cli_cread.o
+obj-$(CONFIG_STM32MP1_DDR_INTERACTIVE) += cli_getch.o cli_simple.o \
+   cli_readline.o cli_cread.o
 obj-$(CONFIG_DFU_OVER_USB) += dfu.o
 obj-y += command.o
 obj-$(CONFIG_$(SPL_TPL_)LOG) += log.o
diff --git a/common/cli_cread.c b/common/cli_cread.c
new file mode 100644
index ..19af27303cfc
--- /dev/null
+++ b/common/cli_cread.c
@@ -0,0 +1,403 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ *
+ * Add to readline cmdline-editing by
+ * (C) Copyright 2005
+ * JinHua Luo, GuangDong Linux Center, 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * cmdline-editing related codes from vivi.
+ * Author: Janghoon Lyu 
+ */
+
+#define putnstr(str, n)printf("%.*s", (int)n, str)
+
+#define CTL_BACKSPACE  ('\b')
+#define DEL((char)255)
+#define DEL7   ((char)127)
+#define CREAD_HIST_CHAR('!')
+
+#define getcmd_putch(ch)   putc(ch)
+#define getcmd_cbeep() getcmd_putch('\a')
+
+#ifdef CONFIG_SPL_BUILD
+#define HIST_MAX   3
+#define HIST_SIZE  32
+#else
+#define HIST_MAX   20
+#define HIST_SIZE  CONFIG_SYS_CBSIZE
+#endif
+
+static int hist_max;
+static int hist_add_idx;
+static int hist_cur = -1;
+static uint hist_num;
+
+static char *hist_list[HIST_MAX];
+static char hist_lines[HIST_MAX][HIST_SIZE + 1];   /* Save room for NULL */
+
+static void getcmd_putchars(int count, int ch)
+{
+   int i;
+
+   for (i = 0; i < count; i++)
+   getcmd_putch(ch);
+}
+
+void hist_init(void)
+{
+   int i;
+
+   hist_max = 0;
+   hist_add_idx = 0;
+   hist_cur = -1;
+   hist_num = 0;
+
+   for (i = 0; i < HIST_MAX; i++) {
+   hist_list[i] = hist_lines[i];
+   hist_list[i][0] = '\0';
+   }
+}
+
+void cread_add_to_hist(char *line)
+{
+   if (line[0] && line[0] != CREAD_HIST_CHAR) {
+   strcpy(hist_list[hist_add_idx], line);
+
+   if (++hist_add_idx >= HIST_MAX)
+   hist_add_idx = 0;
+
+   if (hist_add_idx > hist_max)
+   hist_max = hist_add_idx;
+
+   hist_num++;
+   }
+
+   hist_cur = hist_add_idx;
+}
+
+char *hist_prev(void)
+{
+   char *ret;
+   int old_cur;
+
+   if (hist_cur < 0)
+   return NULL;
+
+   old_cur = hist_cur;
+   if (--hist_cur < 0)
+   hist_cur = hist_max;
+
+   if (hist_cur == hist_add_idx) {
+   hist_cur = old_cur;
+   ret = NULL;
+   } else {
+   ret = hist_list[hist_cur];
+   }
+
+   return ret;
+}
+
+char *hist_next(void)
+{
+   char *ret;
+
+   if (hist_cur < 0)
+   return NULL;
+
+   if (hist_cur == hist_add_idx)
+   return NULL;
+
+   if (++hist_cur > hist_max)
+   hist_cur = 0;
+
+   if (hist_cur == hist_add_idx)
+   ret = "";
+   else
+   ret = hist_list[hist_cur];
+
+   return ret;
+}
+
+void 

[PATCH v3 25/32] Add a new Kconfig for command-line history

2023-10-16 Thread Simon Glass
At present EXPO requires CMDLINE since it uses cli_readline, which
needs history enabled. It should be possible to enter lines of text
into an expo without having history available.

Fix this dependency by creating a new Kconfig for cmdline history.
Adjust the code to use the correct condiition.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Add new patch with a Kconfig for command-line entry

 cmd/Kconfig| 15 +--
 common/cli_cread.c | 24 ++--
 include/cli.h  |  3 ++-
 3 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 5cb45f9c025e..491737ca8ba7 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -29,8 +29,19 @@ config CMDLINE_EDITING
depends on CMDLINE
default y
help
- Enable editing and History functions for interactive command line
- input operations
+ Enable an editing function for interactive, command-line-input
+ operations. This allows moving the cursor back and forth within
+ the line, inserting and deleting characters, etc.
+
+config CMDLINE_HISTORY
+   bool "Enable command-line history"
+   depends on CMDLINE_EDITING
+   default y
+   help
+ Enable a history function for interactive, command-line-input
+ operations. This maintains a small buffer of previously entered
+ commands, allowing the user to enter or edit old commands without
+ having to retype them.
 
 config CMDLINE_PS_SUPPORT
bool "Enable support for changing the command prompt string at run-time"
diff --git a/common/cli_cread.c b/common/cli_cread.c
index 19af27303cfc..33c678e89f3d 100644
--- a/common/cli_cread.c
+++ b/common/cli_cread.c
@@ -28,11 +28,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #define CTL_BACKSPACE  ('\b')
 #define DEL((char)255)
 #define DEL7   ((char)127)
-#define CREAD_HIST_CHAR('!')
 
 #define getcmd_putch(ch)   putc(ch)
 #define getcmd_cbeep() getcmd_putch('\a')
 
+#define CREAD_HIST_CHAR('!')
+
 #ifdef CONFIG_SPL_BUILD
 #define HIST_MAX   3
 #define HIST_SIZE  32
@@ -41,14 +42,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define HIST_SIZE  CONFIG_SYS_CBSIZE
 #endif
 
-static int hist_max;
-static int hist_add_idx;
-static int hist_cur = -1;
-static uint hist_num;
-
-static char *hist_list[HIST_MAX];
-static char hist_lines[HIST_MAX][HIST_SIZE + 1];   /* Save room for NULL */
-
 static void getcmd_putchars(int count, int ch)
 {
int i;
@@ -57,6 +50,16 @@ static void getcmd_putchars(int count, int ch)
getcmd_putch(ch);
 }
 
+#ifdef CONFIG_CMDLINE_HISTORY
+
+static int hist_max;
+static int hist_add_idx;
+static int hist_cur = -1;
+static uint hist_num;
+
+static char *hist_list[HIST_MAX];
+static char hist_lines[HIST_MAX][HIST_SIZE + 1];   /* Save room for NULL */
+
 void hist_init(void)
 {
int i;
@@ -150,6 +153,7 @@ void cread_print_hist_list(void)
i++;
}
 }
+#endif /* CMDLINE_HISTORY */
 
 #define BEGINNING_OF_LINE() {  \
while (cls->num) {  \
@@ -325,7 +329,7 @@ int cread_line_process_ch(struct cli_line_state *cls, char 
ichar)
break;
case CTL_CH('p'):
case CTL_CH('n'):
-   if (cls->history) {
+   if (IS_ENABLED(CONFIG_CMDLINE_HISTORY) && cls->history) {
char *hline;
 
if (ichar == CTL_CH('p'))
diff --git a/include/cli.h b/include/cli.h
index bca24c8c565f..45a338f709f7 100644
--- a/include/cli.h
+++ b/include/cli.h
@@ -294,6 +294,7 @@ char *hist_prev(void);
  */
 char *hist_next(void);
 
+#ifdef CONFIG_CMDLINE_HISTORY
 /**
  * cread_add_to_hist() - Add a line to the history buffer
  *
@@ -304,10 +305,10 @@ char *hist_next(void);
  */
 void cread_add_to_hist(char *line);
 
-#ifdef CONFIG_CMDLINE_EDITING
 void hist_init(void);
 #else
 static inline void hist_init(void) {}
+static inline void cread_add_to_hist(char *line) {}
 #endif
 
 #endif
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 26/32] sandbox: Disable CONFIG_DISTRO_DEFAULTS

2023-10-16 Thread Simon Glass
This is not used for sandbox, so drop it. Enable the things that it
controls to avoid dstrastic changes in the config settings for
sandbox builds.

The end result is that these are enabled:

   BOOTMETH_DISTRO
   BOOTSTD_DEFAULTS

and these are disabled:

   USE_BOOTCOMMAND
   BOOTCOMMAND (was "run distro_bootcmd")
   DISTRO_DEFAULTS

Note that the tools-only build has already disabled DISTRO_DEFAULTS
and BOOTSTD_FULL

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/Kconfig   | 5 +
 boot/Kconfig   | 6 +++---
 configs/sandbox64_defconfig| 1 -
 configs/sandbox_defconfig  | 1 -
 configs/sandbox_flattree_defconfig | 1 -
 configs/sandbox_noinst_defconfig   | 1 -
 configs/sandbox_spl_defconfig  | 1 -
 configs/sandbox_vpl_defconfig  | 1 -
 8 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 19f2891ba1c5..64d0a5548942 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -208,6 +208,11 @@ config SANDBOX
imply PHYSMEM
imply GENERATE_ACPI_TABLE
imply BINMAN
+   imply SYSRESET_CMD_POWEROFF
+   imply SUPPORT_EXTENSION_SCAN
+   imply BOOTSTD_DEFAULTS if BOOTSTD_FULL && CMDLINE
+   imply BOOTMETH_DISTRO if BOOTSTD_FULL && CMDLINE
+   imply CMD_SYSBOOT if BOOTSTD_FULL
 
 config SH
bool "SuperH architecture"
diff --git a/boot/Kconfig b/boot/Kconfig
index e71de0647bc5..bab646bcac34 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -433,8 +433,8 @@ config BOOTSTD_FULL
 config BOOTSTD_DEFAULTS
bool "Select some common defaults for standard boot"
depends on BOOTSTD
-   imply USE_BOOTCOMMAND
-   select BOOT_DEFAULTS
+   imply USE_BOOTCOMMAND if !SANDBOX
+   select BOOT_DEFAULTS if CMDLINE
select BOOTMETH_DISTRO
help
  These are not required but are commonly needed to support a good
@@ -443,7 +443,7 @@ config BOOTSTD_DEFAULTS
 
 config BOOTSTD_BOOTCOMMAND
bool "Use bootstd to boot"
-   default y if !DISTRO_DEFAULTS
+   default y if !DISTRO_DEFAULTS && !SANDBOX
help
  Enable this to select a default boot-command suitable for booting
  with standard boot. This can be overridden by the board if needed,
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
index 1a033b22018b..ff895b930170 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -14,7 +14,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_LEGACY_IMAGE_FORMAT=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_BOOTSTAGE_FDT=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 47417cb0391d..5230b81be2c4 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -14,7 +14,6 @@ CONFIG_FIT_RSASSA_PSS=y
 CONFIG_FIT_CIPHER=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_LEGACY_IMAGE_FORMAT=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_BOOTSTAGE_FDT=y
diff --git a/configs/sandbox_flattree_defconfig 
b/configs/sandbox_flattree_defconfig
index 29ae4532c508..8df2a82c521c 100644
--- a/configs/sandbox_flattree_defconfig
+++ b/configs/sandbox_flattree_defconfig
@@ -12,7 +12,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_LEGACY_IMAGE_FORMAT=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_BOOTSTAGE_FDT=y
diff --git a/configs/sandbox_noinst_defconfig b/configs/sandbox_noinst_defconfig
index d39e54f98d25..263cc013d68e 100644
--- a/configs/sandbox_noinst_defconfig
+++ b/configs/sandbox_noinst_defconfig
@@ -20,7 +20,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_BOOTSTAGE_FDT=y
diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig
index 4a67af2f088f..a84c6d2ba248 100644
--- a/configs/sandbox_spl_defconfig
+++ b/configs/sandbox_spl_defconfig
@@ -20,7 +20,6 @@ CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_BOOTSTAGE_FDT=y
diff --git a/configs/sandbox_vpl_defconfig b/configs/sandbox_vpl_defconfig
index 8d76f19729b9..60fb1701708a 100644
--- a/configs/sandbox_vpl_defconfig
+++ b/configs/sandbox_vpl_defconfig
@@ -27,7 +27,6 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_FIT_BEST_MATCH=y
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_BOOTSTAGE_FDT=y
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 27/32] cmd: Make all commands depend on CMDLINE

2023-10-16 Thread Simon Glass
If this option is disabled, commands should not be available. Convert
the CMDLINE option into a menuconfig and make every command in
cmd/Kconfig depend on it.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 cmd/Kconfig | 31 +--
 1 file changed, 9 insertions(+), 22 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 491737ca8ba7..b6fdbc6ff3b1 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1,7 +1,5 @@
-menu "Command line interface"
-
-config CMDLINE
-   bool "Support U-Boot commands"
+menuconfig CMDLINE
+   bool "Command line interface"
default y
select CLI_READLINE
help
@@ -12,9 +10,10 @@ config CMDLINE
  Depending on the number of commands enabled, this can add
  substantially to the size of U-Boot.
 
+if CMDLINE
+
 config HUSH_PARSER
bool "Use hush shell"
-   depends on CMDLINE
help
  This option enables the "hush" shell (from Busybox) as command line
  interpreter, thus enabling powerful command line syntax like
@@ -26,7 +25,6 @@ config HUSH_PARSER
 
 config CMDLINE_EDITING
bool "Enable command line editing"
-   depends on CMDLINE
default y
help
  Enable an editing function for interactive, command-line-input
@@ -52,15 +50,13 @@ config CMDLINE_PS_SUPPORT
 
 config AUTO_COMPLETE
bool "Enable auto complete using TAB"
-   depends on CMDLINE
default y
help
  Enable auto completion of commands using TAB.
 
 config SYS_LONGHELP
bool "Enable long help messages"
-   depends on CMDLINE
-   default y if CMDLINE
+   default y
help
  Defined when you want long help messages included
  Do not set this option when short of memory.
@@ -98,8 +94,7 @@ config SYS_CBSIZE
 
 config SYS_XTRACE
bool "Command execution tracer"
-   depends on CMDLINE
-   default y if CMDLINE
+   default y
help
  This option enables the possiblity to print all commands before
  executing them and after all variables are evaluated (similar
@@ -238,7 +233,6 @@ menu "Boot commands"
 
 config CMD_BOOTD
bool "bootd"
-   depends on CMDLINE
default y
help
  Run the command stored in the environment "bootcmd", i.e.
@@ -405,7 +399,7 @@ config SYS_BOOTM_LEN
 
 config CMD_BOOTEFI
bool "bootefi"
-   depends on EFI_LOADER && CMDLINE
+   depends on EFI_LOADER
default y
help
  Boot an EFI image from memory.
@@ -437,7 +431,6 @@ source lib/efi_selftest/Kconfig
 
 config CMD_BOOTMENU
bool "bootmenu"
-   depends on CMDLINE
select MENU
select CHARSET
help
@@ -504,7 +497,6 @@ config CMD_GO
 
 config CMD_RUN
bool "run"
-   depends on CMDLINE
default y
help
  Run the command in the given environment variable.
@@ -595,7 +587,6 @@ menu "Environment commands"
 
 config CMD_ASKENV
bool "ask for env variable"
-   depends on CMDLINE
help
  Ask for environment variable
 
@@ -1715,7 +1706,6 @@ if NET
 
 menuconfig CMD_NET
bool "Network commands"
-   depends on CMDLINE
default y
imply NETDEVICES
 
@@ -2019,7 +2009,6 @@ config CMD_ETHSW
 
 config CMD_PXE
bool "pxe"
-   depends on CMDLINE
select PXE_UTILS
help
  Boot image via network using PXE protocol
@@ -2154,7 +2143,6 @@ config CMD_EFICONFIG
 
 config CMD_EXCEPTION
bool "exception - raise exception"
-   depends on CMDLINE
depends on ARM || RISCV || SANDBOX || X86
help
  Enable the 'exception' command which allows to raise an exception.
@@ -2255,14 +2243,12 @@ config CMD_SOUND
 
 config CMD_SYSBOOT
bool "sysboot"
-   depends on CMDLINE
select PXE_UTILS
help
  Boot image via local extlinux.conf file
 
 config CMD_QFW
bool "qfw"
-   depends on CMDLINE
select QFW
help
  This provides access to the QEMU firmware interface.  The main
@@ -2911,4 +2897,5 @@ config CMD_MESON
default y
help
  Enable useful commands for the Meson Soc family developed by Amlogic 
Inc.
-endmenu
+
+endif # CMDLINE
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 16/32] net: Depend on CONFIG_CMDLINE

2023-10-16 Thread Simon Glass
At present it isn't possible to use networking without the command line
enabled. Add this as a condition.

Signed-off-by: Simon Glass 
Reviewed-by: Ramon Fried 
---

(no changes since v1)

 cmd/Kconfig | 1 +
 net/Kconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 148414f011df..c6ea5c860e33 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1694,6 +1694,7 @@ if NET
 
 menuconfig CMD_NET
bool "Network commands"
+   depends on CMDLINE
default y
imply NETDEVICES
 
diff --git a/net/Kconfig b/net/Kconfig
index 4215889127c9..25d494e1db46 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -4,6 +4,7 @@
 
 menuconfig NET
bool "Networking support"
+   depends on CMDLINE
default y
 
 if NET
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 18/32] video: Allow use without CONFIG_CMDLINE

2023-10-16 Thread Simon Glass
Provide a fallback for when CONFIG_SYS_CBSIZE is not provided, so that
the console can still be used.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/video/console_truetype.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c
index 14fb81e9563c..e4dad3f9a191 100644
--- a/drivers/video/console_truetype.c
+++ b/drivers/video/console_truetype.c
@@ -125,7 +125,11 @@ struct pos_info {
  * Allow one for each character on the command line plus one for each newline.
  * This is just an estimate, but it should not be exceeded.
  */
+#ifdef CONFIG_SYS_CBSIZE
 #define POS_HISTORY_SIZE   (CONFIG_SYS_CBSIZE * 11 / 10)
+#else
+#define POS_HISTORY_SIZE   (250 * 11 / 10)
+#endif
 
 /**
  * struct console_tt_metrics - Information about a font / size combination
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 10/32] Move bootmenu_conv_key() into its own file

2023-10-16 Thread Simon Glass
This conversion function is used by expo which does not require CMDLINE.
The menu feature does require CMDLINE.

Move the function into a separate file so that it can be used even when
CMDLINE is not enabled.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 common/Makefile|  2 +-
 common/cli_getch.c |  1 +
 common/menu.c  | 40 -
 common/menu_key.c  | 49 ++
 4 files changed, 51 insertions(+), 41 deletions(-)
 create mode 100644 common/menu_key.c

diff --git a/common/Makefile b/common/Makefile
index b21916f15340..637066ae6682 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -8,7 +8,7 @@ ifndef CONFIG_SPL_BUILD
 obj-y += init/
 obj-y += main.o
 obj-y += exports.o
-obj-y += cli_getch.o
+obj-y += cli_getch.o menu_key.o
 obj-$(CONFIG_HUSH_PARSER) += cli_hush.o
 obj-$(CONFIG_AUTOBOOT) += autoboot.o
 
diff --git a/common/cli_getch.c b/common/cli_getch.c
index 61d4cb261b81..c3332dc27fae 100644
--- a/common/cli_getch.c
+++ b/common/cli_getch.c
@@ -8,6 +8,7 @@
 
 #include 
 #include 
+#include 
 
 /**
  * enum cli_esc_state_t - indicates what to do with an escape character
diff --git a/common/menu.c b/common/menu.c
index b55cf7b99967..844d0ec52af3 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -483,46 +483,6 @@ enum bootmenu_key bootmenu_autoboot_loop(struct 
bootmenu_data *menu,
return key;
 }
 
-enum bootmenu_key bootmenu_conv_key(int ichar)
-{
-   enum bootmenu_key key;
-
-   switch (ichar) {
-   case '\n':
-   /* enter key was pressed */
-   key = BKEY_SELECT;
-   break;
-   case CTL_CH('c'):
-   case '\e':
-   /* ^C was pressed */
-   key = BKEY_QUIT;
-   break;
-   case CTL_CH('p'):
-   key = BKEY_UP;
-   break;
-   case CTL_CH('n'):
-   key = BKEY_DOWN;
-   break;
-   case CTL_CH('s'):
-   key = BKEY_SAVE;
-   break;
-   case '+':
-   key = BKEY_PLUS;
-   break;
-   case '-':
-   key = BKEY_MINUS;
-   break;
-   case ' ':
-   key = BKEY_SPACE;
-   break;
-   default:
-   key = BKEY_NONE;
-   break;
-   }
-
-   return key;
-}
-
 enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu,
struct cli_ch_state *cch)
 {
diff --git a/common/menu_key.c b/common/menu_key.c
new file mode 100644
index ..4e9c3b426b0c
--- /dev/null
+++ b/common/menu_key.c
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2010-2011 Calxeda, Inc.
+ * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+
+enum bootmenu_key bootmenu_conv_key(int ichar)
+{
+   enum bootmenu_key key;
+
+   switch (ichar) {
+   case '\n':
+   /* enter key was pressed */
+   key = BKEY_SELECT;
+   break;
+   case CTL_CH('c'):
+   case '\e':
+   /* ^C was pressed */
+   key = BKEY_QUIT;
+   break;
+   case CTL_CH('p'):
+   key = BKEY_UP;
+   break;
+   case CTL_CH('n'):
+   key = BKEY_DOWN;
+   break;
+   case CTL_CH('s'):
+   key = BKEY_SAVE;
+   break;
+   case '+':
+   key = BKEY_PLUS;
+   break;
+   case '-':
+   key = BKEY_MINUS;
+   break;
+   case ' ':
+   key = BKEY_SPACE;
+   break;
+   default:
+   key = BKEY_NONE;
+   break;
+   }
+
+   return key;
+}
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 17/32] log: Allow use without CONFIG_CMDLINE

2023-10-16 Thread Simon Glass
When CONFIG_SYS_CBSIZE is not used we need an alternative. For logging
it seems that CONFIG_SYS_PBSIZE is a better choice anyway, so update
this.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 common/log.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/log.c b/common/log.c
index b2de57fcb3b8..72a4de3274c7 100644
--- a/common/log.c
+++ b/common/log.c
@@ -206,7 +206,7 @@ static bool log_passes_filters(struct log_device *ldev, 
struct log_rec *rec)
 static int log_dispatch(struct log_rec *rec, const char *fmt, va_list args)
 {
struct log_device *ldev;
-   char buf[CONFIG_SYS_CBSIZE];
+   char buf[CONFIG_SYS_PBSIZE];
 
/*
 * When a log driver writes messages (e.g. via the network stack) this
@@ -268,7 +268,7 @@ int _log(enum log_category_t cat, enum log_level_t level, 
const char *file,
/* display dropped traces with console puts and DEBUG_UART */
if (rec.level <= CONFIG_LOG_DEFAULT_LEVEL ||
rec.flags & LOGRECF_FORCE_DEBUG) {
-   char buf[CONFIG_SYS_CBSIZE];
+   char buf[CONFIG_SYS_PBSIZE];
 
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 21/32] efi: Rearrange the Kconfig for CMD_BOOTEFI_BOOTMGR

2023-10-16 Thread Simon Glass
The command should not be used to enable library functionality. Add a
new BOOTEFI_BOOTMGR Kconfig for that. Adjust the conditions so that the
same code is built.

Signed-off-by: Simon Glass 
Suggested-by: AKASHI Takahiro 
---

Changes in v3:
- Add new patch to rearrange the Kconfig for CMD_BOOTEFI_BOOTMGR

 cmd/Kconfig | 9 +
 lib/efi_loader/Kconfig  | 7 +++
 lib/efi_loader/Makefile | 2 +-
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 46e484fc08b6..3b4112d9f319 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -306,6 +306,15 @@ config CMD_BOOTI
help
  Boot an AArch64 Linux Kernel image from memory.
 
+config CMD_BOOTEFI_BOOTMGR
+   bool "UEFI Boot Manager command"
+   depends on BOOTEFI_BOOTMGR && CMD_BOOTEFI
+   default y
+   help
+ Select this option if you want to select the UEFI binary to be booted
+ via UEFI variables Boot, BootOrder, and BootNext. This enables the
+ 'bootefi bootmgr' command.
+
 config BOOTM_LINUX
bool "Support booting Linux OS images"
depends on CMD_BOOTM || CMD_BOOTZ || CMD_BOOTI
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 621ed5e5b0fb..13cad6342c36 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -32,15 +32,14 @@ config EFI_LOADER
 
 if EFI_LOADER
 
-config CMD_BOOTEFI_BOOTMGR
+config BOOTEFI_BOOTMGR
bool "UEFI Boot Manager"
-   depends on CMDLINE
default y
select BOOTMETH_GLOBAL if BOOTSTD
help
  Select this option if you want to select the UEFI binary to be booted
- via UEFI variables Boot, BootOrder, and BootNext. This enables the
- 'bootefi bootmgr' command.
+ via UEFI variables Boot, BootOrder, and BootNext. You should also
+ normally enable CMD_BOOTEFI_BOOTMGR so that the command is available.
 
 choice
prompt "Store for non-volatile UEFI variables"
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 8d31fc61c601..0a2cb6e3c476 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -42,7 +42,7 @@ targets += initrddump.o
 endif
 
 obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
-obj-$(CONFIG_CMD_BOOTEFI_BOOTMGR) += efi_bootmgr.o
+obj-$(CONFIG_BOOTEFI_BOOTMGR) += efi_bootmgr.o
 obj-y += efi_boottime.o
 obj-y += efi_helper.o
 obj-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += efi_capsule.o
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 22/32] efi: Update EFI_LOADER to depend on DM_ETH

2023-10-16 Thread Simon Glass
Since efi_device_path.c calls eth_get_dev() and assumes that Ethernet is
available, add it as an explicit dependency.

Signed-off-by: Simon Glass 
---

(no changes since v2)

Changes in v2:
- Add new patch to update EFI_LOADER to depend on DM_ETH

 lib/efi_loader/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 13cad6342c36..fca4b3eef270 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -11,6 +11,7 @@ config EFI_LOADER
# We need EFI_STUB_32BIT to be set on x86_32 with EFI_STUB
depends on !EFI_STUB || !X86 || X86_64 || EFI_STUB_32BIT
depends on BLK
+   depends on DM_ETH
depends on !EFI_APP
default y if !ARM || SYS_CPU = armv7 || SYS_CPU = armv8
select CHARSET
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 20/32] efi: Make commands depend on CMDLINE

2023-10-16 Thread Simon Glass
Most of the EFI functionality requires the command line, so make this
explicit. Future work could adjust this, but it needs effort within
the booting support first, like the bootm command.

Signed-off-by: Simon Glass 
Suggested-by: AKASHI Takahiro 
---

(no changes since v2)

Changes in v2:
- Adjust the depends on the commands, instead of EFI_LOADER

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

diff --git a/cmd/Kconfig b/cmd/Kconfig
index c6ea5c860e33..46e484fc08b6 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -384,7 +384,7 @@ config SYS_BOOTM_LEN
 
 config CMD_BOOTEFI
bool "bootefi"
-   depends on EFI_LOADER
+   depends on EFI_LOADER && CMDLINE
default y
help
  Boot an EFI image from memory.
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 19/32] video: Dont require the font command

2023-10-16 Thread Simon Glass
While it is nice to have the font command, using 'select' makes it
impossible to build the console code without it. Change this to use
'imply' instead.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 drivers/video/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index ab927641bb7a..21ea5c860cca 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -180,7 +180,7 @@ config CONSOLE_ROTATION
 
 config CONSOLE_TRUETYPE
bool "Support a console that uses TrueType fonts"
-   select CMD_SELECT_FONT
+   imply CMD_SELECT_FONT
help
  TrueTrype fonts can provide outline-drawing capability rather than
  needing to provide a bitmap for each font and size that is needed.
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 15/32] fdt: Move working_fdt into fdt_support

2023-10-16 Thread Simon Glass
This can be accessed even when commands are not enabled. Move it into
the fdt_support.c file, which is where most of the FDT helpers are.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 boot/fdt_support.c | 5 +
 cmd/fdt.c  | 5 -
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/boot/fdt_support.c b/boot/fdt_support.c
index 5e49078f8c35..6ae7b8e20f65 100644
--- a/boot/fdt_support.c
+++ b/boot/fdt_support.c
@@ -23,6 +23,11 @@
 #include 
 #include 
 
+/*
+ * The working_fdt points to our working flattened device tree.
+ */
+struct fdt_header *working_fdt;
+
 /**
  * fdt_getprop_u32_default_node - Return a node's property or a default
  *
diff --git a/cmd/fdt.c b/cmd/fdt.c
index 331564c13be9..86e847a41826 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -31,11 +31,6 @@ static int fdt_parse_prop(char *const*newval, int count, 
char *data, int *len);
 static int fdt_print(const char *pathp, char *prop, int depth);
 static int is_printable_string(const void *data, int len);
 
-/*
- * The working_fdt points to our working flattened device tree.
- */
-struct fdt_header *working_fdt;
-
 static void set_working_fdt_addr_quiet(ulong addr)
 {
void *buf;
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 11/32] pxe: Depend on CMDLINE

2023-10-16 Thread Simon Glass
We cannot use PXE or sysboot commands without CONFIG_CMDLINE so add the
required condition.

Signed-off-by: Simon Glass 
---

(no changes since v1)

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

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 00a7f84bce99..18be3da972d2 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -2002,6 +2002,7 @@ config CMD_ETHSW
 
 config CMD_PXE
bool "pxe"
+   depends on CMDLINE
select PXE_UTILS
help
  Boot image via network using PXE protocol
@@ -2237,6 +2238,7 @@ config CMD_SOUND
 
 config CMD_SYSBOOT
bool "sysboot"
+   depends on CMDLINE
select PXE_UTILS
help
  Boot image via local extlinux.conf file
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 14/32] bootm: Allow building when cleanup functions are missing

2023-10-16 Thread Simon Glass
There are two cleanup functions needed during boot which depend on
CMD_BOOTM: bootm_disable_interrupts() and board_quiesce_devices()

Provide static inline versions of these for when commands are not
enabled.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 arch/arm/lib/bootm.c |  2 ++
 boot/bootm.c | 10 --
 include/bootm.h  | 15 +--
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index c56285738a26..db8df57cb56e 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -42,9 +42,11 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static struct tag *params;
 
+#ifdef CONFIG_CMD_BOOTM
 __weak void board_quiesce_devices(void)
 {
 }
+#endif
 
 /**
  * announce_and_cleanup() - Print message and prepare for kernel boot
diff --git a/boot/bootm.c b/boot/bootm.c
index 8f96a80d4259..7deae058552a 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -47,9 +47,11 @@ static const void *boot_get_kernel(struct cmd_tbl *cmdtp, 
int flag, int argc,
   char *const argv[], struct bootm_headers 
*images,
   ulong *os_data, ulong *os_len);
 
+#ifdef CONFIG_CMD_BOOTM
 __weak void board_quiesce_devices(void)
 {
 }
+#endif
 
 #ifdef CONFIG_LMB
 static void boot_start_lmb(struct bootm_headers *images)
@@ -470,12 +472,7 @@ static int bootm_load_os(struct bootm_headers *images, int 
boot_progress)
return 0;
 }
 
-/**
- * bootm_disable_interrupts() - Disable interrupts in preparation for load/boot
- *
- * Return: interrupt flag (0 if interrupts were disabled, non-zero if they were
- * enabled)
- */
+#ifdef CONFIG_CMD_BOOTM
 ulong bootm_disable_interrupts(void)
 {
ulong iflag;
@@ -505,6 +502,7 @@ ulong bootm_disable_interrupts(void)
 #endif
return iflag;
 }
+#endif
 
 #define CONSOLE_ARG"console="
 #define NULL_CONSOLE   (CONSOLE_ARG "ttynull")
diff --git a/include/bootm.h b/include/bootm.h
index c3c7336207b1..17c740449efd 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -50,8 +50,6 @@ int bootm_host_load_images(const void *fit, int cfg_noffset);
 int boot_selected_os(int argc, char *const argv[], int state,
 struct bootm_headers *images, boot_os_fn *boot_fn);
 
-ulong bootm_disable_interrupts(void);
-
 /* This is a special function used by booti/bootz */
 int bootm_find_images(int flag, int argc, char *const argv[], ulong start,
  ulong size);
@@ -62,6 +60,15 @@ int do_bootm_states(struct cmd_tbl *cmdtp, int flag, int 
argc,
 
 void arch_preboot_os(void);
 
+#ifdef CONFIG_CMD_BOOTM
+/**
+ * bootm_disable_interrupts() - Disable interrupts, stop Ethernet and USB
+ *
+ * Return: interrupt flag (0 if interrupts were disabled, non-zero if they were
+ * enabled)
+ */
+ulong bootm_disable_interrupts(void);
+
 /*
  * boards should define this to disable devices when EFI exits from boot
  * services.
@@ -69,6 +76,10 @@ void arch_preboot_os(void);
  * TODO(s...@chromium.org>): Update this to use driver model's device_remove().
  */
 void board_quiesce_devices(void);
+#else
+static inline ulong bootm_disable_interrupts(void) { return 0; }
+static inline void board_quiesce_devices(void) {}
+#endif
 
 /**
  * switch_to_non_secure_mode() - switch to non-secure mode
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 12/32] env: Split out non-command code into a new file

2023-10-16 Thread Simon Glass
It is not possible to set environment variables without having
CONFIG_CMD_NVEDIT enabled. When CONFIG_CMDLINE is disabled, we need a
way to set variables.

Split the setting code out into its own file, so that env_set() is
available even when CONFIG_CMDLINE is not. If it is never called, the
code will be dropped at link time.

Update the Makefile rule to only include the env commands when
CONFIG_CMD_NVEDIT is enabled.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 cmd/Makefile   |   2 +-
 cmd/nvedit.c   | 122 ++---
 env/Makefile   |   1 +
 env/env_set.c  | 132 +
 include/env_internal.h |  23 +++
 5 files changed, 161 insertions(+), 119 deletions(-)
 create mode 100644 env/env_set.c

diff --git a/cmd/Makefile b/cmd/Makefile
index 44db5f22861e..29d7c500c66e 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -245,7 +245,7 @@ endif # !CONFIG_SPL_BUILD
 obj-$(CONFIG_$(SPL_)CMD_TLV_EEPROM) += tlv_eeprom.o
 
 # core command
-obj-y += nvedit.o
+obj-$(CONFIG_$(SPL_)CMDLINE) += nvedit.o
 
 obj-$(CONFIG_CMD_BCM_EXT_UTILS) += broadcom/
 
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index daf1ad37f9be..812d82b157f4 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -49,20 +49,6 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 #defineMAX_ENV_SIZE(1 << 20)   /* 1 MiB */
 
-/*
- * This variable is incremented on each do_env_set(), so it can
- * be used via env_get_id() as an indication, if the environment
- * has changed or not. So it is possible to reread an environment
- * variable only if the environment was changed ... done so for
- * example in NetInitLoop()
- */
-static int env_id = 1;
-
-int env_get_id(void)
-{
-   return env_id;
-}
-
 #ifndef CONFIG_SPL_BUILD
 /*
  * Command interface: print one or all environment variables
@@ -195,108 +181,8 @@ DONE:
 
return 0;
 }
-#endif
-#endif /* CONFIG_SPL_BUILD */
-
-/*
- * Set a new environment variable,
- * or replace or delete an existing one.
- */
-static int _do_env_set(int flag, int argc, char *const argv[], int env_flag)
-{
-   int   i, len;
-   char  *name, *value, *s;
-   struct env_entry e, *ep;
-
-   debug("Initial value for argc=%d\n", argc);
-
-#if !IS_ENABLED(CONFIG_SPL_BUILD) && IS_ENABLED(CONFIG_CMD_NVEDIT_EFI)
-   if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'e')
-   return do_env_set_efi(NULL, flag, --argc, ++argv);
-#endif
-
-   while (argc > 1 && **(argv + 1) == '-') {
-   char *arg = *++argv;
-
-   --argc;
-   while (*++arg) {
-   switch (*arg) {
-   case 'f':   /* force */
-   env_flag |= H_FORCE;
-   break;
-   default:
-   return CMD_RET_USAGE;
-   }
-   }
-   }
-   debug("Final value for argc=%d\n", argc);
-   name = argv[1];
-
-   if (strchr(name, '=')) {
-   printf("## Error: illegal character '='"
-  "in variable name \"%s\"\n", name);
-   return 1;
-   }
-
-   env_id++;
-
-   /* Delete only ? */
-   if (argc < 3 || argv[2] == NULL) {
-   int rc = hdelete_r(name, _htab, env_flag);
-
-   /* If the variable didn't exist, don't report an error */
-   return rc && rc != -ENOENT ? 1 : 0;
-   }
-
-   /*
-* Insert / replace new value
-*/
-   for (i = 2, len = 0; i < argc; ++i)
-   len += strlen(argv[i]) + 1;
-
-   value = malloc(len);
-   if (value == NULL) {
-   printf("## Can't malloc %d bytes\n", len);
-   return 1;
-   }
-   for (i = 2, s = value; i < argc; ++i) {
-   char *v = argv[i];
-
-   while ((*s++ = *v++) != '\0')
-   ;
-   *(s - 1) = ' ';
-   }
-   if (s != value)
-   *--s = '\0';
-
-   e.key   = name;
-   e.data  = value;
-   hsearch_r(e, ENV_ENTER, , _htab, env_flag);
-   free(value);
-   if (!ep) {
-   printf("## Error inserting \"%s\" variable, errno=%d\n",
-   name, errno);
-   return 1;
-   }
-
-   return 0;
-}
-
-int env_set(const char *varname, const char *varvalue)
-{
-   const char * const argv[4] = { "setenv", varname, varvalue, NULL };
-
-   /* before import into hashtable */
-   if (!(gd->flags & GD_FLG_ENV_READY))
-   return 1;
-
-   if (varvalue == NULL || varvalue[0] == '\0')
-   return _do_env_set(0, 2, (char * const *)argv, H_PROGRAMMATIC);
-   else
-   return _do_env_set(0, 3, (char * const *)argv, H_PROGRAMMATIC);
-}
+#endif /* CONFIG_CMD_GREPENV */
 
-#ifndef CONFIG_SPL_BUILD
 static int do_env_set(struct cmd_tbl *cmdtp, int flag, int argc,
  

[PATCH v3 13/32] console: Move SYS_PBSIZE into common/

2023-10-16 Thread Simon Glass
This relates to printing output and does not need a command line. Move
it next to the other console-related options.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 cmd/Kconfig| 5 -
 common/Kconfig | 5 +
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 18be3da972d2..148414f011df 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -84,11 +84,6 @@ config SYS_CBSIZE
default 256 if M68K || PPC
default 1024
 
-config SYS_PBSIZE
-   int "Buffer size for console output"
-   default 1024 if ARCH_SUNXI
-   default 1044
-
 config SYS_XTRACE
bool "Command execution tracer"
depends on CMDLINE
diff --git a/common/Kconfig b/common/Kconfig
index 93c96f23b013..1ffb055744d9 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -52,6 +52,11 @@ config CONSOLE_RECORD_IN_SIZE
  The buffer is allocated immediately after the malloc() region is
  ready.
 
+config SYS_PBSIZE
+   int "Buffer size for console output"
+   default 1024 if ARCH_SUNXI
+   default 1044
+
 config DISABLE_CONSOLE
bool "Add functionality to disable console completely"
help
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 09/32] cmd: Use an #ifdef around run_commandf()

2023-10-16 Thread Simon Glass
This is not available if CMDLINE is disabled, so add an #ifdef to correct
this.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 common/cli.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/cli.c b/common/cli.c
index 3916a7b10a7d..4d0fea4387f2 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -129,6 +129,7 @@ int run_command_list(const char *cmd, int len, int flag)
return rcode;
 }
 
+#ifdef CONFIG_CMDLINE
 int run_commandf(const char *fmt, ...)
 {
va_list args;
@@ -153,6 +154,7 @@ int run_commandf(const char *fmt, ...)
}
return run_command(console_buffer, 0);
 }
+#endif /* CMDLINE */
 
 //
 
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 06/32] sifive: Drop an unnecessary #ifdef

2023-10-16 Thread Simon Glass
This code is normally compiled for sifive, but sandbox can also compile
it. We should not use UNIT_TEST as a synonym for SANDBOX, since it is
possible to disable UNIT_TEST for sandbox.

Drop the condition since it isn't needed.

Signed-off-by: Simon Glass 
Suggested-by: Sean Anderson 
---

Changes in v3:
- Just drop the condition instead

 include/k210/pll.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/k210/pll.h b/include/k210/pll.h
index fd16a89cb203..6dd60b2eb4fc 100644
--- a/include/k210/pll.h
+++ b/include/k210/pll.h
@@ -13,7 +13,7 @@ struct k210_pll_config {
u8 od;
 };
 
-#ifdef CONFIG_UNIT_TEST
+#ifdef CONFIG_SANDBOX
 TEST_STATIC int k210_pll_calc_config(u32 rate, u32 rate_in,
 struct k210_pll_config *best);
 #ifndef nop
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 08/32] cli: Always build cli_getch

2023-10-16 Thread Simon Glass
This module is used for user input with menus, not just with the command
line. Compile it always, so it is available even when CMDLINE is disabled.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 common/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/Makefile b/common/Makefile
index cdeadf72026c..b21916f15340 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -8,6 +8,7 @@ ifndef CONFIG_SPL_BUILD
 obj-y += init/
 obj-y += main.o
 obj-y += exports.o
+obj-y += cli_getch.o
 obj-$(CONFIG_HUSH_PARSER) += cli_hush.o
 obj-$(CONFIG_AUTOBOOT) += autoboot.o
 
@@ -37,7 +38,7 @@ obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o
 obj-$(CONFIG_MENU) += menu.o
 obj-$(CONFIG_UPDATE_COMMON) += update.o
 obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
-obj-$(CONFIG_CMDLINE) += cli_getch.o cli_readline.o cli_simple.o
+obj-$(CONFIG_CMDLINE) += cli_readline.o cli_simple.o
 
 endif # !CONFIG_SPL_BUILD
 
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 04/32] cmd: Add a few more dependencies on CMDLINE

2023-10-16 Thread Simon Glass
Add this to some more commands to avoid build errors with sandbox.

Note that this is a temporary solution to expose more problems. A later
patch puts these behind an 'if CMDLINE'

Signed-off-by: Simon Glass 
---

Changes in v3:
- Add an explation as to why this patch is here

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

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 5bc0a92d57ad..00a7f84bce99 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -231,6 +231,7 @@ menu "Boot commands"
 
 config CMD_BOOTD
bool "bootd"
+   depends on CMDLINE
default y
help
  Run the command stored in the environment "bootcmd", i.e.
@@ -420,6 +421,7 @@ source lib/efi_selftest/Kconfig
 
 config CMD_BOOTMENU
bool "bootmenu"
+   depends on CMDLINE
select MENU
select CHARSET
help
@@ -486,6 +488,7 @@ config CMD_GO
 
 config CMD_RUN
bool "run"
+   depends on CMDLINE
default y
help
  Run the command in the given environment variable.
@@ -576,6 +579,7 @@ menu "Environment commands"
 
 config CMD_ASKENV
bool "ask for env variable"
+   depends on CMDLINE
help
  Ask for environment variable
 
@@ -2132,6 +2136,7 @@ config CMD_EFICONFIG
 
 config CMD_EXCEPTION
bool "exception - raise exception"
+   depends on CMDLINE
depends on ARM || RISCV || SANDBOX || X86
help
  Enable the 'exception' command which allows to raise an exception.
@@ -2238,6 +2243,7 @@ config CMD_SYSBOOT
 
 config CMD_QFW
bool "qfw"
+   depends on CMDLINE
select QFW
help
  This provides access to the QEMU firmware interface.  The main
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 07/32] fastboot: Declare a dependency on CMDLINE

2023-10-16 Thread Simon Glass
When CMDLINE is not enabled, this code fails to build. Correct this by
adding a condition.

Signed-off-by: Simon Glass 
---

(no changes since v2)

Changes in v2:
- Change this to use a Kconfig dependency instead of code failing

 drivers/fastboot/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 837c6f1180da..24b100f381fe 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -2,6 +2,7 @@ menu "Fastboot support"
 
 config FASTBOOT
bool
+   depends on CMDLINE
imply ANDROID_BOOT_IMAGE
imply CMD_FASTBOOT
help
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 05/32] test: Make UNIT_TEST depend on CMDLINE

2023-10-16 Thread Simon Glass
Many tests make some use of the command line, so require it for all test
code.

This could be teased apart, perhaps with a test flag indicating that it
uses the command line. Leave that for later.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

Changes in v3:
- Fix 'ut' typo

 test/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/Kconfig b/test/Kconfig
index 830245b6f9a9..2b4036704f91 100644
--- a/test/Kconfig
+++ b/test/Kconfig
@@ -2,6 +2,7 @@ menu "Testing"
 
 config UNIT_TEST
bool "Unit tests"
+   depends on CMDLINE
help
  Select this to compile in unit tests for various parts of
  U-Boot. Test suites will be subcommands of the "ut" command.
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 03/32] autoboot: Correct dependencies on CMDLINE

2023-10-16 Thread Simon Glass
Make AUTOBOOT depend on CMDLINE since it is mostly meaningless without it.

Signed-off-by: Simon Glass 
Reviewed-by: Tom Rini 
---

(no changes since v2)

Changes in v2:
- Move AUTOBOOT_USE_MENUKEY under AUTOBOOT

 boot/Kconfig | 29 +++--
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/boot/Kconfig b/boot/Kconfig
index f74ac7e9cc72..6461f7ebd040 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -1167,14 +1167,16 @@ menu "Autoboot options"
 
 config AUTOBOOT
bool "Autoboot"
+   depends on CMDLINE
default y
help
  This enables the autoboot.  See doc/README.autoboot for detail.
 
+if AUTOBOOT
+
 config BOOTDELAY
int "delay in seconds before automatically booting"
default 2
-   depends on AUTOBOOT
help
  Delay before automatically running bootcmd;
  set to 0 to autoboot with no delay, but you can stop it by key input.
@@ -1196,9 +1198,11 @@ config AUTOBOOT_KEYED
  U-Boot automatic booting process and bring the device
  to the U-Boot prompt for user input.
 
+if AUTOBOOT_KEYED
+
 config AUTOBOOT_FLUSH_STDIN
bool "Enable flushing stdin before starting to read the password"
-   depends on AUTOBOOT_KEYED && !SANDBOX
+   depends on !SANDBOX
help
  When this option is enabled stdin buffer will be flushed before
  starting to read the password.
@@ -1207,7 +1211,6 @@ config AUTOBOOT_FLUSH_STDIN
 
 config AUTOBOOT_PROMPT
string "Autoboot stop prompt"
-   depends on AUTOBOOT_KEYED
default "Autoboot in %d seconds\\n"
help
  This string is displayed before the boot delay selected by
@@ -1223,7 +1226,6 @@ config AUTOBOOT_PROMPT
 
 config AUTOBOOT_ENCRYPTION
bool "Enable encryption in autoboot stopping"
-   depends on AUTOBOOT_KEYED
help
  This option allows a string to be entered into U-Boot to stop the
  autoboot.
@@ -1250,7 +1252,7 @@ config AUTOBOOT_SHA256_FALLBACK
 
 config AUTOBOOT_DELAY_STR
string "Delay autobooting via specific input key / string"
-   depends on AUTOBOOT_KEYED && !AUTOBOOT_ENCRYPTION
+   depends on !AUTOBOOT_ENCRYPTION
help
  This option delays the automatic boot feature by issuing
  a specific input key or string. If CONFIG_AUTOBOOT_DELAY_STR
@@ -1262,7 +1264,7 @@ config AUTOBOOT_DELAY_STR
 
 config AUTOBOOT_STOP_STR
string "Stop autobooting via specific input key / string"
-   depends on AUTOBOOT_KEYED && !AUTOBOOT_ENCRYPTION
+   depends on !AUTOBOOT_ENCRYPTION
help
  This option enables stopping (aborting) of the automatic
  boot feature only by issuing a specific input key or
@@ -1274,7 +1276,7 @@ config AUTOBOOT_STOP_STR
 
 config AUTOBOOT_KEYED_CTRLC
bool "Enable Ctrl-C autoboot interruption"
-   depends on AUTOBOOT_KEYED && !AUTOBOOT_ENCRYPTION
+   depends on !AUTOBOOT_ENCRYPTION
help
  This option allows for the boot sequence to be interrupted
  by ctrl-c, in addition to the "bootdelaykey" and "bootstopkey".
@@ -1283,7 +1285,7 @@ config AUTOBOOT_KEYED_CTRLC
 
 config AUTOBOOT_NEVER_TIMEOUT
bool "Make the password entry never time-out"
-   depends on AUTOBOOT_KEYED && AUTOBOOT_ENCRYPTION && CRYPT_PW
+   depends on AUTOBOOT_ENCRYPTION && CRYPT_PW
help
  This option removes the timeout from the password entry
  when the user first presses the  key before entering
@@ -1291,7 +1293,7 @@ config AUTOBOOT_NEVER_TIMEOUT
 
 config AUTOBOOT_STOP_STR_ENABLE
bool "Enable fixed string to stop autobooting"
-   depends on AUTOBOOT_KEYED && AUTOBOOT_ENCRYPTION
+   depends on AUTOBOOT_ENCRYPTION
help
  This option enables the feature to add a fixed stop
  string that is defined at compile time.
@@ -1322,9 +1324,12 @@ config AUTOBOOT_STOP_STR_SHA256
  includes a ":", the portion prior to the ":" will be treated
  as a salt value.
 
+endif  # AUTOBOOT_KEYED
+
+if !AUTOBOOT_KEYED
+
 config AUTOBOOT_USE_MENUKEY
bool "Allow a specify key to run a menu from the environment"
-   depends on !AUTOBOOT_KEYED
help
  If a specific key is pressed to stop autoboot, then the commands in
  the environment variable 'menucmd' are executed before boot starts.
@@ -1339,6 +1344,10 @@ config AUTOBOOT_MENUKEY
  For example, 33 means "!" in ASCII, so pressing ! at boot would take
  this action.
 
+endif
+
+endif  # AUTOBOOT
+
 config AUTOBOOT_MENU_SHOW
bool "Show a menu on boot"
depends on CMD_BOOTMENU
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 02/32] bootstd: Correct dependencies on CMDLINE

2023-10-16 Thread Simon Glass
With recent changes over the last few years in boot/Kconfig it is
no-longer possible to disable CMDLINE. It results in various link
errors because some options which require CMDLINE are enabled
regardless of whether it is available.

Add the necessary conditions to fix this.

Note that it would be better to have all commands depend on CMDLINE,
but that is extremely difficult at present, since some functions use
CMD_xxx to enable feature xxx. For example networking and environment
have a number of problems to tease apart.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Reword commit message slightly

 boot/Kconfig   | 19 ---
 lib/efi_loader/Kconfig |  1 +
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/boot/Kconfig b/boot/Kconfig
index a01e6cb8aafe..f74ac7e9cc72 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -342,6 +342,7 @@ endif # FIT
 
 config PXE_UTILS
bool
+   depends on CMDLINE
select MENU
help
  Utilities for parsing PXE file formats.
@@ -357,7 +358,7 @@ config BOOT_DEFAULTS
select CMD_PART if PARTITIONS
select CMD_DHCP if CMD_NET
select CMD_PING if CMD_NET
-   select CMD_PXE if CMD_NET
+   select CMD_PXE if CMDLINE && CMD_NET
select SUPPORT_RAW_INITRD
select ENV_VARS_UBOOT_CONFIG
select CMD_BOOTI if ARM64
@@ -461,6 +462,7 @@ config BOOTMETH_GLOBAL
 
 config BOOTMETH_CROS
bool "Bootdev support for Chromium OS"
+   depends on CMDLINE
depends on X86 || ARM || SANDBOX
default y if !ARM
select EFI_PARTITION
@@ -475,6 +477,7 @@ config BOOTMETH_CROS
 
 config BOOTMETH_EXTLINUX
bool "Bootdev support for extlinux boot"
+   depends on CMDLINE
select PXE_UTILS
default y
help
@@ -490,7 +493,7 @@ config BOOTMETH_EXTLINUX
 
 config BOOTMETH_EXTLINUX_PXE
bool "Bootdev support for extlinux boot over network"
-   depends on CMD_PXE && CMD_NET && DM_ETH
+   depends on CMDLINE && CMD_PXE && CMD_NET && DM_ETH
default y
help
  Enables support for extlinux boot using bootdevs. This makes the
@@ -504,7 +507,7 @@ config BOOTMETH_EXTLINUX_PXE
 
 config BOOTMETH_EFILOADER
bool "Bootdev support for EFI boot"
-   depends on EFI_LOADER
+   depends on EFI_LOADER && CMDLINE
default y
help
  Enables support for EFI boot using bootdevs. This makes the
@@ -536,10 +539,10 @@ config BOOTMETH_VBE
 
 config BOOTMETH_DISTRO
bool  # Options needed to boot any distro
-   select BOOTMETH_SCRIPT  # E.g. Armbian uses scripts
-   select BOOTMETH_EXTLINUX  # E.g. Debian uses these
-   select BOOTMETH_EXTLINUX_PXE if CMD_PXE && CMD_NET && DM_ETH
-   select BOOTMETH_EFILOADER if EFI_LOADER # E.g. Ubuntu uses this
+   select BOOTMETH_SCRIPT if CMDLINE # E.g. Armbian uses scripts
+   select BOOTMETH_EXTLINUX if CMDLINE # E.g. Debian uses these
+   select BOOTMETH_EXTLINUX_PXE if CMDLINE && CMD_PXE && CMD_NET && DM_ETH
+   select BOOTMETH_EFILOADER if CMDLINE && EFI_LOADER # E.g. Ubuntu uses 
this
 
 config SPL_BOOTMETH_VBE
bool "Bootdev support for Verified Boot for Embedded (SPL)"
@@ -663,6 +666,7 @@ config BOOTMETH_SANDBOX
 
 config BOOTMETH_SCRIPT
bool "Bootdev support for U-Boot scripts"
+   depends on CMDLINE
default y if BOOTSTD_FULL
select HUSH_PARSER
help
@@ -777,6 +781,7 @@ endmenu # Boot images
 
 config DISTRO_DEFAULTS
bool "(deprecated) Script-based booting of Linux distributions"
+   depends on CMDLINE
select BOOT_DEFAULTS
select AUTO_COMPLETE
select CMDLINE_EDITING
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index d20aaab6dba4..621ed5e5b0fb 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -34,6 +34,7 @@ if EFI_LOADER
 
 config CMD_BOOTEFI_BOOTMGR
bool "UEFI Boot Manager"
+   depends on CMDLINE
default y
select BOOTMETH_GLOBAL if BOOTSTD
help
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 01/32] buildman: Use oldconfig when adjusting the config

2023-10-16 Thread Simon Glass
We cannot be sure that the new config is consistent, particularly when
changing a major item like CONFIG_CMDLINE. Use 'make oldconfig' to
check that and avoid any such problems.

Signed-off-by: Simon Glass 
---

(no changes since v1)

 tools/buildman/builder.py   | 2 +-
 tools/buildman/builderthread.py | 6 ++
 tools/buildman/func_test.py | 4 +++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 5305477c5be6..782e59dd5cca 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -476,7 +476,7 @@ class Builder:
 Args:
 commit: Commit object that is being built
 brd: Board object that is being built
-stage: Stage that we are at (mrproper, config, build)
+stage: Stage that we are at (mrproper, config, oldconfig, build)
 cwd: Directory where make should be run
 args: Arguments to pass to make
 kwargs: Arguments to pass to command.run_pipe()
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 6a61f64da1d4..a8599c0bb2a8 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -426,6 +426,12 @@ class BuilderThread(threading.Thread):
 
 # Now do the build, if everything looks OK
 if result.return_code == 0:
+if adjust_cfg:
+oldc_args = list(args) + ['oldconfig']
+oldc_result = self.make(commit, brd, 'oldconfig', cwd,
+*oldc_args, env=env)
+if oldc_result.return_code:
+return oldc_result
 result = self._build(commit, brd, cwd, args, env, cmd_list,
  config_only)
 if adjust_cfg:
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index 55dd494fe8ee..6b88ed815d65 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -439,6 +439,8 @@ class TestFunctional(unittest.TestCase):
 tools.write_file(fname, b'CONFIG_SOMETHING=1')
 return command.CommandResult(return_code=0,
 combined='Test configuration complete')
+elif stage == 'oldconfig':
+return command.CommandResult(return_code=0)
 elif stage == 'build':
 stderr = ''
 fname = os.path.join(cwd or '', out_dir, 'u-boot')
@@ -461,7 +463,7 @@ Some images are invalid'''
 return command.CommandResult(return_code=0)
 
 # Not handled, so abort
-print('make', stage)
+print('_HandleMake failure: make', stage)
 sys.exit(1)
 
 # Example function to print output lines
-- 
2.42.0.655.g421f12c284-goog



[PATCH v3 00/32] Tidy up use of CONFIG_CMDLINE

2023-10-16 Thread Simon Glass
It should be possible to disable CONFIG_CMDLINE and have all commands
and related functionality dropped from U-Boot. This is useful when
trying to reduce the size of U-Boot.

Recent changes have stopped this from working.

This series repairs the feature for sandbox and adds a test to stop it
breaking again.

Note that quite a lot of functionality is lost if CONFIG_CMDLINE is
disabled, e.g. networking and most booting options. Further work is
needed to make the option more generally useful.

Changes in v3:
- Reword commit message slightly
- Add an explation as to why this patch is here
- Fix 'ut' typo
- Just drop the condition instead
- Add new patch to rearrange the Kconfig for CMD_BOOTEFI_BOOTMGR
- Add new patch with a Kconfig for command-line entry
- Add new patch with a Kconfig for command-line entry
- Reorder the Kconfig options a little
- Add new patch to tidy up semicolon after command macros
- Rebase on Tom's LONGHELP series
- Correct 'of' typo

Changes in v2:
- Move AUTOBOOT_USE_MENUKEY under AUTOBOOT
- Change this to use a Kconfig dependency instead of code failing
- Adjust the depends on the commands, instead of EFI_LOADER
- Add new patch to update EFI_LOADER to depend on DM_ETH
- Add new patch to drop discarding of command linker-lists
- Add new patch to unify the U_BOOT_ENV_LOCATION conditions

Simon Glass (32):
  buildman: Use oldconfig when adjusting the config
  bootstd: Correct dependencies on CMDLINE
  autoboot: Correct dependencies on CMDLINE
  cmd: Add a few more dependencies on CMDLINE
  test: Make UNIT_TEST depend on CMDLINE
  sifive: Drop an unnecessary #ifdef
  fastboot: Declare a dependency on CMDLINE
  cli: Always build cli_getch
  cmd: Use an #ifdef around run_commandf()
  Move bootmenu_conv_key() into its own file
  pxe: Depend on CMDLINE
  env: Split out non-command code into a new file
  console: Move SYS_PBSIZE into common/
  bootm: Allow building when cleanup functions are missing
  fdt: Move working_fdt into fdt_support
  net: Depend on CONFIG_CMDLINE
  log: Allow use without CONFIG_CMDLINE
  video: Allow use without CONFIG_CMDLINE
  video: Dont require the font command
  efi: Make commands depend on CMDLINE
  efi: Rearrange the Kconfig for CMD_BOOTEFI_BOOTMGR
  efi: Update EFI_LOADER to depend on DM_ETH
  cli: Split command-line-editing into its own file
  Add a new Kconfig for command-line entry
  Add a new Kconfig for command-line history
  sandbox: Disable CONFIG_DISTRO_DEFAULTS
  cmd: Make all commands depend on CMDLINE
  sandbox: Avoid requiring cmdline
  arm: x86: Drop discarding of command linker-lists
  mmc: env: Unify the U_BOOT_ENV_LOCATION conditions
  treewide: Tidy up semicolon after command macros
  sandbox: Add a test for disabling CONFIG_CMDLINE

 arch/Kconfig   |  11 +-
 arch/arm/cpu/u-boot.lds|   3 -
 arch/arm/lib/bootm.c   |   2 +
 arch/x86/cpu/u-boot-64.lds |   4 -
 arch/x86/cpu/u-boot-spl.lds|   4 -
 arch/x86/cpu/u-boot.lds|   4 -
 board/freescale/common/vid.c   |   2 +-
 board/xilinx/common/fru.c  |   2 +-
 board/xilinx/versal/cmds.c |   2 +-
 board/xilinx/zynqmp/cmds.c |   2 +-
 boot/Kconfig   |  58 ++--
 boot/bootm.c   |  10 +-
 boot/fdt_support.c |   5 +
 cmd/Kconfig|  50 ++--
 cmd/Makefile   |   2 +-
 cmd/btrfs.c|   2 +-
 cmd/eeprom.c   |   2 +-
 cmd/ext2.c |   4 +-
 cmd/fdt.c  |   5 -
 cmd/fs.c   |   8 +-
 cmd/nvedit.c   | 122 +
 cmd/pinmux.c   |   2 +-
 cmd/qfw.c  |   2 +-
 common/Kconfig |  12 +
 common/Makefile|  10 +-
 common/cli.c   |   2 +
 common/cli_cread.c | 407 +
 common/cli_getch.c |   1 +
 common/cli_readline.c  | 384 +--
 common/log.c   |   4 +-
 common/menu.c  |  40 ---
 common/menu_key.c  |  49 
 configs/sandbox64_defconfig|   1 -
 configs/sandbox_defconfig  |   1 -
 configs/sandbox_flattree_defconfig |   1 -
 configs/sandbox_noinst_defconfig   |   1 -
 configs/sandbox_spl_defconfig  |   1 -
 configs/sandbox_vpl_defconfig  |   1 -
 drivers/fastboot/Kconfig   |   1 +
 drivers/video/Kconfig  |   2 +-
 drivers/video/console_truetype.c   |   4 +
 env/Makefile   |   1 +
 env/env_set.c  | 132 ++
 env/mmc.c  |   2 +-
 include/bootm.h|  15 +-
 include/cli.h  |  31 +++
 include/command.h  |   2 +-
 include/env_internal.h |  23 ++
 include/k210/pll.h | 

Re: [PATCH v7 2/2] schemas: Add some common reserved-memory usages

2023-10-16 Thread Simon Glass
Hi Rob,

On Mon, 16 Oct 2023 at 10:50, Rob Herring  wrote:
>
> On Fri, Oct 13, 2023 at 4:09 PM Simon Glass  wrote:
> >
> > Hi Rob,
> >
> > On Fri, 13 Oct 2023 at 13:42, Rob Herring  wrote:
> > >
> > > On Fri, Oct 6, 2023 at 7:03 PM Simon Glass  wrote:
> > > >
> > > > Hi Ard,
> > > >
> > > > On Fri, 6 Oct 2023 at 17:00, Ard Biesheuvel  wrote:
> > > > >
> > > > > On Fri, 6 Oct 2023 at 20:17, Simon Glass  wrote:
> > > > > >
> > > > > > Hi Ard,
> > > > > >
> > > > > > On Fri, 6 Oct 2023 at 11:33, Ard Biesheuvel  wrote:
> > > > > > >
> > > > > > > On Mon, 2 Oct 2023 at 19:54, Simon Glass  
> > > > > > > wrote:
> > > > > > > >
> > > > > > > > Hi Rob,
> > > > > > > >
> > > > > > > > On Tue, 26 Sept 2023 at 13:42, Simon Glass  
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > It is common to split firmware into 'Platform Init', which 
> > > > > > > > > does the
> > > > > > > > > initial hardware setup and a "Payload" which selects the OS 
> > > > > > > > > to be booted.
> > > > > > > > > Thus an handover interface is required between these two 
> > > > > > > > > pieces.
> > > > > > > > >
> > > > > > > > > Where UEFI boot-time services are not available, but UEFI 
> > > > > > > > > firmware is
> > > > > > > > > present on either side of this interface, information about 
> > > > > > > > > memory usage
> > > > > > > > > and attributes must be presented to the "Payload" in some 
> > > > > > > > > form.
> > > > > > > > >
> > > > > > > > > This aims to provide an small schema addition for the memory 
> > > > > > > > > mapping
> > > > > > > > > needed to keep these two pieces working together well.
> > > > > > > > >
> > > > > > > > > Signed-off-by: Simon Glass 
> > > > > > > > > ---
> > > > > > > > >
> > > > > > > > > Changes in v7:
> > > > > > > > > - Rename acpi-reclaim to acpi
> > > > > > > > > - Drop individual mention of when memory can be reclaimed
> > > > > > > > > - Rewrite the item descriptions
> > > > > > > > > - Add back the UEFI text (with trepidation)
> > > > > > > >
> > > > > > > > I am again checking on this series. Can it be applied, please?
> > > > > > > >
> > > > > > >
> > > > > > > Apologies for the delay in response. I have been away.
> > > > > >
> > > > > > OK, I hope you had a nice trip.
> > > > > >
> > > > >
> > > > > Thanks, it was wonderful!
> > > > >
> > > > > > >
> > > > > > > >
> > > > > > > > >
> > > > > > > > > Changes in v6:
> > > > > > > > > - Drop mention of UEFI
> > > > > > > > > - Use compatible strings instead of node names
> > > > > > > > >
> > > > > > > > > Changes in v5:
> > > > > > > > > - Drop the memory-map node (should have done that in v4)
> > > > > > > > > - Tidy up schema a bit
> > > > > > > > >
> > > > > > > > > Changes in v4:
> > > > > > > > > - Make use of the reserved-memory node instead of creating a 
> > > > > > > > > new one
> > > > > > > > >
> > > > > > > > > Changes in v3:
> > > > > > > > > - Reword commit message again
> > > > > > > > > - cc a lot more people, from the FFI patch
> > > > > > > > > - Split out the attributes into the /memory nodes
> > > > > > > > >
> > > > > > > > > Changes in v2:
> > > > > > > > > - Reword commit message
> > > > > > > > >
> > > > > > > > >  .../reserved-memory/common-reserved.yaml  | 71 
> > > > > > > > > +++
> > > > > > > > >  1 file changed, 71 insertions(+)
> > > > > > > > >  create mode 100644 
> > > > > > > > > dtschema/schemas/reserved-memory/common-reserved.yaml
> > > > > > > > >
> > > > > > > > > diff --git 
> > > > > > > > > a/dtschema/schemas/reserved-memory/common-reserved.yaml 
> > > > > > > > > b/dtschema/schemas/reserved-memory/common-reserved.yaml
> > > > > > > > > new file mode 100644
> > > > > > > > > index 000..f7fbdfd
> > > > > > > > > --- /dev/null
> > > > > > > > > +++ b/dtschema/schemas/reserved-memory/common-reserved.yaml
> > > > > > > > > @@ -0,0 +1,71 @@
> > > > > > > > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > > > > > > > > +%YAML 1.2
> > > > > > > > > +---
> > > > > > > > > +$id: 
> > > > > > > > > http://devicetree.org/schemas/reserved-memory/common-reserved.yaml#
> > > > > > > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > > > > > > +
> > > > > > > > > +title: Common memory reservations
> > > > > > > > > +
> > > > > > > > > +description: |
> > > > > > > > > +  Specifies that the reserved memory region can be used for 
> > > > > > > > > the purpose
> > > > > > > > > +  indicated by its compatible string.
> > > > > > > > > +
> > > > > > > > > +  Clients may reuse this reserved memory if they understand 
> > > > > > > > > what it is for,
> > > > > > > > > +  subject to the notes below.
> > > > > > > > > +
> > > > > > > > > +maintainers:
> > > > > > > > > +  - Simon Glass 
> > > > > > > > > +
> > > > > > > > > +allOf:
> > > > > > > > > +  - $ref: reserved-memory.yaml
> > > > > > > > > +
> > > > > > > > > +properties:
> > > > > > > > > +  compatible:
> > > > > > > > > +description: |
> > > > > > > > > +  This describes some 

Re: [PATCH v2 2/2] serial: introduce CONFIG_CONSOLE_FLUSH_ON_NEWLINE

2023-10-16 Thread Simon Glass
On Mon, 16 Oct 2023 at 02:36, Rasmus Villemoes
 wrote:
>
> When debugging, one sometimes only gets partial output lines or
> nothing at all from the last printf, because the uart has a largish
> buffer, and the code after the printf() may cause the CPU to hang
> before the uart IP has time to actually emit all the characters. That
> can be very confusing, because one doesn't then know exactly where the
> hang happens.
>
> Introduce a config knob allowing one to wait for the uart fifo to
> drain whenever a newline character is printed, roughly corresponding
> to the effect of setvbuf(..., _IOLBF, ...) in ordinary C programs.
>
> Since this uses IS_ENABLED() instead of cpp ifdef, we can remove the
> ifdef around the _serial_flush() definition - if neither
> CONSOLE_FLUSH_SUPPORT or CONSOLE_FLUSH_ON_NEWLINE are enabled, the
> compiler elides _serial_flush(), but it won't warn about it being
> unused.
>
> Signed-off-by: Rasmus Villemoes 
> ---
>  common/Kconfig | 10 ++
>  drivers/serial/serial-uclass.c |  8 ++--
>  2 files changed, 16 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH v4 4/8] rockchip: block: blk-uclass: disable bounce buffer support for rkmtd

2023-10-16 Thread Simon Glass
Hi Johan,

On Sun, 15 Oct 2023 at 16:33, Johan Jonker  wrote:
>
> Disable bounce buffer support for rkmtd.
>
> Signed-off-by: Johan Jonker 
> Reviewed-by: Kever Yang 
> ---
>
> Changed V3:
>   New patch
> ---
>  drivers/block/blk-uclass.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
> index 30ad5bbb0024..ac1b43d757d8 100644
> --- a/drivers/block/blk-uclass.c
> +++ b/drivers/block/blk-uclass.c
> @@ -415,7 +415,7 @@ struct blk_bounce_buffer {
>
>  static int blk_buffer_aligned(struct bounce_buffer *state)
>  {
> -#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
> +#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) && !IS_ENABLED(CONFIG_RKMTD)

We should not have arch-specific code in a generic file. Can you make
BOUNCE_BUFFER depend on !RKMTD ?

> struct blk_bounce_buffer *bbstate =
> container_of(state, struct blk_bounce_buffer, state);
> struct udevice *dev = bbstate->dev;
> @@ -441,7 +441,7 @@ long blk_read(struct udevice *dev, lbaint_t start, 
> lbaint_t blkcnt, void *buf)
>   start, blkcnt, desc->blksz, buf))
> return blkcnt;
>
> -   if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) {
> +   if (IS_ENABLED(CONFIG_BOUNCE_BUFFER) && !IS_ENABLED(CONFIG_RKMTD)) {
> struct blk_bounce_buffer bbstate = { .dev = dev };
> int ret;
>
> @@ -478,7 +478,7 @@ long blk_write(struct udevice *dev, lbaint_t start, 
> lbaint_t blkcnt,
>
> blkcache_invalidate(desc->uclass_id, desc->devnum);
>
> -   if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) {
> +   if (IS_ENABLED(CONFIG_BOUNCE_BUFFER) && !IS_ENABLED(CONFIG_RKMTD)) {
> struct blk_bounce_buffer bbstate = { .dev = dev };
> int ret;
>
> --
> 2.39.2
>

Regards,
Simon


Re: [PATCH v5 2/6] cmd: Add a sysinfo command

2023-10-16 Thread Simon Glass
Hi Detlev,

On Mon, 16 Oct 2023 at 08:21, Detlev Casanova
 wrote:
>
> On Monday, October 2, 2023 2:56:28 P.M. EDT Simon Glass wrote:
> > On Mon, 2 Oct 2023 at 09:21, Detlev Casanova
> >
> >  wrote:
> > > The command is able to show different information for the running
> > > system:
> > > * Model name
> > > * Board ID
> > > * Revision
> > >
> > > This command can be used by boot shell scripts to select configurations
> > > depending on the specific running system.
> > >
> > > Reviewed-by: Marek Vasut 
> > > Signed-off-by: Detlev Casanova 
> > > ---
> > >
> > >  cmd/Kconfig   |   6 +++
> > >  cmd/Makefile  |   1 +
> > >  cmd/sysinfo.c | 133 ++
> > >  3 files changed, 140 insertions(+)
> > >  create mode 100644 cmd/sysinfo.c
> >
> > Reviewed-by: Simon Glass 
> >
> > Would prefer more help text in the Kconfig as this is pretty vague
>
> Indeed, how would that sound ?
>
> Display information to identify the system. It supports showing a board id, a
> revision number as well as a human readable name.

Also it uses the sysinfo driver for your board to get the information.
You could link to the sysinfo docs or header file.

Regards,
Simon


Re: [PATCH v4 2/8] rockchip: dm: prepare rkmtd UCLASS

2023-10-16 Thread Simon Glass
On Sun, 15 Oct 2023 at 16:32, Johan Jonker  wrote:
>
> Prepare a rkmtd UCLASS in use for writing Rockchip boot blocks
> in combination with existing userspace tools and rockusb command.
>
> Signed-off-by: Johan Jonker 
> Reviewed-by: Kever Yang 
> ---
>  disk/part.c| 4 
>  drivers/block/blk-uclass.c | 1 +
>  include/dm/uclass-id.h | 1 +
>  3 files changed, 6 insertions(+)

Reviewed-by: Simon Glass 


[PATCH 1/1] config: qemu: relax print and console buffer size

2023-10-16 Thread Heinrich Schuchardt
QEMU print and console buffer sizes have been restricted on QEMU below
their default values.

One of the side effects of the print buffer size restriction is output
truncation of the 'efidebug dh' command.

As QEMU does not have special memory size restrictions remove the settings
from the defconfig files and go with the generic defaults.

Fixes: d0ee7f295d74 ("Convert CONFIG_SYS_PBSIZE to Kconfig")
Fixes: d31466b382dd ("Convert CONFIG_SYS_CBSIZE to Kconfig")
Signed-off-by: Heinrich Schuchardt 
---
 configs/qemu-ppce500_defconfig   | 1 -
 configs/qemu-riscv32_defconfig   | 2 --
 configs/qemu-riscv32_smode_defconfig | 2 --
 configs/qemu-riscv32_spl_defconfig   | 2 --
 configs/qemu-riscv64_defconfig   | 2 --
 configs/qemu-riscv64_smode_defconfig | 2 --
 configs/qemu-riscv64_spl_defconfig   | 2 --
 configs/qemu-x86_64_defconfig| 1 -
 configs/qemu-x86_defconfig   | 1 -
 configs/qemu_arm64_defconfig | 2 --
 configs/qemu_arm_defconfig   | 2 --
 11 files changed, 19 deletions(-)

diff --git a/configs/qemu-ppce500_defconfig b/configs/qemu-ppce500_defconfig
index fbe84d5702..de7267e228 100644
--- a/configs/qemu-ppce500_defconfig
+++ b/configs/qemu-ppce500_defconfig
@@ -21,7 +21,6 @@ CONFIG_BOOTCOMMAND="test -n \"$qemu_kernel_addr\" && bootm 
$qemu_kernel_addr - $
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
-CONFIG_SYS_PBSIZE=276
 CONFIG_CMD_REGINFO=y
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_GREPENV=y
diff --git a/configs/qemu-riscv32_defconfig b/configs/qemu-riscv32_defconfig
index 9ace68e73f..cf74a48ea2 100644
--- a/configs/qemu-riscv32_defconfig
+++ b/configs/qemu-riscv32_defconfig
@@ -12,8 +12,6 @@ CONFIG_FIT=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
-CONFIG_SYS_CBSIZE=256
-CONFIG_SYS_PBSIZE=276
 CONFIG_SYS_BOOTM_LEN=0x400
 CONFIG_CMD_BOOTEFI_SELFTEST=y
 CONFIG_CMD_NVEDIT_EFI=y
diff --git a/configs/qemu-riscv32_smode_defconfig 
b/configs/qemu-riscv32_smode_defconfig
index 0c7389e2f9..aeef2f35b0 100644
--- a/configs/qemu-riscv32_smode_defconfig
+++ b/configs/qemu-riscv32_smode_defconfig
@@ -13,8 +13,6 @@ CONFIG_FIT=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
-CONFIG_SYS_CBSIZE=256
-CONFIG_SYS_PBSIZE=276
 CONFIG_SYS_BOOTM_LEN=0x400
 CONFIG_CMD_BOOTEFI_SELFTEST=y
 CONFIG_CMD_NVEDIT_EFI=y
diff --git a/configs/qemu-riscv32_spl_defconfig 
b/configs/qemu-riscv32_spl_defconfig
index e63d6fd934..db9c971c2f 100644
--- a/configs/qemu-riscv32_spl_defconfig
+++ b/configs/qemu-riscv32_spl_defconfig
@@ -19,8 +19,6 @@ CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_SPL_MAX_SIZE=0x10
 CONFIG_SPL_BSS_START_ADDR=0x8400
 CONFIG_SPL_SYS_MALLOC=y
-CONFIG_SYS_CBSIZE=256
-CONFIG_SYS_PBSIZE=276
 CONFIG_SYS_BOOTM_LEN=0x400
 # CONFIG_CMD_MII is not set
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
diff --git a/configs/qemu-riscv64_defconfig b/configs/qemu-riscv64_defconfig
index 9a8bbef192..9fb40b22f9 100644
--- a/configs/qemu-riscv64_defconfig
+++ b/configs/qemu-riscv64_defconfig
@@ -12,8 +12,6 @@ CONFIG_FIT=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
-CONFIG_SYS_CBSIZE=256
-CONFIG_SYS_PBSIZE=276
 CONFIG_SYS_BOOTM_LEN=0x400
 CONFIG_CMD_BOOTEFI_SELFTEST=y
 CONFIG_CMD_NVEDIT_EFI=y
diff --git a/configs/qemu-riscv64_smode_defconfig 
b/configs/qemu-riscv64_smode_defconfig
index 1d0f021ade..e3b123ca4d 100644
--- a/configs/qemu-riscv64_smode_defconfig
+++ b/configs/qemu-riscv64_smode_defconfig
@@ -15,8 +15,6 @@ CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};"
 CONFIG_DISPLAY_CPUINFO=y
 CONFIG_DISPLAY_BOARDINFO=y
-CONFIG_SYS_CBSIZE=256
-CONFIG_SYS_PBSIZE=276
 CONFIG_SYS_BOOTM_LEN=0x400
 CONFIG_CMD_BOOTEFI_SELFTEST=y
 CONFIG_CMD_NVEDIT_EFI=y
diff --git a/configs/qemu-riscv64_spl_defconfig 
b/configs/qemu-riscv64_spl_defconfig
index b048bb8aed..d6bf3130fe 100644
--- a/configs/qemu-riscv64_spl_defconfig
+++ b/configs/qemu-riscv64_spl_defconfig
@@ -18,8 +18,6 @@ CONFIG_DISPLAY_BOARDINFO=y
 CONFIG_SPL_MAX_SIZE=0x10
 CONFIG_SPL_BSS_START_ADDR=0x8400
 CONFIG_SPL_SYS_MALLOC=y
-CONFIG_SYS_CBSIZE=256
-CONFIG_SYS_PBSIZE=276
 CONFIG_SYS_BOOTM_LEN=0x400
 # CONFIG_CMD_MII is not set
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
diff --git a/configs/qemu-x86_64_defconfig b/configs/qemu-x86_64_defconfig
index f02e9125a6..2ff49fbd6a 100644
--- a/configs/qemu-x86_64_defconfig
+++ b/configs/qemu-x86_64_defconfig
@@ -46,7 +46,6 @@ CONFIG_SPL_NET=y
 CONFIG_SPL_PCI=y
 CONFIG_SPL_PCH=y
 CONFIG_SPL_RTC=y
-CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
 CONFIG_CMD_BOOTEFI_SELFTEST=y
 CONFIG_CMD_NVEDIT_EFI=y
diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig
index 4b2787d4aa..246ac6b6b8 100644
--- a/configs/qemu-x86_defconfig
+++ b/configs/qemu-x86_defconfig
@@ -24,7 +24,6 @@ CONFIG_LOG=y
 CONFIG_LOGF_FUNC=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_PCI_INIT_R=y
-CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
 

Re: [PATCH v7 1/2] schemas: memory: Add ECC properties

2023-10-16 Thread Simon Glass
Hi Rob,

On Mon, 16 Oct 2023 at 13:57, Rob Herring  wrote:
>
> On Tue, Sep 26, 2023 at 01:42:38PM -0600, Simon Glass wrote:
> > Some memories provide ECC detection and/or correction. For software which
> > wants to check memory, it is helpful to see which regions provide this
> > feature.
> >
> > Add this as a property of the /memory nodes, since it presumably follows
> > the hardware-level memory system.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> > Changes in v7:
> > - Drop unnecessary |
> > - Add a blank line between properties
> >
> > Changes in v6:
> > - Use a number of bits instead of a string property
> > - Fix inidcates typo
> >
> > Changes in v5:
> > - Redo to make this property specific to ECC
> > - Provide properties both for detection and correction
> >
> > Changes in v3:
> > - Add new patch to update the /memory nodes
> >
> >  dtschema/schemas/memory.yaml | 13 +
> >  1 file changed, 13 insertions(+)
>
> Applied this patch.

Thank you for your help and guidance on this.

Regards,
Simon


Re: Please pull u-boot-marvell/master

2023-10-16 Thread Tom Rini
On Mon, Oct 16, 2023 at 04:50:26PM +0200, Stefan Roese wrote:

> Hi Tom,
> 
> please pull this first batch of Marvell related patches:
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] cmd/ti: Update Kconfig logic and Makefile recursion logic

2023-10-16 Thread Tom Rini
On Sat, Oct 07, 2023 at 03:36:58PM -0400, Tom Rini wrote:

> - Add some dependencies to CMD_DDR3 as this is only valid on some
>   platforms (which tend to select it as well).
> - The proper gate for going in to cmd/ti is not
>   CONFIG_TI_COMMON_CMD_OPTIONS as nothing under there is controlled by
>   that symbol but the general TI architecture options.
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Pull request: please pull u-boot-imx-20231016

2023-10-16 Thread Stefano Babic

Hi Tom,

please pull from u-boot-imx, thanks !

The following changes since commit 3c3f1626919cd93cbe6c56e3849937de5be18dbb:

  Merge tag 'dm-pull-13oct23' of 
https://source.denx.de/u-boot/custodians/u-boot-dm (2023-10-14 10:50:20 
-0400)


are available in the Git repository at:

  https://gitlab.denx.de/u-boot/custodians/u-boot-imx.git 
tags/u-boot-imx-20231016


for you to fetch changes up to b0eef7326920ff55ec22dfb86812033d84737839:

  imx8mp-evk: Add USB0 OTG support (2023-10-16 18:52:20 +0200)


u-boot-imx-20231016
---

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/18168

- Imrovement MX93
- Toradex: fixes
- Convert to DM (serial, watchdog) for some boards
- HAB improvements for Secure Boot
- DTO overlay for DHCOM
- USB fixes, Mass storage for MX28
- Cleanup some code
- Phytec MX8M : EEProm detection, fixes
- Gateworks Boards improvements


Alice Guo (1):
  arm: dts: imx93: add a per clock for LPUART1

Andrej Rosano (1):
  usbarmory: Add DM_I2C and DM_SERIAL support

Andrejs Cainikovs (1):
  board: toradex: verdin-imx8mm: set fixed LPDDR4 refresh rate as 
per errata ERR050805


Eduard Strehlau (1):
  smegw01: Remove misuse of CONFIG_ENV_IS_NOWHERE

Fabio Estevam (9):
  usb: ehci: mxs: Fix the USB node pointer retrieval
  usb: ehci: mxs: Use regulator_set_enable_if_allowed()
  mx28evk: Add USB Mass Storage support
  imx7d-sdb-u-boot: Pass SPDX-License tag
  mx7dsabresd: Convert to watchdog driver model
  smegw01: Convert to watchdog driver model
  mxs: Kconfig: Remove TARGET_XFI3 symbol
  pico-pi-imx7d: Unselect CONFIG_CONSOLE_MUX
  imx8mp-evk: Add USB0 OTG support

Hiago De Franco (3):
  verdin-imx8mp: drop unused tdx easy installer ifdef
  toradex: colibri_imx7: Enable nand/emmc detection and set boot 
variant

  arm: mach-imx: Makefile: Extend u-boot-nand.imx padding

Joao Paulo Goncalves (1):
  toradex: verdin-imx8mm/imx8mp: Remove bootcmd_mfg

Marcel Ziswiler (1):
  board: toradex: verdin-imx8mm: enable usb sdp spl recovery support

Marek Vasut (9):
  imx: hab: Use CONFIG_SPL_LOAD_FIT_ADDRESS in the CSF example
  ARM: dts: imx: Switch USB1 port control to GPIO on Data Modul 
i.MX8M Plus eDM SBC

  imx: hab: Use size parameter
  spl: fit: Add board level function to decide application of DTO
  arm64: dts: imx8mp: Switch to DT overlays for i.MX8MP DHCOM SoM
  arm64: dts: imx8mp: Update i.MX8MP DHCOM SoM DT to production rev.200
  arm64: dts: imx8mp: Drop i.MX8MP DHCOM rev.100 PHY address 
workaround from PDK3 DT
  arm64: dts: imx8mp: Add DT overlay describing i.MX8MP DHCOM SoM 
rev.100
  arm64: dts: imx8mp: Make GPIO3 available early in U-Boot proper 
on i.MX8MP DHCOM


Michael Scott (1):
  imx: syscounter: allow timer_init for SPL build

Rasmus Villemoes (4):
  imx8mp: binman: rename spl and u-boot nodes
  imx: spl_imx_romapi: avoid tricky use of spl_load_simple_fit() to 
get full FIT size

  imx: spl_imx_romapi.c: remove dead code
  mx8m: csf.sh: pad csf blob for u-boot.itb to CSF_SIZE minus IVT 
header


Ricardo Salveti (1):
  arm: dts: imx6ull-14x14-evk-u-boot: add rngb

Sébastien Szymanski (2):
  clk: imx: add i.MX93 CCF driver
  imx93_evk: defconfig: enable clock driver

Teresa Remmet (6):
  board: phytec: Add common PHYTEC SoM detection
  board: phytec: common: Add imx8m specific EEPROM detection support
  board: phytec: phycore_imx8mp: Update 2GB RAM Timings
  board: phytec: common: phytec_som_detection: Add helper for PCB 
revision

  board: phytec: phycore-imx8mp: Add EEPROM detection initialisation
  board: phytec: phycore_imx8mp: Add 4000MTS RAM timings based on 
PCB rev


Tim Harvey (10):
  board: gateworks: venice: add imx8mp-gw71xx-2x support
  board: gateworks: venice: add imx8mp-gw72xx-2x support
  board: gateworks: venice: add imx8mp-gw73xx-2x support
  board: gateworks: venice: add imx8mm-gw7905-0x support
  board: gateworks: venice: updates for imx8mp-venice-gw74xx revB PCB
  arm: dts: imx8mm: move firmware/optee node to common 
imx8mm-u-boot.dtsi
  arm: dts: imx8mp: move firmware/optee node to common 
imx8mp-u-boot.dtsi

  arm: dts: imx8mn: protect the firmware/optee node with ifdef
  arm: dts: imx8m: move CAAM nodes into common u-boot.dtsi
  arm: imx: imx8m: add optee configuration to ft_system_setup

Ye Li (1):
  serial: lpuart: Enable IPG clock

 arch/arm/dts/Makefile|   9 +++
 arch/arm/dts/imx6ull-14x14-evk-u-boot.dtsi   |   4 
 arch/arm/dts/imx7d-sdb-u-boot.dtsi   |  14 +++
 arch/arm/dts/imx7d-smegw01-u-boot.dtsi   |  13 ++
 arch/arm/dts/imx8mm-cl-iot-gate-optee-u-boot.dtsi|   7 --
 arch/arm/dts/imx8mm-cl

Re: [PATCH 1/2] command.h: Add a U_BOOT_LONGHELP macro

2023-10-16 Thread Tom Rini
On Sat, Oct 07, 2023 at 03:13:07PM -0400, Tom Rini wrote:

> In order to be able to discard unused long help texts without further
> linker lists, add a macro for defining the long help messages which uses
> __maybe_unused.  This allows us to discard them as unreferenced as part
> of the link.
> 
> Signed-off-by: Tom Rini 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 2/2] cmd: Convert existing long help messages to the new macro

2023-10-16 Thread Tom Rini
On Sat, Oct 07, 2023 at 03:13:08PM -0400, Tom Rini wrote:

> - Generally we just drop the #ifdef CONFIG_SYS_LONGHELP and endif lines
>   and use U_BOOT_LONGHELP to declare the same variable name as before
> - In a few places, either rename the variable to follow convention or
>   introduce the variable as it was being done inline before.
> 
> Signed-off-by: Tom Rini 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 6/6] eeprom: starfive: add 'mac raw' command

2023-10-16 Thread Tom Rini
On Sat, Sep 30, 2023 at 02:01:47PM +0200, Heinrich Schuchardt wrote:

> Add a sub-command to print a hexdump of the EEPROM content.
> 
> Signed-off-by: Heinrich Schuchardt 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 4/6] eeprom: starfive: re-implement mac command

2023-10-16 Thread Tom Rini
On Sat, Sep 30, 2023 at 02:01:45PM +0200, Heinrich Schuchardt wrote:

> The different implementations of the mac command have board or vendor
> specific sub-commands.
> 
> Add the command definition specific to the VisionFive 2 board.
> 
> Don't call cmd_usage() directly but return CMD_RET_USAGE instead.
> 
> Signed-off-by: Heinrich Schuchardt 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 5/6] eeprom: starfive: raw dump if unsupported data version

2023-10-16 Thread Tom Rini
On Sat, Sep 30, 2023 at 02:01:46PM +0200, Heinrich Schuchardt wrote:

> If the data version field of the EEPROM is not supported, provide a hexdump
> of the data.
> 
> Signed-off-by: Heinrich Schuchardt 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 3/6] eeprom: SiFive Unmatched: re-implement mac command

2023-10-16 Thread Tom Rini
On Sat, Sep 30, 2023 at 02:01:44PM +0200, Heinrich Schuchardt wrote:

> The different implementations of the mac command have board or vendor
> specific sub-commands.
> 
> Add the command definition specific to the SiFive HiFive Unmatched board.
> 
> Don't call cmd_usage() directly but return CMD_RET_USAGE instead.
> 
> Signed-off-by: Heinrich Schuchardt 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 2/6] freescale: fix long help handling in mac command

2023-10-16 Thread Tom Rini
On Sat, Sep 30, 2023 at 02:01:43PM +0200, Heinrich Schuchardt wrote:

> CONFIG_SYS_LONGHELP=n we want to reduce the size of the U-Boot binary.
> The long text should be reduced to and empty string in this case.
> 
> There is not need to call cmd_usage() directly. It is sufficient to
> return CMD_RET_USAGE.
> 
> Signed-off-by: Heinrich Schuchardt 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 1/6] cmd: move mac command

2023-10-16 Thread Tom Rini
On Sat, Sep 30, 2023 at 02:01:42PM +0200, Heinrich Schuchardt wrote:

> Board specific implementations of the 'mac' command differ concerning the
> supported sub-commands.
> 
> Move the Freescale specific mac command definition to the board code.
> 
> Signed-off-by: Heinrich Schuchardt 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [GIT PULL] Please pull u-boot-amlogic-20231015

2023-10-16 Thread Tom Rini
On Mon, Oct 16, 2023 at 08:48:06AM +0200, Neil Armstrong wrote:

> Hi Tom,
> 
> A set of changes mostly concerning Amlogic A1 & S4 SoCs for USB, Secure 
> Monitor
> and RNG bringup.
> 
> 
> The CI job is at 
> https://source.denx.de/u-boot/custodians/u-boot-amlogic/pipelines/18138
> 
> Thanks,
> Neil
> 
> The following changes since commit 997bef3c6d22d12c7fd092fb831bf94d114c9f6f:
> 
>   Merge branch '2023-10-11-port-gen_compile_commands_py' (2023-10-11 13:25:01 
> -0400)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-amlogic.git 
> tags/u-boot-amlogic-20231015
> 
> for you to fetch changes up to 7cd53e0d5203f8e25bb69d2e675769888fcbc754:
> 
>   arch: meson: use secure monitor driver (2023-10-15 12:23:48 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] mxs: Kconfig: Remove TARGET_XFI3 symbol

2023-10-16 Thread sbabic
> From: Fabio Estevam 
> The xfi3 target has been removed by commit 539fba2c10e7 ("arm:
> Remove xfi3 board"), but it missed to remove an entry from the
> mxs Kconfig.
> Remove it.
> Signed-off-by: Fabio Estevam 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH v2] pico-pi-imx7d: Unselect CONFIG_CONSOLE_MUX

2023-10-16 Thread sbabic
> From: Fabio Estevam 
> Unselect CONFIG_CONSOLE_MUX to fix the following
> error for the input, output and error interfaces:
> U-Boot 2023.10 (Oct 03 2023 - 21:23:18 -0300)
> ...
> In:No input devices available!
> Out:   No output devices available!
> Err:   No error devices available!
> Net:   eth0: ethernet@30be
> Hit any key to stop autoboot:  0 
> Signed-off-by: Fabio Estevam 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH] arm64: dts: imx8mp: Make GPIO3 available early in U-Boot proper on i.MX8MP DHCOM

2023-10-16 Thread sbabic
> The GPIO3 has to be available early during U-Boot proper start up for
> DRAM size detect to work correctly. The GPIO3 is currently available in
> SPL and late in U-Boot proper, which is insufficient. Add the missing
> bootph-all to make the GPIO3 available also early in U-Boot proper.
> Signed-off-by: Marek Vasut 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH v4] imx8mp-evk: Add USB0 OTG support

2023-10-16 Thread sbabic
> From: Fabio Estevam 
> Add USB0 OTG support.
> Currently, the USB0 OTG nodes are not enabled in the Linux kernel
> devicetree.
> For this reason, enable the USB0 OTG nodes inside imx8mp-evk-u-boot.dtsi
> for now.
> Also select several useful options such as USB gadget and fastboot.
> Tested by running "ums 0 mmc 2".
> Signed-off-by: Fabio Estevam 
> Reviewed-by: Marek Vasut 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[RESEND PATCH] arm: kirkwood: Pogo v4: Enable LTO

2023-10-16 Thread Tony Dinh
Enable building Pogo V4 u-boot image with LTO, which results in about 30K
reduction in size.

Rebased to latest master and resend.

Signed-off-by: Tony Dinh 
---

 configs/pogo_v4_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/pogo_v4_defconfig b/configs/pogo_v4_defconfig
index cbbade3c0c..fd62146ed3 100644
--- a/configs/pogo_v4_defconfig
+++ b/configs/pogo_v4_defconfig
@@ -15,6 +15,7 @@ CONFIG_ENV_OFFSET=0xC
 CONFIG_DEFAULT_DEVICE_TREE="kirkwood-pogoplug-series-4"
 CONFIG_IDENT_STRING="\nPogoplug V4"
 CONFIG_SYS_LOAD_ADDR=0x80
+CONFIG_LTO=y
 CONFIG_PCI=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTSTAGE=y
-- 
2.39.2



Re: [PATCH v7 1/2] schemas: memory: Add ECC properties

2023-10-16 Thread Rob Herring
On Tue, Sep 26, 2023 at 01:42:38PM -0600, Simon Glass wrote:
> Some memories provide ECC detection and/or correction. For software which
> wants to check memory, it is helpful to see which regions provide this
> feature.
> 
> Add this as a property of the /memory nodes, since it presumably follows
> the hardware-level memory system.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v7:
> - Drop unnecessary |
> - Add a blank line between properties
> 
> Changes in v6:
> - Use a number of bits instead of a string property
> - Fix inidcates typo
> 
> Changes in v5:
> - Redo to make this property specific to ECC
> - Provide properties both for detection and correction
> 
> Changes in v3:
> - Add new patch to update the /memory nodes
> 
>  dtschema/schemas/memory.yaml | 13 +
>  1 file changed, 13 insertions(+)

Applied this patch.

Rob


Re: [PATCH v2] usb: xhci: Workaround to fix the USB halted endpoint issues

2023-10-16 Thread Tom Rini
On Mon, Oct 16, 2023 at 08:34:16AM +0200, Michal Simek wrote:
> 
> 
> On 10/13/23 17:15, Tom Rini wrote:
> > On Fri, Oct 13, 2023 at 11:11:04AM -0400, Da Xue wrote:
> > > On Fri, Oct 13, 2023 at 7:47 AM Marek Vasut  wrote:
> > > > 
> > > > On 10/13/23 06:53, Venkatesh Yadav Abbarapu wrote:
> > > > > The xhci host controller driver trying to queue the URB's and it is
> > > > > getting halted at the endpoint, thereby hitting the BUG_ON's.
> > > > > Mostly these kind of random issues are seen on faulty boards.
> > > > > Removing these BUG_ON's from the U-Boot xhci code, as in Linux kernel
> > > > > xhci code BUG_ON/BUG's are removed entirely.
> > > > > Please also note, that BUG_ON() is not recommended any more in the 
> > > > > Linux
> > > > > kernel.
> > > > > Similar issue has been observed on TI AM437x board and they created a 
> > > > > patch
> > > > > in Linux kernel as below
> > > > > https://patches.linaro.org/project/linux-usb/patch/1390250711-25840-1-git-send-email-ba...@ti.com/
> > > > > 
> > > > > Signed-off-by: Venkatesh Yadav Abbarapu 
> > > > 
> > > > I already explained to Xilinx how to sync the driver with Linux and why
> > > > this is needed to move forward, multiple times, and even provided a
> > > > script which does most of the work automatically, since it is basically
> > > > automated process. Xilinx did not even bother to test the script and
> > > > provide any feedback.
> > > > 
> > > > Until that happens, this patch is rejected.
> > > 
> > > This patch also causes all of the USB devices on certain platforms to
> > > not be detected:
> > > 
> > > scanning bus usb@c900 for devices... Device not responding to set 
> > > address.
> > > 
> > >USB device not accepting new address (error=8000)
> > 
> > Yes, we are stuck at the impasse where the custodian is asking for
> > someone to try and do the re-sync, and everyone else will assist with
> > testing on other platforms, but the re-sync hasn't happened.  Can we
> > please get someone from AMD to attempt the re-sync?
> 
> I would like to say that we have someone to do it. But I simply don't have
> that person.

That is the big problem we face, yes.  Eugen, I think you said you were
going to try and find time to do a re-sync, did you end up getting any?

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v7 7/9] Boot var automatic management for removable medias

2023-10-16 Thread João Marcos Costa
Hello again,

Em seg., 16 de out. de 2023 às 09:58, João Marcos Costa <
jmcosta...@gmail.com> escreveu:

> Hello,
>
> Em seg., 16 de out. de 2023 às 08:47, Masahisa Kojima <
> masahisa.koj...@linaro.org> escreveu:
>
>> From: Raymond Mao 
>>
>> Changes for complying to EFI spec §3.5.1.1
>> 'Removable Media Boot Behavior'.
>> Boot variables can be automatically generated during a removable
>> media is probed. At the same time, unused boot variables will be
>> detected and removed.
>>
>> Please note that currently the function 'efi_disk_remove' has no
>> ability to distinguish below two scenarios
>> a) Unplugging of a removable media under U-Boot
>> b) U-Boot exiting and booting an OS
>> Thus currently the boot variables management is not added into
>> 'efi_disk_remove' to avoid boot options being added/erased
>> repeatedly under scenario b) during power cycles
>> See TODO comments under function 'efi_disk_remove' for more details
>>
>> The original efi_secboot tests expect that BootOrder EFI variable
>> is not defined. With this commit, the BootOrder EFI variable is
>> automatically added when the disk is detected. The original
>> efi_secboot tests end up with unexpected failure.
>> The efi_secboot tests need to be modified to explicitly set
>> the BootOrder EFI variable.
>>
>> squashfs ls test is also affected by this modification, need to
>> clear the previous state before squashfs ls test starts.
>>
>> Co-developed-by: Masahisa Kojima 
>> Signed-off-by: Masahisa Kojima 
>> Signed-off-by: Raymond Mao 
>> Reviewed-by: Heinrich Schuchardt 
>> Reviewed-by: Ilias Apalodimas 
>> ---
>
> [...]

> Signed-off-by: Joao Marcos Costa 
>

Sorry for the previous reply containing the wrong tag. Here is my
Reviewed-by tag:

Reviewed-by: Joao Marcos Costa 

--
Atenciosamente,
João Marcos Costa

www.linkedin.com/in/jmarcoscosta/
https://github.com/jmarcoscosta


Re: [PATCH 9/9] cmd: test_enter_suspend: Add test_enter_suspend command

2023-10-16 Thread Heinrich Schuchardt

On 10/16/23 16:11, Thomas Richard wrote:

From: Gregory CLEMENT 

Add test_enter_suspend command using PSCI.
This command is only to test suspend sequence from U-Boot.
The resume will not work.

Signed-off-by: Gregory CLEMENT 
Signed-off-by: Thomas Richard 

---

  cmd/Kconfig |  7 +++
  cmd/boot.c  |  8 
  drivers/firmware/psci.c | 23 +++
  include/command.h   |  2 ++
  4 files changed, 40 insertions(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 43ca10f69c..54e7d4b0e6 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1450,6 +1450,13 @@ config CMD_POWEROFF
help
  Poweroff/Shutdown the system

+config CMD_TEST_ENTER_SUSPEND
+   bool "test enter suspend"
+   depends on ARM
+   select ARM_SMCCC
+   help
+ Command to test the suspend sequence (only for test)
+
  config CMD_READ
bool "read - Read binary data from a partition"
help
diff --git a/cmd/boot.c b/cmd/boot.c
index 14839c1ced..609c07a5a5 100644
--- a/cmd/boot.c
+++ b/cmd/boot.c
@@ -70,3 +70,11 @@ U_BOOT_CMD(
""
  );
  #endif
+
+#if IS_ENABLED(CONFIG_CMD_TEST_ENTER_SUSPEND)
+U_BOOT_CMD(
+   test_enter_suspend, 1, 0, do_test_enter_suspend,
+   "Test the enter SUSPEND sequence of the device",
+   ""
+);
+#endif
diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
index c6b9efab41..591ad1869d 100644
--- a/drivers/firmware/psci.c
+++ b/drivers/firmware/psci.c
@@ -23,6 +23,9 @@
  #include 
  #include 
  #include 
+#if IS_ENABLED(CONFIG_CMD_TEST_ENTER_SUSPEND)
+#include 
+#endif

  #define DRIVER_NAME "psci"

@@ -303,6 +306,26 @@ int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, 
char *const argv[])
  }
  #endif

+#if IS_ENABLED(CONFIG_CMD_TEST_ENTER_SUSPEND)
+int do_test_enter_suspend(struct cmd_tbl *cmdtp, int flag, int argc, char 
*const argv[])
+{
+   do_psci_probe();
+
+   puts("suspend ...\n");
+   puts("disable dcache\n");
+
+   dcache_disable();
+
+   /* ARM_PSCI_1_0_FN64_SYSTEM_SUSPEND */
+   invoke_psci_fn(PSCI_0_2_FN64(14), (unsigned long)do_test_enter_suspend, 
0, 0);


Suspend exists on other architectures, too. E.g. OpenSBI provides an
implementation for RISC-V. It would be preferable to add suspend as a
value to enum enum sysreset_t. Then that functionality can be
implemented in sysreset_psci.c sysreset_sbi.c, and others.

The command should simply be called 'suspend'.

Best regards

Heinrich


+
+   dcache_enable();
+
+   log_err("Suspend failed or not supported on this platform\n");
+   return CMD_RET_FAILURE;
+}
+#endif
+
  static const struct udevice_id psci_of_match[] = {
{ .compatible = "arm,psci" },
{ .compatible = "arm,psci-0.2" },
diff --git a/include/command.h b/include/command.h
index c4e3170967..0126da6b37 100644
--- a/include/command.h
+++ b/include/command.h
@@ -177,6 +177,8 @@ int do_reset(struct cmd_tbl *cmdtp, int flag, int argc,
 char *const argv[]);
  int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[]);
+int do_test_enter_suspend(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[]);

  unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
 char *const argv[]);




Re: [PATCH v5 6/6] sysinfo: rcar3: Implement BOARD_ID and BOARD_REV_*

2023-10-16 Thread Marek Vasut

On 10/16/23 19:03, Detlev Casanova wrote:

On Saturday, October 7, 2023 5:35:27 P.M. EDT Marek Vasut wrote:

On 10/2/23 17:20, Detlev Casanova wrote:

Expose that information to the sysinfo command to let scripts make
decisions based on the board id and revision.

Signed-off-by: Detlev Casanova 
---

   drivers/sysinfo/rcar3.c | 89 +
   1 file changed, 63 insertions(+), 26 deletions(-)

diff --git a/drivers/sysinfo/rcar3.c b/drivers/sysinfo/rcar3.c
index 633e80bc19b..a554323506a 100644
--- a/drivers/sysinfo/rcar3.c
+++ b/drivers/sysinfo/rcar3.c
@@ -32,6 +32,10 @@

*/
   
   struct sysinfo_rcar_priv {
   
   	char	boardmodel[64];


+   u8  id;
+   u8  rev_major;
+   u8  rev_minor;
+   boolhas_rev;

u8  val;
   
   };


@@ -56,9 +60,33 @@ static int sysinfo_rcar_get_str(struct udevice *dev,
int id, size_t size, char *>
};
   
   }


+static int sysinfo_rcar_get_int(struct udevice *dev, int id, int *val)
+{
+   struct sysinfo_rcar_priv *priv = dev_get_priv(dev);
+
+   switch (id) {
+   case SYSINFO_ID_BOARD_ID:
+   *val = priv->id;
+   return 0;
+   case SYSINFO_ID_BOARD_REV_MAJOR:
+   if (!priv->has_rev)
+   return -EINVAL;
+   *val = priv->rev_major;
+   return 0;
+   case SYSINFO_ID_BOARD_REV_MINOR:
+   if (!priv->has_rev)
+   return -EINVAL;
+   *val = priv->rev_minor;
+   return 0;
+   default:
+   return -EINVAL;
+   };
+}
+

   static const struct sysinfo_ops sysinfo_rcar_ops = {
   
   	.detect = sysinfo_rcar_detect,

.get_str = sysinfo_rcar_get_str,

+   .get_int = sysinfo_rcar_get_int,

   };
   
   static void sysinfo_rcar_parse(struct sysinfo_rcar_priv *priv)


@@ -69,8 +97,9 @@ static void sysinfo_rcar_parse(struct sysinfo_rcar_priv
*priv)>
bool ebisu_4d = false;
bool condor_i = false;
char rev[4] = "?.?";

-   u8 rev_major = 0;
-   u8 rev_minor = 0;
+
+   priv->id = board_id;
+   priv->has_rev = false;


Would it make more sense to assign

priv->rev_major = 1;
priv->rev_minor = 0;

And get rid of priv->has_rev entirely ?

Basically say that the default case is rev. 1.0 board.

[...]


I'm not really sure about this has it doesn't differentiate between rev 1.0 and
unknown revision.


Good point, please document this in the commit message.


Re: [PATCH v5 1/6] sysinfo: Add IDs for board id and revision

2023-10-16 Thread Marek Vasut

On 10/16/23 19:37, Heinrich Schuchardt wrote:

On 10/2/23 17:20, Detlev Casanova wrote:

These IDs will be used by the sysinfo command. The new IDs are:
  * SYSINFO_ID_BOARD_ID: The board ID as an integer
  * SYSINFO_ID_BOARD_REV_MAJOR: The board major revision as int
  * SYSINFO_ID_BOARD_REV_MINOR: The board minor revision as int


Integers will not work in the generic case. E.g. for the VisionFive 2
board we have seen board revisions:

1.2A, 1.2B, 1.3B

For the Wandboard:

B1, D1


Dang, I literally had this in my upstreaming queue today, so, sigh.
Dropped for now :-(

--
Best regards,
Marek Vasut



Re: [PATCH v5 4/6] sysinfo: Add documentation

2023-10-16 Thread Heinrich Schuchardt

On 10/2/23 17:20, Detlev Casanova wrote:

Add documentation for the sysinfo command with examples.

Reviewed-by: Marek Vasut 
Signed-off-by: Detlev Casanova 
---
  doc/usage/cmd/sysinfo.rst | 56 +++


Thank you for providing a man-page.

Unfortunately this does not build:
usage/cmd/sysinfo.rst:document isn't included in any toctree

Please, add sysinfo to doc/usage/index.rst.

Please, use run 'make htmldocs' before resubmitting.


  1 file changed, 56 insertions(+)
  create mode 100644 doc/usage/cmd/sysinfo.rst

diff --git a/doc/usage/cmd/sysinfo.rst b/doc/usage/cmd/sysinfo.rst
new file mode 100644
index 000..1660b2aa1a6
--- /dev/null
+++ b/doc/usage/cmd/sysinfo.rst
@@ -0,0 +1,56 @@
+.. SPDX-License-Identifier: GPL-2.0+:
+
+sysinfo command
+===
+
+Synopis


%s/Synopis/Synopsis/


+---
+
+::
+
+sysinfo id 
+sysinfo model 
+sysinfo revision 
+
+Description
+---
+
+The `sysinfo` command is used to show information about the running system
+
+The `sysinfo id` command prints or sets an environment variable to the board id
+as an hex value.


%s/an hex/a hexadecimal/


+
+varname
+an optional environment variable to store the board id into.
+
+The `sysinfo model` command prints or sets an environment variable to the board
+model name as a string value.
+
+varname
+an optional environment variable to store the board model name into.


If varname were optional, the synopsis would be

sysinfo model [varname]


+
+The `sysinfo revision` command prints or sets an environment variable to the
+board revision in the . format, where MINOR and MINOR are int
+values.
+
+varname
+an optional environment variable to store the board revision into.
+
+Examples
+
+
+::
+
+=> sysinfo id
+0x0b
+=> sysinfo model
+Renesas Starter Kit Premier board rev 2.1
+=> sysinfo revision varname
+=> env print varname
+2.1


This is too much hassle to print the information.

We should make the parameters optional:

'sysinfo' should print all information.
'sysinfo revision' should print the revision.



+
+Return value
+
+
+The return value $? is set to 0 (true) if the command succeeded. If an
+error occurs, the return value $? is set to 1 (false).


Please, use the same tense:

%s/succeeded/succeeds/

Best regards

Heinrich




Re: [PATCH v5 1/6] sysinfo: Add IDs for board id and revision

2023-10-16 Thread Heinrich Schuchardt

On 10/2/23 17:20, Detlev Casanova wrote:

These IDs will be used by the sysinfo command. The new IDs are:
  * SYSINFO_ID_BOARD_ID: The board ID as an integer
  * SYSINFO_ID_BOARD_REV_MAJOR: The board major revision as int
  * SYSINFO_ID_BOARD_REV_MINOR: The board minor revision as int


Integers will not work in the generic case. E.g. for the VisionFive 2
board we have seen board revisions:

1.2A, 1.2B, 1.3B

For the Wandboard:

B1, D1



Reviewed-by: Marek Vasut 
Signed-off-by: Detlev Casanova 
---
  include/sysinfo.h | 5 +
  1 file changed, 5 insertions(+)

diff --git a/include/sysinfo.h b/include/sysinfo.h
index b140d742e93..13815600ae6 100644
--- a/include/sysinfo.h
+++ b/include/sysinfo.h
@@ -47,6 +47,11 @@ enum sysinfo_id {
/* For show_board_info() */
SYSINFO_ID_BOARD_MODEL,

+   /* For sysinfo command (all int) */


Please, provide a Sphinx style documentation for every value. Cf.
https://www.kernel.org/doc/html/v5.3/doc-guide/kernel-doc.html#structure-union-and-enumeration-documentation

Best regards

Heinrich


+   SYSINFO_ID_BOARD_ID,
+   SYSINFO_ID_BOARD_REV_MAJOR,
+   SYSINFO_ID_BOARD_REV_MINOR,
+
/* First value available for downstream/board used */
SYSINFO_ID_USER = 0x1000,
  };




Re: [PATCH v5 6/6] sysinfo: rcar3: Implement BOARD_ID and BOARD_REV_*

2023-10-16 Thread Detlev Casanova
On Saturday, October 7, 2023 5:35:27 P.M. EDT Marek Vasut wrote:
> On 10/2/23 17:20, Detlev Casanova wrote:
> > Expose that information to the sysinfo command to let scripts make
> > decisions based on the board id and revision.
> > 
> > Signed-off-by: Detlev Casanova 
> > ---
> > 
> >   drivers/sysinfo/rcar3.c | 89 +
> >   1 file changed, 63 insertions(+), 26 deletions(-)
> > 
> > diff --git a/drivers/sysinfo/rcar3.c b/drivers/sysinfo/rcar3.c
> > index 633e80bc19b..a554323506a 100644
> > --- a/drivers/sysinfo/rcar3.c
> > +++ b/drivers/sysinfo/rcar3.c
> > @@ -32,6 +32,10 @@
> > 
> >*/
> >   
> >   struct sysinfo_rcar_priv {
> >   
> > charboardmodel[64];
> > 
> > +   u8  id;
> > +   u8  rev_major;
> > +   u8  rev_minor;
> > +   boolhas_rev;
> > 
> > u8  val;
> >   
> >   };
> > 
> > @@ -56,9 +60,33 @@ static int sysinfo_rcar_get_str(struct udevice *dev,
> > int id, size_t size, char *> 
> > };
> >   
> >   }
> > 
> > +static int sysinfo_rcar_get_int(struct udevice *dev, int id, int *val)
> > +{
> > +   struct sysinfo_rcar_priv *priv = dev_get_priv(dev);
> > +
> > +   switch (id) {
> > +   case SYSINFO_ID_BOARD_ID:
> > +   *val = priv->id;
> > +   return 0;
> > +   case SYSINFO_ID_BOARD_REV_MAJOR:
> > +   if (!priv->has_rev)
> > +   return -EINVAL;
> > +   *val = priv->rev_major;
> > +   return 0;
> > +   case SYSINFO_ID_BOARD_REV_MINOR:
> > +   if (!priv->has_rev)
> > +   return -EINVAL;
> > +   *val = priv->rev_minor;
> > +   return 0;
> > +   default:
> > +   return -EINVAL;
> > +   };
> > +}
> > +
> > 
> >   static const struct sysinfo_ops sysinfo_rcar_ops = {
> >   
> > .detect = sysinfo_rcar_detect,
> > .get_str = sysinfo_rcar_get_str,
> > 
> > +   .get_int = sysinfo_rcar_get_int,
> > 
> >   };
> >   
> >   static void sysinfo_rcar_parse(struct sysinfo_rcar_priv *priv)
> > 
> > @@ -69,8 +97,9 @@ static void sysinfo_rcar_parse(struct sysinfo_rcar_priv
> > *priv)> 
> > bool ebisu_4d = false;
> > bool condor_i = false;
> > char rev[4] = "?.?";
> > 
> > -   u8 rev_major = 0;
> > -   u8 rev_minor = 0;
> > +
> > +   priv->id = board_id;
> > +   priv->has_rev = false;
> 
> Would it make more sense to assign
> 
> priv->rev_major = 1;
> priv->rev_minor = 0;
> 
> And get rid of priv->has_rev entirely ?
> 
> Basically say that the default case is rev. 1.0 board.
> 
> [...]

I'm not really sure about this has it doesn't differentiate between rev 1.0 and 
unknown revision.





Re: [PATCH v7 2/2] schemas: Add some common reserved-memory usages

2023-10-16 Thread Rob Herring
On Fri, Oct 13, 2023 at 4:09 PM Simon Glass  wrote:
>
> Hi Rob,
>
> On Fri, 13 Oct 2023 at 13:42, Rob Herring  wrote:
> >
> > On Fri, Oct 6, 2023 at 7:03 PM Simon Glass  wrote:
> > >
> > > Hi Ard,
> > >
> > > On Fri, 6 Oct 2023 at 17:00, Ard Biesheuvel  wrote:
> > > >
> > > > On Fri, 6 Oct 2023 at 20:17, Simon Glass  wrote:
> > > > >
> > > > > Hi Ard,
> > > > >
> > > > > On Fri, 6 Oct 2023 at 11:33, Ard Biesheuvel  wrote:
> > > > > >
> > > > > > On Mon, 2 Oct 2023 at 19:54, Simon Glass  wrote:
> > > > > > >
> > > > > > > Hi Rob,
> > > > > > >
> > > > > > > On Tue, 26 Sept 2023 at 13:42, Simon Glass  
> > > > > > > wrote:
> > > > > > > >
> > > > > > > > It is common to split firmware into 'Platform Init', which does 
> > > > > > > > the
> > > > > > > > initial hardware setup and a "Payload" which selects the OS to 
> > > > > > > > be booted.
> > > > > > > > Thus an handover interface is required between these two pieces.
> > > > > > > >
> > > > > > > > Where UEFI boot-time services are not available, but UEFI 
> > > > > > > > firmware is
> > > > > > > > present on either side of this interface, information about 
> > > > > > > > memory usage
> > > > > > > > and attributes must be presented to the "Payload" in some form.
> > > > > > > >
> > > > > > > > This aims to provide an small schema addition for the memory 
> > > > > > > > mapping
> > > > > > > > needed to keep these two pieces working together well.
> > > > > > > >
> > > > > > > > Signed-off-by: Simon Glass 
> > > > > > > > ---
> > > > > > > >
> > > > > > > > Changes in v7:
> > > > > > > > - Rename acpi-reclaim to acpi
> > > > > > > > - Drop individual mention of when memory can be reclaimed
> > > > > > > > - Rewrite the item descriptions
> > > > > > > > - Add back the UEFI text (with trepidation)
> > > > > > >
> > > > > > > I am again checking on this series. Can it be applied, please?
> > > > > > >
> > > > > >
> > > > > > Apologies for the delay in response. I have been away.
> > > > >
> > > > > OK, I hope you had a nice trip.
> > > > >
> > > >
> > > > Thanks, it was wonderful!
> > > >
> > > > > >
> > > > > > >
> > > > > > > >
> > > > > > > > Changes in v6:
> > > > > > > > - Drop mention of UEFI
> > > > > > > > - Use compatible strings instead of node names
> > > > > > > >
> > > > > > > > Changes in v5:
> > > > > > > > - Drop the memory-map node (should have done that in v4)
> > > > > > > > - Tidy up schema a bit
> > > > > > > >
> > > > > > > > Changes in v4:
> > > > > > > > - Make use of the reserved-memory node instead of creating a 
> > > > > > > > new one
> > > > > > > >
> > > > > > > > Changes in v3:
> > > > > > > > - Reword commit message again
> > > > > > > > - cc a lot more people, from the FFI patch
> > > > > > > > - Split out the attributes into the /memory nodes
> > > > > > > >
> > > > > > > > Changes in v2:
> > > > > > > > - Reword commit message
> > > > > > > >
> > > > > > > >  .../reserved-memory/common-reserved.yaml  | 71 
> > > > > > > > +++
> > > > > > > >  1 file changed, 71 insertions(+)
> > > > > > > >  create mode 100644 
> > > > > > > > dtschema/schemas/reserved-memory/common-reserved.yaml
> > > > > > > >
> > > > > > > > diff --git 
> > > > > > > > a/dtschema/schemas/reserved-memory/common-reserved.yaml 
> > > > > > > > b/dtschema/schemas/reserved-memory/common-reserved.yaml
> > > > > > > > new file mode 100644
> > > > > > > > index 000..f7fbdfd
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/dtschema/schemas/reserved-memory/common-reserved.yaml
> > > > > > > > @@ -0,0 +1,71 @@
> > > > > > > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > > > > > > > +%YAML 1.2
> > > > > > > > +---
> > > > > > > > +$id: 
> > > > > > > > http://devicetree.org/schemas/reserved-memory/common-reserved.yaml#
> > > > > > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > > > > > +
> > > > > > > > +title: Common memory reservations
> > > > > > > > +
> > > > > > > > +description: |
> > > > > > > > +  Specifies that the reserved memory region can be used for 
> > > > > > > > the purpose
> > > > > > > > +  indicated by its compatible string.
> > > > > > > > +
> > > > > > > > +  Clients may reuse this reserved memory if they understand 
> > > > > > > > what it is for,
> > > > > > > > +  subject to the notes below.
> > > > > > > > +
> > > > > > > > +maintainers:
> > > > > > > > +  - Simon Glass 
> > > > > > > > +
> > > > > > > > +allOf:
> > > > > > > > +  - $ref: reserved-memory.yaml
> > > > > > > > +
> > > > > > > > +properties:
> > > > > > > > +  compatible:
> > > > > > > > +description: |
> > > > > > > > +  This describes some common memory reservations, with the 
> > > > > > > > compatible
> > > > > > > > +  string indicating what it is used for:
> > > > > > > > +
> > > > > > > > + acpi: Advanced Configuration and Power Interface 
> > > > > > > > (ACPI) tables
> > > > > > > > + acpi-nvs: ACPI Non-Volatile-Sleeping Memory (NVS). 
> > > > > > > > This is reserved by

[PATCH 4/4] arm: dts: imx93-evk: remove wrong eqos compatible string

2023-10-16 Thread sbabic
> The correct compatible string for i.MX93 variant of DWC EQoS MAC is now
> "nxp,imx93-dwmac-eqos".
> Signed-off-by: Sébastien Szymanski 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH 1/4] clk: imx: add i.MX93 CCF driver

2023-10-16 Thread sbabic
> Add i.MX93 CCF driver support.
> Modifed from Linux Kernel v6.5-rc2 and adapted for U-Boot.
> Signed-off-by: Sébastien Szymanski 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH 3/5] arm64: dts: imx8mp: Update i.MX8MP DHCOM SoM DT to production rev.200

2023-10-16 Thread sbabic
> The current imx8mp-dhcom-som.dtsi describes prototype rev.100 SoM,
> update the DT to describe production rev.200 SoM which brings the
> following changes:
> - Fast SoC GPIOs exposed on the SoM edge connector
> - Slow GPIOs like component resets moved to I2C GPIO expander
> - ADC upgraded from TLA2024 to ADS1015 with conversion interrupt
> - EEPROM size increased from 256 B to 4 kiB
> Signed-off-by: Marek Vasut 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH] imx: hab: Use size parameter

2023-10-16 Thread sbabic
> The current code works by sheer coincidence, because (see HABv4 API
> documentation, section 3.4) the RVT authenticate_image call updates
> the size that is passed in with the actual size ROM code pulls from
> IVT/CSF . So if the input size is larger, that is "fine" . Pass in
> size instead to make this really correct.
> Signed-off-by: Marek Vasut 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH 1/4] net: dwc_eth_qos: add i.MX93 support

2023-10-16 Thread sbabic
> Add support for DWC EQoS MAC on i.MX93.
> Signed-off-by: Sébastien Szymanski 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH 1/5] spl: fit: Add board level function to decide application of DTO

2023-10-16 Thread sbabic
> Add board-specific function used to indicate whether a DTO from fitImage
> configuration node 'fdt' property DT and DTO list should be applied onto
> the base DT or not applied.
> This is useful in case of DTOs which implement e.g. different board revision
> details, where such DTO should be applied on one board revision, and should
> not be applied on another board revision.
> Signed-off-by: Marek Vasut 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH 2/3] mx7dsabresd: Convert to watchdog driver model

2023-10-16 Thread sbabic
> From: Fabio Estevam 
> Commit 68dcbdd594d4 ("ARM: imx: Add weak default reset_cpu()") caused
> the 'reset' command in U-Boot to not cause a board reset.
> Fix it by switching to the watchdog driver model via sysreset, which
> is the preferred method for implementing the watchdog reset.
> Signed-off-by: Fabio Estevam 
> Reviewed-by: Marek Vasut 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH 4/5] arm64: dts: imx8mp: Drop i.MX8MP DHCOM rev.100 PHY address workaround from PDK3 DT

2023-10-16 Thread sbabic
> In case the i.MX8MP DHCOM rev.100 has been populated on the PDK3
> carrier board, the on-SoM PHY PHYAD1 signal has been pulled high
> by the carrier board and changed the PHY MDIO address from 5 to 7.
> This has been fixed on production rev.200 SoM by additional buffer
> on the SoM PHYAD/LED signals, remove the workaround.
> Signed-off-by: Marek Vasut 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH 4/4] imx93_evk: defconfig: enable clock driver

2023-10-16 Thread sbabic
> Add clocks nodes in u-boot.dtsi file.
> Remove init_uart_clk() call.
> Signed-off-by: Sébastien Szymanski 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH 3/3] smegw01: Convert to watchdog driver model

2023-10-16 Thread sbabic
> From: Fabio Estevam 
> Commit 68dcbdd594d4 ("ARM: imx: Add weak default reset_cpu()") caused
> the 'reset' command in U-Boot to not cause a board reset.
> Fix it by switching to the watchdog driver model via sysreset, which
> is the preferred method for implementing the watchdog reset.
> Signed-off-by: Fabio Estevam 
> Reviewed-by: Marek Vasut 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH 2/5] arm64: dts: imx8mp: Switch to DT overlays for i.MX8MP DHCOM SoM

2023-10-16 Thread sbabic
> Add DT overlays to support additional DH i.MX8MP DHCOM SoM 660-100
> population options with 1x or 2x RMII PHY mounted on PDK2 or PDK3
> carrier boards.
> Use SPL DTO support to apply matching SoM specific DTO to cater
> for the SoM differences. Remove ad-hoc patching of control DT from
> fdtdec_board_setup().
> Signed-off-by: Marek Vasut 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH 3/4] serial: lpuart: Enable IPG clock

2023-10-16 Thread sbabic
> From: Ye Li 
> Current codes only ennable the PER clock. However on iMX8 the LPUART
> also needs IPG clock which is an LPCG. Should not depend on the default
> LPCG setting.
> Signed-off-by: Ye Li 
> Reviewed-by: Peng Fan 
> Signed-off-by: Sébastien Szymanski 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


[PATCH 5/5] arm64: dts: imx8mp: Add DT overlay describing i.MX8MP DHCOM SoM rev.100

2023-10-16 Thread sbabic
> The current imx8mp-dhcom-som.dtsi describes production rev.200 SoM,
> add DT overlay which reinstates rev.100 SoM description to permit
> prototype rev.100 SoMs to be used until they get phased out.
> Signed-off-by: Marek Vasut 
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=


  1   2   3   >