Re: [PATCH] net: ti: am65-cpsw: Cleanup resources before jump to kernel

2022-02-03 Thread Ramon Fried
On Fri, Jan 28, 2022 at 7:51 AM Vignesh Raghavendra  wrote:
>
> In case fastboot over Ethernet, am65_cpsw_stop() is not called unless
> DM_FLAG_OS_PREPARE is set. Without call to am65_cpsw_stop(), DMA
> resources are not released thus leading to failures in kernel.
> Fix this by adding DM_FLAG_OS_PREPARE flag to am65_cpsw_nuss_port
> driver.
>
> Reported-by: Christian Gmeiner 
> Signed-off-by: Vignesh Raghavendra 
> ---
>  drivers/net/ti/am65-cpsw-nuss.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c
> index 454986ff15..87f51b3b99 100644
> --- a/drivers/net/ti/am65-cpsw-nuss.c
> +++ b/drivers/net/ti/am65-cpsw-nuss.c
> @@ -817,5 +817,5 @@ U_BOOT_DRIVER(am65_cpsw_nuss_port) = {
> .ops= &am65_cpsw_ops,
> .priv_auto  = sizeof(struct am65_cpsw_priv),
> .plat_auto  = sizeof(struct eth_pdata),
> -   .flags = DM_FLAG_ALLOC_PRIV_DMA,
> +   .flags = DM_FLAG_ALLOC_PRIV_DMA | DM_FLAG_OS_PREPARE,
>  };
> --
> 2.35.0
>
Reviewed-by: Ramon Fried 


Re: [PATCH v1 3/4] arch: arm: mach-k3: am642_init: Probe ESM nodes

2022-02-03 Thread Christian Gmeiner
Hi

Some comments from my side.

>  /*
>   * This uninitialized global variable would normal end up in the .bss 
> section,
>   * but the .bss is cleared between writing and reading this variable, so move
> @@ -160,6 +173,9 @@ void board_init_f(ulong dummy)

> store_boot_info_from_rom();
>
> ctrl_mmr_unlock();
> +   mcu_ctrl_mmr_unlock();
> +
> +   enable_mcu_esm_reset();
>
> /* Init DM early */
> spl_early_init();
> @@ -194,6 +210,18 @@ void board_init_f(ulong dummy)
> /* Output System Firmware version info */
> k3_sysfw_print_ver();
>
> +#ifdef CONFIG_ESM_K3

Maybe use #if defined(CONFIG_ESM_K3)

> +   /* Probe/configure ESM0 */
> +   ret = uclass_get_device_by_name(UCLASS_MISC, "esm@42", &dev);

ret condinaly defined and could not compile for every configuration.

void board_init_f(ulong dummy)
{
#if defined(CONFIG_K3_LOAD_SYSFW) || defined(CONFIG_K3_AM64_DDRSS)
struct udevice *dev;
int ret;
#endif


> +   if (ret)
> +   printf("esm main init failed: %d\n", ret);
> +
> +   /* Probe/configure MCUESM */
> +   ret = uclass_get_device_by_name(UCLASS_MISC, "esm@410", &dev);
> +   if (ret)
> +   printf("esm mcu init failed: %d\n", ret);
> +#endif
> +
>  #if defined(CONFIG_K3_AM64_DDRSS)
> ret = uclass_get_device(UCLASS_RAM, 0, &dev);
> if (ret)
> --
> 2.17.1
>


-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy


[PATCH v4 0/2] EFI: Reset system after capsule-on-disk

2022-02-03 Thread Masami Hiramatsu
Hi,

Here is the 4th version of the reset after capsule-on-disk. This version
updates the patch description and use do_reset() and halt or reset_cpu()
if available, according to Takahiro and Sughosh's comment.

The reset after completing the capsule-on-disk is stated in the UEFI
specification 2.9, section 8.5.5 "Delivery of Capsules via file on Mass
Storage device" as below,

In all cases that a capsule is identified for processing the system is
restarted after capsule processing is completed.


Thank you,

---

Masami Hiramatsu (2):
  efi_loader: use efi_update_capsule_firmware() for capsule on disk
  efi_loader: Reset system after CapsuleUpdate on disk


 lib/efi_loader/efi_capsule.c |   20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

--
Masami Hiramatsu 


[PATCH v4 1/2] efi_loader: use efi_update_capsule_firmware() for capsule on disk

2022-02-03 Thread Masami Hiramatsu
Since the efi_update_capsule() represents the UpdateCapsule() runtime
service, it has to handle the capsule flags and update ESRT. However
the capsule-on-disk doesn't need to care about such things.

Thus, the capsule-on-disk should use the efi_capsule_update_firmware()
directly instead of calling efi_update_capsule().

This means the roles of the efi_update_capsule() and capsule-on-disk
are different. We have to keep the efi_update_capsule() for providing
runtime service API at boot time.

Suggested-by: AKASHI Takahiro 
Signed-off-by: Masami Hiramatsu 
---
 Changes in v4:
  - Update patch description.
---
 lib/efi_loader/efi_capsule.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 4463ae00fd..1ec7ea29ff 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -1118,7 +1118,7 @@ efi_status_t efi_launch_capsules(void)
index = 0;
ret = efi_capsule_read_file(files[i], &capsule);
if (ret == EFI_SUCCESS) {
-   ret = EFI_CALL(efi_update_capsule(&capsule, 1, 0));
+   ret = efi_capsule_update_firmware(capsule);
if (ret != EFI_SUCCESS)
log_err("Applying capsule %ls failed\n",
files[i]);



[PATCH v4 2/2] efi_loader: Reset system after CapsuleUpdate on disk

2022-02-03 Thread Masami Hiramatsu
Add a cold reset soon after processing capsule update on disk.
This is required in UEFI specification 2.9 Section 8.5.5
"Delivery of Capsules via file on Mass Storage device" as;

In all cases that a capsule is identified for processing the system is
restarted after capsule processing is completed.

This also reports the result of each capsule update so that the user can
notice that the capsule update has been succeeded or not from console log.

Signed-off-by: Masami Hiramatsu 
---
 Changes in v4:
  - Do not use sysreset because that is a warm reset.
  - Fix patch description.
---
 lib/efi_loader/efi_capsule.c |   18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 1ec7ea29ff..20d9490dbd 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1120,8 +1121,11 @@ efi_status_t efi_launch_capsules(void)
if (ret == EFI_SUCCESS) {
ret = efi_capsule_update_firmware(capsule);
if (ret != EFI_SUCCESS)
-   log_err("Applying capsule %ls failed\n",
+   log_err("Applying capsule %ls failed.\n",
files[i]);
+   else
+   log_info("Applying capsule %ls succeeded.\n",
+files[i]);
 
/* create Capsule */
set_capsule_result(index, capsule, ret);
@@ -1142,6 +1146,16 @@ efi_status_t efi_launch_capsules(void)
free(files[i]);
free(files);
 
-   return ret;
+   /*
+* UEFI spec requires to reset system after complete processing capsule
+* update on the storage.
+*/
+   log_info("Reboot after firmware update");
+   /* Cold reset is required for loading the new firmware. */
+   do_reset(NULL, 0, 0, NULL);
+   hang();
+   /* not reach here */
+
+   return 0;
 }
 #endif /* CONFIG_EFI_CAPSULE_ON_DISK */



Re: [PATCH] net: bootp: Make root path (option 17) length configurable

2022-02-03 Thread Ramon Fried
On Fri, Jan 28, 2022 at 10:41 AM Andre Kalb  wrote:
>
> to adjust the root path length.
> Eg to 256 from Linux Kernel
>
> Signed-off-by: Andre Kalb 
> ---
>  include/net.h | 2 +-
>  net/Kconfig   | 6 ++
>  net/bootp.c   | 2 +-
>  3 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/include/net.h b/include/net.h
> index b02e4f630c..6f3f3dfcd4 100644
> --- a/include/net.h
> +++ b/include/net.h
> @@ -540,7 +540,7 @@ extern struct in_addr net_dns_server2;
>  #endif
>  extern charnet_nis_domain[32]; /* Our IS domain */
>  extern charnet_hostname[32];   /* Our hostname */
> -extern charnet_root_path[64];  /* Our root path */
> +extern charnet_root_path[CONFIG_BOOTP_MAX_ROOT_PATH_LEN];  /* Our root 
> path */
>  /** END OF BOOTP EXTENTIONS **/
>  extern u8  net_ethaddr[ARP_HLEN];  /* Our ethernet 
> address */
>  extern u8  net_server_ethaddr[ARP_HLEN];   /* Boot server enet 
> address */
> diff --git a/net/Kconfig b/net/Kconfig
> index 2ae9d6a020..553e271ce9 100644
> --- a/net/Kconfig
> +++ b/net/Kconfig
> @@ -123,4 +123,10 @@ config BOOTP_SERVERIP
>   variable, not the BOOTP server. This affects the operation of both
>   bootp and tftp.
>
> +config BOOTP_MAX_ROOT_PATH_LEN
> +   int "Option 17 root path length"
> +   default 64
> +   help
> + Select maximal length of option 17 root path.
> +
>  endif   # if NET
> diff --git a/net/bootp.c b/net/bootp.c
> index d83e4eb0ba..1566fc5495 100644
> --- a/net/bootp.c
> +++ b/net/bootp.c
> @@ -64,7 +64,7 @@ ulong bootp_start;
>  ulong  bootp_timeout;
>  char net_nis_domain[32] = {0,}; /* Our NIS domain */
>  char net_hostname[32] = {0,}; /* Our hostname */
> -char net_root_path[64] = {0,}; /* Our bootpath */
> +char net_root_path[CONFIG_BOOTP_MAX_ROOT_PATH_LEN] = {0,}; /* Our bootpath */
>
>  static ulong time_taken_max;
>
> --
> 2.31.1
>
Reviewed-by: Ramon Fried 


Re: [PATCH] sandbox: fix build failure with musl and SDL

2022-02-03 Thread Milan P . Stanić
Hi,

On Thu, 2022-01-27 at 14:35, Simon Glass wrote:
> Hi,
> 
> On Fri, 21 Jan 2022 at 13:11, Milan P. Stanić  wrote:
> >
> > Hi,
> >
> > it works and build pass without error or warning.
> > Tested on alpine edge aarch64 bare metal.
> >
> > Thank you
> >
> > On Fri, 2022-01-21 at 18:00, Heinrich Schuchardt wrote:
> > > sdl.c is compiled against the SDL library.
> > >
> > > Trying to redefine wchar_t with -fshort-wchar is not necessary
> > > and leads to build failures when compiling against musl.
> > >
> > > Cc: Milan P. Stanić 
> > > Signed-off-by: Heinrich Schuchardt 
> >
> > Tested-by: Milan P. Stanić 
> >
> > > ---
> > >  arch/sandbox/Makefile |  7 +++
> > >  arch/sandbox/cpu/Makefile | 11 ---
> > >  2 files changed, 15 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
> > > index f6cf859f24..0bdd322f12 100644
> > > --- a/arch/sandbox/Makefile
> > > +++ b/arch/sandbox/Makefile
> > > @@ -4,3 +4,10 @@ head-y := arch/sandbox/cpu/start.o arch/sandbox/cpu/os.o
> > >  head-$(CONFIG_SANDBOX_SDL) += arch/sandbox/cpu/sdl.o
> > >  libs-y += arch/sandbox/cpu/
> > >  libs-y += arch/sandbox/lib/
> > > +
> > > +# sdl.c fails to compile with -fshort-wchar using musl.
> > > +cmd_cc_sdl.o = $(CC) $(filter-out -nostdinc -fshort-wchar, \
> > > + $(patsubst -I%,-idirafter%,$(c_flags))) -c -o $@ $<
> > > +
> > > +$(obj)/sdl.o: $(src)/sdl.c FORCE
> > > + $(call if_changed_dep,cc_sdl.o)
> > > diff --git a/arch/sandbox/cpu/Makefile b/arch/sandbox/cpu/Makefile
> > > index de7fe7f391..b74c866e56 100644
> > > --- a/arch/sandbox/cpu/Makefile
> > > +++ b/arch/sandbox/cpu/Makefile
> > > @@ -7,7 +7,7 @@
> > >
> > >  obj-y:= cache.o cpu.o state.o
> > >  extra-y  := start.o os.o
> > > -extra-$(CONFIG_SANDBOX_SDL)  += sdl.o
> > > +extra-$(CONFIG_SANDBOX_SDL)+= sdl.o
> > >  obj-$(CONFIG_SPL_BUILD)  += spl.o
> > >  obj-$(CONFIG_ETH_SANDBOX_RAW)+= eth-raw-os.o
> > >
> > > @@ -19,8 +19,6 @@ cmd_cc_os.o = $(CC) $(filter-out -nostdinc, \
> > >
> > >  $(obj)/os.o: $(src)/os.c FORCE
> > >   $(call if_changed_dep,cc_os.o)
> > > -$(obj)/sdl.o: $(src)/sdl.c FORCE
> > > - $(call if_changed_dep,cc_os.o)
> > >
> > >  # eth-raw-os.c is built in the system env, so needs standard includes
> > >  # CFLAGS_REMOVE_eth-raw-os.o cannot be used to drop header include path
> > > @@ -30,3 +28,10 @@ cmd_cc_eth-raw-os.o = $(CC) $(filter-out -nostdinc, \
> > >
> > >  $(obj)/eth-raw-os.o: $(src)/eth-raw-os.c FORCE
> > >   $(call if_changed_dep,cc_eth-raw-os.o)
> > > +
> > > +# sdl.c fails to build with -fshort-wchar using musl
> > > +cmd_cc_sdl.o = $(CC) $(filter-out -nostdinc -fshort-wchar, \
> > > + $(patsubst -I%,-idirafter%,$(c_flags))) -c -o $@ $<
> > > +
> > > +$(obj)/sdl.o: $(src)/sdl.c FORCE
> > > + $(call if_changed_dep,cc_sdl.o)
> > > --
> > > 2.33.1
> > >
> 
> This fails on gitlab.
> 
> https://source.denx.de/u-boot/custodians/u-boot-dm/-/jobs/382812
> 
> $ tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e
> --board ${TEST_PY_BD} ${OVERRIDE}
> Building current source for 1 boards (1 thread, 40 jobs per thread)
>sandbox:  +   sandbox
> +/usr/bin/ld: error: LLVM gold plugin: linking module flags
> 'wchar_size': IDs have conflicting values in 'arch/sandbox/cpu/sdl.o'
> and 'ld-temp.o'
> +clang: error: linker command failed with exit code 1 (use -v to see 
> invocation)
> +make[1]: *** [Makefile:1799: u-boot] Error 1
> +make: *** [Makefile:177: sub-make] Error 2
> 001 /1  sandbox
> Completed: 1 total built, duration 0:00:22, rate 0.05
> Running after_script
> 
> 
> Please can you take a look?

I tested with clang and lld, and clang ld.gold in lxc and bare metal
build. didn't had this errors.

Could be that this problem appears on docker only.

-- 
Kind regards


[PATCH v3] board: gateworks: venice: add imx8mn-gw7902 support

2022-02-03 Thread Tim Harvey
The GW7902 is based on the i.MX 8M Mini / Nano SoC featuring:
 - LPDDR4 DRAM
 - eMMC FLASH
 - Gateworks System Controller
 - LTE CAT M1 modem
 - USB 2.0 HUB
 - M.2 Socket with USB2.0, PCIe, and dual-SIM
 - IMX8M FEC
 - PCIe based GbE
 - RS232/RS485/RS422 serial transceiver
 - GPS
 - CAN bus
 - WiFi / Bluetooth
 - MIPI header (DSI/CSI/GPIO/PWM/I2S)
 - PMIC

To add support for the i.MX8M Nano GW7902:
 - Add imx8mn-venice dts/defconfig/include
 - Add imx8mn-gw7902 dts
 - Add imx8mn-2gb lpddr4 dram configs
 - Add misc support for IMX8M Nano SoC
 - rename imx8mm-venice.c to venice.c as it is no longer imx8mm specific
 - update README with differences for IMX8MN vs IMX8MM

Signed-off-by: Tim Harvey 
---
v3:
 - rebase on origin/master (fix for items moved to defconfig)
 - update binman configuration to align with imx8mm binman

v2:
 - rebase on origin/master (fix for items moved to defconfig)
 - remove unused fdt_pack_reg function
---
 arch/arm/dts/Makefile |2 +
 arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi |   29 +
 arch/arm/dts/imx8mn-venice-gw7902.dts |  888 ++
 arch/arm/dts/imx8mn-venice-u-boot.dtsi|  244 +++
 arch/arm/dts/imx8mn-venice.dts|  152 ++
 arch/arm/mach-imx/imx8m/Kconfig   |7 +
 board/gateworks/venice/Kconfig|   15 +
 board/gateworks/venice/MAINTAINERS|6 +-
 board/gateworks/venice/Makefile   |   10 +-
 board/gateworks/venice/README |3 +-
 board/gateworks/venice/gsc.c  |   13 +
 .../gateworks/venice/imximage-8mn-lpddr4.cfg  |   10 +
 board/gateworks/venice/lpddr4_timing.h|5 +
 ...lpddr4_timing.c => lpddr4_timing_imx8mm.c} |0
 .../lpddr4_timing_imx8mn_2gb_dual_die.c   | 1444 
 .../lpddr4_timing_imx8mn_2gb_single_die.c | 1445 +
 board/gateworks/venice/spl.c  |   31 +-
 .../venice/{imx8mm_venice.c => venice.c}  |0
 configs/imx8mn_venice_defconfig   |  116 ++
 include/configs/imx8mn_venice.h   |  110 ++
 20 files changed, 4523 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mn-venice-gw7902.dts
 create mode 100644 arch/arm/dts/imx8mn-venice-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mn-venice.dts
 create mode 100644 board/gateworks/venice/imximage-8mn-lpddr4.cfg
 rename board/gateworks/venice/{lpddr4_timing.c => lpddr4_timing_imx8mm.c} 
(100%)
 create mode 100644 board/gateworks/venice/lpddr4_timing_imx8mn_2gb_dual_die.c
 create mode 100644 board/gateworks/venice/lpddr4_timing_imx8mn_2gb_single_die.c
 rename board/gateworks/venice/{imx8mm_venice.c => venice.c} (100%)
 create mode 100644 configs/imx8mn_venice_defconfig
 create mode 100644 include/configs/imx8mn_venice.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index ce332021d895..f8e33507e89d 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -909,6 +909,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
imx8mn-ddr4-evk.dtb \
imx8mq-cm.dtb \
imx8mn-evk.dtb \
+   imx8mn-venice.dtb \
+   imx8mn-venice-gw7902.dtb \
imx8mq-evk.dtb \
imx8mm-beacon-kit.dtb \
imx8mn-beacon-kit.dtb \
diff --git a/arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi 
b/arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi
new file mode 100644
index ..f6f0aa7cb5c0
--- /dev/null
+++ b/arch/arm/dts/imx8mn-venice-gw7902-u-boot.dtsi
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Gateworks Corporation
+ */
+
+#include "imx8mn-venice-u-boot.dtsi"
+
+&fec1 {
+   phy-reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+   phy-reset-duration = <1>;
+   phy-reset-post-delay = <1>;
+};
+
+&pinctrl_fec1 {
+   u-boot,dm-spl;
+};
+
+&{/soc@0/bus@3080/i2c@30a2/pmic@4b} {
+   u-boot,dm-spl;
+};
+
+&{/soc@0/bus@3080/i2c@30a2/pmic@4b/regulators} {
+   u-boot,dm-spl;
+};
+
+&pinctrl_pmic {
+   u-boot,dm-spl;
+};
+
diff --git a/arch/arm/dts/imx8mn-venice-gw7902.dts 
b/arch/arm/dts/imx8mn-venice-gw7902.dts
new file mode 100644
index ..06ee4cf79480
--- /dev/null
+++ b/arch/arm/dts/imx8mn-venice-gw7902.dts
@@ -0,0 +1,888 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2021 Gateworks Corporation
+ */
+
+/dts-v1/;
+
+#include 
+#include 
+#include 
+#include 
+
+#include "imx8mn.dtsi"
+
+/ {
+   model = "Gateworks Venice GW7902 i.MX8MN board";
+   compatible = "gw,imx8mn-gw7902", "fsl,imx8mn";
+
+   aliases {
+   usb0 = &usbotg1;
+   };
+
+   chosen {
+   stdout-path = &uart2;
+   };
+
+   memory@4000 {
+   device_type = "memory";
+   reg = <0x0 0x4000 0 0x8000>;
+   };
+
+   can20m: can20m {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock

[PATCH] Dockfile, CI: Update to latest focal tag and build

2022-02-03 Thread Tom Rini
- Latest focal tag
- Add libgnutls to image

Signed-off-by: Tom Rini 
---
 .azure-pipelines.yml| 2 +-
 .gitlab-ci.yml  | 2 +-
 tools/docker/Dockerfile | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index f2aa332be5cc..81ab77e1345c 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -2,7 +2,7 @@ variables:
   windows_vm: windows-2019
   ubuntu_vm: ubuntu-18.04
   macos_vm: macOS-10.15
-  ci_runner_image: trini/u-boot-gitlab-ci-runner:focal-20220105-10Jan2022
+  ci_runner_image: trini/u-boot-gitlab-ci-runner:focal-20220113-03Feb2022
   # Add '-u 0' options for Azure pipelines, otherwise we get "permission
   # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
   # since our $(ci_runner_image) user is not root.
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 75ad67fab032..85b52966346a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@
 
 # Grab our configured image.  The source for this is found at:
 # https://source.denx.de/u-boot/gitlab-ci-runner
-image: trini/u-boot-gitlab-ci-runner:focal-20220105-10Jan2022
+image: trini/u-boot-gitlab-ci-runner:focal-20220113-03Feb2022
 
 # We run some tests in different order, to catch some failures quicker.
 stages:
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index 141260cce13d..7a3f5cbade4e 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -2,7 +2,7 @@
 # This Dockerfile is used to build an image containing basic stuff to be used
 # to build U-Boot and run our test suites.
 
-FROM ubuntu:focal-20220105
+FROM ubuntu:focal-20220113
 MAINTAINER Tom Rini 
 LABEL Description=" This image is for building U-Boot inside a container"
 
-- 
2.25.1



[PATCH] common: fdt_support: add support for "partitions" subnode to fdt_fixup_mtdparts()

2022-02-03 Thread Matthias Schiffer
Listing MTD partitions directly in the flash mode has been deprecated
for a while for kernel Device Trees. Look for a node "partitions" in the
found flash nodes and use it instead of the flash node itself for the
partition list when it exists, so Device Trees following the current
best practices can be fixed up.

Signed-off-by: Matthias Schiffer 
---
 common/fdt_support.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index daa24d4c10..ea18ea3f04 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -988,7 +988,7 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info 
*node_info,
 {
struct mtd_device *dev;
int i, idx;
-   int noff;
+   int noff, parts;
bool inited = false;
 
for (i = 0; i < node_info_size; i++) {
@@ -1014,7 +1014,12 @@ void fdt_fixup_mtdparts(void *blob, const struct 
node_info *node_info,
 
dev = device_find(node_info[i].type, idx++);
if (dev) {
-   if (fdt_node_set_part_info(blob, noff, dev))
+   parts = fdt_subnode_offset(blob, noff,
+  "partitions");
+   if (parts < 0)
+   parts = noff;
+
+   if (fdt_node_set_part_info(blob, parts, dev))
return; /* return on error */
}
}
-- 
2.25.1



Re: [PATCH v2 2/5] sunxi: move Cortex SMPEN setting into start.S

2022-02-03 Thread Andre Przywara
On Wed, 2 Feb 2022 19:06:37 -0600
Samuel Holland  wrote:

Hi Samuel,

> On 1/31/22 7:41 PM, Andre Przywara wrote:
> > According to their TRMs, Cortex ARMv7 CPUs with SMP support require the
> > ACTLR.SMPEN bit to be set as early as possible, before any cache or TLB
> > maintenance operations are done. As we do those things still in start.S,
> > we need to move the SMPEN bit setting there, too.
> > 
> > This introduces a new ARMv7 wide symbol and code to set bit 6 in ACTLR
> > very early in start.S, and moves sunxi boards over to use that instead
> > of the custom code we had in our board.c file (where it was called
> > technically too late).
> > 
> > In practice we got away with this so far, because at this point all the
> > other cores were still in reset, so any broadcasting would have been
> > ignored anyway. But it is architecturally cleaner to do it early, and
> > we move a core specific piece of code out of board.c.
> > 
> > This also gets rid of the ARM_CORTEX_CPU_IS_UP kludge I introduced a few
> > years back, and moves the respective logic into the new Kconfig entry.
> > 
> > Signed-off-by: Andre Przywara 
> > ---
> >  arch/arm/Kconfig|  3 ---
> >  arch/arm/cpu/armv7/Kconfig  |  5 +
> >  arch/arm/cpu/armv7/start.S  | 11 +++
> >  arch/arm/mach-sunxi/Kconfig |  6 --
> >  arch/arm/mach-sunxi/board.c |  9 -
> >  5 files changed, 20 insertions(+), 14 deletions(-)
> > 
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index 6b11c3a50d9..7893d74fab2 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -452,9 +452,6 @@ config ENABLE_ARM_SOC_BOOT0_HOOK
> >   values, then choose this option, and create a file included as
> >which contains the required assembler code.
> >  
> > -config ARM_CORTEX_CPU_IS_UP
> > -   bool
> > -
> >  config USE_ARCH_MEMCPY
> > bool "Use an assembly optimized implementation of memcpy"
> > default y if !ARM64
> > diff --git a/arch/arm/cpu/armv7/Kconfig b/arch/arm/cpu/armv7/Kconfig
> > index 60bb0a9e1ec..cc4684cfed3 100644
> > --- a/arch/arm/cpu/armv7/Kconfig
> > +++ b/arch/arm/cpu/armv7/Kconfig
> > @@ -76,4 +76,9 @@ config ARMV7_LPAE
> > Say Y here to use the long descriptor page table format. This is
> > required if U-Boot runs in HYP mode.
> >  
> > +config ARMV7_SET_CORTEX_SMPEN
> > +   bool
> > +   help
> > + Enable the ARM Cortex ACTLR.SMP enable bit on startup.
> > +
> >  endif
> > diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
> > index 698e15b8e18..af87a5432ae 100644
> > --- a/arch/arm/cpu/armv7/start.S
> > +++ b/arch/arm/cpu/armv7/start.S
> > @@ -173,6 +173,17 @@ ENDPROC(switch_to_hypervisor)
> >   *
> >   */
> >  ENTRY(cpu_init_cp15)
> > +
> > +#if CONFIG_IS_ENABLED(ARMV7_SET_CORTEX_SMPEN)  
> 
> There is no SPL-prefixed symbol, so you probably want plain old "#if defined"
> here instead. Otherwise, this code will always be omitted from SPL.

Ouch, you are right, totally missed that. Actually we need that to be in
the SPL only. We need to enable it *once*, early on, so I changed the
symbol in the Kconfig now to have the SPL_ prefix. And I now verified that
in the objdump of the two start.o files (SPL and proper).

Do you reckon there would be problems with doing it only in the SPL? I
see that for 64-bit cores SPL and proper run in different environments,
but for v7 there should be no need to run all those cpu_init_cp15 code
again, right?
I will test it tonight with this change on some boards.

Thanks for having a look!

Cheers,
Andre

> 
> > +   /*
> > +* The Arm Cortex-A7 TRM says this bit must be enabled before
> > +* "any cache or TLB maintenance operations are performed".
> > +*/
> > +   mrc p15, 0, r0, c1, c0, 1   @ read auxilary control register
> > +   orr r0, r0, #1 << 6 @ set SMP bit to enable coherency
> > +   mcr p15, 0, r0, c1, c0, 1   @ write auxilary control register
> > +#endif
> > +
> > /*
> >  * Invalidate L1 I/D
> >  */
> > diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
> > index d7f9a03152f..637b1fb79e0 100644
> > --- a/arch/arm/mach-sunxi/Kconfig
> > +++ b/arch/arm/mach-sunxi/Kconfig
> > @@ -186,7 +186,6 @@ choice
> >  config MACH_SUN4I
> > bool "sun4i (Allwinner A10)"
> > select CPU_V7A
> > -   select ARM_CORTEX_CPU_IS_UP
> > select PHY_SUN4I_USB
> > select DRAM_SUN4I
> > select SUNXI_GEN_SUN4I
> > @@ -197,7 +196,6 @@ config MACH_SUN4I
> >  config MACH_SUN5I
> > bool "sun5i (Allwinner A13)"
> > select CPU_V7A
> > -   select ARM_CORTEX_CPU_IS_UP
> > select DRAM_SUN4I
> > select PHY_SUN4I_USB
> > select SUNXI_GEN_SUN4I
> > @@ -212,6 +210,7 @@ config MACH_SUN6I
> > select CPU_V7_HAS_NONSEC
> > select CPU_V7_HAS_VIRT
> > select ARCH_SUPPORT_PSCI
> > +   select ARMV7_SET_CORTEX_SMPEN
> > select DRAM_SUN6I
> > select PHY_SUN4I_USB
> > select SPL_

Re: [PATCH] sandbox: fix build failure with musl and SDL

2022-02-03 Thread Tom Rini
On Thu, Feb 03, 2022 at 02:02:47PM +0100, Milan P. Stanić wrote:
> Hi,
> 
> On Thu, 2022-01-27 at 14:35, Simon Glass wrote:
> > Hi,
> > 
> > On Fri, 21 Jan 2022 at 13:11, Milan P. Stanić  wrote:
> > >
> > > Hi,
> > >
> > > it works and build pass without error or warning.
> > > Tested on alpine edge aarch64 bare metal.
> > >
> > > Thank you
> > >
> > > On Fri, 2022-01-21 at 18:00, Heinrich Schuchardt wrote:
> > > > sdl.c is compiled against the SDL library.
> > > >
> > > > Trying to redefine wchar_t with -fshort-wchar is not necessary
> > > > and leads to build failures when compiling against musl.
> > > >
> > > > Cc: Milan P. Stanić 
> > > > Signed-off-by: Heinrich Schuchardt 
> > >
> > > Tested-by: Milan P. Stanić 
> > >
> > > > ---
> > > >  arch/sandbox/Makefile |  7 +++
> > > >  arch/sandbox/cpu/Makefile | 11 ---
> > > >  2 files changed, 15 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
> > > > index f6cf859f24..0bdd322f12 100644
> > > > --- a/arch/sandbox/Makefile
> > > > +++ b/arch/sandbox/Makefile
> > > > @@ -4,3 +4,10 @@ head-y := arch/sandbox/cpu/start.o 
> > > > arch/sandbox/cpu/os.o
> > > >  head-$(CONFIG_SANDBOX_SDL) += arch/sandbox/cpu/sdl.o
> > > >  libs-y += arch/sandbox/cpu/
> > > >  libs-y += arch/sandbox/lib/
> > > > +
> > > > +# sdl.c fails to compile with -fshort-wchar using musl.
> > > > +cmd_cc_sdl.o = $(CC) $(filter-out -nostdinc -fshort-wchar, \
> > > > + $(patsubst -I%,-idirafter%,$(c_flags))) -c -o $@ $<
> > > > +
> > > > +$(obj)/sdl.o: $(src)/sdl.c FORCE
> > > > + $(call if_changed_dep,cc_sdl.o)
> > > > diff --git a/arch/sandbox/cpu/Makefile b/arch/sandbox/cpu/Makefile
> > > > index de7fe7f391..b74c866e56 100644
> > > > --- a/arch/sandbox/cpu/Makefile
> > > > +++ b/arch/sandbox/cpu/Makefile
> > > > @@ -7,7 +7,7 @@
> > > >
> > > >  obj-y:= cache.o cpu.o state.o
> > > >  extra-y  := start.o os.o
> > > > -extra-$(CONFIG_SANDBOX_SDL)  += sdl.o
> > > > +extra-$(CONFIG_SANDBOX_SDL)+= sdl.o
> > > >  obj-$(CONFIG_SPL_BUILD)  += spl.o
> > > >  obj-$(CONFIG_ETH_SANDBOX_RAW)+= eth-raw-os.o
> > > >
> > > > @@ -19,8 +19,6 @@ cmd_cc_os.o = $(CC) $(filter-out -nostdinc, \
> > > >
> > > >  $(obj)/os.o: $(src)/os.c FORCE
> > > >   $(call if_changed_dep,cc_os.o)
> > > > -$(obj)/sdl.o: $(src)/sdl.c FORCE
> > > > - $(call if_changed_dep,cc_os.o)
> > > >
> > > >  # eth-raw-os.c is built in the system env, so needs standard includes
> > > >  # CFLAGS_REMOVE_eth-raw-os.o cannot be used to drop header include path
> > > > @@ -30,3 +28,10 @@ cmd_cc_eth-raw-os.o = $(CC) $(filter-out -nostdinc, \
> > > >
> > > >  $(obj)/eth-raw-os.o: $(src)/eth-raw-os.c FORCE
> > > >   $(call if_changed_dep,cc_eth-raw-os.o)
> > > > +
> > > > +# sdl.c fails to build with -fshort-wchar using musl
> > > > +cmd_cc_sdl.o = $(CC) $(filter-out -nostdinc -fshort-wchar, \
> > > > + $(patsubst -I%,-idirafter%,$(c_flags))) -c -o $@ $<
> > > > +
> > > > +$(obj)/sdl.o: $(src)/sdl.c FORCE
> > > > + $(call if_changed_dep,cc_sdl.o)
> > > > --
> > > > 2.33.1
> > > >
> > 
> > This fails on gitlab.
> > 
> > https://source.denx.de/u-boot/custodians/u-boot-dm/-/jobs/382812
> > 
> > $ tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e
> > --board ${TEST_PY_BD} ${OVERRIDE}
> > Building current source for 1 boards (1 thread, 40 jobs per thread)
> >sandbox:  +   sandbox
> > +/usr/bin/ld: error: LLVM gold plugin: linking module flags
> > 'wchar_size': IDs have conflicting values in 'arch/sandbox/cpu/sdl.o'
> > and 'ld-temp.o'
> > +clang: error: linker command failed with exit code 1 (use -v to see 
> > invocation)
> > +make[1]: *** [Makefile:1799: u-boot] Error 1
> > +make: *** [Makefile:177: sub-make] Error 2
> > 001 /1  sandbox
> > Completed: 1 total built, duration 0:00:22, rate 0.05
> > Running after_script
> > 
> > 
> > Please can you take a look?
> 
> I tested with clang and lld, and clang ld.gold in lxc and bare metal
> build. didn't had this errors.
> 
> Could be that this problem appears on docker only.

Docker is just an Ubuntu/Focal environment, so gcc + ld.gold here.

-- 
Tom


signature.asc
Description: PGP signature


Re: i.MX8M Mini Hangs at ATF when booting from USB

2022-02-03 Thread Tom Rini
On Wed, Feb 02, 2022 at 12:48:06PM -0600, Adam Ford wrote:
> On Wed, Feb 2, 2022 at 12:42 PM Tom Rini  wrote:
> >
> > On Wed, Feb 02, 2022 at 02:45:44PM -0300, Fabio Estevam wrote:
> > > Hi Marcel,
> > >
> > > [Adding Tom and Marek]
> > >
> > > On Wed, Feb 2, 2022 at 2:40 PM Marcel Ziswiler
> > >  wrote:
> > >
> > > > > The blocker to getting non-dm-spl-usb support for IMX8M appears to be
> > > > > the base addresses and instead of adding more of them to imx-regs.h we
> > > > > need to get them from DT via of_platdata which nobody has had time to
> > > > > dig into yet.
> > > >
> > > > I was also a little hesitant due to not using DM in SPL might no longer 
> > > > be accepted upstream. What is the
> > > > stance on this?
> > >
> > > My understanding is that there is no requirement to use DM in SPL.
> >
> > DM isn't required in SPL, no.  Are we running in to some size limit
> > here?  I see SPL_DM being set in a number of imx8m* platforms is why I
> > ask.
> 
> If we try to run SPL_DM_USB we run into serious space issues.  Some of
> us are trying to boot over USB, but the only real way to do it appears
> to be to not use DM_USB in SPL, but that requires adding some more
> manual registers.
> 
> Ideally, we would use of_platdata, but if that's enabled, it requires
> a bunch of drivers to be updated, and until that's done, all kinds of
> stuff break.  I think Fabio tried to push a non-DM-USB method, but
> there was some resistance.

OK.  Yes, I would prefer that ideal situation but given the current
backlog of imx changes, I understand the hesitation to add still more to
the to be merged queue.

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] tools: kwboot: Fix detection of quit esc sequence

2022-02-03 Thread Pali Rohár
Quit esc sequence may be also in the middle of the read buffer.
Fix the detection for that case.

Signed-off-by: Pali Rohár 
---
 tools/kwboot.c | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/tools/kwboot.c b/tools/kwboot.c
index 2684f0e75a56..7737188f0d0a 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -1183,10 +1183,10 @@ kwboot_xmodem(int tty, const void *_img, size_t size, 
int baudrate)
 static int
 kwboot_term_pipe(int in, int out, const char *quit, int *s)
 {
+   char buf[128];
ssize_t nin;
-   char _buf[128], *buf = _buf;
 
-   nin = read(in, buf, sizeof(_buf));
+   nin = read(in, buf, sizeof(buf));
if (nin <= 0)
return -1;
 
@@ -1194,18 +1194,21 @@ kwboot_term_pipe(int in, int out, const char *quit, int 
*s)
int i;
 
for (i = 0; i < nin; i++) {
-   if (*buf == quit[*s]) {
+   if (buf[i] == quit[*s]) {
(*s)++;
-   if (!quit[*s])
-   return 0;
-   buf++;
-   nin--;
+   if (!quit[*s]) {
+   nin = i - *s;
+   break;
+   }
} else {
-   if (kwboot_write(out, quit, *s) < 0)
+   if (*s > i && kwboot_write(out, quit, *s - i) < 
0)
return -1;
*s = 0;
}
}
+
+   if (i == nin)
+   nin -= *s;
}
 
if (kwboot_write(out, buf, nin) < 0)
-- 
2.20.1



[PATCH] tools/mrvl_uart.sh: Remove script

2022-02-03 Thread Pali Rohár
There are two tools for sending images over UART to Marvell SoCs: kwboot
and mrvl_uart.sh. kwboot received lot of new features and improvements in
last few months. There is no need to maintain two tools in U-Boot, so
remove old mrvl_uart.sh tool.

Signed-off-by: Pali Rohár 
---
 tools/mrvl_uart.sh | 119 -
 1 file changed, 119 deletions(-)
 delete mode 100755 tools/mrvl_uart.sh

diff --git a/tools/mrvl_uart.sh b/tools/mrvl_uart.sh
deleted file mode 100755
index a46411fc99fb..
--- a/tools/mrvl_uart.sh
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: GPL-2.0
-#
-##
-# Copyright (C) 2016 Marvell International Ltd.
-#
-# https://spdx.org/licenses
-#
-# Author: Konstantin Porotchkin kos...@marvell.com
-#
-# Version 0.3
-#
-# UART recovery downloader for Armada SoCs
-#
-##
-
-port=$1
-file=$2
-speed=$3
-
-pattern_repeat=1500
-default_baudrate=115200
-tmpfile=/tmp/xmodem.pattern
-tools=( dd stty sx minicom )
-
-case "$3" in
-2)
-fast_baudrate=230400
-prefix="\xF2"
-;;
-4)
-fast_baudrate=460800
-prefix="\xF4"
-;;
-8)
-   fast_baudrate=921600
-prefix="\xF8"
-;;
-*)
-   fast_baudrate=$default_baudrate
-prefix="\xBB"
-esac
-
-if [[ -z "$port" || -z "$file" ]]
-then
-echo -e "\nMarvell recovery image downloader for Armada SoC family."
-echo -e "Command syntax:"
-echo -e "\t$(basename $0)   [2|4|8]"
-echo -e "\tport  - serial port the target board is connected to"
-echo -e "\tfile  - recovery boot image for target download"
-echo -e "\t2|4|8 - times to increase the default serial port speed by"
-echo -e "For example - load the image over ttyUSB0 @ 460800 baud:"
-echo -e "$(basename $0) /dev/ttyUSB0 /tmp/flash-image.bin 4\n"
-echo -e "=WARNING="
-echo -e "- The speed-up option is not available in SoC families prior to 
A8K+"
-echo -e "- This utility is not compatible with Armada 37xx SoC family\n"
-fi
-
-# Sanity checks
-if [ -c "$port" ]
-then
-   echo -e "Using device connected on serial port \"$port\""
-else
-   echo "Wrong serial port name!"
-   exit 1
-fi
-
-if [ -f "$file" ]
-then
-   echo -e "Loading flash image file \"$file\""
-else
-   echo "File $file does not exist!"
-   exit 1
-fi
-
-# Verify required tools installation
-for tool in ${tools[@]}
-do
-toolname=`which $tool`
-if [ -z "$toolname" ]
-then
-echo -e "Missing installation of \"$tool\" --> Exiting"
-exit 1
-fi
-done
-
-
-echo -e "Recovery will run at $fast_baudrate baud"
-echo -e ""
-
-if [ -f "$tmpfile" ]
-then
-rm -f $tmpfile
-fi
-
-# Send the escape sequence to target board using default debug port speed
-stty -F $port raw ignbrk time 5 $default_baudrate
-counter=0
-while [ $counter -lt $pattern_repeat ]; do
-echo -n -e "$prefix\x11\x22\x33\x44\x55\x66\x77" >> $tmpfile
-let counter=counter+1
-done
-
-echo -en "Press the \"Reset\" button on the target board and "
-echo -en "the \"Enter\" key on the host keyboard simultaneously"
-read
-dd if=$tmpfile of=$port &>/dev/null
-
-# Speed up the binary image transfer
-stty -F $port raw ignbrk time 5 $fast_baudrate
-sx -vv $file > $port < $port
-#sx-at91 $port $file
-
-# Return the port to the default speed
-stty -F $port raw ignbrk time 5 $default_baudrate
-
-# Optional - fire up Minicom
-minicom -D $port -b $default_baudrate
-
-- 
2.20.1



Re: [PATCH] sandbox: fix build failure with musl and SDL

2022-02-03 Thread Heinrich Schuchardt

On 2/3/22 17:43, Tom Rini wrote:

On Thu, Feb 03, 2022 at 02:02:47PM +0100, Milan P. Stanić wrote:

Hi,

On Thu, 2022-01-27 at 14:35, Simon Glass wrote:

Hi,

On Fri, 21 Jan 2022 at 13:11, Milan P. Stanić  wrote:


Hi,

it works and build pass without error or warning.
Tested on alpine edge aarch64 bare metal.

Thank you

On Fri, 2022-01-21 at 18:00, Heinrich Schuchardt wrote:

sdl.c is compiled against the SDL library.

Trying to redefine wchar_t with -fshort-wchar is not necessary
and leads to build failures when compiling against musl.

Cc: Milan P. Stanić 
Signed-off-by: Heinrich Schuchardt 


Tested-by: Milan P. Stanić 


---
  arch/sandbox/Makefile |  7 +++
  arch/sandbox/cpu/Makefile | 11 ---
  2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index f6cf859f24..0bdd322f12 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -4,3 +4,10 @@ head-y := arch/sandbox/cpu/start.o arch/sandbox/cpu/os.o
  head-$(CONFIG_SANDBOX_SDL) += arch/sandbox/cpu/sdl.o
  libs-y += arch/sandbox/cpu/
  libs-y += arch/sandbox/lib/
+
+# sdl.c fails to compile with -fshort-wchar using musl.
+cmd_cc_sdl.o = $(CC) $(filter-out -nostdinc -fshort-wchar, \
+ $(patsubst -I%,-idirafter%,$(c_flags))) -c -o $@ $<
+
+$(obj)/sdl.o: $(src)/sdl.c FORCE
+ $(call if_changed_dep,cc_sdl.o)
diff --git a/arch/sandbox/cpu/Makefile b/arch/sandbox/cpu/Makefile
index de7fe7f391..b74c866e56 100644
--- a/arch/sandbox/cpu/Makefile
+++ b/arch/sandbox/cpu/Makefile
@@ -7,7 +7,7 @@

  obj-y:= cache.o cpu.o state.o
  extra-y  := start.o os.o
-extra-$(CONFIG_SANDBOX_SDL)  += sdl.o
+extra-$(CONFIG_SANDBOX_SDL)+= sdl.o
  obj-$(CONFIG_SPL_BUILD)  += spl.o
  obj-$(CONFIG_ETH_SANDBOX_RAW)+= eth-raw-os.o

@@ -19,8 +19,6 @@ cmd_cc_os.o = $(CC) $(filter-out -nostdinc, \

  $(obj)/os.o: $(src)/os.c FORCE
   $(call if_changed_dep,cc_os.o)
-$(obj)/sdl.o: $(src)/sdl.c FORCE
- $(call if_changed_dep,cc_os.o)

  # eth-raw-os.c is built in the system env, so needs standard includes
  # CFLAGS_REMOVE_eth-raw-os.o cannot be used to drop header include path
@@ -30,3 +28,10 @@ cmd_cc_eth-raw-os.o = $(CC) $(filter-out -nostdinc, \

  $(obj)/eth-raw-os.o: $(src)/eth-raw-os.c FORCE
   $(call if_changed_dep,cc_eth-raw-os.o)
+
+# sdl.c fails to build with -fshort-wchar using musl
+cmd_cc_sdl.o = $(CC) $(filter-out -nostdinc -fshort-wchar, \
+ $(patsubst -I%,-idirafter%,$(c_flags))) -c -o $@ $<
+
+$(obj)/sdl.o: $(src)/sdl.c FORCE
+ $(call if_changed_dep,cc_sdl.o)
--
2.33.1



This fails on gitlab.

https://source.denx.de/u-boot/custodians/u-boot-dm/-/jobs/382812

$ tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e
--board ${TEST_PY_BD} ${OVERRIDE}
Building current source for 1 boards (1 thread, 40 jobs per thread)
sandbox:  +   sandbox
+/usr/bin/ld: error: LLVM gold plugin: linking module flags
'wchar_size': IDs have conflicting values in 'arch/sandbox/cpu/sdl.o'
and 'ld-temp.o'
+clang: error: linker command failed with exit code 1 (use -v to see invocation)
+make[1]: *** [Makefile:1799: u-boot] Error 1
+make: *** [Makefile:177: sub-make] Error 2
 001 /1  sandbox
Completed: 1 total built, duration 0:00:22, rate 0.05
Running after_script


Please can you take a look?


I tested with clang and lld, and clang ld.gold in lxc and bare metal
build. didn't had this errors.

Could be that this problem appears on docker only.


Docker is just an Ubuntu/Focal environment, so gcc + ld.gold here.



Your are looking at an old version of the patch.

[PATCH v2 1/1] sandbox: fix build failure with musl and SDL

https://patchwork.ozlabs.org/project/uboot/patch/20220128090832.35509-1-heinrich.schucha...@canonical.com/

@Simon
Could you, please, review.

Best regards

Heinrich



[PATCH] MAINTAINERS: Update list of Armada 385 and Armada 3720 drivers

2022-02-03 Thread Pali Rohár
Signed-off-by: Pali Rohár 
---
 MAINTAINERS | 9 +
 1 file changed, 9 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index dcdd99e368d1..7b05f8866edc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -278,11 +278,20 @@ T:git 
https://source.denx.de/u-boot/custodians/u-boot-marvell.git
 F: arch/arm/mach-kirkwood/
 F: arch/arm/mach-mvebu/
 F: drivers/ata/ahci_mvebu.c
+F: drivers/clk/mvebu/
 F: drivers/ddr/marvell/
 F: drivers/gpio/mvebu_gpio.c
+F: drivers/i2c/mvtwsi.c
+F: drivers/mmc/xenon_sdhci.c
+F: drivers/phy/marvell/
+F: drivers/pinctrl/mvebu/
+F: drivers/rtc/armada38x.c
 F: drivers/spi/kirkwood_spi.c
+F: drivers/spi/mvebu_a3700_spi.c
 F: drivers/pci/pcie_dw_mvebu.c
+F: drivers/watchdog/armada-37xx-wdt.c
 F: drivers/watchdog/orion_wdt.c
+F: include/configs/mv-common.h
 
 ARM MARVELL PCIE CONTROLLER DRIVERS
 M: Pali Rohár 
-- 
2.20.1



Re: [PATCH] tools/mrvl_uart.sh: Remove script

2022-02-03 Thread Marek Behún
On Thu,  3 Feb 2022 17:50:46 +0100
Pali Rohár  wrote:

> There are two tools for sending images over UART to Marvell SoCs: kwboot
> and mrvl_uart.sh. kwboot received lot of new features and improvements in
> last few months. There is no need to maintain two tools in U-Boot, so
> remove old mrvl_uart.sh tool.
> 
> Signed-off-by: Pali Rohár 

Reviewed-by: Marek Behún 


Re: [PATCH v5 3/4] sandbox: Detect the host bit size automatically

2022-02-03 Thread Tom Rini
On Sun, Jan 23, 2022 at 12:55:13PM -0700, Simon Glass wrote:

> At present if you build sandbox on a 32-bit host a lot of errors are
> produced. This is because CONFIG_HOST_64BIT is enabled by default.
> 
> It is quite annoying to have to change that manually before building
> sandbox. It is also quite confusing for new users.
> 
> Add a way to detect the setting and add the appropriate
> CONFIG_HOST_64BIT=y or CONFIG_HOST_32BIT=y to the defconfig, to avoid
> this issue.
> 
> Tidy up the Kconfig help for the above two options while we are here.
> 
> Signed-off-by: Simon Glass 

This pretty reliably fails to build for me with
CONFIG_HOST_DETECT_BITNESS=y resulting in CONFIG_SANDBOX_BITS_PER_LONG
not being set.  It's as easy to trigger as "make O=/tmp/fail
sandbox_config all" for me (over on bill-the-cat if it works for you
locally).

-- 
Tom


signature.asc
Description: PGP signature


Re: i.MX8M Mini Hangs at ATF when booting from USB

2022-02-03 Thread Marek Vasut

On 2/3/22 17:46, Tom Rini wrote:

On Wed, Feb 02, 2022 at 12:48:06PM -0600, Adam Ford wrote:

On Wed, Feb 2, 2022 at 12:42 PM Tom Rini  wrote:


On Wed, Feb 02, 2022 at 02:45:44PM -0300, Fabio Estevam wrote:

Hi Marcel,

[Adding Tom and Marek]

On Wed, Feb 2, 2022 at 2:40 PM Marcel Ziswiler
 wrote:


The blocker to getting non-dm-spl-usb support for IMX8M appears to be
the base addresses and instead of adding more of them to imx-regs.h we
need to get them from DT via of_platdata which nobody has had time to
dig into yet.


I was also a little hesitant due to not using DM in SPL might no longer be 
accepted upstream. What is the
stance on this?


My understanding is that there is no requirement to use DM in SPL.


DM isn't required in SPL, no.  Are we running in to some size limit
here?  I see SPL_DM being set in a number of imx8m* platforms is why I
ask.


If we try to run SPL_DM_USB we run into serious space issues.  Some of
us are trying to boot over USB, but the only real way to do it appears
to be to not use DM_USB in SPL, but that requires adding some more
manual registers.

Ideally, we would use of_platdata, but if that's enabled, it requires
a bunch of drivers to be updated, and until that's done, all kinds of
stuff break.  I think Fabio tried to push a non-DM-USB method, but
there was some resistance.


OK.  Yes, I would prefer that ideal situation but given the current
backlog of imx changes, I understand the hesitation to add still more to
the to be merged queue.


Stefano should be back soon.

That said, the hang in MX8M USB likely happens because USB block depends 
on GPC driver to bring up its power domains, which does so by means of 
SMC calls into ATF, which at SPL time is unavailable, hence the hang.


So someone would have to rewrite the MX8M GPC driver to NOT do SMC 
calls, but rather control the GPC registers directly, like it is done in 
Linux.


Re: i.MX8M Mini Hangs at ATF when booting from USB

2022-02-03 Thread Adam Ford
On Thu, Feb 3, 2022 at 11:23 AM Marek Vasut  wrote:
>
> On 2/3/22 17:46, Tom Rini wrote:
> > On Wed, Feb 02, 2022 at 12:48:06PM -0600, Adam Ford wrote:
> >> On Wed, Feb 2, 2022 at 12:42 PM Tom Rini  wrote:
> >>>
> >>> On Wed, Feb 02, 2022 at 02:45:44PM -0300, Fabio Estevam wrote:
>  Hi Marcel,
> 
>  [Adding Tom and Marek]
> 
>  On Wed, Feb 2, 2022 at 2:40 PM Marcel Ziswiler
>   wrote:
> 
> >> The blocker to getting non-dm-spl-usb support for IMX8M appears to be
> >> the base addresses and instead of adding more of them to imx-regs.h we
> >> need to get them from DT via of_platdata which nobody has had time to
> >> dig into yet.
> >
> > I was also a little hesitant due to not using DM in SPL might no longer 
> > be accepted upstream. What is the
> > stance on this?
> 
>  My understanding is that there is no requirement to use DM in SPL.
> >>>
> >>> DM isn't required in SPL, no.  Are we running in to some size limit
> >>> here?  I see SPL_DM being set in a number of imx8m* platforms is why I
> >>> ask.
> >>
> >> If we try to run SPL_DM_USB we run into serious space issues.  Some of
> >> us are trying to boot over USB, but the only real way to do it appears
> >> to be to not use DM_USB in SPL, but that requires adding some more
> >> manual registers.
> >>
> >> Ideally, we would use of_platdata, but if that's enabled, it requires
> >> a bunch of drivers to be updated, and until that's done, all kinds of
> >> stuff break.  I think Fabio tried to push a non-DM-USB method, but
> >> there was some resistance.
> >
> > OK.  Yes, I would prefer that ideal situation but given the current
> > backlog of imx changes, I understand the hesitation to add still more to
> > the to be merged queue.
>
> Stefano should be back soon.
>
> That said, the hang in MX8M USB likely happens because USB block depends
> on GPC driver to bring up its power domains, which does so by means of
> SMC calls into ATF, which at SPL time is unavailable, hence the hang.

I did some experiments on that, but the USB enumerates, downloads the
image, parses the image, but hangs on the jump.  From what I could
tell, the boot ROM appeared to enable enough of the USB to facilitate
the USB transfer.  If I did the same experiment without SPL_DM_USB,
the load was successful.  I am guessing the memory is too tight with
SPL_DM_USB, because I am not seeing a significant difference in
behavior other than code and memory footprint with and without DM_USB.

>
> So someone would have to rewrite the MX8M GPC driver to NOT do SMC
> calls, but rather control the GPC registers directly, like it is done in
> Linux.

This has been in my radar, since I think I understand it fairly well,
but I haven't had the time to tackle it.

adam


Re: [PATCH v2 2/2] efi_loader: Reset system after CapsuleUpdate on disk

2022-02-03 Thread Heinrich Schuchardt

On 2/2/22 05:15, AKASHI Takahiro wrote:

On Wed, Feb 02, 2022 at 10:53:05AM +0900, Masami Hiramatsu wrote:

Hi Takahiro,

2022年2月1日(火) 20:38 AKASHI Takahiro :



On Tue, Feb 01, 2022 at 05:33:09PM +0900, Masami Hiramatsu wrote:

Add a config option to reset system soon after processing capsule update
on disk. This is required in UEFI specification 2.9 Section 8.5.5
  "Delivery of Capsules via file on Mass Storage device" as;

 In all cases that a capsule is identified for processing the system is
 restarted after capsule processing is completed.

This also reports the result of each capsule update so that the user can
notice that the capsule update has been succeeded or not from console log.

Signed-off-by: Masami Hiramatsu 
---
  Changes in v2:
   - Remove kconfig option to disable this feature.
   - Use panic() instead of do_reset() so that if the reset fails,
 the machine halt.
   - Log the result of each capsule update always.
---
  lib/efi_loader/efi_capsule.c |   12 +---
  1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 1ec7ea29ff..39bce714f7 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -1119,9 +1119,9 @@ efi_status_t efi_launch_capsules(void)
   ret = efi_capsule_read_file(files[i], &capsule);
   if (ret == EFI_SUCCESS) {
   ret = efi_capsule_update_firmware(capsule);
- if (ret != EFI_SUCCESS)
- log_err("Applying capsule %ls failed\n",
- files[i]);
+ log_err("Applying capsule %ls %s\n",
+ files[i],
+ ret == EFI_SUCCESS ? "succeeded" : "failed");


log_err()? log_info() is better, I think.


Hmm, would you think to use log_info() even if it is failed? Or should
we have log_err(failure) and log_info(success)?


It is what I meant :)





   /* create Capsule */
   set_capsule_result(index, capsule, ret);
@@ -1142,6 +1142,12 @@ efi_status_t efi_launch_capsules(void)
   free(files[i]);
   free(files);

+ /*
+  * UEFI spec requires to reset system after complete processing capsule
+  * update on the storage.
+  */
+ panic("Reboot after firmware update");


If CONFIG_PANIC_HANG is enabled, the system won't restart.
It's not what we want here.


Indeed.
Heinrich, what would you think if do_reset() doesn't work?
(I think it is OK to get it back here, but needs a warning)


If (CONFIG_IS_ENABLED(SYSRESET)) {
 puts ("resetting ...\n");
 sysreset_reset_walk(SYSRESET_WARM);


do_reset() is implemented in many 25 places.
drivers/sysreset/sysreset-uclass.c is just one of them.

@Tom, @Simon:
Is there a migration timeline to replace all other do_reset()
implementations?

A dummy implementation like in arch/riscv/lib/reset.c should not exist.
The sysreset uclass handles the case of no sysreset driver already.

Best regards

Heinrich


} else {
 do_reset(...)
 halt();
}
/* not reach here */

-Takahiro Akashi



Thank you,



-Takahiro Akashi


+
   return ret;
  }
  #endif /* CONFIG_EFI_CAPSULE_ON_DISK */





--
Masami Hiramatsu




[PATCH v2 1/2] colibri-imx6ull: improve env badblock management

2022-02-03 Thread Marcel Ziswiler
From: Francesco Dolcini 

Use the complete 512kb (4 blocks) nand partition reserved for u-boot
environment instead of just the first block, this allows the module to
have a working environment even if 3 blocks are bad.

Signed-off-by: Francesco Dolcini 
Signed-off-by: Marcel Ziswiler 

---

Changes in v2:
- Re-based on top of today's master taking our recent addition of the
  eMMC SKU into account.
- Just remove stale eMMC environment comment after Kconfig move.

 include/configs/colibri-imx6ull.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/configs/colibri-imx6ull.h 
b/include/configs/colibri-imx6ull.h
index 787fe33941..91f0f953a1 100644
--- a/include/configs/colibri-imx6ull.h
+++ b/include/configs/colibri-imx6ull.h
@@ -140,8 +140,9 @@
(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 /* environment organization */
-
-/* Environment in eMMC, before config block at the end of 1st "boot sector" */
+#if defined(CONFIG_ENV_IS_IN_NAND)
+#define CONFIG_ENV_RANGE   (4 * CONFIG_ENV_SIZE)
+#endif
 
 #ifdef CONFIG_TARGET_COLIBRI_IMX6ULL_NAND
 /* NAND stuff */
-- 
2.34.1



[PATCH v2 2/2] colibri-imx7: improve env badblock management

2022-02-03 Thread Marcel Ziswiler
From: Francesco Dolcini 

Use the complete 512kb (4 blocks) nand partition reserved for u-boot
environment instead of just the first block, this allows the module
to have a working environment even if 3 blocks are bad.

Signed-off-by: Francesco Dolcini 

---

(no changes since v1)

 include/configs/colibri_imx7.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h
index faf27ba4fa..92e24ea8c6 100644
--- a/include/configs/colibri_imx7.h
+++ b/include/configs/colibri_imx7.h
@@ -180,6 +180,11 @@
 #define CONFIG_SYS_INIT_SP_ADDR \
(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
+/* environment organization */
+#if defined(CONFIG_ENV_IS_IN_NAND)
+#define CONFIG_ENV_RANGE   (4 * CONFIG_ENV_SIZE)
+#endif
+
 #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND
 /* NAND stuff */
 #define CONFIG_SYS_MAX_NAND_DEVICE 1
-- 
2.34.1



Re: [PATCH] adc: rockchip-saradc: add support for getting reference voltage value

2022-02-03 Thread John Keeping
On Wed, Feb 02, 2022 at 01:12:54PM -0500, Peter Cai wrote:
> Mirroring commit 97ab802aa36f ("adc: meson-saradc: add support for
> getting reference voltage value") for meson-saradc, this adds support
> for getting the "vref-supply" regulator and register it as the ADC's
> reference voltage regulator, so clients can translate sampled ADC values
> to voltage.
> 
> Signed-off-by: Peter Cai 
> Cc: Simon Glass 
> Cc: Philipp Tomsich 
> Cc: Kever Yang 

One code style nit below, but:

Reviewed-by: John Keeping 
Tested-by: John Keeping 

The results from this look good on RK3288.

> ---
>  drivers/adc/rockchip-saradc.c | 21 +
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/adc/rockchip-saradc.c b/drivers/adc/rockchip-saradc.c
> index e464d33f2267..67c11d896e8d 100644
> --- a/drivers/adc/rockchip-saradc.c
> +++ b/drivers/adc/rockchip-saradc.c
> @@ -13,6 +13,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #define SARADC_CTRL_CHN_MASK GENMASK(2, 0)
>  #define SARADC_CTRL_POWER_CTRL   BIT(3)
> @@ -100,8 +101,11 @@ int rockchip_saradc_stop(struct udevice *dev)
>  
>  int rockchip_saradc_probe(struct udevice *dev)
>  {
> + struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev);
>   struct rockchip_saradc_priv *priv = dev_get_priv(dev);
>   struct clk clk;
> + struct udevice *vref;

Should vref be above clk to keep the reverse Christmas tree order of
decreasing line length?

> + int vref_uv;
>   int ret;
>  
>   ret = clk_get_by_index(dev, 0, &clk);
> @@ -114,6 +118,23 @@ int rockchip_saradc_probe(struct udevice *dev)
>  
>   priv->active_channel = -1;
>  
> + ret = device_get_supply_regulator(dev, "vref-supply", &vref);
> + if (ret) {
> + printf("can't get vref-supply: %d\n", ret);
> + return ret;
> + }
> +
> + vref_uv = regulator_get_value(vref);
> + if (vref_uv < 0) {
> + printf("can't get vref-supply value: %d\n", vref_uv);
> + return vref_uv;
> + }
> +
> + /* VDD supplied by common vref pin */
> + uc_pdata->vdd_supply = vref;
> + uc_pdata->vdd_microvolts = vref_uv;
> + uc_pdata->vss_microvolts = 0;
> +
>   return 0;
>  }
>  
> -- 
> 2.35.0
> 


Re: i.MX8M Mini Hangs at ATF when booting from USB

2022-02-03 Thread Marek Vasut

On 2/3/22 18:27, Adam Ford wrote:

On Thu, Feb 3, 2022 at 11:23 AM Marek Vasut  wrote:


On 2/3/22 17:46, Tom Rini wrote:

On Wed, Feb 02, 2022 at 12:48:06PM -0600, Adam Ford wrote:

On Wed, Feb 2, 2022 at 12:42 PM Tom Rini  wrote:


On Wed, Feb 02, 2022 at 02:45:44PM -0300, Fabio Estevam wrote:

Hi Marcel,

[Adding Tom and Marek]

On Wed, Feb 2, 2022 at 2:40 PM Marcel Ziswiler
 wrote:


The blocker to getting non-dm-spl-usb support for IMX8M appears to be
the base addresses and instead of adding more of them to imx-regs.h we
need to get them from DT via of_platdata which nobody has had time to
dig into yet.


I was also a little hesitant due to not using DM in SPL might no longer be 
accepted upstream. What is the
stance on this?


My understanding is that there is no requirement to use DM in SPL.


DM isn't required in SPL, no.  Are we running in to some size limit
here?  I see SPL_DM being set in a number of imx8m* platforms is why I
ask.


If we try to run SPL_DM_USB we run into serious space issues.  Some of
us are trying to boot over USB, but the only real way to do it appears
to be to not use DM_USB in SPL, but that requires adding some more
manual registers.

Ideally, we would use of_platdata, but if that's enabled, it requires
a bunch of drivers to be updated, and until that's done, all kinds of
stuff break.  I think Fabio tried to push a non-DM-USB method, but
there was some resistance.


OK.  Yes, I would prefer that ideal situation but given the current
backlog of imx changes, I understand the hesitation to add still more to
the to be merged queue.


Stefano should be back soon.

That said, the hang in MX8M USB likely happens because USB block depends
on GPC driver to bring up its power domains, which does so by means of
SMC calls into ATF, which at SPL time is unavailable, hence the hang.


I did some experiments on that, but the USB enumerates, downloads the
image, parses the image, but hangs on the jump.  From what I could
tell, the boot ROM appeared to enable enough of the USB to facilitate
the USB transfer.


And this works when you load SPL via USB or does it also work when you 
load SPL from e.g. SD card ? I bet it is only the former.



If I did the same experiment without SPL_DM_USB,
the load was successful.  I am guessing the memory is too tight with
SPL_DM_USB, because I am not seeing a significant difference in
behavior other than code and memory footprint with and without DM_USB.



So someone would have to rewrite the MX8M GPC driver to NOT do SMC
calls, but rather control the GPC registers directly, like it is done in
Linux.


This has been in my radar, since I think I understand it fairly well,
but I haven't had the time to tackle it.


It's not going to implement itself.

[...]


[PATCH v2 0/2] Use the complete 512kb (4 blocks) nand partition reserved for u-boot

2022-02-03 Thread Marcel Ziswiler
From: Marcel Ziswiler 

environment instead of just the first block, this allows the module
to have a working environment even if 3 blocks are bad.

Changes in v2:
- Re-based on top of today's master taking our recent addition of the
  eMMC SKU into account.
- Just remove stale eMMC environment comment after Kconfig move.

Francesco Dolcini (2):
  colibri-imx6ull: improve env badblock management
  colibri-imx7: improve env badblock management

 include/configs/colibri-imx6ull.h | 5 +++--
 include/configs/colibri_imx7.h| 5 +
 2 files changed, 8 insertions(+), 2 deletions(-)

-- 
2.34.1



[PATCH] phy: phy-uclass: check the parents for phys

2022-02-03 Thread Angus Ainslie
The port/hub leaf nodes don't contain the phy definitions in some dts
files so check the parents.

Signed-off-by: Angus Ainslie 
---
 drivers/phy/phy-uclass.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c
index 49e2ec25c2..8b84da3ce0 100644
--- a/drivers/phy/phy-uclass.c
+++ b/drivers/phy/phy-uclass.c
@@ -354,23 +354,31 @@ int generic_phy_configure(struct phy *phy, void *params)
 int generic_phy_get_bulk(struct udevice *dev, struct phy_bulk *bulk)
 {
int i, ret, count;
+   struct udevice *phydev = dev;
 
bulk->count = 0;
 
/* Return if no phy declared */
-   if (!dev_read_prop(dev, "phys", NULL))
-   return 0;
+   if (!dev_read_prop(dev, "phys", NULL)) {
+   phydev = dev->parent;
+   if (!dev_read_prop(phydev, "phys", NULL)) {
+   pr_err("%s : no phys property\n", __func__);
+   return 0;
+   }
+   }
 
-   count = dev_count_phandle_with_args(dev, "phys", "#phy-cells", 0);
-   if (count < 1)
+   count = dev_count_phandle_with_args(phydev, "phys", "#phy-cells", 0);
+   if (count < 1) {
+   pr_err("%s : no phys found %d\n", __func__, count);
return count;
+   }
 
-   bulk->phys = devm_kcalloc(dev, count, sizeof(struct phy), GFP_KERNEL);
+   bulk->phys = devm_kcalloc(phydev, count, sizeof(struct phy), 
GFP_KERNEL);
if (!bulk->phys)
return -ENOMEM;
 
for (i = 0; i < count; i++) {
-   ret = generic_phy_get_by_index(dev, i, &bulk->phys[i]);
+   ret = generic_phy_get_by_index(phydev, i, &bulk->phys[i]);
if (ret) {
pr_err("Failed to get PHY%d for %s\n", i, dev->name);
return ret;
-- 
2.25.1



Re: [RFC 0/2] A/B firmware update based in eMMC boot partition.

2022-02-03 Thread Tom Rini
On Tue, Jan 25, 2022 at 03:43:29PM +0100, Wolfgang Denk wrote:
> Dear Ying-Chun Liu,
> 
> In message <20220125135535.224061-1-grandp...@gmail.com> you wrote:
> >
> > I've implemented A/B firmware update based on eMMC hw partitions.
> > Normally we have 2 boot partitions on eMMC. One is active and another
> > is inactive. We can then flash the firmware to the inactive one and
> > make it active.
> 
> We have been doing software updates using U-Boot scripts etc. for
> many, many years.  But during that time a large number of
> restrictions and shortcomings became clear.
[snip]

I just want to chime in here and agree with the overall point that
Wolfgang is making.  There are a number of update schemes that handle
firmware (to whatever level can be safely done) and I see U-Boot's role
here as to support these mechanisms as easily and cleanly as possible
(so, watchdog, bootcount, etc, etc) but to not implement a specific
scheme directly.

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] Nokia RX-51: Convert to CONFIG_DM_KEYBOARD

2022-02-03 Thread Pali Rohár
Signed-off-by: Pali Rohár 
---

I would really appreciate if U-Boot test framework starts printing
deprecation warnings, instead of sending patches which directly drop
support for some boards.

There is absolutely no warning during building U-Boot for RX-51 board
that this board has not been converted to DM_KEYBOARD yet.

---
 board/nokia/rx51/rx51.c  | 37 +++-
 configs/nokia_rx51_defconfig |  2 +-
 include/configs/nokia_rx51.h | 13 +
 3 files changed, 34 insertions(+), 18 deletions(-)

diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index 99ca36fbbea1..a52691509da4 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -579,10 +580,10 @@ static u8 keybuf_head;
 static u8 keybuf_tail;
 
 /*
- * Routine: rx51_kp_init
+ * Routine: rx51_kp_start
  * Description: Initialize HW keyboard.
  */
-int rx51_kp_init(void)
+static int rx51_kp_start(struct udevice *dev)
 {
int ret = 0;
u8 ctrl;
@@ -656,7 +657,7 @@ static void rx51_kp_fill(u8 k, u8 mods)
  * Routine: rx51_kp_tstc
  * Description: Test if key was pressed (from buffer).
  */
-int rx51_kp_tstc(struct stdio_dev *sdev)
+static int rx51_kp_tstc(struct udevice *dev)
 {
u8 c, r, dk, i;
u8 intr;
@@ -712,14 +713,36 @@ int rx51_kp_tstc(struct stdio_dev *sdev)
  * Routine: rx51_kp_getc
  * Description: Get last pressed key (from buffer).
  */
-int rx51_kp_getc(struct stdio_dev *sdev)
+static int rx51_kp_getc(struct udevice *dev)
 {
keybuf_head %= KEYBUF_SIZE;
-   while (!rx51_kp_tstc(sdev))
+   while (!rx51_kp_tstc(dev))
WATCHDOG_RESET();
return keybuf[keybuf_head++];
 }
 
+static int rx51_kp_probe(struct udevice *dev)
+{
+   struct keyboard_priv *uc_priv = dev_get_uclass_priv(dev);
+   struct stdio_dev *sdev = &uc_priv->sdev;
+
+   strcpy(sdev->name, "keyboard");
+   return input_stdio_register(sdev);
+}
+
+static const struct keyboard_ops rx51_kp_ops = {
+   .start = rx51_kp_start,
+   .tstc = rx51_kp_tstc,
+   .getc = rx51_kp_getc,
+};
+
+U_BOOT_DRIVER(rx51_kp) = {
+   .name = "rx51_kp",
+   .id = UCLASS_KEYBOARD,
+   .probe = rx51_kp_probe,
+   .ops = &rx51_kp_ops,
+};
+
 static const struct mmc_config rx51_mmc_cfg = {
.host_caps = MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS,
.f_min = 40,
@@ -753,3 +776,7 @@ U_BOOT_DRVINFOS(rx51_i2c) = {
 U_BOOT_DRVINFOS(rx51_watchdog) = {
{ "rx51_watchdog" },
 };
+
+U_BOOT_DRVINFOS(rx51_kp) = {
+   { "rx51_kp" },
+};
diff --git a/configs/nokia_rx51_defconfig b/configs/nokia_rx51_defconfig
index 4a95f42e4eb4..47b7bc3b4f03 100644
--- a/configs/nokia_rx51_defconfig
+++ b/configs/nokia_rx51_defconfig
@@ -66,6 +66,7 @@ CONFIG_DM=y
 # CONFIG_DM_SEQ_ALIAS is not set
 # CONFIG_BLOCK_CACHE is not set
 CONFIG_DM_I2C=y
+CONFIG_DM_KEYBOARD=y
 # CONFIG_MMC_HW_PARTITIONING is not set
 # CONFIG_MMC_VERBOSE is not set
 CONFIG_MMC_OMAP_HS=y
@@ -78,7 +79,6 @@ CONFIG_USB_MUSB_UDC=y
 CONFIG_USB_OMAP3=y
 CONFIG_CFB_CONSOLE=y
 CONFIG_CFB_CONSOLE_ANSI=y
-# CONFIG_VGA_AS_SINGLE_DEVICE is not set
 CONFIG_SPLASH_SCREEN=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=31000
 CONFIG_WDT=y
diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h
index adfc055a2c9e..9be64c3d3f87 100644
--- a/include/configs/nokia_rx51.h
+++ b/include/configs/nokia_rx51.h
@@ -77,21 +77,10 @@
 #define VIDEO_FB_16BPP_PIXEL_SWAP
 #define VIDEO_FB_16BPP_WORD_SWAP
 
-/* functions for cfb_console */
-#define VIDEO_KBD_INIT_FCT rx51_kp_init()
-#define VIDEO_TSTC_FCT rx51_kp_tstc
-#define VIDEO_GETC_FCT rx51_kp_getc
-#ifndef __ASSEMBLY__
-struct stdio_dev;
-int rx51_kp_init(void);
-int rx51_kp_tstc(struct stdio_dev *sdev);
-int rx51_kp_getc(struct stdio_dev *sdev);
-#endif
-
 /* Environment information */
 #define CONFIG_EXTRA_ENV_SETTINGS \
"usbtty=cdc_acm\0" \
-   "stdin=usbtty,serial,vga\0" \
+   "stdin=usbtty,serial,keyboard\0" \
"stdout=usbtty,serial,vga\0" \
"stderr=usbtty,serial,vga\0" \
"slide=gpio input " __stringify(GPIO_SLIDE) "\0" \
-- 
2.20.1



Re: [PATCH v5 3/4] sandbox: Detect the host bit size automatically

2022-02-03 Thread Heinrich Schuchardt

On 1/23/22 20:55, Simon Glass wrote:

At present if you build sandbox on a 32-bit host a lot of errors are
produced. This is because CONFIG_HOST_64BIT is enabled by default.

It is quite annoying to have to change that manually before building
sandbox. It is also quite confusing for new users.

Add a way to detect the setting and add the appropriate
CONFIG_HOST_64BIT=y or CONFIG_HOST_32BIT=y to the defconfig, to avoid
this issue.

Tidy up the Kconfig help for the above two options while we are here.

Signed-off-by: Simon Glass 
---

(no changes since v4)

Changes in v4:
- Use $(HOSTCC) instead of gcc
- Add proper Kconfig help

Changes in v3:
- Use 'bitness' instead of 'bit'

Changes in v2:
- Drop patches previously applied
- Put all the packages in gcc.rst

  Makefile | 11 ++-
  arch/sandbox/Kconfig | 33 -
  scripts/kconfig/Makefile | 14 +-
  3 files changed, 51 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index b08bad48738..da9b5e494f8 100644
--- a/Makefile
+++ b/Makefile
@@ -570,8 +570,17 @@ export KBUILD_DEFCONFIG KBUILD_KCONFIG
  config: scripts_basic outputmakefile FORCE
$(Q)$(MAKE) $(build)=scripts/kconfig $@

+# If nothing is specified explicitly, detect the bit size for sandbox,
+# referred to from arch/sandbox/Kconfig
+# Add it to the end of the defconfig file
  %config: scripts_basic outputmakefile FORCE
-   $(Q)$(MAKE) $(build)=scripts/kconfig $@
+   $(Q)if test -f $(srctree)/configs/$@ && \
+   ! grep -Eq "CONFIG_HOST_(32|64)BIT=y" $(srctree)/configs/$@; 
then \
+   echo '#include \nint main(void) { 
printf("CONFIG_HOST_%dBIT=y\\n", __WORDSIZE); return 0; }' \


This does not compile on Alpine Linux:

test.c: In function 'main':
test.c:2:50: error: '__WORDSIZE' undeclared (first use in this function)
2 | int main(void) { printf("CONFIG_HOST_%dBIT=y\n", __WORDSIZE);
return 0; }


+| $(HOSTCC) -x c - -o get_word_size; \
+   extra=$$(./get_word_size); \
+   fi; \
+   $(MAKE) $(build)=scripts/kconfig EXTRA_DEFCONFIG=$$extra $@

  else
  # ===
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
index 477c51960da..08d7f3bded6 100644
--- a/arch/sandbox/Kconfig
+++ b/arch/sandbox/Kconfig
@@ -35,19 +35,42 @@ config SYS_CONFIG_NAME

  choice
prompt "Run sandbox on 32/64-bit host"
-   default HOST_64BIT
+   default HOST_DETECT_BITNESS
help
- Sandbox can be built on 32-bit and 64-bit hosts.
- The default is to build on a 64-bit host and run
- on a 64-bit host. If you want to run sandbox on
- a 32-bit host, change it here.
+ Sandbox can be built on 32-bit and 64-bit hosts. This is generally
+ auto-detected but you can force a particular word size here. If you
+ see strange warnings about SANDBOX_BITS_PER_LONG then you may have





+ selected the wrong value.

  config HOST_32BIT
bool "32-bit host"
depends on !PHYS_64BIT
+   help
+ Select this if the host is a 32-bit machine. This adjusts various


This text is really confusing me.

Does HOST_32BIT relate to the bitness of HOSTCC that we use to compile
tools? I would not know why I should have to set HOSTCC manually.

The bitness of the binary that we build is orthogonal to the bitness of
the system that we are building on.

You can build a 64bit ARM binary on a 32bit machine and vice versa.

An i386 binary can be run on a x86_64 host. Same with ARMv7 on an ARMv8
host.

Normally I would call the machine I am building on host. But that does
not imply the bitness of the target machine nor does it imply the
bitness of the binary.

What does your usage of HOST relate to?

Best regards

Heinrich


+ tests and other features to work correctly in this environment. If
+ this option is enabled on 64-bit machines you may get build warnings
+ and/or errors.

  config HOST_64BIT
bool "64-bit host"
+   help
+ Select this if the host is a 64-bit machine. This adjusts various
+ tests and other features to work correctly in this environment. If
+ this option is enabled on 32-bit machines you may get build warnings
+ and/or errors.
+
+config HOST_DETECT_BITNESS
+   bool "Auto-detect host bitness"
+   help
+ Select this if you want the build system to determine the bitness
+ automatically. This compiles a small program during the build, then
+ runs it to determine the bitness using __WORDSIZE (32 or 64 bits).
+ Then it adds one of the above options (CONFIG_HOST_32 or
+ CONFIG_HOST_64) to the configuration when creating it.
+
+ In rare situations this may fail, e.g. on an unsupported Operating
+ System or toolchain, in which case you will likely get build warnings
+ and er

[PATCH] malloc_simple: Remove usage of unsupported %zx format string

2022-02-03 Thread Pali Rohár
Replace %zx by %lx and cast size_t to ulong.

U-Boot currently prints garbage debug output:
size=x, ptr=18, limit=18: 4002a000

With this change it prints correct debug data:
size=18, ptr=18, limit=2000: 4002a000

Signed-off-by: Pali Rohár 
---
 common/malloc_simple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/malloc_simple.c b/common/malloc_simple.c
index 0267fb6bec87..67ee623850e0 100644
--- a/common/malloc_simple.c
+++ b/common/malloc_simple.c
@@ -23,7 +23,7 @@ static void *alloc_simple(size_t bytes, int align)
 
addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
new_ptr = addr + bytes - gd->malloc_base;
-   log_debug("size=%zx, ptr=%lx, limit=%lx: ", bytes, new_ptr,
+   log_debug("size=%lx, ptr=%lx, limit=%lx: ", (ulong)bytes, new_ptr,
  gd->malloc_limit);
if (new_ptr > gd->malloc_limit) {
log_err("alloc space exhausted\n");
-- 
2.20.1



Re: [PATCH v5 4/4] treewide: Use 16-bit unicode strings

2022-02-03 Thread Heinrich Schuchardt

On 1/23/22 20:55, Simon Glass wrote:

At present we use wide characters for unicode but this is not necessary.


nits:
%s/unicode/Unicode/


Change the code to use the 'u' literal instead. This helps to fix build
warnings for sandbox on rpi.


%s/rpi/the Raspberry Pi/



Note: This applies tree-wide


Why do we need this in the commit message? You patch changes lib/ and
test/ only.



Signed-off-by: Simon Glass 


Otherwise
Reviewed-by: Heinrich Schuchardt 


---

(no changes since v3)

Changes in v3:
- Add a new patch to change non-EFI occurences

  lib/lzma/Types.h  |  4 ++--
  lib/vsprintf.c|  2 +-
  test/print_ut.c   |  2 +-
  test/unicode_ut.c | 22 +++---
  4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/lib/lzma/Types.h b/lib/lzma/Types.h
index 8afcba556eb..04f894a8ca9 100644
--- a/lib/lzma/Types.h
+++ b/lib/lzma/Types.h
@@ -225,9 +225,9 @@ typedef struct
  #else

  #define CHAR_PATH_SEPARATOR '/'
-#define WCHAR_PATH_SEPARATOR L'/'
+#define WCHAR_PATH_SEPARATOR u'/'
  #define STRING_PATH_SEPARATOR "/"
-#define WSTRING_PATH_SEPARATOR L"/"
+#define WSTRING_PATH_SEPARATOR u"/"

  #endif

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 2c84649fa8a..69b2f6a1adc 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -279,7 +279,7 @@ static char *string(char *buf, char *end, const char *s, 
int field_width,
  static __maybe_unused char *string16(char *buf, char *end, u16 *s,
 int field_width, int precision, int flags)
  {
-   const u16 *str = s ? s : L"";
+   const u16 *str = s ? s : u"";
ssize_t i, len = utf16_strnlen(str, precision);

if (!(flags & LEFT))
diff --git a/test/print_ut.c b/test/print_ut.c
index 194387f169f..a133907674d 100644
--- a/test/print_ut.c
+++ b/test/print_ut.c
@@ -118,7 +118,7 @@ static int print_printf(struct unit_test_state *uts)
snprintf(str, 0, "testing none");
ut_asserteq('x', *str);

-   sprintf(big_str, "_%ls_", L"foo");
+   sprintf(big_str, "_%ls_", u"foo");
ut_assertok(strcmp("_foo_", big_str));

/* Test the banner function */
diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index 617eed8cfa0..f821e5a6be8 100644
--- a/test/unicode_ut.c
+++ b/test/unicode_ut.c
@@ -299,17 +299,17 @@ static int unicode_test_utf8_utf16_strcpy(struct 
unit_test_state *uts)
pos = buf;
utf8_utf16_strcpy(&pos, j1);
ut_asserteq(4, pos - buf);
-   ut_assert(!unicode_test_u16_strcmp(buf, L"j1?l", SIZE_MAX));
+   ut_assert(!unicode_test_u16_strcmp(buf, u"j1?l", SIZE_MAX));

pos = buf;
utf8_utf16_strcpy(&pos, j2);
ut_asserteq(4, pos - buf);
-   ut_assert(!unicode_test_u16_strcmp(buf, L"j2?l", SIZE_MAX));
+   ut_assert(!unicode_test_u16_strcmp(buf, u"j2?l", SIZE_MAX));

pos = buf;
utf8_utf16_strcpy(&pos, j3);
ut_asserteq(3, pos - buf);
-   ut_assert(!unicode_test_u16_strcmp(buf, L"j3?", SIZE_MAX));
+   ut_assert(!unicode_test_u16_strcmp(buf, u"j3?", SIZE_MAX));

return 0;
  }
@@ -584,13 +584,13 @@ UNICODE_TEST(unicode_test_utf_to_upper);

  static int unicode_test_u16_strncmp(struct unit_test_state *uts)
  {
-   ut_assert(u16_strncmp(L"abc", L"abc", 3) == 0);
-   ut_assert(u16_strncmp(L"abcdef", L"abcghi", 3) == 0);
-   ut_assert(u16_strncmp(L"abcdef", L"abcghi", 6) < 0);
-   ut_assert(u16_strncmp(L"abcghi", L"abcdef", 6) > 0);
-   ut_assert(u16_strcmp(L"abc", L"abc") == 0);
-   ut_assert(u16_strcmp(L"abcdef", L"deghi") < 0);
-   ut_assert(u16_strcmp(L"deghi", L"abcdef") > 0);
+   ut_assert(u16_strncmp(u"abc", u"abc", 3) == 0);
+   ut_assert(u16_strncmp(u"abcdef", u"abcghi", 3) == 0);
+   ut_assert(u16_strncmp(u"abcdef", u"abcghi", 6) < 0);
+   ut_assert(u16_strncmp(u"abcghi", u"abcdef", 6) > 0);
+   ut_assert(u16_strcmp(u"abc", u"abc") == 0);
+   ut_assert(u16_strcmp(u"abcdef", u"deghi") < 0);
+   ut_assert(u16_strcmp(u"deghi", u"abcdef") > 0);
return 0;
  }
  UNICODE_TEST(unicode_test_u16_strncmp);
@@ -713,7 +713,7 @@ UNICODE_TEST(unicode_test_utf8_to_utf32_stream);
  static int unicode_test_efi_create_indexed_name(struct unit_test_state *uts)
  {
u16 buf[16];
-   u16 const expected[] = L"Capsule0AF9";
+   u16 const expected[] = u"Capsule0AF9";
u16 *pos;

memset(buf, 0xeb, sizeof(buf));




Re: [PATCH] malloc_simple: Remove usage of unsupported %zx format string

2022-02-03 Thread Sean Anderson
Hi Pali,

On 2/3/22 1:51 PM, Pali Rohár wrote:
> Replace %zx by %lx and cast size_t to ulong.
> 
> U-Boot currently prints garbage debug output:
> size=x, ptr=18, limit=18: 4002a000
> 
> With this change it prints correct debug data:
> size=18, ptr=18, limit=2000: 4002a000
> 
> Signed-off-by: Pali Rohár 

This qualifier is implemented in vsprintf, but not tiny-printf,
and is widely used throughout the codebase. So perhaps a better
fix might be 

diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index f661fc6505..ad25bb7383 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -229,7 +229,8 @@ static int _vprintf(struct printf_info *info, const char 
*fmt, va_list va)
ch = *fmt++;
}
}
-   if (ch == 'l') {
+   if (ch == 'l' ||
+   (sizeof(size_t) >= sizeof(int) && ch == 'z')) {
ch = *(fmt++);
islong = true;
}
--

which is not completely correct (since tiny-printf doesn't
support long longs), but will address the core issue.

--Sean



Re: [PATCH] malloc_simple: Remove usage of unsupported %zx format string

2022-02-03 Thread Sean Anderson



On 2/3/22 2:25 PM, Sean Anderson wrote:
> Hi Pali,
> 
> On 2/3/22 1:51 PM, Pali Rohár wrote:
>> Replace %zx by %lx and cast size_t to ulong.
>> 
>> U-Boot currently prints garbage debug output:
>> size=x, ptr=18, limit=18: 4002a000
>> 
>> With this change it prints correct debug data:
>> size=18, ptr=18, limit=2000: 4002a000
>> 
>> Signed-off-by: Pali Rohár 
> 
> This qualifier is implemented in vsprintf, but not tiny-printf,
> and is widely used throughout the codebase. So perhaps a better
> fix might be 
> 
> diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
> index f661fc6505..ad25bb7383 100644
> --- a/lib/tiny-printf.c
> +++ b/lib/tiny-printf.c
> @@ -229,7 +229,8 @@ static int _vprintf(struct printf_info *info, const char 
> *fmt, va_list va)
> ch = *fmt++;
> }
> }
> -   if (ch == 'l') {
> +   if (ch == 'l' ||
> +   (sizeof(size_t) >= sizeof(int) && ch == 'z')) {
> ch = *(fmt++);
> islong = true;
> }
> --
> 
> which is not completely correct (since tiny-printf doesn't
> support long longs), but will address the core issue.

Actually, we probably need something more like

if (ch == 'z') {
ch = *(fmt++);
islong = sizeof(size_t) >= sizeof(int);
}

so that 32-bit arches still print the integer.

--Sean


[PATCH] mkimage: Improve documentation of algo-name parameter

2022-02-03 Thread Jan Kiszka
From: Jan Kiszka 

Addresses the feedback provided on 5902a397d029 which raced with the
merge.

Signed-off-by: Jan Kiszka 
---
 doc/mkimage.1 | 2 +-
 tools/imagetool.h | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 0734bd36a11..fc84cca066b 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -158,7 +158,7 @@ CONFIG_OF_CONTROL in U-Boot.
 .TP
 .BI "\-o [" "signing algorithm" "]"
 Specifies the algorithm to be used for signing a FIT image. The default is
-taken from the target signature nodes 'algo' properties.
+taken from the signature node's 'algo' property.
 
 .TP
 .BI "\-p [" "external position" "]"
diff --git a/tools/imagetool.h b/tools/imagetool.h
index a4105515d81..12f911600f9 100644
--- a/tools/imagetool.h
+++ b/tools/imagetool.h
@@ -71,7 +71,8 @@ struct image_tool_params {
const char *keydest;/* Destination .dtb for public key */
const char *keyfile;/* Filename of private or public key */
const char *comment;/* Comment to add to signature node */
-   const char *algo_name;  /* Algorithm name to use hashing/signing */
+   const char *algo_name;  /* Algorithm name to use for hashing/signing or
+  NULL to use the one specified in the its */
int require_keys;   /* 1 to mark signing keys as 'required' */
int file_size;  /* Total size of output file */
int orig_file_size; /* Original size for file before padding */
-- 
2.34.1


[PATCH] test/py: Add test case for mkimage -o argument

2022-02-03 Thread Jan Kiszka
From: Jan Kiszka 

Stress the '-o algo_name' argument of mkimage by expanding the vboot
test.

Signed-off-by: Jan Kiszka 
---
 test/py/tests/test_vboot.py   | 33 +++---
 test/py/tests/vboot/sign-configs-algo-arg.its | 44 +++
 test/py/tests/vboot/sign-images-algo-arg.its  | 40 +
 3 files changed, 101 insertions(+), 16 deletions(-)
 create mode 100644 test/py/tests/vboot/sign-configs-algo-arg.its
 create mode 100644 test/py/tests/vboot/sign-images-algo-arg.its

diff --git a/test/py/tests/test_vboot.py b/test/py/tests/test_vboot.py
index b080d482af9..ac8ed9f1145 100644
--- a/test/py/tests/test_vboot.py
+++ b/test/py/tests/test_vboot.py
@@ -35,18 +35,19 @@ import vboot_evil
 # Only run the full suite on a few combinations, since it doesn't add any more
 # test coverage.
 TESTDATA = [
-['sha1-basic', 'sha1', '', None, False, True],
-['sha1-pad', 'sha1', '', '-E -p 0x1', False, False],
-['sha1-pss', 'sha1', '-pss', None, False, False],
-['sha1-pss-pad', 'sha1', '-pss', '-E -p 0x1', False, False],
-['sha256-basic', 'sha256', '', None, False, False],
-['sha256-pad', 'sha256', '', '-E -p 0x1', False, False],
-['sha256-pss', 'sha256', '-pss', None, False, False],
-['sha256-pss-pad', 'sha256', '-pss', '-E -p 0x1', False, False],
-['sha256-pss-required', 'sha256', '-pss', None, True, False],
-['sha256-pss-pad-required', 'sha256', '-pss', '-E -p 0x1', True, True],
-['sha384-basic', 'sha384', '', None, False, False],
-['sha384-pad', 'sha384', '', '-E -p 0x1', False, False],
+['sha1-basic', 'sha1', '', None, False, True, False],
+['sha1-pad', 'sha1', '', '-E -p 0x1', False, False, False],
+['sha1-pss', 'sha1', '-pss', None, False, False, False],
+['sha1-pss-pad', 'sha1', '-pss', '-E -p 0x1', False, False, False],
+['sha256-basic', 'sha256', '', None, False, False, False],
+['sha256-pad', 'sha256', '', '-E -p 0x1', False, False, False],
+['sha256-pss', 'sha256', '-pss', None, False, False, False],
+['sha256-pss-pad', 'sha256', '-pss', '-E -p 0x1', False, False, False],
+['sha256-pss-required', 'sha256', '-pss', None, True, False, False],
+['sha256-pss-pad-required', 'sha256', '-pss', '-E -p 0x1', True, True, 
False],
+['sha384-basic', 'sha384', '', None, False, False, False],
+['sha384-pad', 'sha384', '', '-E -p 0x1', False, False, False],
+['algo-arg', 'algo-arg', '', '-o sha256,rsa2048', False, False, True],
 ]
 
 @pytest.mark.boardspec('sandbox')
@@ -55,10 +56,10 @@ TESTDATA = [
 @pytest.mark.requiredtool('fdtget')
 @pytest.mark.requiredtool('fdtput')
 @pytest.mark.requiredtool('openssl')
-@pytest.mark.parametrize("name,sha_algo,padding,sign_options,required,full_test",
+@pytest.mark.parametrize("name,sha_algo,padding,sign_options,required,full_test,algo_arg",
  TESTDATA)
 def test_vboot(u_boot_console, name, sha_algo, padding, sign_options, required,
-   full_test):
+   full_test, algo_arg):
 """Test verified boot signing with mkimage and verification with 'bootm'.
 
 This works using sandbox only as it needs to update the device tree used
@@ -219,7 +220,7 @@ def test_vboot(u_boot_console, name, sha_algo, padding, 
sign_options, required,
 # Build the FIT, but don't sign anything yet
 cons.log.action('%s: Test FIT with signed images' % sha_algo)
 make_fit('sign-images-%s%s.its' % (sha_algo, padding))
-run_bootm(sha_algo, 'unsigned images', 'dev-', True)
+run_bootm(sha_algo, 'unsigned images', ' - OK' if algo_arg else 
'dev-', True)
 
 # Sign images with our dev keys
 sign_fit(sha_algo, sign_options)
@@ -230,7 +231,7 @@ def test_vboot(u_boot_console, name, sha_algo, padding, 
sign_options, required,
 
 cons.log.action('%s: Test FIT with signed configuration' % sha_algo)
 make_fit('sign-configs-%s%s.its' % (sha_algo, padding))
-run_bootm(sha_algo, 'unsigned config', '%s+ OK' % sha_algo, True)
+run_bootm(sha_algo, 'unsigned config', '%s+ OK' % ('sha256' if 
algo_arg else sha_algo), True)
 
 # Sign images with our dev keys
 sign_fit(sha_algo, sign_options)
diff --git a/test/py/tests/vboot/sign-configs-algo-arg.its 
b/test/py/tests/vboot/sign-configs-algo-arg.its
new file mode 100644
index 000..3a5bb6d0f73
--- /dev/null
+++ b/test/py/tests/vboot/sign-configs-algo-arg.its
@@ -0,0 +1,44 @@
+/dts-v1/;
+
+/ {
+   description = "Chrome OS kernel image with one or more FDT blobs";
+   #address-cells = <1>;
+
+   images {
+   kernel {
+   data = /incbin/("test-kernel.bin");
+   type = "kernel_noload";
+   arch = "sandbox";
+   os = "linux";
+   compression = "none";
+   load = <0x4>;
+   entry = <0x8>;
+

Re: [PATCH V3] usb: ehci-mx6: Enable OTG detection on imx8mm and imx8mn

2022-02-03 Thread Tim Harvey
On Tue, Jan 25, 2022 at 12:44 AM Marcel Ziswiler
 wrote:
>
> On Mon, 2022-01-17 at 18:21 -0600, Adam Ford wrote:
> > The imx8mm and imx8mn appear compatible with imx7d-usb
> > flags in the OTG driver.  If the dr_mode is defined as
> > host or peripheral, the device appears to operate correctly,
> > however the auto host/peripheral detection results in an error.
> >
> > The solution isn't just adding checks for imx8mm and imx8mn to
> > the check for imx7, because the USB clock needs to be running
> > to read from the USBNC_PHY_STATUS_OFFSET register or it will hang.
> >
> > Marek requested that I not enable the clocks in ehci_usb_of_to_plat,
> > so I modified that function to return an unknown state if the
> > device tree does not explicitly state whether it is a host
> > or a peripheral.
> >
> > When the driver probes, it looks to see if it's in the unknown
> > state, and only then will it read the register to auto-detect.
> >
> > Signed-off-by: Adam Ford 
> > ---
> > V3:  Keep ehci_usb_of_to_plat but add the ability to return
> >  and unknown state instead of reading the register.
> >  If the probe determines the states is unknown, it will
> >  query the register after the clocks have been enabled.
> >  Because of the slight behavior change, I removed any
> >  review or tested tags.
> >
> > V2:  Rename ehci_usb_of_to_plat to ehci_usb_dr_mode and call it
> >  from the probe after the clocks are enabled, but before
> >  the data is needed.
> >
> > diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
> > index 1bd6147c76..cf44e53ff7 100644
> > --- a/drivers/usb/host/ehci-mx6.c
> > +++ b/drivers/usb/host/ehci-mx6.c
> > @@ -543,7 +543,7 @@ static int ehci_usb_phy_mode(struct udevice *dev)
> > plat->init_type = USB_INIT_DEVICE;
> > else
> > plat->init_type = USB_INIT_HOST;
> > -   } else if (is_mx7()) {
> > +   } else if (is_mx7() || is_imx8mm() || is_imx8mn()) {
> > phy_status = (void __iomem *)(addr +
> >   USBNC_PHY_STATUS_OFFSET);
> > val = readl(phy_status);
> > @@ -573,9 +573,8 @@ static int ehci_usb_of_to_plat(struct udevice *dev)
> > case USB_DR_MODE_PERIPHERAL:
> > plat->init_type = USB_INIT_DEVICE;
> > break;
> > -   case USB_DR_MODE_OTG:
> > -   case USB_DR_MODE_UNKNOWN:
> > -   return ehci_usb_phy_mode(dev);
> > +   default:
> > +   plat->init_type = USB_INIT_UNKNOWN;
> > };
> >
> > return 0;
> > @@ -677,6 +676,20 @@ static int ehci_usb_probe(struct udevice *dev)
> > mdelay(1);
> >  #endif
> >
> > +   /*
> > +* If the device tree didn't specify host or device,
> > +* the default is USB_INIT_UNKNOWN, so we need to check
> > +* the register. For imx8mm and imx8mn, the clocks need to be
> > +* running first, so we defer the check until they are.
> > +*/
> > +   if (priv->init_type == USB_INIT_UNKNOWN) {
> > +   ret = ehci_usb_phy_mode(dev);
> > +   if (ret)
> > +   goto err_clk;
>
> Hm, unfortunately, that label is gated by an ifdef leading to the following 
> on colibri_imx7:
>
> drivers/usb/host/ehci-mx6.c: In function ‘ehci_usb_probe’:
> drivers/usb/host/ehci-mx6.c:688:4: error: label ‘err_clk’ used but not defined
>   688 |goto err_clk;
>   |^~~~
> make[1]: *** [scripts/Makefile.build:254: drivers/usb/host/ehci-mx6.o] Error 1
>
> I have to admit that maybe we should indeed run it with DM_REGULATOR but that 
> won't change anything on this
> issue. I guess one should really not have any gotos to a label err_clk being 
> ifdefed from somewhere not
> ifdefed.
>

Adam,

Can you re-submit this with an ifdef to handle the correct goto when
DM_REGULATOR is undefined?

It looks like Fabio figured out his issue with his board and it was
unrelated to this (fixed by 'mmc: fsl_esdhc_imx: fix watermark level
in dma') so I think Marcel's point is the only blocker on this patch
unless there is more discussion needed with Michael or some feedback
needed from Marek?

Best regards,

Tim


Re: [PATCH V3] usb: ehci-mx6: Enable OTG detection on imx8mm and imx8mn

2022-02-03 Thread Adam Ford
On Thu, Feb 3, 2022 at 2:59 PM Tim Harvey  wrote:
>
> On Tue, Jan 25, 2022 at 12:44 AM Marcel Ziswiler
>  wrote:
> >
> > On Mon, 2022-01-17 at 18:21 -0600, Adam Ford wrote:
> > > The imx8mm and imx8mn appear compatible with imx7d-usb
> > > flags in the OTG driver.  If the dr_mode is defined as
> > > host or peripheral, the device appears to operate correctly,
> > > however the auto host/peripheral detection results in an error.
> > >
> > > The solution isn't just adding checks for imx8mm and imx8mn to
> > > the check for imx7, because the USB clock needs to be running
> > > to read from the USBNC_PHY_STATUS_OFFSET register or it will hang.
> > >
> > > Marek requested that I not enable the clocks in ehci_usb_of_to_plat,
> > > so I modified that function to return an unknown state if the
> > > device tree does not explicitly state whether it is a host
> > > or a peripheral.
> > >
> > > When the driver probes, it looks to see if it's in the unknown
> > > state, and only then will it read the register to auto-detect.
> > >
> > > Signed-off-by: Adam Ford 
> > > ---
> > > V3:  Keep ehci_usb_of_to_plat but add the ability to return
> > >  and unknown state instead of reading the register.
> > >  If the probe determines the states is unknown, it will
> > >  query the register after the clocks have been enabled.
> > >  Because of the slight behavior change, I removed any
> > >  review or tested tags.
> > >
> > > V2:  Rename ehci_usb_of_to_plat to ehci_usb_dr_mode and call it
> > >  from the probe after the clocks are enabled, but before
> > >  the data is needed.
> > >
> > > diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
> > > index 1bd6147c76..cf44e53ff7 100644
> > > --- a/drivers/usb/host/ehci-mx6.c
> > > +++ b/drivers/usb/host/ehci-mx6.c
> > > @@ -543,7 +543,7 @@ static int ehci_usb_phy_mode(struct udevice *dev)
> > > plat->init_type = USB_INIT_DEVICE;
> > > else
> > > plat->init_type = USB_INIT_HOST;
> > > -   } else if (is_mx7()) {
> > > +   } else if (is_mx7() || is_imx8mm() || is_imx8mn()) {
> > > phy_status = (void __iomem *)(addr +
> > >   USBNC_PHY_STATUS_OFFSET);
> > > val = readl(phy_status);
> > > @@ -573,9 +573,8 @@ static int ehci_usb_of_to_plat(struct udevice *dev)
> > > case USB_DR_MODE_PERIPHERAL:
> > > plat->init_type = USB_INIT_DEVICE;
> > > break;
> > > -   case USB_DR_MODE_OTG:
> > > -   case USB_DR_MODE_UNKNOWN:
> > > -   return ehci_usb_phy_mode(dev);
> > > +   default:
> > > +   plat->init_type = USB_INIT_UNKNOWN;
> > > };
> > >
> > > return 0;
> > > @@ -677,6 +676,20 @@ static int ehci_usb_probe(struct udevice *dev)
> > > mdelay(1);
> > >  #endif
> > >
> > > +   /*
> > > +* If the device tree didn't specify host or device,
> > > +* the default is USB_INIT_UNKNOWN, so we need to check
> > > +* the register. For imx8mm and imx8mn, the clocks need to be
> > > +* running first, so we defer the check until they are.
> > > +*/
> > > +   if (priv->init_type == USB_INIT_UNKNOWN) {
> > > +   ret = ehci_usb_phy_mode(dev);
> > > +   if (ret)
> > > +   goto err_clk;
> >
> > Hm, unfortunately, that label is gated by an ifdef leading to the following 
> > on colibri_imx7:
> >
> > drivers/usb/host/ehci-mx6.c: In function ‘ehci_usb_probe’:
> > drivers/usb/host/ehci-mx6.c:688:4: error: label ‘err_clk’ used but not 
> > defined
> >   688 |goto err_clk;
> >   |^~~~
> > make[1]: *** [scripts/Makefile.build:254: drivers/usb/host/ehci-mx6.o] 
> > Error 1
> >
> > I have to admit that maybe we should indeed run it with DM_REGULATOR but 
> > that won't change anything on this
> > issue. I guess one should really not have any gotos to a label err_clk 
> > being ifdefed from somewhere not
> > ifdefed.
> >
>
> Adam,
>
> Can you re-submit this with an ifdef to handle the correct goto when
> DM_REGULATOR is undefined?
>
> It looks like Fabio figured out his issue with his board and it was
> unrelated to this (fixed by 'mmc: fsl_esdhc_imx: fix watermark level
> in dma') so I think Marcel's point is the only blocker on this patch
> unless there is more discussion needed with Michael or some feedback
> needed from Marek?

Tim,
Not a problem. I was waiting for feedback from Marek in case there
were more issues, but I can fix the goto reference and resubmit.  I'm
build-testing the colibri_imx7 now.

I'm just moving the 'err_clk' reference out of the #ifdef so the same
reference can be used.  It doesn't look like it should be inside the
#ifdef anyway.

You should see something shortly, and I'll add you to the CC list.

adam

>
> Best regards,
>
> Tim


Re: [PATCH] Nokia RX-51: Convert to CONFIG_DM_KEYBOARD

2022-02-03 Thread Tom Rini
On Thu, Feb 03, 2022 at 07:38:50PM +0100, Pali Rohár wrote:

> Signed-off-by: Pali Rohár 
> ---
> 
> I would really appreciate if U-Boot test framework starts printing
> deprecation warnings, instead of sending patches which directly drop
> support for some boards.
> 
> There is absolutely no warning during building U-Boot for RX-51 board
> that this board has not been converted to DM_KEYBOARD yet.

Please send some patch that implements what you're wanting to see for
how to make the warnings more visible.  I do agree the warning for
v2022.10 only showed up after the merge to -next once v2022.01 came out,
but it's still a fairly long time to clean up the few unconverted
boards.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] malloc_simple: Remove usage of unsupported %zx format string

2022-02-03 Thread Tom Rini
On Thu, Feb 03, 2022 at 02:28:23PM -0500, Sean Anderson wrote:
> 
> 
> On 2/3/22 2:25 PM, Sean Anderson wrote:
> > Hi Pali,
> > 
> > On 2/3/22 1:51 PM, Pali Rohár wrote:
> >> Replace %zx by %lx and cast size_t to ulong.
> >> 
> >> U-Boot currently prints garbage debug output:
> >> size=x, ptr=18, limit=18: 4002a000
> >> 
> >> With this change it prints correct debug data:
> >> size=18, ptr=18, limit=2000: 4002a000
> >> 
> >> Signed-off-by: Pali Rohár 
> > 
> > This qualifier is implemented in vsprintf, but not tiny-printf,
> > and is widely used throughout the codebase. So perhaps a better
> > fix might be 
> > 
> > diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
> > index f661fc6505..ad25bb7383 100644
> > --- a/lib/tiny-printf.c
> > +++ b/lib/tiny-printf.c
> > @@ -229,7 +229,8 @@ static int _vprintf(struct printf_info *info, const 
> > char *fmt, va_list va)
> > ch = *fmt++;
> > }
> > }
> > -   if (ch == 'l') {
> > +   if (ch == 'l' ||
> > +   (sizeof(size_t) >= sizeof(int) && ch == 'z')) {
> > ch = *(fmt++);
> > islong = true;
> > }
> > --
> > 
> > which is not completely correct (since tiny-printf doesn't
> > support long longs), but will address the core issue.
> 
> Actually, we probably need something more like
> 
> if (ch == 'z') {
>   ch = *(fmt++);
>   islong = sizeof(size_t) >= sizeof(int);
> }
> 
> so that 32-bit arches still print the integer.

Right, but then we grow tiny-printf on the boards that really need to be
super concerned about space.  We have typically done what Pali proposes
here before of make the subset of code that runs under tiny-printf use
more restrictive and possibly slightly less optimal format characters.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] malloc_simple: Remove usage of unsupported %zx format string

2022-02-03 Thread Simon Glass
Hi Pali,

On Thu, 3 Feb 2022 at 11:51, Pali Rohár  wrote:
>
> Replace %zx by %lx and cast size_t to ulong.
>
> U-Boot currently prints garbage debug output:
> size=x, ptr=18, limit=18: 4002a000

Do you mean in SPL?

>
> With this change it prints correct debug data:
> size=18, ptr=18, limit=2000: 4002a000
>
> Signed-off-by: Pali Rohár 
> ---
>  common/malloc_simple.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Simon Glass 

> diff --git a/common/malloc_simple.c b/common/malloc_simple.c
> index 0267fb6bec87..67ee623850e0 100644
> --- a/common/malloc_simple.c
> +++ b/common/malloc_simple.c
> @@ -23,7 +23,7 @@ static void *alloc_simple(size_t bytes, int align)
>
> addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
> new_ptr = addr + bytes - gd->malloc_base;
> -   log_debug("size=%zx, ptr=%lx, limit=%lx: ", bytes, new_ptr,
> +   log_debug("size=%lx, ptr=%lx, limit=%lx: ", (ulong)bytes, new_ptr,
>   gd->malloc_limit);
> if (new_ptr > gd->malloc_limit) {
> log_err("alloc space exhausted\n");
> --
> 2.20.1
>

Regards,
Simon


[PATCH V4] usb: ehci-mx6: Enable OTG detection on imx8mm and imx8mn

2022-02-03 Thread Adam Ford
The imx8mm and imx8mn appear compatible with imx7d-usb
flags in the OTG driver.  If the dr_mode is defined as
host or peripheral, the device appears to operate correctly,
however the auto host/peripheral detection results in an error.

The solution isn't just adding checks for imx8mm and imx8mn to
the check for imx7, because the USB clock needs to be running
to read from the USBNC_PHY_STATUS_OFFSET register or it will hang.

Marek requested that I not enable the clocks in ehci_usb_of_to_plat,
so I modified that function to return an unknown state if the
device tree does not explicitly state whether it is a host
or a peripheral.

When the driver probes, it looks to see if it's in the unknown
state, and only then will it read the register to auto-detect.

Signed-off-by: Adam Ford 
Tested-by: Tim Harvey 
---
V4:  Fix 'err_clk' reference, so it is not encapsulated in
 an ifdef making it available at all times.
V3:  Keep ehci_usb_of_to_plat but add the ability to return
 and unknown state instead of reading the register.
 If the probe determines the states is unknown, it will
 query the register after the clocks have been enabled.
 Because of the slight behavior change, I removed any
 review or tested tags.

V2:  Rename ehci_usb_of_to_plat to ehci_usb_dr_mode and call it
 from the probe after t

diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index 1bd6147c76..060b02accc 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -543,7 +543,7 @@ static int ehci_usb_phy_mode(struct udevice *dev)
plat->init_type = USB_INIT_DEVICE;
else
plat->init_type = USB_INIT_HOST;
-   } else if (is_mx7()) {
+   } else if (is_mx7() || is_imx8mm() || is_imx8mn()) {
phy_status = (void __iomem *)(addr +
  USBNC_PHY_STATUS_OFFSET);
val = readl(phy_status);
@@ -573,9 +573,8 @@ static int ehci_usb_of_to_plat(struct udevice *dev)
case USB_DR_MODE_PERIPHERAL:
plat->init_type = USB_INIT_DEVICE;
break;
-   case USB_DR_MODE_OTG:
-   case USB_DR_MODE_UNKNOWN:
-   return ehci_usb_phy_mode(dev);
+   default:
+   plat->init_type = USB_INIT_UNKNOWN;
};
 
return 0;
@@ -677,6 +676,20 @@ static int ehci_usb_probe(struct udevice *dev)
mdelay(1);
 #endif
 
+   /*
+* If the device tree didn't specify host or device,
+* the default is USB_INIT_UNKNOWN, so we need to check
+* the register. For imx8mm and imx8mn, the clocks need to be
+* running first, so we defer the check until they are.
+*/
+   if (priv->init_type == USB_INIT_UNKNOWN) {
+   ret = ehci_usb_phy_mode(dev);
+   if (ret)
+   goto err_clk;
+   else
+   priv->init_type = plat->init_type;
+   }
+
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
ret = device_get_supply_regulator(dev, "vbus-supply",
  &priv->vbus_supply);
@@ -741,8 +754,8 @@ err_regulator:
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
if (priv->vbus_supply)
regulator_set_enable(priv->vbus_supply, false);
-err_clk:
 #endif
+err_clk:
 #if CONFIG_IS_ENABLED(CLK)
clk_disable(&priv->clk);
 #else
diff --git a/include/usb.h b/include/usb.h
index f032de8af9..7e3796bd5b 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -163,7 +163,8 @@ struct int_queue;
  */
 enum usb_init_type {
USB_INIT_HOST,
-   USB_INIT_DEVICE
+   USB_INIT_DEVICE,
+   USB_INIT_UNKNOWN,
 };
 
 /**
-- 
2.32.0



Re: [PATCH V4] usb: ehci-mx6: Enable OTG detection on imx8mm and imx8mn

2022-02-03 Thread Fabio Estevam
Hi Adam,

On Thu, Feb 3, 2022 at 6:20 PM Adam Ford  wrote:
>
> The imx8mm and imx8mn appear compatible with imx7d-usb
> flags in the OTG driver.  If the dr_mode is defined as
> host or peripheral, the device appears to operate correctly,
> however the auto host/peripheral detection results in an error.
>
> The solution isn't just adding checks for imx8mm and imx8mn to
> the check for imx7, because the USB clock needs to be running
> to read from the USBNC_PHY_STATUS_OFFSET register or it will hang.
>
> Marek requested that I not enable the clocks in ehci_usb_of_to_plat,
> so I modified that function to return an unknown state if the
> device tree does not explicitly state whether it is a host
> or a peripheral.
>
> When the driver probes, it looks to see if it's in the unknown
> state, and only then will it read the register to auto-detect.
>
> Signed-off-by: Adam Ford 
> Tested-by: Tim Harvey 

The last time I tried to test your previous version I was having an
issue which is solved by Marcel's patch:
https://lists.denx.de/pipermail/u-boot/2022-February/474006.html

With Marcel's patch applied and your updated version, "ums 0 mmc 0"
works fine on a imx7s-warp, thanks:

Tested-by: Fabio Estevam 


Re: [PATCH v1 3/4] arch: arm: mach-k3: am642_init: Probe ESM nodes

2022-02-03 Thread Nishanth Menon
On 12:22-20220202, Hari Nagalla wrote:

One additional comment independent of Christian's comment..

[...]
> diff --git a/arch/arm/mach-k3/am642_init.c b/arch/arm/mach-k3/am642_init.c
> index 543dea02bc..cb9495e525 100644
> --- a/arch/arm/mach-k3/am642_init.c
> +++ b/arch/arm/mach-k3/am642_init.c
> @@ -24,6 +24,8 @@
>  #include 
>  
>  #if defined(CONFIG_SPL_BUILD)
> +#define MCU_CTRL_MMR0_BASE   0x0450
> +#define CTRLMMR_MCU_RST_CTRL 0x04518170
>  
>  static void ctrl_mmr_unlock(void)
>  {
> @@ -42,6 +44,17 @@ static void ctrl_mmr_unlock(void)
>   mmr_unlock(MCU_PADCFG_MMR1_BASE, 1);
>  }
>  
> +static void mcu_ctrl_mmr_unlock(void)
> +{

There is no real point in spliting this up into mcu_ctrl_mmr_unlock.
I'd suggest putting it part of ctrl_mmr_unlock (we already do unlock MCU
padconf mmrs there)


[...]
-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D)/Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 
1736 249D


Re: [PATCH v1 1/4] misc: k3_esm: Add functionality to set and route error events within K3SoC

2022-02-03 Thread Nishanth Menon
On 12:22-20220202, Hari Nagalla wrote:
> Add functionality to enable, set priority to the input events and to
> route to MCU ESM. On AM64x/AM62x devices, it is possible to route Main
> ESM0 error events to MCU ESM. When these error events are routed to MCU
> ESM high output, it can trigger the reset logic to reset the device,
> when CTRLMMR_MCU_RST_CTRL:MCU_ESM_ERROR_RESET_EN_Z is set to '0'.
> 

Since this driver is common, it will be good to also highlight that
existing devices (such as J7* SoCs) which use the same driver is not
impacted by this change.

> Signed-off-by: Hari Nagalla 
> ---
>  drivers/misc/k3_esm.c | 53 ---
>  1 file changed, 50 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/misc/k3_esm.c b/drivers/misc/k3_esm.c
> index cc2a23dd66..41faeb3d85 100644
> --- a/drivers/misc/k3_esm.c
> +++ b/drivers/misc/k3_esm.c
> @@ -16,17 +16,57 @@
>  
>  #define ESM_SFT_RST  0x0c
>  #define ESM_SFT_RST_KEY  0x0f
> +#define ESM_EN   0x08
> +#define ESM_EN_KEY   0x0f
>  
>  #define ESM_STS(i)   (0x404 + (i) / 32 * 0x20)
> +#define ESM_STS_MASK(i)  (1 << ((i) % 32))
>  #define ESM_PIN_EN_SET_OFFSET(i) (0x414 + (i) / 32 * 0x20)
> -#define ESM_PIN_MASK(i)  BIT((i) & 0x1f)
> +#define ESM_PIN_MASK(i)  (1 << ((i) % 32))
> +#define ESM_INTR_EN_SET_OFFSET(i)(0x408 + (i) / 32 * 0x20)
> +#define ESM_INTR_MASK(i) (1 << ((i) % 32))
> +#define ESM_INTR_PRIO_SET_OFFSET(i)  (0x410 + (i) / 32 * 0x20)
> +#define ESM_INTR_PRIO_MASK(i)(1 << ((i) % 32))
>  
>  static void esm_pin_enable(void __iomem *base, int pin)
>  {
> + u32 value;
> +
> + value = readl(base + ESM_PIN_EN_SET_OFFSET(pin));
> + value |= ESM_PIN_MASK(pin);
>   /* Enable event */
> - writel(ESM_PIN_MASK(pin), base + ESM_PIN_EN_SET_OFFSET(pin));
> + writel(value, base + ESM_PIN_EN_SET_OFFSET(pin));
> +}
> +
> +static void esm_intr_enable(void __iomem *base, int pin)
> +{
> + u32 value;
> +
> + value = readl(base + ESM_INTR_EN_SET_OFFSET(pin));
> + value |= ESM_INTR_MASK(pin);
> + /* Enable Interrupt event */
> + writel(value, base + ESM_INTR_EN_SET_OFFSET(pin));
> +}
> +
> +static void esm_intr_prio_set(void __iomem *base, int pin)
> +{
> + u32 value;
> +
> + value = readl(base + ESM_INTR_PRIO_SET_OFFSET(pin));
> + value |= ESM_INTR_PRIO_MASK(pin);
> + /* Set to priority */
> + writel(value, base + ESM_INTR_PRIO_SET_OFFSET(pin));
>  }
>  
> +static void esm_clear_raw_status(void __iomem *base, int pin)
> +{
> + u32 value;
> +
> + value = readl(base + ESM_STS(pin));
> + value |= ESM_STS_MASK(pin);
> + /* Clear Event status */
> + writel(value, base + ESM_STS(pin));
> +}
>  /**
>   * k3_esm_probe: configures ESM based on DT data
>   *
> @@ -67,8 +107,15 @@ static int k3_esm_probe(struct udevice *dev)
>   /* Clear any pending events */
>   writel(ESM_SFT_RST_KEY, base + ESM_SFT_RST);
>  
> - for (i = 0; i < num_pins; i++)
> + for (i = 0; i < num_pins; i++) {
> + esm_intr_prio_set(base, pins[i]);
> + esm_clear_raw_status(base, pins[i]);
>   esm_pin_enable(base, pins[i]);
> + esm_intr_enable(base, pins[i]);
> + }
> +
> + /* Enable ESM */
> + writel(ESM_EN_KEY, base + ESM_EN);
>  
>  free_pins:
>   kfree(pins);
> -- 
> 2.17.1
> 

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D)/Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 
1736 249D


Re: [PATCH] Nokia RX-51: Convert to CONFIG_DM_KEYBOARD

2022-02-03 Thread Tom Rini
On Thu, Feb 03, 2022 at 04:16:23PM -0500, Tom Rini wrote:
> On Thu, Feb 03, 2022 at 07:38:50PM +0100, Pali Rohár wrote:
> 
> > Signed-off-by: Pali Rohár 
> > ---
> > 
> > I would really appreciate if U-Boot test framework starts printing
> > deprecation warnings, instead of sending patches which directly drop
> > support for some boards.
> > 
> > There is absolutely no warning during building U-Boot for RX-51 board
> > that this board has not been converted to DM_KEYBOARD yet.
> 
> Please send some patch that implements what you're wanting to see for
> how to make the warnings more visible.  I do agree the warning for
> v2022.10 only showed up after the merge to -next once v2022.01 came out,
> but it's still a fairly long time to clean up the few unconverted
> boards.

Oh, I see what's going on.  Simon, the DM_KEYBOARD check isn't
triggering for any boards.  I'll look more.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v1 2/4] arm: dts: k3-am64: Add support for ESM device nodes

2022-02-03 Thread Nishanth Menon
On 12:22-20220202, Hari Nagalla wrote:
> Enable acces to ESM0 configuration space and add Main ESM0 and MCU ESM

s/acces/access/

> nodes to the AM64 device tree.
> 
> Signed-off-by: Hari Nagalla 
> ---
>  arch/arm/dts/k3-am64.dtsi|  1 +
>  arch/arm/dts/k3-am642-r5-evm.dts | 19 +++
>  arch/arm/dts/k3-am642-r5-sk.dts  | 19 +++
>  3 files changed, 39 insertions(+)
> 
> diff --git a/arch/arm/dts/k3-am64.dtsi b/arch/arm/dts/k3-am64.dtsi
> index de6805b0c7..7aa94d5a6e 100644
> --- a/arch/arm/dts/k3-am64.dtsi
> +++ b/arch/arm/dts/k3-am64.dtsi
> @@ -64,6 +64,7 @@
>   #address-cells = <2>;
>   #size-cells = <2>;
>   ranges = <0x00 0x000f4000 0x00 0x000f4000 0x00 0x02d0>, /* 
> PINCTRL */
> +  <0x00 0x0042 0x00 0x0042 0x00 0x1000>, /* 
> ESM0 */

^^ we need to ensure that kernel.org also has this specific
change. We need to be able to copy the device tree files and overwrite
u-boot device trees and things continue to function.

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D)/Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 
1736 249D


Re: [PATCH] Nokia RX-51: Convert to CONFIG_DM_KEYBOARD

2022-02-03 Thread Tom Rini
On Thu, Feb 03, 2022 at 04:45:44PM -0500, Tom Rini wrote:
> On Thu, Feb 03, 2022 at 04:16:23PM -0500, Tom Rini wrote:
> > On Thu, Feb 03, 2022 at 07:38:50PM +0100, Pali Rohár wrote:
> > 
> > > Signed-off-by: Pali Rohár 
> > > ---
> > > 
> > > I would really appreciate if U-Boot test framework starts printing
> > > deprecation warnings, instead of sending patches which directly drop
> > > support for some boards.
> > > 
> > > There is absolutely no warning during building U-Boot for RX-51 board
> > > that this board has not been converted to DM_KEYBOARD yet.
> > 
> > Please send some patch that implements what you're wanting to see for
> > how to make the warnings more visible.  I do agree the warning for
> > v2022.10 only showed up after the merge to -next once v2022.01 came out,
> > but it's still a fairly long time to clean up the few unconverted
> > boards.
> 
> Oh, I see what's going on.  Simon, the DM_KEYBOARD check isn't
> triggering for any boards.  I'll look more.

And here's where we're at.  nokia_rx51 doesn't set CONFIG_KEYBOARD, so
didn't trigger the warning about  migration.  Every platform that sets
CONFIG_KEYBOARD is migrated.  I don't know how many other platforms are
in the situation nokia_rx51 is in.  Yanking out the legacy code and
seeing what fails to build, and going from there is probably the next
option.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] Nokia RX-51: Convert to CONFIG_DM_KEYBOARD

2022-02-03 Thread Simon Glass
Hi,

On Thu, 3 Feb 2022 at 14:53, Tom Rini  wrote:
>
> On Thu, Feb 03, 2022 at 04:45:44PM -0500, Tom Rini wrote:
> > On Thu, Feb 03, 2022 at 04:16:23PM -0500, Tom Rini wrote:
> > > On Thu, Feb 03, 2022 at 07:38:50PM +0100, Pali Rohár wrote:
> > >
> > > > Signed-off-by: Pali Rohár 
> > > > ---
> > > >
> > > > I would really appreciate if U-Boot test framework starts printing
> > > > deprecation warnings, instead of sending patches which directly drop
> > > > support for some boards.
> > > >
> > > > There is absolutely no warning during building U-Boot for RX-51 board
> > > > that this board has not been converted to DM_KEYBOARD yet.
> > >
> > > Please send some patch that implements what you're wanting to see for
> > > how to make the warnings more visible.  I do agree the warning for
> > > v2022.10 only showed up after the merge to -next once v2022.01 came out,
> > > but it's still a fairly long time to clean up the few unconverted
> > > boards.
> >
> > Oh, I see what's going on.  Simon, the DM_KEYBOARD check isn't
> > triggering for any boards.  I'll look more.
>
> And here's where we're at.  nokia_rx51 doesn't set CONFIG_KEYBOARD, so
> didn't trigger the warning about  migration.  Every platform that sets
> CONFIG_KEYBOARD is migrated.  I don't know how many other platforms are
> in the situation nokia_rx51 is in.  Yanking out the legacy code and
> seeing what fails to build, and going from there is probably the next
> option.

Yes.

As to your questoin, none that I know of. I sent a series to drop
cfb_console which was how this used to work, although in fact it
hasn't worked for a while. The problem here seems to be that this
board was multiple migrations behind and so was not caught.

We should be able to remove the migration check.

Pali, just to explain from the other POV, I am finding it increasingly
frustrating dealing with ad-hoc CONFIG options, old drivers, etc. We
really need to complete some of the migrations we started 6 years ago.

Regards,
Simon


Re: [PATCH] Nokia RX-51: Convert to CONFIG_DM_KEYBOARD

2022-02-03 Thread Simon Glass
Hi,

On Thu, 3 Feb 2022 at 15:02, Simon Glass  wrote:
>
> Hi,
>
> On Thu, 3 Feb 2022 at 14:53, Tom Rini  wrote:
> >
> > On Thu, Feb 03, 2022 at 04:45:44PM -0500, Tom Rini wrote:
> > > On Thu, Feb 03, 2022 at 04:16:23PM -0500, Tom Rini wrote:
> > > > On Thu, Feb 03, 2022 at 07:38:50PM +0100, Pali Rohár wrote:
> > > >
> > > > > Signed-off-by: Pali Rohár 
> > > > > ---
> > > > >
> > > > > I would really appreciate if U-Boot test framework starts printing
> > > > > deprecation warnings, instead of sending patches which directly drop
> > > > > support for some boards.
> > > > >
> > > > > There is absolutely no warning during building U-Boot for RX-51 board
> > > > > that this board has not been converted to DM_KEYBOARD yet.
> > > >
> > > > Please send some patch that implements what you're wanting to see for
> > > > how to make the warnings more visible.  I do agree the warning for
> > > > v2022.10 only showed up after the merge to -next once v2022.01 came out,
> > > > but it's still a fairly long time to clean up the few unconverted
> > > > boards.
> > >
> > > Oh, I see what's going on.  Simon, the DM_KEYBOARD check isn't
> > > triggering for any boards.  I'll look more.
> >
> > And here's where we're at.  nokia_rx51 doesn't set CONFIG_KEYBOARD, so
> > didn't trigger the warning about  migration.  Every platform that sets
> > CONFIG_KEYBOARD is migrated.  I don't know how many other platforms are
> > in the situation nokia_rx51 is in.  Yanking out the legacy code and
> > seeing what fails to build, and going from there is probably the next
> > option.
>
> Yes.
>
> As to your questoin, none that I know of. I sent a series to drop
> cfb_console which was how this used to work, although in fact it
> hasn't worked for a while. The problem here seems to be that this
> board was multiple migrations behind and so was not caught.
>
> We should be able to remove the migration check.
>
> Pali, just to explain from the other POV, I am finding it increasingly
> frustrating dealing with ad-hoc CONFIG options, old drivers, etc. We
> really need to complete some of the migrations we started 6 years ago.

BTW the keyboard driver should go in drivers/input and should use
device tree, not platdata.

Regards,
Simon


Re: [PATCH] Nokia RX-51: Convert to CONFIG_DM_KEYBOARD

2022-02-03 Thread Tom Rini
On Thu, Feb 03, 2022 at 03:03:21PM -0700, Simon Glass wrote:
> Hi,
> 
> On Thu, 3 Feb 2022 at 15:02, Simon Glass  wrote:
> >
> > Hi,
> >
> > On Thu, 3 Feb 2022 at 14:53, Tom Rini  wrote:
> > >
> > > On Thu, Feb 03, 2022 at 04:45:44PM -0500, Tom Rini wrote:
> > > > On Thu, Feb 03, 2022 at 04:16:23PM -0500, Tom Rini wrote:
> > > > > On Thu, Feb 03, 2022 at 07:38:50PM +0100, Pali Rohár wrote:
> > > > >
> > > > > > Signed-off-by: Pali Rohár 
> > > > > > ---
> > > > > >
> > > > > > I would really appreciate if U-Boot test framework starts printing
> > > > > > deprecation warnings, instead of sending patches which directly drop
> > > > > > support for some boards.
> > > > > >
> > > > > > There is absolutely no warning during building U-Boot for RX-51 
> > > > > > board
> > > > > > that this board has not been converted to DM_KEYBOARD yet.
> > > > >
> > > > > Please send some patch that implements what you're wanting to see for
> > > > > how to make the warnings more visible.  I do agree the warning for
> > > > > v2022.10 only showed up after the merge to -next once v2022.01 came 
> > > > > out,
> > > > > but it's still a fairly long time to clean up the few unconverted
> > > > > boards.
> > > >
> > > > Oh, I see what's going on.  Simon, the DM_KEYBOARD check isn't
> > > > triggering for any boards.  I'll look more.
> > >
> > > And here's where we're at.  nokia_rx51 doesn't set CONFIG_KEYBOARD, so
> > > didn't trigger the warning about  migration.  Every platform that sets
> > > CONFIG_KEYBOARD is migrated.  I don't know how many other platforms are
> > > in the situation nokia_rx51 is in.  Yanking out the legacy code and
> > > seeing what fails to build, and going from there is probably the next
> > > option.
> >
> > Yes.
> >
> > As to your questoin, none that I know of. I sent a series to drop
> > cfb_console which was how this used to work, although in fact it
> > hasn't worked for a while. The problem here seems to be that this
> > board was multiple migrations behind and so was not caught.
> >
> > We should be able to remove the migration check.
> >
> > Pali, just to explain from the other POV, I am finding it increasingly
> > frustrating dealing with ad-hoc CONFIG options, old drivers, etc. We
> > really need to complete some of the migrations we started 6 years ago.
> 
> BTW the keyboard driver should go in drivers/input and should use
> device tree, not platdata.

This is likely one of the cases where we end up saying a platform is
only platdata, given size concerns?  That's my quick recollection from
talking about the USB stuff a few months back, and some other related
size questions.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] Nokia RX-51: Convert to CONFIG_DM_KEYBOARD

2022-02-03 Thread Simon Glass
Hi Tom,

On Thu, 3 Feb 2022 at 15:09, Tom Rini  wrote:
>
> On Thu, Feb 03, 2022 at 03:03:21PM -0700, Simon Glass wrote:
> > Hi,
> >
> > On Thu, 3 Feb 2022 at 15:02, Simon Glass  wrote:
> > >
> > > Hi,
> > >
> > > On Thu, 3 Feb 2022 at 14:53, Tom Rini  wrote:
> > > >
> > > > On Thu, Feb 03, 2022 at 04:45:44PM -0500, Tom Rini wrote:
> > > > > On Thu, Feb 03, 2022 at 04:16:23PM -0500, Tom Rini wrote:
> > > > > > On Thu, Feb 03, 2022 at 07:38:50PM +0100, Pali Rohár wrote:
> > > > > >
> > > > > > > Signed-off-by: Pali Rohár 
> > > > > > > ---
> > > > > > >
> > > > > > > I would really appreciate if U-Boot test framework starts printing
> > > > > > > deprecation warnings, instead of sending patches which directly 
> > > > > > > drop
> > > > > > > support for some boards.
> > > > > > >
> > > > > > > There is absolutely no warning during building U-Boot for RX-51 
> > > > > > > board
> > > > > > > that this board has not been converted to DM_KEYBOARD yet.
> > > > > >
> > > > > > Please send some patch that implements what you're wanting to see 
> > > > > > for
> > > > > > how to make the warnings more visible.  I do agree the warning for
> > > > > > v2022.10 only showed up after the merge to -next once v2022.01 came 
> > > > > > out,
> > > > > > but it's still a fairly long time to clean up the few unconverted
> > > > > > boards.
> > > > >
> > > > > Oh, I see what's going on.  Simon, the DM_KEYBOARD check isn't
> > > > > triggering for any boards.  I'll look more.
> > > >
> > > > And here's where we're at.  nokia_rx51 doesn't set CONFIG_KEYBOARD, so
> > > > didn't trigger the warning about  migration.  Every platform that sets
> > > > CONFIG_KEYBOARD is migrated.  I don't know how many other platforms are
> > > > in the situation nokia_rx51 is in.  Yanking out the legacy code and
> > > > seeing what fails to build, and going from there is probably the next
> > > > option.
> > >
> > > Yes.
> > >
> > > As to your questoin, none that I know of. I sent a series to drop
> > > cfb_console which was how this used to work, although in fact it
> > > hasn't worked for a while. The problem here seems to be that this
> > > board was multiple migrations behind and so was not caught.
> > >
> > > We should be able to remove the migration check.
> > >
> > > Pali, just to explain from the other POV, I am finding it increasingly
> > > frustrating dealing with ad-hoc CONFIG options, old drivers, etc. We
> > > really need to complete some of the migrations we started 6 years ago.
> >
> > BTW the keyboard driver should go in drivers/input and should use
> > device tree, not platdata.
>
> This is likely one of the cases where we end up saying a platform is
> only platdata, given size concerns?  That's my quick recollection from
> talking about the USB stuff a few months back, and some other related
> size questions.

OK, I see. Yes, device tree would add a lot (in fact it doesn't even
use OF_CONTROL).

Regards,
Simon


[RESEND PATCH] arm: kirkwood: Dockstar : Add DM Ethernet

2022-02-03 Thread Tony Dinh
The Dockstar board has the network chip Marvell 88E1116R. Convert to
Ethernet driver model, and use uclass mvgbe and the compatible driver
M88E1118R to bring up Ethernet.

- Add CONFIG_DM_ETH and associated configs.
- Add board_eth_init() to use uclass mvgbe to bring up the network.
And remove ad-hoc code.
- Add CONFIG_PHY_MARVELL to properly configure the network.
- Currently, CONFIG_RESET_PHY_R symbol is used in
arch/arm/mach-kirkwood/include/mach/config.h for all Kirkwood
boards with mv8831116 PHY, with each board defines the function
reset_phy(). Undefine it for this board.
- Miscellaneous changes: Move constants to .c file and remove
header file board/Seagate/dockstar/dockstar.h, use
CONFIG_SYS_THUMB_BUILD to keep u-boot image
under 512K, add CONFIG_HUSH_PARSER, use BIT macro, and cleanup comments.

- Note: This patch is a RESEND for a previous patch:
https://patchwork.ozlabs.org/project/uboot/patch/20210812051854.1340-2-mibo...@gmail.com/

Signed-off-by: Tony Dinh 
---

 board/Seagate/dockstar/dockstar.c | 62 ++-
 board/Seagate/dockstar/dockstar.h | 27 --
 configs/dockstar_defconfig|  5 +++
 include/configs/dockstar.h| 20 +++---
 4 files changed, 30 insertions(+), 84 deletions(-)
 delete mode 100644 board/Seagate/dockstar/dockstar.h

diff --git a/board/Seagate/dockstar/dockstar.c 
b/board/Seagate/dockstar/dockstar.c
index fb69193158..d72e3ef24e 100644
--- a/board/Seagate/dockstar/dockstar.c
+++ b/board/Seagate/dockstar/dockstar.c
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
+ * Copyright (C) 2022 Tony Dinh 
  * Copyright (C) 2010  Eric C. Cooper 
  *
  * Based on sheevaplug.c originally written by
@@ -11,18 +12,22 @@
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include "dockstar.h"
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#define DOCKSTAR_OE_LOW(~(0))
+#define DOCKSTAR_OE_HIGH   (~(0))
+#define DOCKSTAR_OE_VAL_LOWBIT(29) /* USB_PWEN low */
+#define DOCKSTAR_OE_VAL_HIGH   BIT(17) /* LED pin high */
+
 int board_early_init_f(void)
 {
/*
@@ -92,6 +97,11 @@ int board_early_init_f(void)
return 0;
 }
 
+int board_eth_init(struct bd_info *bis)
+{
+   return cpu_eth_init(bis);
+}
+
 int board_init(void)
 {
/*
@@ -105,53 +115,21 @@ int board_init(void)
return 0;
 }
 
-#ifdef CONFIG_RESET_PHY_R
-/* Configure and enable MV88E1116 PHY */
-void reset_phy(void)
-{
-   u16 reg;
-   u16 devadr;
-   char *name = "egiga0";
-
-   if (miiphy_set_current_dev(name))
-   return;
-
-   /* command to read PHY dev address */
-   if (miiphy_read(name, 0xEE, 0xEE, (u16 *) &devadr)) {
-   printf("Err..%s could not read PHY dev address\n",
-   __FUNCTION__);
-   return;
-   }
-
-   /*
-* Enable RGMII delay on Tx and Rx for CPU port
-* Ref: sec 4.7.2 of chip datasheet
-*/
-   miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2);
-   miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, ®);
-   reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL);
-   miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg);
-   miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0);
-
-   /* reset the phy */
-   miiphy_reset(name, devadr);
-
-   printf("88E1116 Initialized on %s\n", name);
-}
-#endif /* CONFIG_RESET_PHY_R */
-
 #if CONFIG_IS_ENABLED(BOOTSTAGE)
-#define GREEN_LED  (1 << 14)
-#define ORANGE_LED (1 << 15)
+#define GREEN_LED  BIT(14)
+#define ORANGE_LED BIT(15)
 #define BOTH_LEDS  (GREEN_LED | ORANGE_LED)
 #define NEITHER_LED0
 
 static void set_leds(u32 leds, u32 blinking)
 {
struct kwgpio_registers *r = (struct kwgpio_registers 
*)MVEBU_GPIO1_BASE;
-   u32 oe = readl(&r->oe) | BOTH_LEDS;
+   u32 oe;
+   u32 bl;
+
+   oe = readl(&r->oe) | BOTH_LEDS;
writel(oe & ~leds, &r->oe); /* active low */
-   u32 bl = readl(&r->blink_en) & ~BOTH_LEDS;
+   bl = readl(&r->blink_en) & ~BOTH_LEDS;
writel(bl | blinking, &r->blink_en);
 }
 
diff --git a/board/Seagate/dockstar/dockstar.h 
b/board/Seagate/dockstar/dockstar.h
deleted file mode 100644
index cbb1644476..00
--- a/board/Seagate/dockstar/dockstar.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2010  Eric C. Cooper 
- *
- * Based on sheevaplug.h originally written by
- * Prafulla Wadaskar 
- * (C) Copyright 2009
- * Marvell Semiconductor 
- */
-
-#ifndef __DOCKSTAR_H
-#define __DOCKSTAR_H
-
-#define DOCKSTAR_OE_LOW(~(0))
-#define DOCKSTAR_OE_HIGH   (~(0))
-#define DOCKSTAR_OE_VAL_LOW(1 << 29)   /* USB_PWEN low */
-#define DOCKSTAR_OE_VAL_HIGH   (1 << 17)   /* LED pin high */
-
-/* PHY related */
-#define MV88E1116_LED_FCTRL_REG10
-#de

Re: [PATCH v5 1/4] scripts/checkpatch.pl: Resync with v5.16

2022-02-03 Thread Tom Rini
On Sun, Jan 23, 2022 at 12:55:11PM -0700, Simon Glass wrote:

> This resyncs us with the version found in v5.16 of the Linux kernel with
> the following exceptions:
> - Keep our u-boot specific tests / code area.
> - Change the location of checkpatch.rst
> - Drop the "use strscpy" test as we don't have that, but do have strlcpy
>   and want that used now.
> - Keep debug/printf in the list for $logFunctions
> 
> This also syncs the spdxcheck.py tool and all the associated
> documentation.
> S
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v5 2/4] efi: Use 16-bit Unicode strings

2022-02-03 Thread Tom Rini
On Sun, Jan 23, 2022 at 12:55:12PM -0700, Simon Glass wrote:

> At present we use wide characters for Unicode but this is not necessary.
> Change the code to use the 'u' literal instead. This helps to fix build
> warnings for sandbox on the Raspberry Pi.
> 
> Signed-off-by: Simon Glass 
> Suggested-by: Heinrich Schuchardt 
> Reviewed-by: Heinrich Schuchardt 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v5 4/4] treewide: Use 16-bit unicode strings

2022-02-03 Thread Tom Rini
On Sun, Jan 23, 2022 at 12:55:14PM -0700, Simon Glass wrote:

> At present we use wide characters for unicode but this is not necessary.
> Change the code to use the 'u' literal instead. This helps to fix build
> warnings for sandbox on rpi.
> 
> Note: This applies tree-wide
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] armv8: start.S: remove CONFIG_SYS_RESET_SCTRL code

2022-02-03 Thread Tom Rini
On Mon, Jan 24, 2022 at 05:17:40PM +, Andre Przywara wrote:

> There is some code that tries to "reset" the SCTLR_ELx register early in
> the boot process. The idea seems to be to guarantee some sane settings
> that U-Boot actually relies on, for instance running in little-endian
> mode, with the MMU off initially.
> However the current code has multiple problems:
> - For a start, no platform or config defines the symbol that would
>   enable that code.
> - The code itself really only works if the bits that it tries to clear
>   are already cleared:
>   - If we run in big-endian mode initially, any previous loads would have
> been wrong already. That applies to the (optional) relocation code,
> but more prominently to the mask that it uses to clear those bits:
> "ldr x1, =0xfdfa" looks innocent, but actually involves a memory
> access to the literal pool, using the current endianess.
>   - If we run with the MMU enabled, we are probably doomed already. We
> *could* hope that we are running with an identity mapping, but would
> need to do some cache maintenance to avoid losing dirty cache lines.
> - The idea of doing a read-modify-write of SCTLR is somewhat
>   questionable to begin with, because as the owner of the current
>   exception level we should initialise all bits of this register with a
>   certain fixed value.
> - The code is unnecessarily complicated, and the function name is
>   misspelled.
> 
> While those problems *could* admittedly be fixed, the point that is does
> not seem to be used at all at the moment tells me we should just remove
> this code, and be it to not give a bad example.
> 
> If people care, I could introduce some proper SCTLR initialisation code.
> We are about to work this out for the boot-wrapper[1] as we speak, but
> apparently we got away without doing this in U-Boot ever since, so it
> might not be worth the potential trouble.
> 
> [1] 
> https://lore.kernel.org/linux-arm-kernel/20220114105653.3003399-7-mark.rutl...@arm.com/
> 
> Signed-off-by: Andre Przywara 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] scripts: Makefile: also clean subdir dtc

2022-02-03 Thread Tom Rini
On Tue, Jan 25, 2022 at 11:32:20AM +0100, Philippe Reynes wrote:

> Since commit 93b196532254 ("Makefile: Only build dtc if needed"),
> the sub directory scripts/dtc is never cleaned.
> Adds the directory dtc to subdir to always clean it.
> 
> Signed-off-by: Philippe Reynes 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] net: ti: am65-cpsw: Cleanup resources before jump to kernel

2022-02-03 Thread Tom Rini
On Fri, Jan 28, 2022 at 11:21:19AM +0530, Vignesh Raghavendra wrote:

> In case fastboot over Ethernet, am65_cpsw_stop() is not called unless
> DM_FLAG_OS_PREPARE is set. Without call to am65_cpsw_stop(), DMA
> resources are not released thus leading to failures in kernel.
> Fix this by adding DM_FLAG_OS_PREPARE flag to am65_cpsw_nuss_port
> driver.
> 
> Reported-by: Christian Gmeiner 
> Signed-off-by: Vignesh Raghavendra 
> Reviewed-by: Ramon Fried 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] arm: pdu001: Exend the list of maintained files

2022-02-03 Thread Tom Rini
On Fri, Jan 28, 2022 at 02:36:12PM +0100, Felix Brack wrote:

> Add the PDU001 board specific DT files to MAINTAINERS. This should
> help for better tracking of changes to these files.
> 
> Signed-off-by: Felix Brack 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] armv8: spl: Fix build with LINUX_KERNEL_IMAGE_HEADER

2022-02-03 Thread Tom Rini
On Sat, Jan 29, 2022 at 06:27:03PM +0300, Alper Nebi Yasak wrote:

> Setting LINUX_KERNEL_IMAGE_HEADER=y attempts to include an ARM64 Linux
> kernel image header at the start of both U-Boot proper and SPL binaries.
> However, some definitions that the image header uses are not included by
> the SPL linker script, resulting in a build error. Include them the way
> they are included in U-Boot proper's linker script to fix the error.
> 
> Signed-off-by: Alper Nebi Yasak 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] spl: ymodem: Fix buffer overflow during Image copy

2022-02-03 Thread Tom Rini
On Mon, Jan 31, 2022 at 09:49:19AM +0530, Vignesh Raghavendra wrote:

> ymodem_read_fit() driver will end copying up to BUF_SIZE boundary even
> when requested size of copy operation is less than that.
> For example, if offset = 0, size = 1440B, ymodem_read_fit() ends up
> copying 2KB from offset = 0, to destination buffer addr
> 
> This causes data corruption when malloc'd buffer is passed during UART
> boot since commit 03f1f78a9b44 ("spl: fit: Prefer a malloc()'d buffer
> for loading images")
> 
> With this, UART boot works again on K3 (AM654, J7, AM64) family of
> devices.
> 
> Fixes: 03f1f78a9b44 ("spl: fit: Prefer a malloc()'d buffer for loading 
> images")
> Signed-off-by: Vignesh Raghavendra 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] Dockerfile: Add libgnutls package for building mkeficapsule command

2022-02-03 Thread Tom Rini
On Tue, Feb 01, 2022 at 10:32:36AM +0900, AKASHI Takahiro wrote:

> For adding signing feature for capsule authentication to the host tool,
> mkeficapsule, we will link gnutls library for crypto operation.
> Since we need this command to complete the capsule authentication test
> on sandbox in CI loop, necessary packages must be installed on the host.
> 
> See my patch, "tools: mkeficapsule: add firmware image signing."
> 
> Signed-off-by: AKASHI Takahiro 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] Dockfile, CI: Update to latest focal tag and build

2022-02-03 Thread Tom Rini
On Thu, Feb 03, 2022 at 09:10:05AM -0500, Tom Rini wrote:

> - Latest focal tag
> - Add libgnutls to image
> 
> Signed-off-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] drivers/adc/rockchip-saradc: remove double semi-colon

2022-02-03 Thread Giulio Benetti
Signed-off-by: Giulio Benetti 
---
 drivers/adc/rockchip-saradc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/adc/rockchip-saradc.c b/drivers/adc/rockchip-saradc.c
index e464d33f22..e0cbab6aa0 100644
--- a/drivers/adc/rockchip-saradc.c
+++ b/drivers/adc/rockchip-saradc.c
@@ -131,7 +131,7 @@ int rockchip_saradc_of_to_plat(struct udevice *dev)
}
 
priv->data = data;
-   uc_pdata->data_mask = (1 << priv->data->num_bits) - 1;;
+   uc_pdata->data_mask = (1 << priv->data->num_bits) - 1;
uc_pdata->data_format = ADC_DATA_FORMAT_BIN;
uc_pdata->data_timeout_us = SARADC_TIMEOUT / 5;
uc_pdata->channel_mask = (1 << priv->data->num_channels) - 1;
-- 
2.25.1



Pull request: u-boot-sunxi/master for 2022.04 (part 2)

2022-02-03 Thread Andre Przywara
Hi Tom,

this is the promised second part of the sunxi PR for 2022.04, albeit
technially outside of the merge window. We were working on this full
steam since the beginning of the year, and it deserves to be merged,
I think.
The main attraction is support for the F1C100s SoC, which sports a
venerable ARM926 core. Support for this SoC and the LicheePi Nano board
has been in Linux for years, and U-Boot patches were posted mid last
year already.
The new SoC using ARMv5 also means that the bulk of the new code should
not touch any existing boards, although we did some refactorings first,
of course, which actually cleans up some existing sunxi code.

Compile tested for all 160 sunxi boards, and briefly tested on BananaPi M1,
OrangePi Zero, Pine64 and Pine-H64. Tested by others on their boards,
including F1C100s and F1C200s devices.

Thanks,
Andre

==
The following changes since commit 006fddde01da7e8b3c7cad4a35f3245edc894ab4:

  Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq (2022-02-02 
09:16:49 -0500)

are available in the Git repository at:

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

for you to fetch changes up to b6ffd58e45043b822844345d4ca9b2cb1e2917b7:

  configs: sunxi: Add support for Lichee Pi Nano (2022-02-04 00:09:57 +)


Andre Przywara (5):
  sunxi: move non-essential code out of s_init()
  sunxi: move Cortex SMPEN setting into start.S
  sunxi: move early "SRAM setup" into separate file
  armv8: remove no longer needed lowlevel_init.S
  sunxi-common.h: remove pointless #ifdefs

Icenowy Zheng (9):
  arm: arm926ej-s: start.S: port save_boot_params support from armv7 code
  arm: arm926ej-s: Add sunxi code
  ARM: sunxi: Add clock and uart to sunxi headers
  sunxi: Add F1C100s DRAM initial support
  sunxi: board: Add support for SUNIV
  configs: sunxi: Add common SUNIV header
  mach-sunxi: Add support for SUNIV architecture
  ARM: dts: suniv: Add device tree files and bindings for F1C100s
  configs: sunxi: Add support for Lichee Pi Nano

Jesse Taube (1):
  mach-sunxi: Move timer code to mach folder

 Kconfig  |   8 +-
 arch/arm/Kconfig |   3 -
 arch/arm/cpu/arm926ejs/Makefile  |   1 +
 arch/arm/cpu/arm926ejs/cpu.c |  13 +
 arch/arm/cpu/arm926ejs/start.S   |  19 +
 arch/arm/cpu/arm926ejs/sunxi/Makefile|   5 +
 arch/arm/cpu/arm926ejs/sunxi/config.mk   |   6 +
 arch/arm/cpu/arm926ejs/sunxi/fel_utils.S |  33 ++
 arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds  |  48 +++
 arch/arm/cpu/armv7/Kconfig   |   5 +
 arch/arm/cpu/armv7/start.S   |  11 +
 arch/arm/cpu/armv7/sunxi/Makefile|   4 +-
 arch/arm/cpu/armv7/sunxi/sram.c  |  40 +++
 arch/arm/cpu/armv8/Makefile  |   1 -
 arch/arm/cpu/armv8/lowlevel_init.S   |  43 ---
 arch/arm/dts/Makefile|   2 +
 arch/arm/dts/suniv-f1c100s-licheepi-nano.dts |  26 ++
 arch/arm/dts/suniv-f1c100s.dtsi  | 144 
 arch/arm/dts/sunxi-u-boot.dtsi   |   2 +
 arch/arm/include/asm/arch-sunxi/clock.h  |   2 +-
 arch/arm/include/asm/arch-sunxi/clock_sun6i.h|  13 +
 arch/arm/include/asm/arch-sunxi/cpu_sun4i.h  |   7 +
 arch/arm/include/asm/arch-sunxi/dram.h   |   2 +
 arch/arm/include/asm/arch-sunxi/dram_suniv.h |  46 +++
 arch/arm/include/asm/arch-sunxi/gpio.h   |   1 +
 arch/arm/mach-sunxi/Kconfig  |  18 +-
 arch/arm/mach-sunxi/Makefile |   5 +
 arch/arm/mach-sunxi/board.c  | 109 +++---
 arch/arm/mach-sunxi/clock.c  |   3 +-
 arch/arm/mach-sunxi/clock_sun6i.c|  86 +++--
 arch/arm/mach-sunxi/cpu_info.c   |   2 +
 arch/arm/mach-sunxi/dram_helpers.c   |   4 +
 arch/arm/mach-sunxi/dram_suniv.c | 420 +++
 arch/arm/{cpu/armv7/sunxi => mach-sunxi}/timer.c |   7 +-
 board/sunxi/board.c  |   4 +-
 boot/Kconfig |   7 +-
 configs/licheepi_nano_defconfig  |  11 +
 include/configs/suniv.h  |  14 +
 include/configs/sunxi-common.h   |  64 ++--
 include/dt-bindings/clock/suniv-ccu-f1c100s.h|  70 
 include/dt-bindings/reset/suniv-ccu-f1c100s.h|  38 ++
 41 files changed, 1174 insertions(+), 173 deletions(-)
 create mode 100644 arch/arm/cpu/arm926ejs/sunxi/Makefile
 create mode 100644 arch/arm/cpu/arm926ejs/sunxi/config.mk
 create mode 100644 arch/arm/cpu/arm926ejs/sunxi/fel_utils.S
 create mode 100644 arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
 create mode 1006

Re: [PATCH] tools/mrvl_uart.sh: Remove script

2022-02-03 Thread Stefan Roese

Added Kosta to Cc, as he is the author of this script.

On 2/3/22 17:50, Pali Rohár wrote:

There are two tools for sending images over UART to Marvell SoCs: kwboot
and mrvl_uart.sh. kwboot received lot of new features and improvements in
last few months. There is no need to maintain two tools in U-Boot, so
remove old mrvl_uart.sh tool.

Signed-off-by: Pali Rohár 
---
  tools/mrvl_uart.sh | 119 -
  1 file changed, 119 deletions(-)
  delete mode 100755 tools/mrvl_uart.sh


Kosta, do you see any problems with removing this script? As you might
have seen, Pali and Marek did some great work on kwboot in the mean
time. Is there anything left in mrvl_uart.sh that kwboot can't handle?

Thanks,
Stefan


diff --git a/tools/mrvl_uart.sh b/tools/mrvl_uart.sh
deleted file mode 100755
index a46411fc99fb..
--- a/tools/mrvl_uart.sh
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: GPL-2.0
-#
-##
-# Copyright (C) 2016 Marvell International Ltd.
-#
-# https://spdx.org/licenses
-#
-# Author: Konstantin Porotchkin kos...@marvell.com
-#
-# Version 0.3
-#
-# UART recovery downloader for Armada SoCs
-#
-##
-
-port=$1
-file=$2
-speed=$3
-
-pattern_repeat=1500
-default_baudrate=115200
-tmpfile=/tmp/xmodem.pattern
-tools=( dd stty sx minicom )
-
-case "$3" in
-2)
-fast_baudrate=230400
-prefix="\xF2"
-;;
-4)
-fast_baudrate=460800
-prefix="\xF4"
-;;
-8)
-   fast_baudrate=921600
-prefix="\xF8"
-;;
-*)
-   fast_baudrate=$default_baudrate
-prefix="\xBB"
-esac
-
-if [[ -z "$port" || -z "$file" ]]
-then
-echo -e "\nMarvell recovery image downloader for Armada SoC family."
-echo -e "Command syntax:"
-echo -e "\t$(basename $0)   [2|4|8]"
-echo -e "\tport  - serial port the target board is connected to"
-echo -e "\tfile  - recovery boot image for target download"
-echo -e "\t2|4|8 - times to increase the default serial port speed by"
-echo -e "For example - load the image over ttyUSB0 @ 460800 baud:"
-echo -e "$(basename $0) /dev/ttyUSB0 /tmp/flash-image.bin 4\n"
-echo -e "=WARNING="
-echo -e "- The speed-up option is not available in SoC families prior to 
A8K+"
-echo -e "- This utility is not compatible with Armada 37xx SoC family\n"
-fi
-
-# Sanity checks
-if [ -c "$port" ]
-then
-   echo -e "Using device connected on serial port \"$port\""
-else
-   echo "Wrong serial port name!"
-   exit 1
-fi
-
-if [ -f "$file" ]
-then
-   echo -e "Loading flash image file \"$file\""
-else
-   echo "File $file does not exist!"
-   exit 1
-fi
-
-# Verify required tools installation
-for tool in ${tools[@]}
-do
-toolname=`which $tool`
-if [ -z "$toolname" ]
-then
-echo -e "Missing installation of \"$tool\" --> Exiting"
-exit 1
-fi
-done
-
-
-echo -e "Recovery will run at $fast_baudrate baud"
-echo -e ""
-
-if [ -f "$tmpfile" ]
-then
-rm -f $tmpfile
-fi
-
-# Send the escape sequence to target board using default debug port speed
-stty -F $port raw ignbrk time 5 $default_baudrate
-counter=0
-while [ $counter -lt $pattern_repeat ]; do
-echo -n -e "$prefix\x11\x22\x33\x44\x55\x66\x77" >> $tmpfile
-let counter=counter+1
-done
-
-echo -en "Press the \"Reset\" button on the target board and "
-echo -en "the \"Enter\" key on the host keyboard simultaneously"
-read
-dd if=$tmpfile of=$port &>/dev/null
-
-# Speed up the binary image transfer
-stty -F $port raw ignbrk time 5 $fast_baudrate
-sx -vv $file > $port < $port
-#sx-at91 $port $file
-
-# Return the port to the default speed
-stty -F $port raw ignbrk time 5 $default_baudrate
-
-# Optional - fire up Minicom
-minicom -D $port -b $default_baudrate
-


Viele Grüße,
Stefan Roese

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


Re: [PATCH] tools: kwboot: Fix detection of quit esc sequence

2022-02-03 Thread Stefan Roese

On 2/3/22 17:45, Pali Rohár wrote:

Quit esc sequence may be also in the middle of the read buffer.
Fix the detection for that case.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  tools/kwboot.c | 19 +++
  1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/tools/kwboot.c b/tools/kwboot.c
index 2684f0e75a56..7737188f0d0a 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -1183,10 +1183,10 @@ kwboot_xmodem(int tty, const void *_img, size_t size, 
int baudrate)
  static int
  kwboot_term_pipe(int in, int out, const char *quit, int *s)
  {
+   char buf[128];
ssize_t nin;
-   char _buf[128], *buf = _buf;
  
-	nin = read(in, buf, sizeof(_buf));

+   nin = read(in, buf, sizeof(buf));
if (nin <= 0)
return -1;
  
@@ -1194,18 +1194,21 @@ kwboot_term_pipe(int in, int out, const char *quit, int *s)

int i;
  
  		for (i = 0; i < nin; i++) {

-   if (*buf == quit[*s]) {
+   if (buf[i] == quit[*s]) {
(*s)++;
-   if (!quit[*s])
-   return 0;
-   buf++;
-   nin--;
+   if (!quit[*s]) {
+   nin = i - *s;
+   break;
+   }
} else {
-   if (kwboot_write(out, quit, *s) < 0)
+   if (*s > i && kwboot_write(out, quit, *s - i) < 
0)
return -1;
*s = 0;
}
}
+
+   if (i == nin)
+   nin -= *s;
}
  
  	if (kwboot_write(out, buf, nin) < 0)


Viele Grüße,
Stefan Roese

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


Re: [PATCH] MAINTAINERS: Update list of Armada 385 and Armada 3720 drivers

2022-02-03 Thread Stefan Roese

On 2/3/22 17:57, Pali Rohár wrote:

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  MAINTAINERS | 9 +
  1 file changed, 9 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index dcdd99e368d1..7b05f8866edc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -278,11 +278,20 @@ T:git 
https://source.denx.de/u-boot/custodians/u-boot-marvell.git
  F:arch/arm/mach-kirkwood/
  F:arch/arm/mach-mvebu/
  F:drivers/ata/ahci_mvebu.c
+F: drivers/clk/mvebu/
  F:drivers/ddr/marvell/
  F:drivers/gpio/mvebu_gpio.c
+F: drivers/i2c/mvtwsi.c
+F: drivers/mmc/xenon_sdhci.c
+F: drivers/phy/marvell/
+F: drivers/pinctrl/mvebu/
+F: drivers/rtc/armada38x.c
  F:drivers/spi/kirkwood_spi.c
+F: drivers/spi/mvebu_a3700_spi.c
  F:drivers/pci/pcie_dw_mvebu.c
+F: drivers/watchdog/armada-37xx-wdt.c
  F:drivers/watchdog/orion_wdt.c
+F: include/configs/mv-common.h
  
  ARM MARVELL PCIE CONTROLLER DRIVERS

  M:Pali Rohár 


Viele Grüße,
Stefan Roese

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


Re: [RESEND PATCH] arm: kirkwood: Dockstar : Add DM Ethernet

2022-02-03 Thread Stefan Roese

On 2/3/22 23:32, Tony Dinh wrote:

The Dockstar board has the network chip Marvell 88E1116R. Convert to
Ethernet driver model, and use uclass mvgbe and the compatible driver
M88E1118R to bring up Ethernet.

- Add CONFIG_DM_ETH and associated configs.
- Add board_eth_init() to use uclass mvgbe to bring up the network.
And remove ad-hoc code.
- Add CONFIG_PHY_MARVELL to properly configure the network.
- Currently, CONFIG_RESET_PHY_R symbol is used in
arch/arm/mach-kirkwood/include/mach/config.h for all Kirkwood
boards with mv8831116 PHY, with each board defines the function
reset_phy(). Undefine it for this board.
- Miscellaneous changes: Move constants to .c file and remove
header file board/Seagate/dockstar/dockstar.h, use
CONFIG_SYS_THUMB_BUILD to keep u-boot image
under 512K, add CONFIG_HUSH_PARSER, use BIT macro, and cleanup comments.

- Note: This patch is a RESEND for a previous patch:
https://patchwork.ozlabs.org/project/uboot/patch/20210812051854.1340-2-mibo...@gmail.com/

Signed-off-by: Tony Dinh 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---

  board/Seagate/dockstar/dockstar.c | 62 ++-
  board/Seagate/dockstar/dockstar.h | 27 --
  configs/dockstar_defconfig|  5 +++
  include/configs/dockstar.h| 20 +++---
  4 files changed, 30 insertions(+), 84 deletions(-)
  delete mode 100644 board/Seagate/dockstar/dockstar.h

diff --git a/board/Seagate/dockstar/dockstar.c 
b/board/Seagate/dockstar/dockstar.c
index fb69193158..d72e3ef24e 100644
--- a/board/Seagate/dockstar/dockstar.c
+++ b/board/Seagate/dockstar/dockstar.c
@@ -1,5 +1,6 @@
  // SPDX-License-Identifier: GPL-2.0+
  /*
+ * Copyright (C) 2022 Tony Dinh 
   * Copyright (C) 2010  Eric C. Cooper 
   *
   * Based on sheevaplug.c originally written by
@@ -11,18 +12,22 @@
  #include 
  #include 
  #include 
-#include 
-#include 
+#include 
  #include 
  #include 
  #include 
  #include 
  #include 
  #include 
-#include "dockstar.h"
+#include 
  
  DECLARE_GLOBAL_DATA_PTR;
  
+#define DOCKSTAR_OE_LOW		(~(0))

+#define DOCKSTAR_OE_HIGH   (~(0))
+#define DOCKSTAR_OE_VAL_LOWBIT(29) /* USB_PWEN low */
+#define DOCKSTAR_OE_VAL_HIGH   BIT(17) /* LED pin high */
+
  int board_early_init_f(void)
  {
/*
@@ -92,6 +97,11 @@ int board_early_init_f(void)
return 0;
  }
  
+int board_eth_init(struct bd_info *bis)

+{
+   return cpu_eth_init(bis);
+}
+
  int board_init(void)
  {
/*
@@ -105,53 +115,21 @@ int board_init(void)
return 0;
  }
  
-#ifdef CONFIG_RESET_PHY_R

-/* Configure and enable MV88E1116 PHY */
-void reset_phy(void)
-{
-   u16 reg;
-   u16 devadr;
-   char *name = "egiga0";
-
-   if (miiphy_set_current_dev(name))
-   return;
-
-   /* command to read PHY dev address */
-   if (miiphy_read(name, 0xEE, 0xEE, (u16 *) &devadr)) {
-   printf("Err..%s could not read PHY dev address\n",
-   __FUNCTION__);
-   return;
-   }
-
-   /*
-* Enable RGMII delay on Tx and Rx for CPU port
-* Ref: sec 4.7.2 of chip datasheet
-*/
-   miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2);
-   miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, ®);
-   reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL);
-   miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg);
-   miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0);
-
-   /* reset the phy */
-   miiphy_reset(name, devadr);
-
-   printf("88E1116 Initialized on %s\n", name);
-}
-#endif /* CONFIG_RESET_PHY_R */
-
  #if CONFIG_IS_ENABLED(BOOTSTAGE)
-#define GREEN_LED  (1 << 14)
-#define ORANGE_LED (1 << 15)
+#define GREEN_LED  BIT(14)
+#define ORANGE_LED BIT(15)
  #define BOTH_LEDS (GREEN_LED | ORANGE_LED)
  #define NEITHER_LED   0
  
  static void set_leds(u32 leds, u32 blinking)

  {
struct kwgpio_registers *r = (struct kwgpio_registers 
*)MVEBU_GPIO1_BASE;
-   u32 oe = readl(&r->oe) | BOTH_LEDS;
+   u32 oe;
+   u32 bl;
+
+   oe = readl(&r->oe) | BOTH_LEDS;
writel(oe & ~leds, &r->oe);  /* active low */
-   u32 bl = readl(&r->blink_en) & ~BOTH_LEDS;
+   bl = readl(&r->blink_en) & ~BOTH_LEDS;
writel(bl | blinking, &r->blink_en);
  }
  
diff --git a/board/Seagate/dockstar/dockstar.h b/board/Seagate/dockstar/dockstar.h

deleted file mode 100644
index cbb1644476..00
--- a/board/Seagate/dockstar/dockstar.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2010  Eric C. Cooper 
- *
- * Based on sheevaplug.h originally written by
- * Prafulla Wadaskar 
- * (C) Copyright 2009
- * Marvell Semiconductor 
- */
-
-#ifndef __DOCKSTAR_H
-#define __DOCKSTAR_H
-
-#define DOCKSTAR_OE_LOW(~(0))
-#define DOCKSTAR_OE_HIGH   (~(0))
-#define DOCKSTAR_OE_VAL_LOW(1 << 29) /* USB_PWEN low */
-#define DOCKSTAR_OE_VAL_HIGH   (1 << 17) 

Re: [PATCH] arm: kirkwood: iConnect : Add Ethernet support

2022-02-03 Thread Stefan Roese

On 2/2/22 06:59, Tony Dinh wrote:

- Currently, CONFIG_RESET_PHY_R symbol is used in
arch/arm/mach-kirkwood/include/mach/config.h for all Kirkwood
boards with mv8831116 PHY, with each board defines the function
reset_phy(). Undefine it for this board.
- Add board_eth_init(), CONFIG_DM_ETH, and CONFIG_PHY_MARVELL
to bring up Ethernet.
- Miscellaneous changes: Move constants to .c file and remove header file
board/iomega/iconnect/iconnect.h. Add CONFIG_HUSH_PARSER, use BIT macro,
and cleanup comments.

Signed-off-by: Tony Dinh 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---

  board/iomega/iconnect/iconnect.c | 17 ++---
  board/iomega/iconnect/iconnect.h | 24 
  configs/iconnect_defconfig   |  6 +-
  include/configs/iconnect.h   | 21 +++--
  4 files changed, 26 insertions(+), 42 deletions(-)
  delete mode 100644 board/iomega/iconnect/iconnect.h

diff --git a/board/iomega/iconnect/iconnect.c b/board/iomega/iconnect/iconnect.c
index 9e123aab00..0387160200 100644
--- a/board/iomega/iconnect/iconnect.c
+++ b/board/iomega/iconnect/iconnect.c
@@ -1,5 +1,6 @@
  // SPDX-License-Identifier: GPL-2.0+
  /*
+ * Copyright (C) 2022 Tony Dinh 
   * Copyright (C) 2009-2012
   * Wojciech Dubowik 
   * Luka Perkov 
@@ -7,15 +8,20 @@
  
  #include 

  #include 
-#include 
+#include 
  #include 
  #include 
  #include 
  #include 
-#include "iconnect.h"
+#include 
  
  DECLARE_GLOBAL_DATA_PTR;
  
+#define ICONNECT_OE_LOW (~BIT(7))

+#define ICONNECT_OE_HIGH(~BIT(10))
+#define ICONNECT_OE_VAL_LOW (0)
+#define ICONNECT_OE_VAL_HIGHBIT(10)
+
  int board_early_init_f(void)
  {
/*
@@ -85,9 +91,14 @@ int board_early_init_f(void)
return 0;
  }
  
+int board_eth_init(struct bd_info *bis)

+{
+   return cpu_eth_init(bis);
+}
+
  int board_init(void)
  {
-   /* adress of boot parameters */
+   /* address of boot parameters */
gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
  
  	return 0;

diff --git a/board/iomega/iconnect/iconnect.h b/board/iomega/iconnect/iconnect.h
deleted file mode 100644
index 4f0be71918..00
--- a/board/iomega/iconnect/iconnect.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2009-2012
- * Wojciech Dubowik 
- * Luka Perkov 
- */
-
-#ifndef __ICONNECT_H
-#define __ICONNECT_H
-
-#define ICONNECT_OE_LOW(~(1 << 7))
-#define ICONNECT_OE_HIGH   (~(1 << 10))
-#define ICONNECT_OE_VAL_LOW(0)
-#define ICONNECT_OE_VAL_HIGH   (1 << 10)
-
-/* PHY related */
-#define MV88E1116_LED_FCTRL_REG10
-#define MV88E1116_CPRSP_CR3_REG21
-#define MV88E1116_MAC_CTRL_REG 21
-#define MV88E1116_PGADR_REG22
-#define MV88E1116_RGMII_TXTM_CTRL  (1 << 4)
-#define MV88E1116_RGMII_RXTM_CTRL  (1 << 5)
-
-#endif /* __ICONNECT_H */
diff --git a/configs/iconnect_defconfig b/configs/iconnect_defconfig
index 1c9c77a292..336fae270a 100644
--- a/configs/iconnect_defconfig
+++ b/configs/iconnect_defconfig
@@ -20,7 +20,8 @@ CONFIG_BOOTCOMMAND="setenv bootargs ${console} ${mtdparts} 
${bootargs_root}; ubi
  CONFIG_USE_PREBOOT=y
  # CONFIG_DISPLAY_BOARDINFO is not set
  CONFIG_BOARD_LATE_INIT=y
-CONFIG_SYS_PROMPT="iconnect => "
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="iConnect> "
  # CONFIG_CMD_FLASH is not set
  CONFIG_CMD_NAND=y
  CONFIG_CMD_PCI=y
@@ -39,11 +40,14 @@ CONFIG_OF_CONTROL=y
  CONFIG_ENV_OVERWRITE=y
  CONFIG_ENV_IS_IN_NAND=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
  CONFIG_NETCONSOLE=y
  CONFIG_DM=y
  # CONFIG_MMC is not set
  CONFIG_MTD=y
  CONFIG_MTD_RAW_NAND=y
+CONFIG_PHY_MARVELL=y
+CONFIG_DM_ETH=y
  CONFIG_MVGBE=y
  CONFIG_MII=y
  CONFIG_PCI=y
diff --git a/include/configs/iconnect.h b/include/configs/iconnect.h
index f1aad1efde..44a4b4409f 100644
--- a/include/configs/iconnect.h
+++ b/include/configs/iconnect.h
@@ -1,5 +1,6 @@
  /* SPDX-License-Identifier: GPL-2.0+ */
  /*
+ * Copyright (C) 2022 Tony Dinh 
   * (C) Copyright 2009-2012
   * Wojciech Dubowik 
   * Luka Perkov 
@@ -10,32 +11,24 @@
  
  #include "mv-common.h"
  
-/*

- * Environment variables configuration
- */
-
-/*
- * Default environment variables
- */
-
  #define CONFIG_EXTRA_ENV_SETTINGS \
"console=console=ttyS0,115200\0"  \
"mtdids=nand0=orion_nand\0"   \
-   "mtdparts="CONFIG_MTDPARTS_DEFAULT\
+   "mtdparts=" CONFIG_MTDPARTS_DEFAULT   \
"kernel=/boot/uImage\0"   \
"bootargs_root=noinitrd ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0"
  
  /*

   * Ethernet driver configuration
+ *
+ * This board has PCIe Wifi card, so allow Ethernet to be disabled
   */
  #ifdef CONFIG_CMD_NET
  #define CONFIG_MVGBE_PORTS{1, 0}  /* enable port 0 only */
  #define CONFIG_PHY_BASE_ADR   11
-#undef CONFIG_RESET_PHY_R
+#ifdef CONFIG_RESET_PHY_R
+#undef CONFIG_RESE

[RFC PATCH 1/2] efi_loader: fix dual signed image certification

2022-02-03 Thread Ilias Apalodimas
The EFI spec allows for images to carry multiple signatures. Currently
we don't adhere to the verification process for such images.

The spec says:
"Multiple signatures are allowed to exist in the binary's certificate
table (as per PE/COFF Section "Attribute Certificate Table"). Only one
hash or signature is required to be present in db in order to pass
validation, so long as neither the SHA-256 hash of the binary nor any
present signature is reflected in dbx."

With our current implementation signing the image with two certificates
and inserting both of them in db and one of them dbx doesn't always reject
the image.  The rejection depends on the order that the image was signed
and the order the certificates are read (and checked) in db.

While at it move the sha256 hash verification outside the signature
checking loop, since it only needs to run once per image and get simplify
the logic for authenticating an unsigned imahe using sha256 hashes.

Signed-off-by: Ilias Apalodimas 
---
 lib/efi_loader/efi_image_loader.c | 88 +++
 1 file changed, 18 insertions(+), 70 deletions(-)

diff --git a/lib/efi_loader/efi_image_loader.c 
b/lib/efi_loader/efi_image_loader.c
index f41cfa4fccd5..5df35939f702 100644
--- a/lib/efi_loader/efi_image_loader.c
+++ b/lib/efi_loader/efi_image_loader.c
@@ -516,53 +516,6 @@ err:
 }
 
 #ifdef CONFIG_EFI_SECURE_BOOT
-/**
- * efi_image_unsigned_authenticate() - authenticate unsigned image with
- * SHA256 hash
- * @regs:  List of regions to be verified
- *
- * If an image is not signed, it doesn't have a signature. In this case,
- * its message digest is calculated and it will be compared with one of
- * hash values stored in signature databases.
- *
- * Return: true if authenticated, false if not
- */
-static bool efi_image_unsigned_authenticate(struct efi_image_regions *regs)
-{
-   struct efi_signature_store *db = NULL, *dbx = NULL;
-   bool ret = false;
-
-   dbx = efi_sigstore_parse_sigdb(u"dbx");
-   if (!dbx) {
-   EFI_PRINT("Getting signature database(dbx) failed\n");
-   goto out;
-   }
-
-   db = efi_sigstore_parse_sigdb(u"db");
-   if (!db) {
-   EFI_PRINT("Getting signature database(db) failed\n");
-   goto out;
-   }
-
-   /* try black-list first */
-   if (efi_signature_lookup_digest(regs, dbx, true)) {
-   EFI_PRINT("Image is not signed and its digest found in 
\"dbx\"\n");
-   goto out;
-   }
-
-   /* try white-list */
-   if (efi_signature_lookup_digest(regs, db, false))
-   ret = true;
-   else
-   EFI_PRINT("Image is not signed and its digest not found in 
\"db\" or \"dbx\"\n");
-
-out:
-   efi_sigstore_free(db);
-   efi_sigstore_free(dbx);
-
-   return ret;
-}
-
 /**
  * efi_image_authenticate() - verify a signature of signed image
  * @efi:   Pointer to image
@@ -608,14 +561,7 @@ static bool efi_image_authenticate(void *efi, size_t 
efi_size)
if (!efi_image_parse(new_efi, efi_size, ®s, &wincerts,
 &wincerts_len)) {
EFI_PRINT("Parsing PE executable image failed\n");
-   goto err;
-   }
-
-   if (!wincerts) {
-   /* The image is not signed */
-   ret = efi_image_unsigned_authenticate(regs);
-
-   goto err;
+   goto out;
}
 
/*
@@ -624,18 +570,18 @@ static bool efi_image_authenticate(void *efi, size_t 
efi_size)
db = efi_sigstore_parse_sigdb(u"db");
if (!db) {
EFI_PRINT("Getting signature database(db) failed\n");
-   goto err;
+   goto out;
}
 
dbx = efi_sigstore_parse_sigdb(u"dbx");
if (!dbx) {
EFI_PRINT("Getting signature database(dbx) failed\n");
-   goto err;
+   goto out;
}
 
if (efi_signature_lookup_digest(regs, dbx, true)) {
EFI_PRINT("Image's digest was found in \"dbx\"\n");
-   goto err;
+   goto out;
}
 
/*
@@ -678,7 +624,8 @@ static bool efi_image_authenticate(void *efi, size_t 
efi_size)
if (guidcmp(auth, &efi_guid_cert_type_pkcs7)) {
EFI_PRINT("Certificate type not supported: 
%pUs\n",
  auth);
-   continue;
+   ret = false;
+   goto out;
}
 
auth += sizeof(efi_guid_t);
@@ -686,7 +633,8 @@ static bool efi_image_authenticate(void *efi, size_t 
efi_size)
} else if (wincert->wCertificateType
!= WIN_CERT_TYPE_PKCS_SIGNED_DATA) {
EFI_PRINT("Certificate type not supported\n");
-   continue;
+   ret = false;

[RFC PATCH 2/2] test/py: efi_secboot: adjust secure boot tests to code changes

2022-02-03 Thread Ilias Apalodimas
The previous patch is changing U-Boot's behavior wrt certificate based
binary authentication.  Specifically an image who's digest of a
certificate is found in dbx is now rejected.  Fix the test accordingly

Signed-off-by: Ilias Apalodimas 
---
 test/py/tests/test_efi_secboot/test_signed.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/test/py/tests/test_efi_secboot/test_signed.py 
b/test/py/tests/test_efi_secboot/test_signed.py
index 0aee34479f55..7f5ec78261da 100644
--- a/test/py/tests/test_efi_secboot/test_signed.py
+++ b/test/py/tests/test_efi_secboot/test_signed.py
@@ -186,7 +186,7 @@ class TestEfiSignedImage(object):
 assert 'Hello, world!' in ''.join(output)
 
 with u_boot_console.log.section('Test Case 5c'):
-# Test Case 5c, not rejected if one of signatures (digest of
+# Test Case 5c, rejected if one of signatures (digest of
 # certificate) is revoked
 output = u_boot_console.run_command_list([
 'fatload host 0:1 400 dbx_hash.auth',
@@ -195,7 +195,8 @@ class TestEfiSignedImage(object):
 output = u_boot_console.run_command_list([
 'efidebug boot next 1',
 'efidebug test bootmgr'])
-assert 'Hello, world!' in ''.join(output)
+assert '\'HELLO\' failed' in ''.join(output)
+assert 'efi_start_image() returned: 26' in ''.join(output)
 
 with u_boot_console.log.section('Test Case 5d'):
 # Test Case 5d, rejected if both of signatures are revoked
-- 
2.32.0



[PATCH] video: Add missing dependency for DM_GPIO

2022-02-03 Thread Michal Simek
Seps driver also requires DM_GPIO to be enabled.

Signed-off-by: Michal Simek 
---

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

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index cfa08b501bad..ff8e11f6489d 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -675,7 +675,7 @@ config VIDEO_NX
 
 config VIDEO_SEPS525
bool "Enable video support for Seps525"
-   depends on DM_VIDEO
+   depends on DM_VIDEO && DM_GPIO
help
  Enable support for the Syncoam PM-OLED display driver (RGB 160x128).
  Currently driver is supporting only SPI interface.
-- 
2.35.0



[PATCH] xilinx: Remove GPIO_EXTRA_HEADER selection

2022-02-03 Thread Michal Simek
Platform specific headers are empty that's why there is no need to include
them. That's why remove them for Zynq/ZynqMP and Versal.

Signed-off-by: Michal Simek 
---

 arch/arm/Kconfig |  4 
 arch/arm/mach-versal/include/mach/gpio.h |  6 --
 arch/arm/mach-zynq/include/mach/gpio.h   | 10 --
 arch/arm/mach-zynqmp/include/mach/gpio.h | 11 ---
 4 files changed, 31 deletions(-)
 delete mode 100644 arch/arm/mach-versal/include/mach/gpio.h
 delete mode 100644 arch/arm/mach-zynq/include/mach/gpio.h
 delete mode 100644 arch/arm/mach-zynqmp/include/mach/gpio.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6b11c3a50d91..ae5002c9e4d1 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1138,7 +1138,6 @@ config ARCH_VERSAL
select DM_MMC if MMC
select DM_SERIAL
select GICV3
-   select GPIO_EXTRA_HEADER
select OF_CONTROL
select SOC_DEVICE
imply BOARD_LATE_INIT
@@ -1164,7 +1163,6 @@ config ARCH_ZYNQ
select DM_SERIAL
select DM_SPI
select DM_SPI_FLASH
-   select GPIO_EXTRA_HEADER
select OF_CONTROL
select SPI
select SPL_BOARD_INIT if SPL
@@ -1191,7 +1189,6 @@ config ARCH_ZYNQMP_R5
select DM_ETH if NET
select DM_MMC if MMC
select DM_SERIAL
-   select GPIO_EXTRA_HEADER
select OF_CONTROL
imply CMD_DM
imply DM_USB_GADGET
@@ -1209,7 +1206,6 @@ config ARCH_ZYNQMP
select DM_SPI_FLASH if DM_SPI
imply FIRMWARE
select GICV2
-   select GPIO_EXTRA_HEADER
select OF_CONTROL
select SPL_BOARD_INIT if SPL
select SPL_CLK if SPL
diff --git a/arch/arm/mach-versal/include/mach/gpio.h 
b/arch/arm/mach-versal/include/mach/gpio.h
deleted file mode 100644
index 677facba5efe..
--- a/arch/arm/mach-versal/include/mach/gpio.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright 2016 - 2018 Xilinx, Inc.
- */
-
-/* Empty file - for compilation */
diff --git a/arch/arm/mach-zynq/include/mach/gpio.h 
b/arch/arm/mach-zynq/include/mach/gpio.h
deleted file mode 100644
index 6143e24563bc..
--- a/arch/arm/mach-zynq/include/mach/gpio.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (c) 2013 Xilinx, Inc.
- * Copyright (c) 2015 DAVE Embedded Systems
- */
-
-#ifndef _ZYNQ_GPIO_H
-#define _ZYNQ_GPIO_H
-
-#endif /* _ZYNQ_GPIO_H */
diff --git a/arch/arm/mach-zynqmp/include/mach/gpio.h 
b/arch/arm/mach-zynqmp/include/mach/gpio.h
deleted file mode 100644
index 542a5fc3e944..
--- a/arch/arm/mach-zynqmp/include/mach/gpio.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright 2015 Xilinx, Inc.
- */
-
-#ifndef __ARCH_ZYNQMP_GPIO_H
-#define __ARCH_ZYNQMP_GPIO_H
-
-/* Empty file - sdhci requires this. */
-
-#endif
-- 
2.35.0



Re: [PATCHv2] arm64: zynqmp: Print the secure boot status information

2022-02-03 Thread Jorge Ramirez-Ortiz, Foundries
On 13/10/21, Jorge Ramirez-Ortiz wrote:
> Output the secure boot configuration to the console.


Hi, Michal
was there any reason for not merging this patch?
thanks
Jorge


> 
> Signed-off-by: Jorge Ramirez-Ortiz 
> ---
> 
>  v2:
>Michal review 12 Aug 2021
>  print information on SPL and UBOOT
>  improve the print command
>  add macros to mask the status
>
>  arch/arm/mach-zynqmp/include/mach/hardware.h |  6 +-
>  board/xilinx/zynqmp/zynqmp.c | 14 ++
>  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-zynqmp/include/mach/hardware.h 
> b/arch/arm/mach-zynqmp/include/mach/hardware.h
> index eebf38551c..c6b1464a9f 100644
> --- a/arch/arm/mach-zynqmp/include/mach/hardware.h
> +++ b/arch/arm/mach-zynqmp/include/mach/hardware.h
> @@ -141,8 +141,12 @@ struct apu_regs {
>  #define ZYNQMP_SILICON_VER_MASK  0xF
>  #define ZYNQMP_SILICON_VER_SHIFT 0
>  
> +#define ZYNQMP_CSU_STATUS_AUTHENTICATED  BIT(0)
> +#define ZYNQMP_CSU_STATUS_ENCRYPTED  BIT(1)
> +
>  struct csu_regs {
> - u32 reserved0[4];
> + u32 status;
> + u32 reserved0[3];
>   u32 multi_boot;
>   u32 reserved1[11];
>   u32 idcode;
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index 000a7cde8d..3e7ca2e9c6 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -358,6 +358,18 @@ static int multi_boot(void)
>   return multiboot;
>  }
>  
> +static void print_secure_boot(void)
> +{
> + u32 status = 0;
> +
> + if (zynqmp_mmio_read((ulong)&csu_base->status, &status))
> + return;
> +
> + printf("Secure Boot:\t%sauthenticated, %sencrypted\n",
> +status & ZYNQMP_CSU_STATUS_AUTHENTICATED ? "" : "not ",
> +status & ZYNQMP_CSU_STATUS_ENCRYPTED ? "" : "not ");
> +}
> +
>  #define PS_SYSMON_ANALOG_BUS_VAL 0x3210
>  #define PS_SYSMON_ANALOG_BUS_REG 0xFFA50914
>  
> @@ -394,6 +406,8 @@ int board_init(void)
>   fpga_add(fpga_xilinx, &zynqmppl);
>  #endif
>  
> + /* display secure boot information */
> + print_secure_boot();
>   if (current_el() == 3)
>   printf("Multiboot:\t%d\n", multi_boot());
>  
> -- 
> 2.31.1
>