Re: [PATCH] xilinx: zynqmp: Fix SPL_FS_LOAD_PAYLOAD_NAME usage

2022-12-04 Thread Michal Simek




On 12/2/22 14:06, Michal Simek wrote:

SPL_FS_LOAD_PAYLOAD_NAME depends on SPL to be enabled.
If SPL is not enabled code still expects SPL_FS_LOAD_PAYLOAD_NAME to be
present. That's why setup proper dependency in the code.
And by doing so also change the logic around dfu_alt_info string
composition to be simpler.

Signed-off-by: Michal Simek 
---

  board/xilinx/zynqmp/zynqmp.c | 45 +++-
  1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 5fe0873fe221..579708d2e0cf 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -611,8 +611,7 @@ enum env_location env_get_location(enum env_operation op, 
int prio)
  
  void set_dfu_alt_info(char *interface, char *devstr)

  {
-   int multiboot;
-   int bootseq = 0;
+   int multiboot, bootseq = 0, len = 0;
  
  	ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
  
@@ -634,29 +633,33 @@ void set_dfu_alt_info(char *interface, char *devstr)

case SD1_LSHFT_MODE:
case SD_MODE1:
bootseq = mmc_get_env_dev();
-   if (!multiboot)
-   snprintf(buf, DFU_ALT_BUF_LEN,
-"mmc %d=boot.bin fat %d 1;"
-"%s fat %d 1",
-bootseq, bootseq,
-CONFIG_SPL_FS_LOAD_PAYLOAD_NAME, bootseq);
-   else
-   snprintf(buf, DFU_ALT_BUF_LEN,
-"mmc %d=boot%04d.bin fat %d 1;"
-"%s fat %d 1",
-bootseq, multiboot, bootseq,
-CONFIG_SPL_FS_LOAD_PAYLOAD_NAME, bootseq);
+
+   len += snprintf(buf + len, DFU_ALT_BUF_LEN, "mmc %d=boot",
+  bootseq);
+
+   if (multiboot)
+   len += snprintf(buf + len, DFU_ALT_BUF_LEN,
+  "%04d", multiboot);
+
+   len += snprintf(buf + len, DFU_ALT_BUF_LEN, ".bin fat %d 1",
+  bootseq);
+#if defined(CONFIG_SPL_FS_LOAD_PAYLOAD_NAME)
+   len += snprintf(buf + len, DFU_ALT_BUF_LEN, ";%s fat %d 1",
+  CONFIG_SPL_FS_LOAD_PAYLOAD_NAME, bootseq);
+#endif
break;
-#if defined(CONFIG_SYS_SPI_U_BOOT_OFFS)
case QSPI_MODE_24BIT:
case QSPI_MODE_32BIT:
-   snprintf(buf, DFU_ALT_BUF_LEN,
-"sf 0:0=boot.bin raw %x 0x150;"
-"%s raw 0x%x 0x50",
-multiboot * SZ_32K, CONFIG_SPL_FS_LOAD_PAYLOAD_NAME,
-CONFIG_SYS_SPI_U_BOOT_OFFS);
-   break;
+   len += snprintf(buf + len, DFU_ALT_BUF_LEN,
+  "sf 0:0=boot.bin raw %x 0x150",
+  multiboot * SZ_32K);
+#if defined(CONFIG_SPL_FS_LOAD_PAYLOAD_NAME) && 
defined(CONFIG_SYS_SPI_U_BOOT_OFFS)
+   len += snprintf(buf + len, DFU_ALT_BUF_LEN,
+  ";%s raw 0x%x 0x50",
+  CONFIG_SPL_FS_LOAD_PAYLOAD_NAME,
+  CONFIG_SYS_SPI_U_BOOT_OFFS);
  #endif
+   break;
default:
return;
}



Applied.
M


Re: [PATCH] arm64: versal-net: Enable defconfig for Micron octal flashes

2022-12-04 Thread Michal Simek




On 11/29/22 11:18, Michal Simek wrote:

From: Ashok Reddy Soma 

Micron mt35 series octal flashes are under config option
CONFIG_SPI_FLASH_MT35XU. Enable it in default defconfig for octal
flashes to be detected.

Signed-off-by: Ashok Reddy Soma 
Signed-off-by: Michal Simek 
---

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

diff --git a/configs/xilinx_versal_net_virt_defconfig 
b/configs/xilinx_versal_net_virt_defconfig
index 431a8de9fcf2..2fdf99f7cbbd 100644
--- a/configs/xilinx_versal_net_virt_defconfig
+++ b/configs/xilinx_versal_net_virt_defconfig
@@ -87,6 +87,7 @@ CONFIG_SPI_FLASH_ISSI=y
  CONFIG_SPI_FLASH_MACRONIX=y
  CONFIG_SPI_FLASH_SPANSION=y
  CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MT35XU=y
  CONFIG_SPI_FLASH_SST=y
  CONFIG_SPI_FLASH_WINBOND=y
  # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set


Applied.
M


Re: [PATCH] spi: cadence-qspi: Remove condition for calling enable linear mode

2022-12-04 Thread Michal Simek




On 11/29/22 12:41, Ashok Reddy Soma wrote:

cadence_qspi_apb_enable_linear_mode() has a weak function defined, so no
need to gaurd this under if (CONFIG_IS_ENABLED(ARCH_VERSAL)).

In cadence_qspi_apb_write_execute(), enable linear mode is called twice by
mistake, remove extra one.

Signed-off-by: Ashok Reddy Soma 
---

  drivers/spi/cadence_qspi_apb.c | 6 +-
  1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c
index cfae5dcbda..d1f89138ef 100644
--- a/drivers/spi/cadence_qspi_apb.c
+++ b/drivers/spi/cadence_qspi_apb.c
@@ -735,8 +735,7 @@ int cadence_qspi_apb_read_execute(struct cadence_spi_priv 
*priv,
void *buf = op->data.buf.in;
size_t len = op->data.nbytes;
  
-	if (CONFIG_IS_ENABLED(ARCH_VERSAL))

-   cadence_qspi_apb_enable_linear_mode(true);
+   cadence_qspi_apb_enable_linear_mode(true);
  
  	if (priv->use_dac_mode && (from + len < priv->ahbsize)) {

if (len < 256 ||
@@ -905,9 +904,6 @@ int cadence_qspi_apb_write_execute(struct cadence_spi_priv 
*priv,
const void *buf = op->data.buf.out;
size_t len = op->data.nbytes;
  
-	if (CONFIG_IS_ENABLED(ARCH_VERSAL))

-   cadence_qspi_apb_enable_linear_mode(true);
-
/*
 * Some flashes like the Cypress Semper flash expect a dummy 4-byte
 * address (all 0s) with the read status register command in DTR mode.


Applied.
M


Re: [PATCH] ARM: zynq: Add missing twd timer for mini configurations

2022-12-04 Thread Michal Simek




On 11/29/22 13:23, Michal Simek wrote:

The commit b7e0750d8872 ("zynq: Convert arm twd timer to DM driver")
switched timer to DM but missing to add nodes to all mini configurations.
Based on it missing timer end up in non functional system where any delay
doesn't work.

Signed-off-by: Michal Simek 
---

  arch/arm/dts/zynq-cse-nand.dts  | 7 +++
  arch/arm/dts/zynq-cse-nor.dts   | 7 +++
  arch/arm/dts/zynq-cse-qspi.dtsi | 7 +++
  3 files changed, 21 insertions(+)

diff --git a/arch/arm/dts/zynq-cse-nand.dts b/arch/arm/dts/zynq-cse-nand.dts
index 32cb3bffcb94..27adfb921622 100644
--- a/arch/arm/dts/zynq-cse-nand.dts
+++ b/arch/arm/dts/zynq-cse-nand.dts
@@ -86,6 +86,13 @@
reg = <0x100 0x100>;
};
};
+
+   scutimer: timer@f8f00600 {
+   u-boot,dm-pre-reloc;
+   compatible = "arm,cortex-a9-twd-timer";
+   reg = <0xf8f00600 0x20>;
+   clock-frequency = <3>;
+   };
};
  };
  
diff --git a/arch/arm/dts/zynq-cse-nor.dts b/arch/arm/dts/zynq-cse-nor.dts

index 197fbd717aae..f22a149f7924 100644
--- a/arch/arm/dts/zynq-cse-nor.dts
+++ b/arch/arm/dts/zynq-cse-nor.dts
@@ -85,6 +85,13 @@
#address-cells = <1>;
#size-cells = <1>;
};
+
+   scutimer: timer@f8f00600 {
+   u-boot,dm-pre-reloc;
+   compatible = "arm,cortex-a9-twd-timer";
+   reg = <0xf8f00600 0x20>;
+   clock-frequency = <3>;
+   };
};
  };
  
diff --git a/arch/arm/dts/zynq-cse-qspi.dtsi b/arch/arm/dts/zynq-cse-qspi.dtsi

index 38410eeca886..f7ac92b8026d 100644
--- a/arch/arm/dts/zynq-cse-qspi.dtsi
+++ b/arch/arm/dts/zynq-cse-qspi.dtsi
@@ -116,6 +116,13 @@
reg = <0x100 0x100>;
};
};
+
+   scutimer: timer@f8f00600 {
+   u-boot,dm-pre-reloc;
+   compatible = "arm,cortex-a9-twd-timer";
+   reg = <0xf8f00600 0x20>;
+   clock-frequency = <3>;
+   };
};
  
  };


Applied.
M


Re: [PATCH] arm64: zynqmp: Do not enable IPI by default

2022-12-04 Thread Michal Simek




On 11/29/22 16:09, Michal Simek wrote:

ZynqMP mini configurations are not using IPI driver and enabling this is
adding additional ~1200 Bytes (depends on configuration).
This ends up in situation that there is no enough space in OCM for
relocation that's why disable this driver for all mini configurations.

Signed-off-by: Michal Simek 
---

  arch/arm/Kconfig | 4 ++--
  configs/xilinx_zynqmp_mini_defconfig | 1 +
  configs/xilinx_zynqmp_mini_emmc0_defconfig   | 1 +
  configs/xilinx_zynqmp_mini_emmc1_defconfig   | 1 +
  configs/xilinx_zynqmp_mini_nand_defconfig| 1 +
  configs/xilinx_zynqmp_mini_nand_single_defconfig | 1 +
  configs/xilinx_zynqmp_mini_qspi_defconfig| 1 +
  7 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f95ed71b2466..3f68d0988b7f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1302,7 +1302,7 @@ config ARCH_ZYNQMP
select DM
select DEBUG_UART_BOARD_INIT if SPL && DEBUG_UART
select DM_ETH if NET
-   select DM_MAILBOX
+   imply DM_MAILBOX
select DM_MMC if MMC
select DM_SERIAL
select DM_SPI if SPI
@@ -1319,7 +1319,7 @@ config ARCH_ZYNQMP
imply SPL_FIRMWARE if SPL
select SPL_SEPARATE_BSS if SPL
select SUPPORT_SPL
-   select ZYNQMP_IPI
+   imply ZYNQMP_IPI if DM_MAILBOX
select SOC_DEVICE
imply BOARD_LATE_INIT
imply CMD_DM
diff --git a/configs/xilinx_zynqmp_mini_defconfig 
b/configs/xilinx_zynqmp_mini_defconfig
index 245b6a42b935..f29128bf55d9 100644
--- a/configs/xilinx_zynqmp_mini_defconfig
+++ b/configs/xilinx_zynqmp_mini_defconfig
@@ -59,6 +59,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
  # CONFIG_NET is not set
  # CONFIG_DM_WARN is not set
  # CONFIG_DM_DEVICE_REMOVE is not set
+# CONFIG_DM_MAILBOX is not set
  # CONFIG_MMC is not set
  CONFIG_ARM_DCC=y
  CONFIG_PANIC_HANG=y
diff --git a/configs/xilinx_zynqmp_mini_emmc0_defconfig 
b/configs/xilinx_zynqmp_mini_emmc0_defconfig
index adf1dae66ede..611da78239db 100644
--- a/configs/xilinx_zynqmp_mini_emmc0_defconfig
+++ b/configs/xilinx_zynqmp_mini_emmc0_defconfig
@@ -71,6 +71,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
  # CONFIG_DM_WARN is not set
  # CONFIG_DM_DEVICE_REMOVE is not set
  CONFIG_SPL_DM_SEQ_ALIAS=y
+# CONFIG_DM_MAILBOX is not set
  CONFIG_SUPPORT_EMMC_BOOT=y
  CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_ZYNQ=y
diff --git a/configs/xilinx_zynqmp_mini_emmc1_defconfig 
b/configs/xilinx_zynqmp_mini_emmc1_defconfig
index 9d799ad0e3d5..c8084e6ae050 100644
--- a/configs/xilinx_zynqmp_mini_emmc1_defconfig
+++ b/configs/xilinx_zynqmp_mini_emmc1_defconfig
@@ -71,6 +71,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
  # CONFIG_DM_WARN is not set
  # CONFIG_DM_DEVICE_REMOVE is not set
  CONFIG_SPL_DM_SEQ_ALIAS=y
+# CONFIG_DM_MAILBOX is not set
  CONFIG_SUPPORT_EMMC_BOOT=y
  CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_ZYNQ=y
diff --git a/configs/xilinx_zynqmp_mini_nand_defconfig 
b/configs/xilinx_zynqmp_mini_nand_defconfig
index 29040a39e970..f5a467940266 100644
--- a/configs/xilinx_zynqmp_mini_nand_defconfig
+++ b/configs/xilinx_zynqmp_mini_nand_defconfig
@@ -55,6 +55,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
  # CONFIG_NET is not set
  # CONFIG_DM_WARN is not set
  # CONFIG_DM_DEVICE_REMOVE is not set
+# CONFIG_DM_MAILBOX is not set
  # CONFIG_MMC is not set
  CONFIG_MTD=y
  CONFIG_DM_MTD=y
diff --git a/configs/xilinx_zynqmp_mini_nand_single_defconfig 
b/configs/xilinx_zynqmp_mini_nand_single_defconfig
index 7c17c061d424..61c44e2a6a44 100644
--- a/configs/xilinx_zynqmp_mini_nand_single_defconfig
+++ b/configs/xilinx_zynqmp_mini_nand_single_defconfig
@@ -55,6 +55,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
  # CONFIG_NET is not set
  # CONFIG_DM_WARN is not set
  # CONFIG_DM_DEVICE_REMOVE is not set
+# CONFIG_DM_MAILBOX is not set
  # CONFIG_MMC is not set
  CONFIG_MTD=y
  CONFIG_DM_MTD=y
diff --git a/configs/xilinx_zynqmp_mini_qspi_defconfig 
b/configs/xilinx_zynqmp_mini_qspi_defconfig
index 513b51998d25..a4b754e09ebb 100644
--- a/configs/xilinx_zynqmp_mini_qspi_defconfig
+++ b/configs/xilinx_zynqmp_mini_qspi_defconfig
@@ -76,6 +76,7 @@ CONFIG_SPL_DM_SEQ_ALIAS=y
  # CONFIG_GPIO is not set
  # CONFIG_I2C is not set
  # CONFIG_INPUT is not set
+# CONFIG_DM_MAILBOX is not set
  # CONFIG_MMC is not set
  # CONFIG_SPI_FLASH_SMART_HWCAPS is not set
  # CONFIG_SPI_FLASH_UNLOCK_ALL is not set


Applied.
M


Re: [PATCH] arm64: zynqmp: Do not include psu_init to U-Boot by default

2022-12-04 Thread Michal Simek




On 12/2/22 09:18, Michal Simek wrote:

The commit ed35de617013 ("Convert CONFIG_ZYNQMP_PSU_INIT_ENABLED to
Kconfig") converted CONFIG_ZYNQMP_PSU_INIT_ENABLED symbol and enabled it by
default which is not correct configuration.
Intention of this config was to have it enabled by default for SPL and
provide an option to users to also do low level initialization directly
from U-Boot.
That's why it is necessary to define second symbol with SPL marking in it
and properly use symbols depends on usage in Makefile.
Also disable ZYNQMP_PSU_INIT_ENABLED from boards which enables it by
default. CONFIG_SPL_ZYNQMP_PSU_INIT_ENABLED is enabled by default when SPL
is enabled.

Reported-by: Venkatesh Yadav Abbarapu 
Signed-off-by: Michal Simek 
---

  arch/arm/mach-zynqmp/Kconfig | 9 -
  arch/arm/mach-zynqmp/Makefile| 2 +-
  board/xilinx/zynqmp/Makefile | 6 +-
  ...vnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig | 1 -
  configs/xilinx_zynqmp_mini_defconfig | 1 -
  configs/xilinx_zynqmp_mini_emmc0_defconfig   | 1 -
  configs/xilinx_zynqmp_mini_emmc1_defconfig   | 1 -
  configs/xilinx_zynqmp_mini_nand_defconfig| 1 -
  configs/xilinx_zynqmp_mini_nand_single_defconfig | 1 -
  configs/xilinx_zynqmp_mini_qspi_defconfig| 1 -
  10 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-zynqmp/Kconfig b/arch/arm/mach-zynqmp/Kconfig
index 66045067d2fe..fd6f07715a83 100644
--- a/arch/arm/mach-zynqmp/Kconfig
+++ b/arch/arm/mach-zynqmp/Kconfig
@@ -142,7 +142,14 @@ config ZYNQMP_PSU_INIT_ENABLED
bool "Include psu_init"
select BOARD_EARLY_INIT_F
help
- Include psu_init to full u-boot. SPL include psu_init by default.
+ Include psu_init to full u-boot.
+
+config SPL_ZYNQMP_PSU_INIT_ENABLED
+   bool "Include psu_init in SPL"
+   default y if SPL
+   select BOARD_EARLY_INIT_F
+   help
+ Include psu_init by default in SPL.
  
  config SPL_ZYNQMP_ALT_BOOTMODE_ENABLED

bool "Overwrite SPL bootmode"
diff --git a/arch/arm/mach-zynqmp/Makefile b/arch/arm/mach-zynqmp/Makefile
index 4f9f6b56a98a..bb1830c84625 100644
--- a/arch/arm/mach-zynqmp/Makefile
+++ b/arch/arm/mach-zynqmp/Makefile
@@ -8,4 +8,4 @@ obj-y   += cpu.o
  obj-$(CONFIG_MP)  += mp.o
  obj-$(CONFIG_SPL_BUILD) += spl.o handoff.o psu_spl_init.o
  obj-$(CONFIG_SPL_ZYNQMP_DRAM_ECC_INIT) += ecc_spl_init.o
-obj-$(CONFIG_ZYNQMP_PSU_INIT_ENABLED)  += psu_spl_init.o
+obj-$(CONFIG_$(SPL_)ZYNQMP_PSU_INIT_ENABLED)   += psu_spl_init.o
diff --git a/board/xilinx/zynqmp/Makefile b/board/xilinx/zynqmp/Makefile
index a91402875332..732f909fc215 100644
--- a/board/xilinx/zynqmp/Makefile
+++ b/board/xilinx/zynqmp/Makefile
@@ -31,11 +31,7 @@ $(warning Put custom psu_init_gpl.c/h to 
board/xilinx/zynqmp/custom_hw_platform/
  endif
  endif
  
-ifdef_any_of = $(filter-out undefined,$(foreach v,$(1),$(origin $(v

-
-ifneq ($(call ifdef_any_of, CONFIG_ZYNQMP_PSU_INIT_ENABLED CONFIG_SPL_BUILD),)
-obj-y += $(init-objs)
-endif
+obj-$(CONFIG_$(SPL_)ZYNQMP_PSU_INIT_ENABLED) += $(init-objs)
  
  ifdef CONFIG_SPL_BUILD

  ifneq ($(CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE),"")
diff --git a/configs/avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig 
b/configs/avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig
index ce07f1633e04..0a3d710a8b1f 100644
--- a/configs/avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig
+++ b/configs/avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig
@@ -8,7 +8,6 @@ 
CONFIG_DEFAULT_DEVICE_TREE="avnet-ultrazedev-cc-v1.0-ultrazedev-som-v1.0"
  CONFIG_SPL=y
  CONFIG_SPL_SPI_FLASH_SUPPORT=y
  CONFIG_SPL_SPI=y
-CONFIG_ZYNQMP_PSU_INIT_ENABLED=y
  CONFIG_SYS_LOAD_ADDR=0x800
  CONFIG_DEBUG_UART=y
  CONFIG_SYS_MEMTEST_START=0x
diff --git a/configs/xilinx_zynqmp_mini_defconfig 
b/configs/xilinx_zynqmp_mini_defconfig
index f29128bf55d9..d8b3aab94f1f 100644
--- a/configs/xilinx_zynqmp_mini_defconfig
+++ b/configs/xilinx_zynqmp_mini_defconfig
@@ -7,7 +7,6 @@ CONFIG_SYS_MALLOC_LEN=0x1a00
  CONFIG_ENV_SIZE=0x80
  CONFIG_DEFAULT_DEVICE_TREE="zynqmp-mini"
  CONFIG_SYS_MEM_RSVD_FOR_MMU=y
-CONFIG_ZYNQMP_PSU_INIT_ENABLED=y
  # CONFIG_CMD_ZYNQMP is not set
  CONFIG_SYS_LOAD_ADDR=0x800
  CONFIG_SYS_MEMTEST_START=0x
diff --git a/configs/xilinx_zynqmp_mini_emmc0_defconfig 
b/configs/xilinx_zynqmp_mini_emmc0_defconfig
index 611da78239db..a1ee98dfc252 100644
--- a/configs/xilinx_zynqmp_mini_emmc0_defconfig
+++ b/configs/xilinx_zynqmp_mini_emmc0_defconfig
@@ -10,7 +10,6 @@ CONFIG_ENV_SIZE=0x80
  CONFIG_DEFAULT_DEVICE_TREE="zynqmp-mini-emmc0"
  CONFIG_SPL_SYS_MALLOC_F_LEN=0x600
  CONFIG_SPL=y
-CONFIG_ZYNQMP_PSU_INIT_ENABLED=y
  # CONFIG_CMD_ZYNQMP is not set
  CONFIG_SYS_LOAD_ADDR=0x800
  CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
diff --git a/configs/xilinx_zynqmp_mini_emmc1_defconfig 

Re: [PATCH] board/xilinx/zynqmp/MAINTAINERS: change e-mail address for Luca Ceresoli

2022-12-04 Thread Michal Simek




On 12/3/22 22:49, Luca Ceresoli wrote:

My Bootlin address is the preferred one now.

Signed-off-by: Luca Ceresoli 
Signed-off-by: Luca Ceresoli 
---
  board/xilinx/zynqmp/MAINTAINERS | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/xilinx/zynqmp/MAINTAINERS b/board/xilinx/zynqmp/MAINTAINERS
index 17a2766413c6..07b91b81c95b 100644
--- a/board/xilinx/zynqmp/MAINTAINERS
+++ b/board/xilinx/zynqmp/MAINTAINERS
@@ -11,7 +11,7 @@ F:configs/xilinx_zynqmp*
  F:configs/avnet_ultra96_rev1_defconfig
  
  ARM ZYNQMP AVNET ULTRAZED EV BOARD

-M: Luca Ceresoli 
+M: Luca Ceresoli 
  S:Maintained
  F:arch/arm/dts/avnet-ultrazedev-*
  F:configs/avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0_defconfig


Applied.
M


Please pull u-boot-i2c

2022-12-04 Thread Heiko Schocher
Hello Tom,

please pull from u-boot-i2c:

The following changes since commit d2c5607edde2544e059fa871927877213f6bd532:

  Merge tag 'efi-2023-01-rc3' of 
https://source.denx.de/u-boot/custodians/u-boot-efi (2022-12-04
10:01:48 -0500)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-i2c.git 
tags/i2cfixes-for-v2023.01-rc3

for you to fetch changes up to d7b8fa1a6cd3201c3b71ed7c7b2b6e6eab00173b:

  i2c: nuvoton: renamed the NPCM i2c driver (2022-12-05 06:00:37 +0100)


i2c Fixes for v2023.01-rc3

- nuovoton driver:
  rename npcm_i2c -> npcm-i2c from Jim Liu


Jim Liu (1):
  i2c: nuvoton: renamed the NPCM i2c driver

 drivers/i2c/{npcm-i2c.c => npcm_i2c.c} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename drivers/i2c/{npcm-i2c.c => npcm_i2c.c} (100%)

Azure build looks good:

https://dev.azure.com/hs0298/hs/_build/results?buildId=86=results

Thanks!

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


Re: [PATCH v1] i2c: nuvoton: renamed the NPCM i2c driver

2022-12-04 Thread Heiko Schocher
Hello Jim Liu,

On 21.11.22 09:59, Jim Liu wrote:
> The Makefile name is npcm_i2c but the driver is npcm-i2c.
> 
> Signed-off-by: Jim Liu 
> ---
>  drivers/i2c/{npcm-i2c.c => npcm_i2c.c} | 0
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  rename drivers/i2c/{npcm-i2c.c => npcm_i2c.c} (100%)
> 
> diff --git a/drivers/i2c/npcm-i2c.c b/drivers/i2c/npcm_i2c.c
> similarity index 100%
> rename from drivers/i2c/npcm-i2c.c
> rename to drivers/i2c/npcm_i2c.c
> 

Applied to u-boot-i2c master, thanks!

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


Re: [PATCH 1/1] doc: board: typo GIUD Microchip MPFS Icicle Kit doc

2022-12-04 Thread Padmarao.Begari
> On Wed, 2022-11-30 at 18:03 +0100, Heinrich Schuchardt wrote:
> %s/GIUD/GUID/
> 
> Fixes: 9e550e18305f ("doc: board: Add Microchip MPFS Icicle Kit doc")
> Signed-off-by: Heinrich Schuchardt  >
> ---
>  doc/board/microchip/mpfs_icicle.rst | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Padmarao Begari 

> diff --git a/doc/board/microchip/mpfs_icicle.rst
> b/doc/board/microchip/mpfs_icicle.rst
> index a4b10c6bd7..09c2c6a9c1 100644
> --- a/doc/board/microchip/mpfs_icicle.rst
> +++ b/doc/board/microchip/mpfs_icicle.rst
> @@ -209,7 +209,7 @@ GUID type
>  ~
> 
>  The HSS always picks up HSS payload from a GPT partition with
> -GIUD type "21686148-6449-6E6F-744E-656564454649" or sector '0' of
> the eMMC if no
> +GUID type "21686148-6449-6E6F-744E-656564454649" or sector '0' of
> the eMMC if no
>  GPT partition.
> 
>  Booting
> @@ -460,7 +460,7 @@ GUID type
>  ~
> 
>  The HSS always picks up the HSS payload from a GPT partition with
> -GIUD type "21686148-6449-6E6F-744E-656564454649" or sector '0' of
> the eMMC if no
> +GUID type "21686148-6449-6E6F-744E-656564454649" or sector '0' of
> the eMMC if no
>  GPT partition.
> 
>  Sample boot log from MPFS Icicle Kit
> --
> 2.37.2
> 


Re: [PATCH] serial: Use -EAGAIN in getc and putc

2022-12-04 Thread Stefan Roese

On 12/4/22 13:36, Pali Rohár wrote:

U-Boot serial code already handles -EAGAIN value from getc and putc
callbacks. So change drivers code to return -EAGAIN when HW is busy instead
of doing its own busy loop and waiting until HW is ready.

Signed-off-by: Pali Rohár 


Reviewed-by: Stefan Roese 

Thanks,
Stefan


---
  drivers/serial/serial_arc.c | 8 
  drivers/serial/serial_lpuart.c  | 8 
  drivers/serial/serial_mvebu_a3700.c | 8 
  3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c
index b2d95bdbe18d..c2fc8a901e25 100644
--- a/drivers/serial/serial_arc.c
+++ b/drivers/serial/serial_arc.c
@@ -53,8 +53,8 @@ static int arc_serial_putc(struct udevice *dev, const char c)
struct arc_serial_plat *plat = dev_get_plat(dev);
struct arc_serial_regs *const regs = plat->reg;
  
-	while (!(readb(>status) & UART_TXEMPTY))

-   ;
+   if (!(readb(>status) & UART_TXEMPTY))
+   return -EAGAIN;
  
  	writeb(c, >data);
  
@@ -83,8 +83,8 @@ static int arc_serial_getc(struct udevice *dev)

struct arc_serial_plat *plat = dev_get_plat(dev);
struct arc_serial_regs *const regs = plat->reg;
  
-	while (!arc_serial_tstc(regs))

-   ;
+   if (!arc_serial_tstc(regs))
+   return -EAGAIN;
  
  	/* Check for overflow errors */

if (readb(>status) & UART_OVERFLOW_ERR)
diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index ff576da516d4..d7259d531b55 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -168,8 +168,8 @@ static void _lpuart_serial_setbrg(struct udevice *dev,
  static int _lpuart_serial_getc(struct lpuart_serial_plat *plat)
  {
struct lpuart_fsl *base = plat->reg;
-   while (!(__raw_readb(>us1) & (US1_RDRF | US1_OR)))
-   schedule();
+   if (!(__raw_readb(>us1) & (US1_RDRF | US1_OR)))
+   return -EAGAIN;
  
  	barrier();
  
@@ -181,8 +181,8 @@ static void _lpuart_serial_putc(struct lpuart_serial_plat *plat,

  {
struct lpuart_fsl *base = plat->reg;
  
-	while (!(__raw_readb(>us1) & US1_TDRE))

-   schedule();
+   if (!(__raw_readb(>us1) & US1_TDRE))
+   return -EAGAIN;
  
  	__raw_writeb(c, >ud);

  }
diff --git a/drivers/serial/serial_mvebu_a3700.c 
b/drivers/serial/serial_mvebu_a3700.c
index 0fcd7e88acee..b2017c645565 100644
--- a/drivers/serial/serial_mvebu_a3700.c
+++ b/drivers/serial/serial_mvebu_a3700.c
@@ -40,8 +40,8 @@ static int mvebu_serial_putc(struct udevice *dev, const char 
ch)
struct mvebu_plat *plat = dev_get_plat(dev);
void __iomem *base = plat->base;
  
-	while (readl(base + UART_STATUS_REG) & UART_STATUS_TXFIFO_FULL)

-   ;
+   if (readl(base + UART_STATUS_REG) & UART_STATUS_TXFIFO_FULL)
+   return -EAGAIN;
  
  	writel(ch, base + UART_TX_REG);
  
@@ -53,8 +53,8 @@ static int mvebu_serial_getc(struct udevice *dev)

struct mvebu_plat *plat = dev_get_plat(dev);
void __iomem *base = plat->base;
  
-	while (!(readl(base + UART_STATUS_REG) & UART_STATUS_RX_RDY))

-   ;
+   if (!(readl(base + UART_STATUS_REG) & UART_STATUS_RX_RDY))
+   return -EAGAIN;
  
  	return readl(base + UART_RX_REG) & 0xff;

  }


Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,  Managing Director: Erika Unter
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 v5 3/3] board: qemu-riscv: enable semihosting

2022-12-04 Thread Kautuk Consul
Hi,

On Sat, Dec 3, 2022 at 9:44 AM Bin Meng  wrote:
>
> On Fri, Sep 23, 2022 at 3:03 PM Kautuk Consul  
> wrote:
> >
> > To enable semihosting we also need to enable the following
> > configs in defconfigs:
> > CONFIG_SEMIHOSTING
> > CONFIG_SPL_SEMIHOSTING
> > CONFIG_SEMIHOSTING_SERIAL
> > CONFIG_SERIAL_PROBE_ALL
> > CONFIG_SPL_FS_EXT4
> > CONFIG_SPL_FS_FAT
>
> Why should these _SPL_FS_xxx be required? If it's required by
> SEMIHOSTING, could the dependency be fixed there?

The build dependencies require that these options be there.

>
> >
> > Signed-off-by: Kautuk Consul 
> > ---
> >  configs/qemu-riscv32_defconfig   | 4 
> >  configs/qemu-riscv32_smode_defconfig | 4 
> >  configs/qemu-riscv32_spl_defconfig   | 7 +++
> >  configs/qemu-riscv64_defconfig   | 4 
> >  configs/qemu-riscv64_smode_defconfig | 4 
> >  configs/qemu-riscv64_spl_defconfig   | 7 +++
> >  6 files changed, 30 insertions(+)
> >
>
> Regards,
> Bin


Re: [PATCH v5 0/3] Add riscv semihosting support in u-boot

2022-12-04 Thread Kautuk Consul
Sorry about that! I assumed everyone would know the option and decided to
just upt the ordinary command
to show that the semihosting changes don't impact the non-semihosting
scenarios.

On Sat, Dec 3, 2022 at 11:32 AM Bin Meng  wrote:

> Hi Kautuk,
>
> On Sat, Dec 3, 2022 at 12:28 PM Bin Meng  wrote:
> >
> > On Tue, Nov 29, 2022 at 2:58 PM Kautuk Consul 
> wrote:
> > >
> > > I have tested it both on Qemu and Ventana's internal simulator.
> >
> > How to verify this? I used your instructions and U-Boot says: No match
> > for driver 'serial_semihosting'
> >
> > U-Boot 2023.01-rc2-00113-g2a4accaf5e (Dec 03 2022 - 12:20:20 +0800)
> > CPU: rv64imafdch_zicsr_zifencei_zihintpause_zba_zbb_zbc_zbs_sstc
> > Model: riscv-virtio,qemu
> > DRAM: 256 MiB
> > No match for driver 'serial_semihosting'
> > Some drivers were not found
> > Core: 25 devices, 12 uclasses, devicetree: board
> > Flash: 32 MiB
> > Loading Environment from nowhere... OK
> > In: serial@1000
> > Out: serial@1000
> > Err: serial@1000
> > Net: No ethernet found.
> > Working FDT set to 8f734950
> > Hit any key to stop autoboot: 0
> > =>
> >
> > >
> > > On Tue, Nov 29, 2022 at 12:06 PM Bin Meng  wrote:
> > >>
> > >> Hi Kautuk,
> > >>
> > >> On Tue, Nov 29, 2022 at 2:29 PM Kautuk Consul <
> kcon...@ventanamicro.com> wrote:
> > >> >
> > >> > Hi,
> > >> >
> > >> > Can someone pick this patchset up ?
> > >> >
> > >> > It has been reviewed and there has been no comment on this in
> recent days.
> > >> >
> > >> > Thanks.
> > >> >
> > >> > On Fri, Sep 23, 2022 at 12:33 PM Kautuk Consul <
> kcon...@ventanamicro.com> wrote:
> > >> >>
> > >> >> Semihosting is a mechanism that enables code running on
> > >> >> a target to communicate and use the Input/Output
> > >> >> facilities on a host computer that is running a debugger.
> > >> >> This patchset adds support for semihosting in u-boot
> > >> >> for RISCV64 targets.
> > >> >>
> > >> >> CHANGES since v4:
> > >> >> -   Check arch dependencies for SEMIHOSTING as well as
> SPL_SEMIHOSTING
> > >> >> config options as per Sean's comment.
> > >> >> -   arch/riscv/lib/interrupts.c: Check for post and pre
> instructions
> > >> >> of the ebreak statement whether they are as per the RISCV
> > >> >> semihosting specification. Only then do a
> disable_semihosting
> > >> >> and epc += 4 and return.
> > >> >>
> > >> >> Compilation and test commands for SPL and S-mode configurations
> > >> >> =
> > >> >>
> > >> >> U-Boot S-mode on QEMU virt
> > >> >> 
> > >> >> // Compilation of S-mode u-boot
> > >> >> ARCH=riscv
> > >> >> CROSS_COMPILE=riscv64-unknown-linux-gnu-
> > >> >> make qemu-riscv64_smode_defconfig
> > >> >> make
> > >> >> // Run riscv 64-bit u-boot with opensbi on qemu
> > >> >> qemu-system-riscv64 -M virt -m 256M -display none -serial stdio
> -bios\
> > >> >> opensbi/build/platform/generic/firmware/fw_jump.bin -kernel\
> > >> >> u-boot/u-boot.bin
>
> It turns out your instructions missed "-semihosting" in the QEMU command
> line.
>
> With that I can see U-Boot boots with the serial_semihosting driver.
>
> > >> >>
> > >> >> U-Boot SPL on QEMU virt
> > >> >> 
> > >> >> // Compilation of u-boot-spl
> > >> >> ARCH=riscv
> > >> >> CROSS_COMPILE=riscv64-unknown-linux-gnu-
> > >> >> make qemu-riscv64_spl_defconfig
> > >> >> make OPENSBI=opensbi/build/platform/generic/firmware/fw_dynamic.bin
> > >> >> // Run 64-bit u-boot-spl in qemu
> > >> >> qemu-system-riscv64 -M virt -m 256M -display none -serial stdio
> -bios\
> > >> >> u-boot/spl/u-boot-spl.bin -device\
> > >> >> loader,file=u-boot/u-boot.itb,addr=0x8020
> > >> >>
> > >>
> > >> Do you have instructions on how to actually test semihosting? Does it
> > >> require a JTAG debugger? But I see you are using QEMU?
> > >>
> >
>
> Regards,
> Bin
>


Re: [PATCH v1] i2c: nuvoton: renamed the NPCM i2c driver

2022-12-04 Thread Heiko Schocher
Hello Jim Liu,

On 21.11.22 09:59, Jim Liu wrote:
> The Makefile name is npcm_i2c but the driver is npcm-i2c.
> 
> Signed-off-by: Jim Liu 
> ---
>  drivers/i2c/{npcm-i2c.c => npcm_i2c.c} | 0
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  rename drivers/i2c/{npcm-i2c.c => npcm_i2c.c} (100%)
> 
> diff --git a/drivers/i2c/npcm-i2c.c b/drivers/i2c/npcm_i2c.c
> similarity index 100%
> rename from drivers/i2c/npcm-i2c.c
> rename to drivers/i2c/npcm_i2c.c
> 

Thanks!

Reviewed-by: Heiko Schocher 

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


Re: [PATCH] usb: gadget: dfu: Fix check of transfer direction

2022-12-04 Thread offougajoris
Tested on Warp7 , thanks 

Tested-by: Joris Offouga 

> Le 30 nov. 2022 à 19:55, hsimeliere.opensou...@witekio.com a écrit :
> 
> From: Hugo SIMELIERE 
> 
> Commit fbce985e28eaca3af82afecc11961aadaf971a7e to fix CVE-2022-2347
> blocks DFU usb requests.
> The verification of the transfer direction was done by an equality
> but it is a bit mask.
> 
> Signed-off-by: Hugo SIMELIERE 
> ---
> drivers/usb/gadget/f_dfu.c | 8 
> 1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
> index 33ef62f8ba..44877df4ec 100644
> --- a/drivers/usb/gadget/f_dfu.c
> +++ b/drivers/usb/gadget/f_dfu.c
> @@ -325,7 +325,7 @@ static int state_dfu_idle(struct f_dfu *f_dfu,
> 
>switch (ctrl->bRequest) {
>case USB_REQ_DFU_DNLOAD:
> -if (ctrl->bRequestType == USB_DIR_OUT) {
> +if (!(ctrl->bRequestType & USB_DIR_IN)) {
>if (len == 0) {
>f_dfu->dfu_state = DFU_STATE_dfuERROR;
>value = RET_STALL;
> @@ -337,7 +337,7 @@ static int state_dfu_idle(struct f_dfu *f_dfu,
>}
>break;
>case USB_REQ_DFU_UPLOAD:
> -if (ctrl->bRequestType == USB_DIR_IN) {
> +if (ctrl->bRequestType & USB_DIR_IN) {
>f_dfu->dfu_state = DFU_STATE_dfuUPLOAD_IDLE;
>f_dfu->blk_seq_num = 0;
>value = handle_upload(req, len);
> @@ -436,7 +436,7 @@ static int state_dfu_dnload_idle(struct f_dfu *f_dfu,
> 
>switch (ctrl->bRequest) {
>case USB_REQ_DFU_DNLOAD:
> -if (ctrl->bRequestType == USB_DIR_OUT) {
> +if (!(ctrl->bRequestType & USB_DIR_IN)) {
>f_dfu->dfu_state = DFU_STATE_dfuDNLOAD_SYNC;
>f_dfu->blk_seq_num = w_value;
>value = handle_dnload(gadget, len);
> @@ -527,7 +527,7 @@ static int state_dfu_upload_idle(struct f_dfu *f_dfu,
> 
>switch (ctrl->bRequest) {
>case USB_REQ_DFU_UPLOAD:
> -if (ctrl->bRequestType == USB_DIR_IN) {
> +if (ctrl->bRequestType & USB_DIR_IN) {
>/* state transition if less data then requested */
>f_dfu->blk_seq_num = w_value;
>value = handle_upload(req, len);
> -- 
> 2.25.1
> 


Re: [PATCH] Enforce buffer boundaries on RNDIS USB Gadget

2022-12-04 Thread Marek Vasut

On 12/4/22 21:36, Szymon Heidrich wrote:

Hi,

sorry for the delays.


diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index 13c327ea38..3948f2cc9a 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -855,14 +855,17 @@ static int rndis_set_response(int configNr, 
rndis_set_msg_type *buf)
  rndis_set_cmplt_type    *resp;
  rndis_resp_t    *r;

+   BufLength = get_unaligned_le32(>InformationBufferLength);
+   BufOffset = get_unaligned_le32(>InformationBufferOffset);
+   if ((BufOffset > RNDIS_MAX_TOTAL_SIZE - 8) ||
+   (BufLength > RNDIS_MAX_TOTAL_SIZE - 8 - BufOffset))
+   return -EINVAL;
+
  r = rndis_add_response(configNr, sizeof(rndis_set_cmplt_type));
  if (!r)
  return -ENOMEM;
  resp = (rndis_set_cmplt_type *) r->buf;

-   BufLength = get_unaligned_le32(>InformationBufferLength);
-   BufOffset = get_unaligned_le32(>InformationBufferOffset);
-


Reading through the RNDIS code, do you think the rndis_query_response and 
others which use buffer/offset data from the message should also be sanitized 
the same way ? I can imagine the query can be used to do test for 1bit of data 
all over the memory too.



I added the extra validation in rndis_set_response as with the current 
implementation
it is possible to manipulate InformationBufferOffset to exploit 
OID_GEN_CURRENT_PACKET_FILTER
to set arbitrary memory contents within a 32byte offset as the devices packet 
filter.
This value may be next retrieved using gen_ndis_query_resp so one may extract 
specific memory
regions two bytes a time.


I see, can you please add that ^ explanation into the commit message and 
send V2 ? I'll pick it into the current MR.


Thanks


As for rndis_query_response I didn't touch it as the buffer offset and length 
passed to gen_ndis_query_resp
are not used. Please let me know in case I'm missing something.


[...]


[RFC 1/1] sound: allow waveform selection

2022-12-04 Thread Heinrich Schuchardt
* Allow the sound command to select the sine or the square waveform.
* Allow to play multiple tones with one command.
* Adjust documentation.
* Adjust unit test.

Signed-off-by: Heinrich Schuchardt 
---
This would be the alternative to
[v2,6/7] sound: add CONFIG_SOUND_SINE symbol
For testing with the sandbox remove this line

arch/sandbox/dts/test.dts:969
sandbox,silent; /* Don't emit sounds while testing */

run the sand box with './u-boot -T' and issue the following commands

sound play
sound play -s 
sound play -s 600 500 -q
sound play -s 500 1047 500 880 500 0 500 1047 500 880 500 0 500 784 500 698 
500 784 1000 698

Listening to the output demonstrates why patch 7/7 is needed.
---
 arch/sandbox/include/asm/test.h |  7 
 cmd/sound.c | 60 ++---
 doc/usage/cmd/sound.rst | 28 ++-
 drivers/sound/sandbox.c |  7 
 drivers/sound/sound-uclass.c| 19 +--
 include/sound.h | 21 +---
 test/dm/sound.c | 45 -
 7 files changed, 151 insertions(+), 36 deletions(-)

diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index 568738c16d..199a38f57e 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -188,6 +188,13 @@ int sandbox_get_setup_called(struct udevice *dev);
  */
 int sandbox_get_sound_active(struct udevice *dev);
 
+/**
+ * sandbox_reset_sound_count() - reset sound data count and sum
+ *
+ * @dev: device to reset
+ */
+void sandbox_reset_sound_count(struct udevice *dev);
+
 /**
  * sandbox_get_sound_count() - Read back the count of the sound data so far
  *
diff --git a/cmd/sound.c b/cmd/sound.c
index 20ac3f758e..d1724e0b7c 100644
--- a/cmd/sound.c
+++ b/cmd/sound.c
@@ -39,26 +39,56 @@ static int do_play(struct cmd_tbl *cmdtp, int flag, int 
argc,
int ret = 0;
int msec = 1000;
int freq = 400;
-
-   if (argc > 1)
-   msec = dectoul(argv[1], NULL);
-   if (argc > 2)
-   freq = dectoul(argv[2], NULL);
+   enum sound_waveform waveform = SOUND_SQUARE;
+   bool first = true;
 
ret = uclass_first_device_err(UCLASS_SOUND, );
-   if (!ret)
-   ret = sound_beep(dev, msec, freq);
-   if (ret) {
-   printf("Sound device failed to play (err=%d)\n", ret);
-   return CMD_RET_FAILURE;
+   if (ret)
+   goto err;
+
+   --argc;
+   ++argv;
+   while (argc || first) {
+   first = false;
+   if (argc && *argv[0] == '-') {
+   switch (argv[0][1]) {
+   case 'q':
+   waveform = SOUND_SQUARE;
+   break;
+   case 's':
+   waveform = SOUND_SINE;
+   break;
+   default:
+   return CMD_RET_USAGE;
+   }
+   --argc;
+   ++argv;
+   }
+   if (argc && *argv[0] != '-') {
+   msec = dectoul(argv[0], NULL);
+   --argc;
+   ++argv;
+   }
+   if (argc && *argv[0] != '-') {
+   freq = dectoul(argv[0], NULL);
+   --argc;
+   ++argv;
+   }
+   ret = sound_beep(dev, msec, freq, waveform);
+   if (ret)
+   goto err;
}
 
return 0;
+
+err:
+   printf("Sound device failed to play (err=%d)\n", ret);
+   return CMD_RET_FAILURE;
 }
 
 static struct cmd_tbl cmd_sound_sub[] = {
U_BOOT_CMD_MKENT(init, 0, 1, do_init, "", ""),
-   U_BOOT_CMD_MKENT(play, 2, 1, do_play, "", ""),
+   U_BOOT_CMD_MKENT(play, INT_MAX, 1, do_play, "", ""),
 };
 
 /* process sound command */
@@ -83,8 +113,12 @@ static int do_sound(struct cmd_tbl *cmdtp, int flag, int 
argc,
 }
 
 U_BOOT_CMD(
-   sound, 4, 1, do_sound,
+   sound, INT_MAX, 1, do_sound,
"sound sub-system",
"init - initialise the sound driver\n"
-   "sound play [len [freq]] - play a sound for len ms at freq Hz\n"
+   "sound play [[[-q|-s] len [freq]] ...] - play a sound\n"
+   "  -q - square waveform\n"
+   "  -s - sine waveform\n"
+   "  len - duration in ms\n"
+   "  freq - frequency in Hz\n"
 );
diff --git a/doc/usage/cmd/sound.rst b/doc/usage/cmd/sound.rst
index d3fac243b1..03e3a2de78 100644
--- a/doc/usage/cmd/sound.rst
+++ b/doc/usage/cmd/sound.rst
@@ -10,7 +10,7 @@ Synopsis
 ::
 
 sound init
-sound play [len [freq]]
+sound play [[[-q|-s] len [freq]] ...]
 
 Description
 ---
@@ -24,12 +24,38 @@ sound play
 plays a square wave sound. It does not depend on previously calling
 *sound init*.
 
+-q
+generate 

[PATCHv2 010/149] rsa-verify: Rework host check for CONFIG_RSA_VERIFY_WITH_PKEY

2022-12-04 Thread Tom Rini
While we do not want to use CONFIG_RSA_VERIFY_WITH_PKEY on the host, we
cannot undef the symbol in this manner. As this ends up being a test
within another function we can use !tools_build() as a test here.

Cc: Simon Glass 
Signed-off-by: Tom Rini 
---
Changes in v2:
- Switch to !tools_build() per Simon
---
 lib/rsa/rsa-verify.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c
index 9605c376390a..db2aca5385a9 100644
--- a/lib/rsa/rsa-verify.c
+++ b/lib/rsa/rsa-verify.c
@@ -23,18 +23,13 @@
 #include 
 #include 
 
-#ifndef __UBOOT__
 /*
  * NOTE:
  * Since host tools, like mkimage, make use of openssl library for
  * RSA encryption, rsa_verify_with_pkey()/rsa_gen_key_prop() are
  * of no use and should not be compiled in.
- * So just turn off CONFIG_RSA_VERIFY_WITH_PKEY.
  */
 
-#undef CONFIG_RSA_VERIFY_WITH_PKEY
-#endif
-
 /* Default public exponent for backward compatibility */
 #define RSA_DEFAULT_PUBEXP 65537
 
@@ -506,7 +501,8 @@ int rsa_verify_hash(struct image_sign_info *info,
 {
int ret = -EACCES;
 
-   if (CONFIG_IS_ENABLED(RSA_VERIFY_WITH_PKEY) && !info->fdt_blob) {
+   if (!tools_build() && CONFIG_IS_ENABLED(RSA_VERIFY_WITH_PKEY) &&
+   !info->fdt_blob) {
/* don't rely on fdt properties */
ret = rsa_verify_with_pkey(info, hash, sig, sig_len);
if (ret)
-- 
2.25.1



Re: [PATCH 1/1] mvebu: fix end-of-array check

2022-12-04 Thread Pali Rohár
On Monday 05 December 2022 10:16:51 Simon Glass wrote:
> On Thu, 1 Dec 2022 at 07:55, Derek LaHousse  wrote:
> >
> > Properly seek the end of default_environment variables.
> >
> > The current algorithm overwrites from the second variable.  This
> > replacement finds the end of the array of strings.
> >
> > Stomped variables include "board", "soc", "loadaddr".  These can be
> > seen on a "env default -a" after patch, but they are not seen with a
> > version before the patch.
> >
> > Signed-off-by: Derek LaHousse 
> > ---
> >  board/Marvell/mvebu_armada-37xx/board.c | 7 +--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> Reviewed-by: Simon Glass 
> 
> It seems odd to update the default environment, but if we want to do
> this, it should really be done in a function in env/ along with some
> tests in test/env
> 
> Regards,
> Simon

Well, this is just a temporary solution until Marek's env patch series is 
merged:
https://lore.kernel.org/u-boot/20211103232332.2737-1-ka...@kernel.org/

But I agree that tests would prevent these bugs.


Re: [PATCH 1/1] sound: avoid endless loop

2022-12-04 Thread Heinrich Schuchardt




On 12/4/22 22:17, Simon Glass wrote:

On Mon, 5 Dec 2022 at 02:05, Heinrich Schuchardt
 wrote:


'sound play 1 10' results in an endless loop on the sandbox.

If the frequency exceeds half the sampling rate, zero out the output
buffer.

Fixes: 511ed5fdd389 ("SOUND: SAMSUNG: Add I2S driver")
Signed-off-by: Heinrich Schuchardt 
---
  drivers/sound/sound.c | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)


Reviewed-by: Simon Glass 

(nit below)



diff --git a/drivers/sound/sound.c b/drivers/sound/sound.c
index 041dfdccfe..c0fc50c99d 100644
--- a/drivers/sound/sound.c
+++ b/drivers/sound/sound.c
@@ -15,7 +15,10 @@ void sound_create_square_wave(uint sample_rate, unsigned 
short *data, int size,
 const int period = freq ? sample_rate / freq : 0;
 const int half = period / 2;

-   assert(freq);
+   if (!half) {
+   memset(data, 0, size);


'\0'


Please, have a look at the function definition:

include/malloc.h:366:
void* memset(void*, int, size_t);

Best regards

Heinrich





+   return;
+   }

 /* Make sure we don't overflow our buffer */
 if (size % 2)
--
2.37.2



Re: [PATCH] pci: Handle failed calloc in decode_regions()

2022-12-04 Thread Pierre-Clément Tosi
Hi,

On Fri, Dec 02, 2022 at 08:38:37PM +0100, s...@geanix.com wrote:
> 
> Quoting Pierre-Clément Tosi :
> 
> > Add a check for calloc() failing to allocate the requested memory.
> > 
> > Make decode_regions() return an error code.
> > 
> > Cc: Bin Meng 
> > Cc: Simon Glass 
> > Cc: Stefan Roese 
> > Signed-off-by: Pierre-Clément Tosi 
> > ---
> 
> Hi,
> 
> We upgraded from v2022.04 -> v2022.10, and this PATCH breaks PCI (scsi/sata)
> support for x86_64.
> I have seen this in qemu, i havn't had the time to test this on real hardware.
> 
> Steps to reproduce:
> $ make efi-x86_payload64_defconfig && make -j32 && scripts/build-efi.sh -sPrp

Decompiling the resulting u-boot.dtb shows

pci {
compatible = "pci-x86";
u-boot,dm-pre-reloc;
};

which isn't supported by the patch as we return -EINVAL when missing "ranges".
The rationale here was that the property seemed mandatory (see [1] and [2]); was
this a misunderstanding of potential corner cases?

OTOH, I see that most DTS using "pci-x86" (a pseudo-device intended to act as a
PCI bus) actually provide "ranges". In particular, a comment added by
0ced70a0bb7a ("x86: tpl: Add a fake PCI bus") states that

The BARs are allocated statically in the device tree.

So I'll let others comment on this but either:

- arch/x86/dts/efi-x86_payload.dts (and a few other DTS) is missing "ranges"; or
- pci_uclass_pre_probe() should treat UCLASS_SIMPLE_BUS differently.

[1]: 
https://www.kernel.org/doc/Documentation/devicetree/bindings/pci/host-generic-pci.txt
[2]: IEEE Std 1275-1994

> 
> Br,
> /Sean
> 
> >  drivers/pci/pci-uclass.c | 15 ++-
> >  1 file changed, 10 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > index 970ee1adf1..2c85e78a13 100644
> > --- a/drivers/pci/pci-uclass.c
> > +++ b/drivers/pci/pci-uclass.c
> > @@ -954,7 +954,7 @@ int pci_bind_bus_devices(struct udevice *bus)
> > return 0;
> >  }
> > 
> > -static void decode_regions(struct pci_controller *hose, ofnode parent_node,
> > +static int decode_regions(struct pci_controller *hose, ofnode parent_node,
> >ofnode node)
> >  {
> > int pci_addr_cells, addr_cells, size_cells;
> > @@ -968,7 +968,7 @@ static void decode_regions(struct pci_controller
> > *hose, ofnode parent_node,
> > prop = ofnode_get_property(node, "ranges", );
> > if (!prop) {
> > debug("%s: Cannot decode regions\n", __func__);
> > -   return;
> > +   return -EINVAL;
> > }
> > 
> > pci_addr_cells = ofnode_read_simple_addr_cells(node);
> > @@ -986,6 +986,8 @@ static void decode_regions(struct pci_controller
> > *hose, ofnode parent_node,
> > max_regions = len / cells_per_record + CONFIG_NR_DRAM_BANKS;
> > hose->regions = (struct pci_region *)
> > calloc(1, max_regions * sizeof(struct pci_region));
> > +   if (!hose->regions)
> > +   return -ENOMEM;
> > 
> > for (i = 0; i < max_regions; i++, len -= cells_per_record) {
> > u64 pci_addr, addr, size;
> > @@ -1053,7 +1055,7 @@ static void decode_regions(struct pci_controller
> > *hose, ofnode parent_node,
> > /* Add a region for our local memory */
> > bd = gd->bd;
> > if (!bd)
> > -   return;
> > +   return 0;
> > 
> > for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
> > if (bd->bi_dram[i].size) {
> > @@ -1068,7 +1070,7 @@ static void decode_regions(struct pci_controller
> > *hose, ofnode parent_node,
> > }
> > }
> > 
> > -   return;
> > +   return 0;
> >  }
> > 
> >  static int pci_uclass_pre_probe(struct udevice *bus)
> > @@ -1097,7 +1099,10 @@ static int pci_uclass_pre_probe(struct udevice *bus)
> > /* For bridges, use the top-level PCI controller */
> > if (!device_is_on_pci_bus(bus)) {
> > hose->ctlr = bus;
> > -   decode_regions(hose, dev_ofnode(bus->parent), dev_ofnode(bus));
> > +   ret = decode_regions(hose, dev_ofnode(bus->parent),
> > +dev_ofnode(bus));
> > +   if (ret)
> > +   return ret;
> > } else {
> > struct pci_controller *parent_hose;
> > 
> > --
> > 2.36.1.124.g0e6072fb45-goog
> 
> 
> 

-- 
Pierre


Re: [PATCH 05/41] chromebook_samus_tpl: Disable SPL networking

2022-12-04 Thread Simon Glass
On Mon, 28 Nov 2022 at 04:25, Tom Rini  wrote:
>
> We don't appear to actually use networking in SPL here, disable it.
>
> Cc: Simon Glass 
> Signed-off-by: Tom Rini 
> ---
>  configs/chromebook_samus_tpl_defconfig | 1 -
>  1 file changed, 1 deletion(-)
>

Reviewed-by: Simon Glass 


Re: [PATCH 2/3] sound: add CONFIG_SOUND_SINE symbol

2022-12-04 Thread Simon Glass
Hi Heinrich,

On Mon, 5 Dec 2022 at 09:53, Heinrich Schuchardt
 wrote:
>
> Provide a configuration symbol to allow the sound command play a sine wave
> instead of a square wave.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>  drivers/sound/Kconfig|  6 ++
>  drivers/sound/sound-uclass.c | 10 --
>  test/dm/sound.c  | 20 
>  3 files changed, 26 insertions(+), 10 deletions(-)

This should be a runtime setting, so we can test both. Probably it
needs another arg to sound_beep().

Regards,
Simon


Re: [PATCH 002/149] rk32xx: Use standard TPL linker script

2022-12-04 Thread Simon Glass
On Mon, 5 Dec 2022 at 04:06, Tom Rini  wrote:
>
> As of 2f41ade79e59 ("linker: Modify linker scripts to be more generic")
> we can use the same linker script for SPL and TPL and not have to make
> use of #undef tricks. Remove these last remnants.
>
> Signed-off-by: Tom Rini 
> ---
>  arch/arm/mach-rockchip/rk3288/Kconfig |  3 ---
>  arch/arm/mach-rockchip/u-boot-tpl.lds | 12 
>  configs/evb-rk3229_defconfig  |  1 -
>  3 files changed, 16 deletions(-)
>  delete mode 100644 arch/arm/mach-rockchip/u-boot-tpl.lds
>

Reviewed-by: Simon Glass 


Re: [PATCH 1/1] drivers:spi:fix some typos

2022-12-04 Thread Simon Glass
On Sat, 3 Dec 2022 at 01:26, Pengfei Fan  wrote:
>
> Fix some typos in spi drivers
>
> Signed-off-by: Pengfei Fan 
> ---
>  drivers/spi/bcm63xx_hsspi.c   | 2 +-
>  drivers/spi/cadence_qspi.c| 2 +-
>  drivers/spi/fsl_dspi.c| 4 ++--
>  drivers/spi/mtk_snfi_spi.c| 4 ++--
>  drivers/spi/mvebu_a3700_spi.c | 2 +-
>  drivers/spi/omap3_spi.c   | 2 +-
>  drivers/spi/rk_spi.c  | 2 +-
>  drivers/spi/sh_qspi.c | 2 +-
>  drivers/spi/spi-aspeed-smc.c  | 4 ++--
>  drivers/spi/spi-qup.c | 2 +-
>  drivers/spi/spi-sifive.c  | 2 +-
>  11 files changed, 14 insertions(+), 14 deletions(-)

Reviewed-by: Simon Glass 

[..]

> diff --git a/drivers/spi/sh_qspi.c b/drivers/spi/sh_qspi.c
> index 5ba8a8ea79..23af77f3df 100644
> --- a/drivers/spi/sh_qspi.c
> +++ b/drivers/spi/sh_qspi.c
> @@ -160,7 +160,7 @@ static int sh_qspi_xfer_common(struct sh_qspi_slave *ss, 
> unsigned int bitlen,
> }
>
> if (bitlen % 8) {
> -   printf("%s: bitlen is not 8bit alined %d", __func__, bitlen);
> +   printf("%s: bitlen is not 8bit aligned %d", __func__, bitlen);
> return 1;
> }
>

But we should not be using __func__. Better:

log_warning("bitlen is not 8bit aligned %d", bitlen);

Also need to put this at the very top of the file:

#define LOG_CATEGORY UCLASS_SPI

Regards,
Simon


Re: [PATCH 1/1] test:dm:fix typo

2022-12-04 Thread Simon Glass
On Sat, 3 Dec 2022 at 01:26, Yuepeng Xing
 wrote:
>
> Fix typos in the 'test/dm' directory.
>
> Signed-off-by: Yuepeng Xing 
> ---
>  test/dm/blk.c| 2 +-
>  test/dm/button.c | 4 ++--
>  test/dm/gpio.c   | 4 ++--
>  test/dm/host.c   | 2 +-
>  test/dm/remoteproc.c | 2 +-
>  test/dm/scmi.c   | 2 +-
>  test/dm/spmi.c   | 2 +-
>  test/dm/test-fdt.c   | 2 +-
>  8 files changed, 10 insertions(+), 10 deletions(-)
>

Reviewed-by: Simon Glass 


Re: [PATCH 1/1] common:autoboot:modify function parameters

2022-12-04 Thread Simon Glass
On Sat, 3 Dec 2022 at 01:25, Shenlin Liang
 wrote:
>
> the blob parameter of the function process_fdt_options has not been
> invoked in the function body and should be changed to void type
>
> Signed-off-by: Shenlin Liang 
> ---
>  common/autoboot.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH 001/149] exynos: Rework legacy PWM usage

2022-12-04 Thread Simon Glass
On Mon, 5 Dec 2022 at 04:06, Tom Rini  wrote:
>
> The way that the timer support is currently done for exynos/nexell
> platforms relies on the legacy PWM infrastructure, and that needs to be
> updated. However, we really cannot safely undef CONFIG_DM_PWM to build
> the timer.c file without warnings. For now, rename the relevant legacy
> functions to be prefixed with s5p_ and add prototypes to the arch pwm.h
> files.
>
> Cc: Minkyu Kang 
> Cc: Jaehoon Chung 
> Cc: Dzmitry Sankouski 
> Cc: Stefan Bosch 
> Signed-off-by: Tom Rini 
> ---
>  arch/arm/cpu/armv7/s5p-common/pwm.c  | 11 +--
>  arch/arm/cpu/armv7/s5p-common/timer.c| 10 +++---
>  arch/arm/mach-exynos/include/mach/pwm.h  |  5 +
>  arch/arm/mach-nexell/include/mach/pwm.h  |  5 +
>  arch/arm/mach-s5pc1xx/include/mach/pwm.h |  5 +
>  board/friendlyarm/nanopi2/board.c|  4 ++--
>  board/friendlyarm/nanopi2/onewire.c  |  4 ++--
>  7 files changed, 27 insertions(+), 17 deletions(-)

Reviewed-by: Simon Glass 

Can someone update this to use driver model?


- Simon


Re: [PATCH v5 1/1] u-boot-initial-env: rework make target

2022-12-04 Thread Simon Glass
Hi Max,

On Mon, 28 Nov 2022 at 21:41, Max Krummenacher  wrote:
>
> From: Max Krummenacher 
>
> With LTO enabled the U-Boot initial environment is no longer stored
> in an easy accessible section in env/common.o. I.e. the section name
> changes from build to build, its content maybe compressed and it is
> annotated with additional data.
>
> Drop trying to read the initial env with elf tools from the compiler
> specific object file in favour of adding and using a host tool with
> the only functionality of printing the initial env to stdout.
>
> See also:
> https://lore.kernel.org/all/927b122e-1f62-e790-f5ca-30bae4332...@foss.st.com/
>
> Signed-off-by: Max Krummenacher 
> Acked-by: Pali Rohár 
>
> ---
>
> Changes in v5:
> - don't build the printinitialenv tool unconditionally but build it
>   only as part of the u-boot-initial-env target.
>   This no longer fails the 'make tools-only_defconfig tools-only'
>   use-case which is reported by Tom Rini.
>   Adding the $(env_h) dependencies to the tools target might give
>   circular dependencies issues with some future tool.
> - add Acked-by: Pali Rohár 
>
> Changes in v4:
> - add '(objtree)/' when calling the tool. Suggested by Pali Rohár.
> - renamed patch, as more than just the Makefile has changes
>
> Changes in v3:
> - moved the tool from scripts/ to tools/. Suggested by Tom Rini
> - changed the dependencies to '$(env_h)' and 'tools'.
>   Suggested by Tom Rini and Pali Rohár.
> - removed the sed rule which replaces \x00 with \x0A as this is already
>   done by the tool. Suggested by Pali Rohár.
>
> Changes in v2:
> - reworked to build a host tool which prints the configured
>   environment as proposed by Pali Rohár
>   
> https://lore.kernel.org/u-boot/20221018174827.1393211-1-max.oss...@gmail.com/
> - renamed patch, v1 used "Makefile: fix u-boot-initial-env target if lto is 
> enabled"
>
>  Makefile| 10 ++
>  tools/.gitignore|  1 +
>  tools/Makefile  |  4 
>  tools/printinitialenv.c | 44 +
>  4 files changed, 55 insertions(+), 4 deletions(-)
>  create mode 100644 tools/printinitialenv.c

Reviewed-by: Simon Glass 

It would be nice to have a test for this. It could go in test_env.py
and you can use test_event.py as an example.


- Simon


>
> diff --git a/Makefile b/Makefile
> index 2d24ac3959f..32e4bef10f5 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2439,11 +2439,13 @@ endif
> $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
>
>  quiet_cmd_genenv = GENENV  $@
> -cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ 
> env/common.o; \
> -   sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' 
> $@; \
> -   sort --field-separator== -k1,1 --stable $@ -o $@
> +cmd_genenv = \
> +   $(objtree)/tools/printinitialenv | \
> +   sed -e '/^\s*$$/d' | \
> +   sort --field-separator== -k1,1 --stable -o $@
>
> -u-boot-initial-env: u-boot.bin
> +u-boot-initial-env: $(env_h) FORCE
> +   $(Q)$(MAKE) $(build)=tools $(objtree)/tools/printinitialenv
> $(call if_changed,genenv)
>
>  # Consistency checks
> diff --git a/tools/.gitignore b/tools/.gitignore
> index d3a93ff294a..28e8ce2a07a 100644
> --- a/tools/.gitignore
> +++ b/tools/.gitignore
> @@ -28,6 +28,7 @@
>  /mxsboot
>  /ncb
>  /prelink-riscv
> +/printinitialenv
>  /proftool
>  /relocate-rela
>  /spl_size_limit
> diff --git a/tools/Makefile b/tools/Makefile
> index 26be0a7ba2e..80bc62befcb 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -275,6 +275,10 @@ clean-dirs := lib common
>
>  always := $(hostprogs-y)
>
> +# Host tool to dump the currently configured default environment,
> +# build it on demand, i.e. not add it to 'always'.
> +hostprogs-y += printinitialenv
> +
>  # Generated LCD/video logo
>  LOGO_H = $(objtree)/include/bmp_logo.h
>  LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h
> diff --git a/tools/printinitialenv.c b/tools/printinitialenv.c
> new file mode 100644
> index 000..c58b234d679
> --- /dev/null
> +++ b/tools/printinitialenv.c
> @@ -0,0 +1,44 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * (C) Copyright 2022
> + * Max Krummenacher, Toradex
> + *
> + * Snippets taken from tools/env/fw_env.c
> + *
> + * This prints the list of default environment variables as currently
> + * configured.
> + *
> + */
> +
> +#include 
> +
> +/* Pull in the current config to define the default environment */
> +#include 
> +
> +#ifndef __ASSEMBLY__
> +#define __ASSEMBLY__ /* get only #defines from config.h */
> +#include 
> +#undef __ASSEMBLY__
> +#else
> +#include 
> +#endif
> +
> +#define DEFAULT_ENV_INSTANCE_STATIC
> +#include 
> +#include 
> +
> +int main(void)
> +{
> +   char *env, *nxt;
> +
> +   for (env = default_environment; *env; env = nxt + 1) {
> +   for (nxt = env; *nxt; ++nxt) {
> +   if (nxt >= 
> _environment[sizeof(default_environment)]) {
> +   

Re: [PATCH v3 1/2] tools: mkimage: don't print error message "Success" in case of failure

2022-12-04 Thread Simon Glass
On Thu, 24 Nov 2022 at 00:55, Marc Kleine-Budde  wrote:
>
> In case there's no struct image_type_params::set_header callback, no
> "errno" will be set. Don't fail with an error message, followed by
> "Success". Remove the printing of the human readable "errno" value.
>
> Signed-off-by: Marc Kleine-Budde 
> ---
>  tools/mkimage.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH 33/41] sandbox: Finish migration to Kconfig

2022-12-04 Thread Simon Glass
Hi Tom,

On Sat, 3 Dec 2022 at 10:43, Tom Rini  wrote:
>
> Stop using CONFIG_SANDBOX_ARCH and use CONFIG_SANDBOX instead. For the
> SPI related defines, set them directly in Kconfig. This now empties
> arch/sandbox/include/asm/config.h.
>
> Cc: Simon Glass 
> Signed-off-by: Tom Rini 
> ---
>  arch/sandbox/include/asm/config.h | 10 --
>  drivers/adc/adc-uclass.c  |  2 +-
>  drivers/spi/Kconfig   | 10 ++
>  3 files changed, 11 insertions(+), 11 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH 01/41] usb: Update USB_STORAGE dependencies

2022-12-04 Thread Simon Glass
On Sat, 3 Dec 2022 at 10:43, Tom Rini  wrote:
>
> As it's no longer possible to have !DM_USB set, we can remove these
> dependencies.
>
> Signed-off-by: Tom Rini 
> ---
>  common/spl/Kconfig  | 2 +-
>  drivers/usb/Kconfig | 1 -
>  2 files changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH 010/149] rsa-verify: Rework host check for CONFIG_RSA_VERIFY_WITH_PKEY

2022-12-04 Thread Simon Glass
Hi Tom,

On Mon, 5 Dec 2022 at 04:07, Tom Rini  wrote:
>
> While we do not want to use CONFIG_RSA_VERIFY_WITH_PKEY on the host, we
> cannot undef the symbol in this manner. As this ends up only being a
> single location in a file that already has other checks for HOST_CC, add
> one more HOST_CC check instead.
>
> Signed-off-by: Tom Rini 
> ---
>  lib/rsa/rsa-verify.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c
> index 9605c376390a..0662235be6f1 100644
> --- a/lib/rsa/rsa-verify.c
> +++ b/lib/rsa/rsa-verify.c
> @@ -23,18 +23,13 @@
>  #include 
>  #include 
>
> -#ifndef __UBOOT__
>  /*
>   * NOTE:
>   * Since host tools, like mkimage, make use of openssl library for
>   * RSA encryption, rsa_verify_with_pkey()/rsa_gen_key_prop() are
>   * of no use and should not be compiled in.
> - * So just turn off CONFIG_RSA_VERIFY_WITH_PKEY.
>   */
>
> -#undef CONFIG_RSA_VERIFY_WITH_PKEY
> -#endif
> -
>  /* Default public exponent for backward compatibility */
>  #define RSA_DEFAULT_PUBEXP 65537
>
> @@ -506,6 +501,7 @@ int rsa_verify_hash(struct image_sign_info *info,
>  {
> int ret = -EACCES;
>
> +#if !defined(USE_HOSTCC)

you can use

if tools_build()

here, I believe. I've been trying to avoid #if USE_HOSTCC

> if (CONFIG_IS_ENABLED(RSA_VERIFY_WITH_PKEY) && !info->fdt_blob) {
> /* don't rely on fdt properties */
> ret = rsa_verify_with_pkey(info, hash, sig, sig_len);
> @@ -513,6 +509,7 @@ int rsa_verify_hash(struct image_sign_info *info,
> debug("%s: rsa_verify_with_pkey() failed\n", 
> __func__);
> return ret;
> }
> +#endif
>
> if (CONFIG_IS_ENABLED(FIT_SIGNATURE)) {
> const void *blob = info->fdt_blob;
> --
> 2.25.1
>

Regards,
Simon


Re: [PATCH 1/1] sound: avoid endless loop

2022-12-04 Thread Simon Glass
On Mon, 5 Dec 2022 at 02:05, Heinrich Schuchardt
 wrote:
>
> 'sound play 1 10' results in an endless loop on the sandbox.
>
> If the frequency exceeds half the sampling rate, zero out the output
> buffer.
>
> Fixes: 511ed5fdd389 ("SOUND: SAMSUNG: Add I2S driver")
> Signed-off-by: Heinrich Schuchardt 
> ---
>  drivers/sound/sound.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass 

(nit below)

>
> diff --git a/drivers/sound/sound.c b/drivers/sound/sound.c
> index 041dfdccfe..c0fc50c99d 100644
> --- a/drivers/sound/sound.c
> +++ b/drivers/sound/sound.c
> @@ -15,7 +15,10 @@ void sound_create_square_wave(uint sample_rate, unsigned 
> short *data, int size,
> const int period = freq ? sample_rate / freq : 0;
> const int half = period / 2;
>
> -   assert(freq);
> +   if (!half) {
> +   memset(data, 0, size);

'\0'


> +   return;
> +   }
>
> /* Make sure we don't overflow our buffer */
> if (size % 2)
> --
> 2.37.2
>


Re: Patch proposal - mkimage: fit: Support signed conf 'auto' FITs

2022-12-04 Thread Simon Glass
()Hi Sean,

On Tue, 29 Nov 2022 at 04:45, Sean Anderson  wrote:
>
> On 11/22/22 21:09, Simon Glass wrote:
> > Hi Pegorer,
> >
> > On Sat, 19 Nov 2022 at 11:01, Pegorer Massimo  
> > wrote:
> >>
> >> Commit 87b0af9317cb4105f3f29cb0a4c28c7cd87ea65f added support for signing 
> >> auto-generated (mkimage -f auto) FIT. Unfortunately, this signs 'images' 
> >> subnodes but not 'configurations' ones. Following patch is a proposal to 
> >> support also 'configurations' signing + 'images' hashing, as an 
> >> alternative to 'images' signing, with 'auto' FIT. For this purpose, a new 
> >> optional argument is added to mkimage '-r' option: any other better idea?
> >>
> >> =
> >>
> >> From 8c8c8f421d541cc2eccb50490a57e86b81dc8df2 Mon Sep 17 00:00:00 2001
> >> From: Massimo Pegorer 
> >> Date: Sat, 19 Nov 2022 16:25:58 +0100
> >> Subject: [PATCH] mkimage: fit: Support signed conf 'auto' FITs
> >>
> >> Extend support for signing in auto-generated FITs. Previously, it was
> >> possible to sign 'images' subnodes in auto FIT, but not 'configurations'
> >> subnodes. Consequently, usage with -K and -r options (i.e. write keys as
> >> 'required' in a .dtb file) resulted in adding a signature node with
> >> required = "image" property in the dtb.
> >>
> >> This patch allows usage of an optional argument with -r option to select
> >> which subnodes, 'images' ones or 'configurations' ones, have to be signed
> >> (in the second case 'images' subnodes are hashed): with '-r' or '-rimage'
> >> the firsts are signed, while with '-rconf' the seconds; argument values
> >> different than 'image' and 'conf' are invalid.
> >>
> >> Example to write a key with required = "conf" attribute into a dtb file:
> >>
> >> mkimage -f auto -rconf -d /dev/null -K  -o  \
> >> -g  -k  
> >>
> >> Signed-off-by: Massimo Pegorer 
> >> ---
> >>  tools/fit_image.c | 25 +
> >>  tools/mkimage.c   | 18 ++
>
> Remember to update the man page for your next revision.
>
> >>  2 files changed, 31 insertions(+), 12 deletions(-)
> >>
> >> diff --git a/tools/fit_image.c b/tools/fit_image.c
> >> index 923a9755b7..c78d83d509 100644
> >> --- a/tools/fit_image.c
> >> +++ b/tools/fit_image.c
> >> @@ -199,19 +199,22 @@ static void get_basename(char *str, int size, const 
> >> char *fname)
> >>  }
> >>
> >>  /**
> >> - * add_hash_node() - Add a hash or signature node
> >> + * add_hash_or_sign_node() - Add a hash or signature node
> >>   *
> >>   * @params: Image parameters
> >>   * @fdt: Device tree to add to (in sequential-write mode)
> >> + * @do_add_hash: true to add hash even if key name hint is provided
> >>   *
> >> - * If there is a key name hint, try to sign the images. Otherwise, just 
> >> add a
> >> - * CRC.
> >> + * If do_add_hash is false (default) and there is a key name hint, try to 
> >> add
> >> + * a sign node to parent. Otherwise, just add a CRC. Rationale: if conf 
> >> have
> >> + * to be signed, image/dt have to be hashed even if there is a key name 
> >> hint.
> >>   *
> >>   * Return: 0 on success, or -1 on failure
> >>   */
> >> -static int add_hash_node(struct image_tool_params *params, void *fdt)
> >> +static int add_hash_or_sig_node(struct image_tool_params *params, void 
> >> *fdt,
> >> +   bool do_add_hash)
> >>  {
> >> -   if (params->keyname) {
> >> +   if (!do_add_hash && params->keyname) {
> >> if (!params->algo_name) {
> >> fprintf(stderr,
> >> "%s: Algorithm name must be specified\n",
> >> @@ -269,7 +272,7 @@ static int fit_write_images(struct image_tool_params 
> >> *params, char *fdt)
> >> ret = fdt_property_file(params, fdt, FIT_DATA_PROP, 
> >> params->datafile);
> >> if (ret)
> >> return ret;
> >> -   ret = add_hash_node(params, fdt);
> >> +   ret = add_hash_or_sig_node(params, fdt, (params->require_keys == 
> >> 2));
> >> if (ret)
> >> return ret;
> >> fdt_end_node(fdt);
> >> @@ -294,7 +297,8 @@ static int fit_write_images(struct image_tool_params 
> >> *params, char *fdt)
> >> 
> >> genimg_get_arch_short_name(params->arch));
> >> fdt_property_string(fdt, FIT_COMP_PROP,
> >> 
> >> genimg_get_comp_short_name(IH_COMP_NONE));
> >> -   ret = add_hash_node(params, fdt);
> >> +   ret = add_hash_or_sig_node(params, fdt,
> >> +  (params->require_keys == 2));
> >> if (ret)
> >> return ret;
> >> fdt_end_node(fdt);
> >> @@ -314,7 +318,8 @@ static int fit_write_images(struct image_tool_params 
> >> *params, char *fdt)
> >> params->fit_ramdisk);
> >> if (ret)
> >> return ret;
> >> -   ret = add_hash_node(params, fdt);
> >> 

Re: [PATCH] reboot-mode: Add NVMEM reboot mode

2022-12-04 Thread Simon Glass
On Sat, 3 Dec 2022 at 05:04, Sean Anderson  wrote:
>
> This adds an NVMEM reboot mode driver, similar to Linux's
> implementation. This allows using the same device tree binding for Linux
> and U-Boot in most cases.
>
> Signed-off-by: Sean Anderson 
> ---
>
>  MAINTAINERS |  1 +
>  drivers/reboot-mode/Kconfig |  7 +++
>  drivers/reboot-mode/Makefile|  1 +
>  drivers/reboot-mode/reboot-mode-nvmem.c | 57 +
>  4 files changed, 66 insertions(+)
>  create mode 100644 drivers/reboot-mode/reboot-mode-nvmem.c

Reviewed-by: Simon Glass 


Re: [PATCH] serial: Use -EAGAIN in getc and putc

2022-12-04 Thread Simon Glass
On Mon, 5 Dec 2022 at 01:37, Pali Rohár  wrote:
>
> U-Boot serial code already handles -EAGAIN value from getc and putc
> callbacks. So change drivers code to return -EAGAIN when HW is busy instead
> of doing its own busy loop and waiting until HW is ready.
>
> Signed-off-by: Pali Rohár 
> ---
>  drivers/serial/serial_arc.c | 8 
>  drivers/serial/serial_lpuart.c  | 8 
>  drivers/serial/serial_mvebu_a3700.c | 8 
>  3 files changed, 12 insertions(+), 12 deletions(-)

Reviewed-by: Simon Glass 


Re: [PATCH 00/17] Support android boot image v3/v4

2022-12-04 Thread Simon Glass
Hi Safae,

On Sun, 27 Nov 2022 at 05:59, Safae Ouajih  wrote:
>
> Hello everyone,
>
> * This is based on Roman Stratiienko's work to support boot image header 
> version 3 and 4.
>
> * This supports the new boot image headers v3, v4 and bootconfig feature.
> https://source.android.com/docs/core/architecture/bootloader/boot-image-header
> https://source.android.com/docs/core/architecture/bootloader/implementing-bootconfig
>
> - Tested on Amlogic Khadas vim3l, a reference board for Android Open Source 
> Project
>   https://www.khadas.com/vim3l
>
>   And on AM625 Texas Instruments board with 5.10 linux kernel
>
> Main changes :
> - New partition : vendor boot, with a specific vendor ramdisk
> - DTB is stored in the vendor boot partition
> - The generic ramdisk is placed after the vendor ramdisk
> - Bootconfig feature support
>
>
> Here is a link to see the related android boot flow changes on KHADAS vim3l 
> as an example:
> https://gitlab.baylibre.com/baylibre/amlogic/atv/u-boot/-/commits/souajih/BootImagev4/
>
> Safae Ouajih (17):
>   android: boot: rename andr_img_hdr -> andr_boot_img_hdr_v0_v1_v2
>   android: boot: support vendor boot image in abootimg
>   android: boot: replace android_image_check_header
>   android: boot: add boot image header v3 and v4 structures
>   android: boot: add documentation for boot image header v3/v4 structure
>   android: boot: kcomp: support andr_image_data
>   android: boot: move to andr_image_data structure
>   android: boot: content print is not supported for v3,v4 header version
>   android: boot: boot image header v3,v4 do not support recovery DTBO
>   android: boot: add vendor boot image to prepare for v3,v4 support
>   android: boot: update android_image_get_data to support v3,v4
>   android: boot: ramdisk: support vendor ramdisk
>   android: boot: support extra command line
>   drivers: fastboot: zImage flashing is not supported for v3,v4
>   android: boot: support boot image header version 3 and 4
>   lib: support libxbc
>   android: boot: support bootconfig
>
>  boot/bootm.c  |  29 ++-
>  boot/image-android.c  | 367 ++
>  boot/image-board.c|  15 +-
>  boot/image-fdt.c  |   5 +-
>  cmd/abootimg.c|  66 ---
>  drivers/fastboot/fb_mmc.c |  19 +-
>  include/android_image.h   | 220 ++-
>  include/image.h   |  37 ++--
>  include/xbc.h |   1 +
>  lib/Kconfig   |  12 ++
>  lib/Makefile  |   1 +
>  lib/libxbc/Makefile   |   1 +
>  lib/libxbc/libxbc.c   | 112 
>  lib/libxbc/libxbc.h   |  54 ++
>  14 files changed, 806 insertions(+), 133 deletions(-)
>  create mode 100644 include/xbc.h
>  create mode 100644 lib/libxbc/Makefile
>  create mode 100644 lib/libxbc/libxbc.c
>  create mode 100644 lib/libxbc/libxbc.h
>
> --
> 2.25.1
>

Please update the tests to cover this new functionality (test_avb.py)

Regards,
Simon


Re: [PATCH 1/1] mvebu: fix end-of-array check

2022-12-04 Thread Simon Glass
On Thu, 1 Dec 2022 at 07:55, Derek LaHousse  wrote:
>
> Properly seek the end of default_environment variables.
>
> The current algorithm overwrites from the second variable.  This
> replacement finds the end of the array of strings.
>
> Stomped variables include "board", "soc", "loadaddr".  These can be
> seen on a "env default -a" after patch, but they are not seen with a
> version before the patch.
>
> Signed-off-by: Derek LaHousse 
> ---
>  board/Marvell/mvebu_armada-37xx/board.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass 

It seems odd to update the default environment, but if we want to do
this, it should really be done in a function in env/ along with some
tests in test/env

Regards,
Simon


Re: [PATCH] ata: ahci-pci: Replace magic constant by macro

2022-12-04 Thread Simon Glass
On Mon, 5 Dec 2022 at 01:32, Pali Rohár  wrote:
>
> Replace 0x1b21 by macro PCI_VENDOR_ID_ASMEDIA with the same value.
>
> Signed-off-by: Pali Rohár 
> ---
>  drivers/ata/ahci-pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass 


Re: [PATCH 1/1] doc: man-page for the sound command

2022-12-04 Thread Simon Glass
On Mon, 5 Dec 2022 at 04:23, Heinrich Schuchardt
 wrote:
>
> Provide a man-page for the sound command.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>  doc/usage/cmd/sound.rst | 41 +
>  doc/usage/index.rst |  1 +
>  2 files changed, 42 insertions(+)
>  create mode 100644 doc/usage/cmd/sound.rst

Reviewed-by: Simon Glass 


Re: [PATCH 1/1] cmd: fix long text for sound command

2022-12-04 Thread Simon Glass
On Mon, 5 Dec 2022 at 04:38, Heinrich Schuchardt
 wrote:
>
> Make it clear that if only 1 parameter is provided this is the duration.
>
> The ISO symbol for hertz is Hz.
>
> Fixes: c0c88533fffd ("Sound: Add command for audio playback")
> Signed-off-by: Heinrich Schuchardt 
> ---
>  cmd/sound.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass 


Re: [PATCH 1/1] test: test sandbox sound driver more rigorously

2022-12-04 Thread Simon Glass
On Mon, 5 Dec 2022 at 05:16, Heinrich Schuchardt
 wrote:
>
> Consider unexpected values for frequency:
>
> * negative frequency
> * zero frequency
> * frequency exceeding sampling frequency
>
> As in these cases the sum of the samples is zero also check the count of
> the samples.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>  arch/sandbox/include/asm/test.h | 10 ++
>  drivers/sound/sandbox.c |  9 +
>  test/dm/sound.c | 11 +++
>  3 files changed, 30 insertions(+)

Reviewed-by: Simon Glass 


[PATCH v2 7/7] sandbox: fix sound driver

2022-12-04 Thread Heinrich Schuchardt
In the callback function we have to use memcpy(). Otherwise we add
the new samples on top of what is stored in the stream buffer.

If we don't have enough data, zero out the rest of the stream buffer.

Our sampling frequency is 48000. Let the batch size for the callback
function be 960. If we play a multiple of 20 ms, this will always be
a full batch.

Signed-off-by: Heinrich Schuchardt 
---
v2:
no change
---
 arch/sandbox/cpu/sdl.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c
index f4ca36b35c..2c570ed8d1 100644
--- a/arch/sandbox/cpu/sdl.c
+++ b/arch/sandbox/cpu/sdl.c
@@ -441,7 +441,6 @@ void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, int 
len)
 {
struct buf_info *buf;
int avail;
-   bool have_data = false;
int i;
 
for (i = 0; i < 2; i++) {
@@ -453,10 +452,9 @@ void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, 
int len)
}
if (avail > len)
avail = len;
-   have_data = true;
 
-   SDL_MixAudio(stream, buf->data + buf->pos, avail,
-SDL_MIX_MAXVOLUME);
+   memcpy(stream, buf->data + buf->pos, avail);
+   stream += avail;
buf->pos += avail;
len -= avail;
 
@@ -466,7 +464,8 @@ void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, int 
len)
else
break;
}
-   sdl.stopping = !have_data;
+   memset(stream, 0, len);
+   sdl.stopping = !!len;
 }
 
 int sandbox_sdl_sound_init(int rate, int channels)
@@ -484,7 +483,7 @@ int sandbox_sdl_sound_init(int rate, int channels)
wanted.freq = rate;
wanted.format = AUDIO_S16;
wanted.channels = channels;
-   wanted.samples = 1024;  /* Good low-latency value for callback */
+   wanted.samples = 960;  /* Good low-latency value for callback */
wanted.callback = sandbox_sdl_fill_audio;
wanted.userdata = NULL;
 
-- 
2.37.2



[PATCH v2 2/7] test: test sandbox sound driver more rigorously

2022-12-04 Thread Heinrich Schuchardt
Consider unexpected values for frequency:

* negative frequency
* zero frequency
* frequency exceeding sampling frequency

As in these cases the sum of the samples is zero also check the count of
the samples.

Signed-off-by: Heinrich Schuchardt 
---
v2:
no change
---
 arch/sandbox/include/asm/test.h | 10 ++
 drivers/sound/sandbox.c |  9 +
 test/dm/sound.c | 11 +++
 3 files changed, 30 insertions(+)

diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index 0406085917..568738c16d 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -188,6 +188,16 @@ int sandbox_get_setup_called(struct udevice *dev);
  */
 int sandbox_get_sound_active(struct udevice *dev);
 
+/**
+ * sandbox_get_sound_count() - Read back the count of the sound data so far
+ *
+ * This data is provided to the sandbox driver by the sound play() method.
+ *
+ * @dev: Device to check
+ * Return: count of audio data
+ */
+int sandbox_get_sound_count(struct udevice *dev);
+
 /**
  * sandbox_get_sound_sum() - Read back the sum of the sound data so far
  *
diff --git a/drivers/sound/sandbox.c b/drivers/sound/sandbox.c
index 4a2c87a84c..c6cbd81fdb 100644
--- a/drivers/sound/sandbox.c
+++ b/drivers/sound/sandbox.c
@@ -29,6 +29,7 @@ struct sandbox_i2s_priv {
 struct sandbox_sound_priv {
int setup_called;   /* Incremented when setup() method is called */
bool active;/* TX data is being sent */
+   int count;  /* Use to count the provided audio data */
int sum;/* Use to sum the provided audio data */
bool allow_beep;/* true to allow the start_beep() interface */
int frequency_hz;   /* Beep frequency if active, else 0 */
@@ -68,6 +69,13 @@ int sandbox_get_sound_active(struct udevice *dev)
return priv->active;
 }
 
+int sandbox_get_sound_count(struct udevice *dev)
+{
+   struct sandbox_sound_priv *priv = dev_get_priv(dev);
+
+   return priv->count;
+}
+
 int sandbox_get_sound_sum(struct udevice *dev)
 {
struct sandbox_sound_priv *priv = dev_get_priv(dev);
@@ -168,6 +176,7 @@ static int sandbox_sound_play(struct udevice *dev, void 
*data, uint data_size)
 
for (i = 0; i < data_size; i++)
priv->sum += ((uint8_t *)data)[i];
+   priv->count += data_size;
 
return i2s_tx_data(uc_priv->i2s, data, data_size);
 }
diff --git a/test/dm/sound.c b/test/dm/sound.c
index b73f6ab111..15d545ab5a 100644
--- a/test/dm/sound.c
+++ b/test/dm/sound.c
@@ -26,8 +26,19 @@ static int dm_test_sound(struct unit_test_state *uts)
ut_asserteq(0, sandbox_get_setup_called(dev));
 
ut_assertok(sound_beep(dev, 1, 100));
+   ut_asserteq(48, sandbox_get_sound_count(dev));
ut_asserteq(4560, sandbox_get_sound_sum(dev));
ut_assertok(sound_beep(dev, 1, 100));
+   ut_asserteq(96, sandbox_get_sound_count(dev));
+   ut_asserteq(9120, sandbox_get_sound_sum(dev));
+   ut_assertok(sound_beep(dev, 1, -100));
+   ut_asserteq(144, sandbox_get_sound_count(dev));
+   ut_asserteq(9120, sandbox_get_sound_sum(dev));
+   ut_assertok(sound_beep(dev, 1, 0));
+   ut_asserteq(192, sandbox_get_sound_count(dev));
+   ut_asserteq(9120, sandbox_get_sound_sum(dev));
+   ut_assertok(sound_beep(dev, 1, INT_MAX));
+   ut_asserteq(240, sandbox_get_sound_count(dev));
ut_asserteq(9120, sandbox_get_sound_sum(dev));
ut_asserteq(false, sandbox_get_sound_active(dev));
 
-- 
2.37.2



[PATCH v2 4/7] doc: man-page for the sound command

2022-12-04 Thread Heinrich Schuchardt
Provide a man-page for the sound command.

Signed-off-by: Heinrich Schuchardt 
---
v2:
add default values
---
 doc/usage/cmd/sound.rst | 41 +
 doc/usage/index.rst |  1 +
 2 files changed, 42 insertions(+)
 create mode 100644 doc/usage/cmd/sound.rst

diff --git a/doc/usage/cmd/sound.rst b/doc/usage/cmd/sound.rst
new file mode 100644
index 00..d3fac243b1
--- /dev/null
+++ b/doc/usage/cmd/sound.rst
@@ -0,0 +1,41 @@
+.. SPDX-License-Identifier: GPL-2.0+
+.. Copyright 2022, Heinrich Schuchardt 
+
+sound command
+=
+
+Synopsis
+
+
+::
+
+sound init
+sound play [len [freq]]
+
+Description
+---
+
+The *sound* command is used to play a beep sound.
+
+sound init
+initializes the sound driver.
+
+sound play
+plays a square wave sound. It does not depend on previously calling
+*sound init*.
+
+len
+duration of the sound in ms, defaults to 1000 ms
+
+freq
+frequency of the sound in Hz, defaults to 400 Hz
+
+Configuration
+-
+
+The sound command is enabled by CONFIG_CMD_SOUND=y.
+
+Return value
+
+
+The return value $? is 0 (true) if the command succeeds, 1 (false) otherwise.
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index 0bc82887e9..bbd40a6e18 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -73,6 +73,7 @@ Shell commands
cmd/scp03
cmd/setexpr
cmd/size
+   cmd/sound
cmd/temperature
cmd/tftpput
cmd/true
-- 
2.37.2



[PATCH v2 6/7] sound: add CONFIG_SOUND_SINE symbol

2022-12-04 Thread Heinrich Schuchardt
Provide a configuration symbol to allow the sound command play a sine wave
instead of a square wave.

Signed-off-by: Heinrich Schuchardt 
---
v2:
update documentation
---
 doc/usage/cmd/sound.rst  |  3 +++
 drivers/sound/Kconfig|  6 ++
 drivers/sound/sound-uclass.c | 10 --
 test/dm/sound.c  | 20 
 4 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/doc/usage/cmd/sound.rst b/doc/usage/cmd/sound.rst
index d3fac243b1..aa988fa261 100644
--- a/doc/usage/cmd/sound.rst
+++ b/doc/usage/cmd/sound.rst
@@ -35,6 +35,9 @@ Configuration
 
 The sound command is enabled by CONFIG_CMD_SOUND=y.
 
+By default a square wave is generated. With CONFIG_SOUND_SINE=y a sine wave is
+used instead.
+
 Return value
 
 
diff --git a/drivers/sound/Kconfig b/drivers/sound/Kconfig
index 0948d8caab..1005192fd4 100644
--- a/drivers/sound/Kconfig
+++ b/drivers/sound/Kconfig
@@ -12,6 +12,12 @@ config SOUND
  audio codecs are called from the sound-i2s code. This could be
  converted to driver model.
 
+config SOUND_SINE
+   bool "Generate sine wave"
+   help
+ When this setting is enabled playing a sound produces a sine
+ wave. If the settings is not enabled, a square wave is produced.
+
 config I2S
bool "Enable I2S support"
depends on SOUND
diff --git a/drivers/sound/sound-uclass.c b/drivers/sound/sound-uclass.c
index 2ffc4fc7c1..637f6b11ab 100644
--- a/drivers/sound/sound-uclass.c
+++ b/drivers/sound/sound-uclass.c
@@ -99,8 +99,14 @@ int sound_beep(struct udevice *dev, int msecs, int 
frequency_hz)
return -ENOMEM;
}
 
-   sound_create_square_wave(i2s_uc_priv->samplingrate, data, data_size,
-frequency_hz, i2s_uc_priv->channels);
+   if (CONFIG_IS_ENABLED(SOUND_SINE))
+   sound_create_sine_wave(i2s_uc_priv->samplingrate, data,
+  data_size, frequency_hz,
+  i2s_uc_priv->channels);
+   else
+   sound_create_square_wave(i2s_uc_priv->samplingrate, data,
+data_size, frequency_hz,
+i2s_uc_priv->channels);
 
ret = 0;
while (msecs >= 1000) {
diff --git a/test/dm/sound.c b/test/dm/sound.c
index 15d545ab5a..f16ea80157 100644
--- a/test/dm/sound.c
+++ b/test/dm/sound.c
@@ -17,6 +17,12 @@ static int dm_test_sound(struct unit_test_state *uts)
 {
struct sound_uc_priv *uc_priv;
struct udevice *dev;
+   int expected;
+
+   if (CONFIG_IS_ENABLED(SOUND_SINE))
+   expected = 3494;
+   else
+   expected = 4560;
 
/* check probe success */
ut_assertok(uclass_first_device_err(UCLASS_SOUND, ));
@@ -24,24 +30,22 @@ static int dm_test_sound(struct unit_test_state *uts)
ut_asserteq_str("audio-codec", uc_priv->codec->name);
ut_asserteq_str("i2s", uc_priv->i2s->name);
ut_asserteq(0, sandbox_get_setup_called(dev));
-
ut_assertok(sound_beep(dev, 1, 100));
ut_asserteq(48, sandbox_get_sound_count(dev));
-   ut_asserteq(4560, sandbox_get_sound_sum(dev));
+   ut_asserteq(expected, sandbox_get_sound_sum(dev));
ut_assertok(sound_beep(dev, 1, 100));
ut_asserteq(96, sandbox_get_sound_count(dev));
-   ut_asserteq(9120, sandbox_get_sound_sum(dev));
+   expected *= 2;
+   ut_asserteq(expected, sandbox_get_sound_sum(dev));
ut_assertok(sound_beep(dev, 1, -100));
ut_asserteq(144, sandbox_get_sound_count(dev));
-   ut_asserteq(9120, sandbox_get_sound_sum(dev));
+   ut_asserteq(expected, sandbox_get_sound_sum(dev));
ut_assertok(sound_beep(dev, 1, 0));
ut_asserteq(192, sandbox_get_sound_count(dev));
-   ut_asserteq(9120, sandbox_get_sound_sum(dev));
+   ut_asserteq(expected, sandbox_get_sound_sum(dev));
ut_assertok(sound_beep(dev, 1, INT_MAX));
ut_asserteq(240, sandbox_get_sound_count(dev));
-   ut_asserteq(9120, sandbox_get_sound_sum(dev));
-   ut_asserteq(false, sandbox_get_sound_active(dev));
-
+   ut_asserteq(expected, sandbox_get_sound_sum(dev));
return 0;
 }
 DM_TEST(dm_test_sound, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
-- 
2.37.2



[PATCH v2 3/7] cmd: fix long text for sound command

2022-12-04 Thread Heinrich Schuchardt
Make it clear that if only 1 parameter is provided this is the duration.

The ISO symbol for hertz is Hz.

Fixes: c0c88533fffd ("Sound: Add command for audio playback")
Signed-off-by: Heinrich Schuchardt 
---
v2:
no change
---
 cmd/sound.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/sound.c b/cmd/sound.c
index f82f2aa670..20ac3f758e 100644
--- a/cmd/sound.c
+++ b/cmd/sound.c
@@ -86,5 +86,5 @@ U_BOOT_CMD(
sound, 4, 1, do_sound,
"sound sub-system",
"init - initialise the sound driver\n"
-   "sound play [len] [freq] - play a sound for len ms at freq hz\n"
+   "sound play [len [freq]] - play a sound for len ms at freq Hz\n"
 );
-- 
2.37.2



[PATCH v2 5/7] sound: function to generate sine wave

2022-12-04 Thread Heinrich Schuchardt
Add function sound_create_sine_wave().

Signed-off-by: Heinrich Schuchardt 
---
v2:
remove stray printf()
---
 drivers/sound/sound.c | 37 +
 include/sound.h   | 12 
 2 files changed, 49 insertions(+)

diff --git a/drivers/sound/sound.c b/drivers/sound/sound.c
index c0fc50c99d..abf9bb6de2 100644
--- a/drivers/sound/sound.c
+++ b/drivers/sound/sound.c
@@ -8,6 +8,43 @@
 #include 
 #include 
 
+/* Amplitude between 1 and 32767 */
+#define AMP 16384
+#define AMP2PI ((int)(6.28318530718 * AMP))
+
+void sound_create_sine_wave(uint sample_rate, unsigned short *data, int size,
+   uint freq, uint channels)
+{
+   int v, x = 0, y = AMP;
+
+   if (freq >= 0 && freq < sample_rate / 8) {
+   v = (AMP2PI * freq) / sample_rate;
+   /* tan(x) = x + x^3/3 + ... */
+   v += ((v * v) / AMP * v) / (3 * AMP);
+   } else {
+   v = 0;
+   }
+
+   for (int i = 0; i < size - (2 * channels - 1);) {
+   int s, dx, dy;
+
+   dx = (v * y) / AMP;
+   dy = -((v * x) / AMP);
+   x += dx;
+   y += dy;
+
+   /* Normalize radius: (1+x)^2 ~ 1+2x, for small x */
+   s = AMP * AMP - x * x - y * y;
+   s /= 2 * AMP;
+   s += AMP;
+   x = (s * x) / AMP;
+   y = (s * y) / AMP;
+
+   for (int j = 0; size && j < channels; ++j, i += 2)
+   *data++ = x;
+   }
+}
+
 void sound_create_square_wave(uint sample_rate, unsigned short *data, int size,
  uint freq, uint channels)
 {
diff --git a/include/sound.h b/include/sound.h
index dab9ea186e..cf9c3e8fb7 100644
--- a/include/sound.h
+++ b/include/sound.h
@@ -34,6 +34,18 @@ struct sound_uc_priv {
int setup_done;
 };
 
+/**
+ * Generates sine wave sound data for 1 second
+ *
+ * @sample_rate: Sample rate in Hz
+ * @data: data buffer pointer
+ * @size: size of the buffer in bytes
+ * @freq: frequency of the wave
+ * @channels: Number of channels to use
+ */
+void sound_create_sine_wave(uint sample_rate, unsigned short *data, int size,
+   uint freq, uint channels);
+
 /**
  * Generates square wave sound data for 1 second
  *
-- 
2.37.2



[PATCH v2 1/7] sound: avoid endless loop

2022-12-04 Thread Heinrich Schuchardt
'sound play 1 10' results in an endless loop on the sandbox.

If the frequency exceeds half the sampling rate, zero out the output
buffer.

Fixes: 511ed5fdd389 ("SOUND: SAMSUNG: Add I2S driver")
Signed-off-by: Heinrich Schuchardt 
---
v2:
no change
---
 drivers/sound/sound.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/sound/sound.c b/drivers/sound/sound.c
index 041dfdccfe..c0fc50c99d 100644
--- a/drivers/sound/sound.c
+++ b/drivers/sound/sound.c
@@ -15,7 +15,10 @@ void sound_create_square_wave(uint sample_rate, unsigned 
short *data, int size,
const int period = freq ? sample_rate / freq : 0;
const int half = period / 2;
 
-   assert(freq);
+   if (!half) {
+   memset(data, 0, size);
+   return;
+   }
 
/* Make sure we don't overflow our buffer */
if (size % 2)
-- 
2.37.2



[PATCH v2 0/7] sound: fix drivers

2022-12-04 Thread Heinrich Schuchardt
* Avoid endless loop in sound_create_square_wave()
* In unit test add edge cases.
* Fix long text for sound command.
* Add man-page for sound command.
* Add sine wave generator.
* Fix sandbox driver.

v2:
bring all sound related patches into one series
add default values in man-page
remove stray printf()
update man-page concerning sine wave

Heinrich Schuchardt (7):
  sound: avoid endless loop
  test: test sandbox sound driver more rigorously
  cmd: fix long text for sound command
  doc: man-page for the sound command
  sound: function to generate sine wave
  sound: add CONFIG_SOUND_SINE symbol
  sandbox: fix sound driver

 arch/sandbox/cpu/sdl.c  | 11 -
 arch/sandbox/include/asm/test.h | 10 
 cmd/sound.c |  2 +-
 doc/usage/cmd/sound.rst | 44 +
 doc/usage/index.rst |  1 +
 drivers/sound/Kconfig   |  6 +
 drivers/sound/sandbox.c |  9 +++
 drivers/sound/sound-uclass.c| 10 ++--
 drivers/sound/sound.c   | 42 ++-
 include/sound.h | 12 +
 test/dm/sound.c | 25 +++
 11 files changed, 157 insertions(+), 15 deletions(-)
 create mode 100644 doc/usage/cmd/sound.rst

-- 
2.37.2



[PATCH 3/3] sandbox: fix sound driver

2022-12-04 Thread Heinrich Schuchardt
In the callback function we have to use memcpy(). Otherwise we add
the new samples on top of what is stored in the stream buffer.

If we don't have enough data, zero out the rest of the stream buffer.

Our sampling frequency is 48000. Let the batch size for the callback
function be 960. If we play a multiple of 20 ms, this will always be
a full batch.

Signed-off-by: Heinrich Schuchardt 
---
 arch/sandbox/cpu/sdl.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c
index f4ca36b35c..2c570ed8d1 100644
--- a/arch/sandbox/cpu/sdl.c
+++ b/arch/sandbox/cpu/sdl.c
@@ -441,7 +441,6 @@ void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, int 
len)
 {
struct buf_info *buf;
int avail;
-   bool have_data = false;
int i;
 
for (i = 0; i < 2; i++) {
@@ -453,10 +452,9 @@ void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, 
int len)
}
if (avail > len)
avail = len;
-   have_data = true;
 
-   SDL_MixAudio(stream, buf->data + buf->pos, avail,
-SDL_MIX_MAXVOLUME);
+   memcpy(stream, buf->data + buf->pos, avail);
+   stream += avail;
buf->pos += avail;
len -= avail;
 
@@ -466,7 +464,8 @@ void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, int 
len)
else
break;
}
-   sdl.stopping = !have_data;
+   memset(stream, 0, len);
+   sdl.stopping = !!len;
 }
 
 int sandbox_sdl_sound_init(int rate, int channels)
@@ -484,7 +483,7 @@ int sandbox_sdl_sound_init(int rate, int channels)
wanted.freq = rate;
wanted.format = AUDIO_S16;
wanted.channels = channels;
-   wanted.samples = 1024;  /* Good low-latency value for callback */
+   wanted.samples = 960;  /* Good low-latency value for callback */
wanted.callback = sandbox_sdl_fill_audio;
wanted.userdata = NULL;
 
-- 
2.37.2



[PATCH 2/3] sound: add CONFIG_SOUND_SINE symbol

2022-12-04 Thread Heinrich Schuchardt
Provide a configuration symbol to allow the sound command play a sine wave
instead of a square wave.

Signed-off-by: Heinrich Schuchardt 
---
 drivers/sound/Kconfig|  6 ++
 drivers/sound/sound-uclass.c | 10 --
 test/dm/sound.c  | 20 
 3 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/sound/Kconfig b/drivers/sound/Kconfig
index 0948d8caab..1005192fd4 100644
--- a/drivers/sound/Kconfig
+++ b/drivers/sound/Kconfig
@@ -12,6 +12,12 @@ config SOUND
  audio codecs are called from the sound-i2s code. This could be
  converted to driver model.
 
+config SOUND_SINE
+   bool "Generate sine wave"
+   help
+ When this setting is enabled playing a sound produces a sine
+ wave. If the settings is not enabled, a square wave is produced.
+
 config I2S
bool "Enable I2S support"
depends on SOUND
diff --git a/drivers/sound/sound-uclass.c b/drivers/sound/sound-uclass.c
index 2ffc4fc7c1..637f6b11ab 100644
--- a/drivers/sound/sound-uclass.c
+++ b/drivers/sound/sound-uclass.c
@@ -99,8 +99,14 @@ int sound_beep(struct udevice *dev, int msecs, int 
frequency_hz)
return -ENOMEM;
}
 
-   sound_create_square_wave(i2s_uc_priv->samplingrate, data, data_size,
-frequency_hz, i2s_uc_priv->channels);
+   if (CONFIG_IS_ENABLED(SOUND_SINE))
+   sound_create_sine_wave(i2s_uc_priv->samplingrate, data,
+  data_size, frequency_hz,
+  i2s_uc_priv->channels);
+   else
+   sound_create_square_wave(i2s_uc_priv->samplingrate, data,
+data_size, frequency_hz,
+i2s_uc_priv->channels);
 
ret = 0;
while (msecs >= 1000) {
diff --git a/test/dm/sound.c b/test/dm/sound.c
index 15d545ab5a..f16ea80157 100644
--- a/test/dm/sound.c
+++ b/test/dm/sound.c
@@ -17,6 +17,12 @@ static int dm_test_sound(struct unit_test_state *uts)
 {
struct sound_uc_priv *uc_priv;
struct udevice *dev;
+   int expected;
+
+   if (CONFIG_IS_ENABLED(SOUND_SINE))
+   expected = 3494;
+   else
+   expected = 4560;
 
/* check probe success */
ut_assertok(uclass_first_device_err(UCLASS_SOUND, ));
@@ -24,24 +30,22 @@ static int dm_test_sound(struct unit_test_state *uts)
ut_asserteq_str("audio-codec", uc_priv->codec->name);
ut_asserteq_str("i2s", uc_priv->i2s->name);
ut_asserteq(0, sandbox_get_setup_called(dev));
-
ut_assertok(sound_beep(dev, 1, 100));
ut_asserteq(48, sandbox_get_sound_count(dev));
-   ut_asserteq(4560, sandbox_get_sound_sum(dev));
+   ut_asserteq(expected, sandbox_get_sound_sum(dev));
ut_assertok(sound_beep(dev, 1, 100));
ut_asserteq(96, sandbox_get_sound_count(dev));
-   ut_asserteq(9120, sandbox_get_sound_sum(dev));
+   expected *= 2;
+   ut_asserteq(expected, sandbox_get_sound_sum(dev));
ut_assertok(sound_beep(dev, 1, -100));
ut_asserteq(144, sandbox_get_sound_count(dev));
-   ut_asserteq(9120, sandbox_get_sound_sum(dev));
+   ut_asserteq(expected, sandbox_get_sound_sum(dev));
ut_assertok(sound_beep(dev, 1, 0));
ut_asserteq(192, sandbox_get_sound_count(dev));
-   ut_asserteq(9120, sandbox_get_sound_sum(dev));
+   ut_asserteq(expected, sandbox_get_sound_sum(dev));
ut_assertok(sound_beep(dev, 1, INT_MAX));
ut_asserteq(240, sandbox_get_sound_count(dev));
-   ut_asserteq(9120, sandbox_get_sound_sum(dev));
-   ut_asserteq(false, sandbox_get_sound_active(dev));
-
+   ut_asserteq(expected, sandbox_get_sound_sum(dev));
return 0;
 }
 DM_TEST(dm_test_sound, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
-- 
2.37.2



[PATCH 0/3] sandbox: fix sound driver

2022-12-04 Thread Heinrich Schuchardt
The playback from the sound driver does not provide the expected sound.

To make this easier to hear add a sine wave generator to the sound driver
and add a configuration symbol to select it.

This series is on top of
[PATCH 1/1] test: test sandbox sound driver more rigorously
https://lists.denx.de/pipermail/u-boot/2022-December/501266.html

Heinrich Schuchardt (3):
  sound: function to generate sine wave
  sound: add CONFIG_SOUND_SINE symbol
  sandbox: fix sound driver

 arch/sandbox/cpu/sdl.c   | 11 +-
 drivers/sound/Kconfig|  6 ++
 drivers/sound/sound-uclass.c | 10 +++--
 drivers/sound/sound.c| 39 
 include/sound.h  | 12 +++
 5 files changed, 70 insertions(+), 8 deletions(-)

-- 
2.37.2



[PATCH 1/3] sound: function to generate sine wave

2022-12-04 Thread Heinrich Schuchardt
Add function sound_create_sine_wave().

Signed-off-by: Heinrich Schuchardt 
---
 drivers/sound/sound.c | 39 +++
 include/sound.h   | 12 
 2 files changed, 51 insertions(+)

diff --git a/drivers/sound/sound.c b/drivers/sound/sound.c
index c0fc50c99d..10551f1e45 100644
--- a/drivers/sound/sound.c
+++ b/drivers/sound/sound.c
@@ -8,6 +8,45 @@
 #include 
 #include 
 
+/* Amplitude between 1 and 32767 */
+#define AMP 16384
+#define AMP2PI ((int)(6.28318530718 * AMP))
+
+void sound_create_sine_wave(uint sample_rate, unsigned short *data, int size,
+   uint freq, uint channels)
+{
+   int v, x = 0, y = AMP;
+
+   printf("%d\n", AMP2PI);
+
+   if (freq >= 0 && freq < sample_rate / 8) {
+   v = (AMP2PI * freq) / sample_rate;
+   /* tan(x) = x + x^3/3 + ... */
+   v += ((v * v) / AMP * v) / (3 * AMP);
+   } else {
+   v = 0;
+   }
+
+   for (int i = 0; i < size - (2 * channels - 1);) {
+   int s, dx, dy;
+
+   dx = (v * y) / AMP;
+   dy = -((v * x) / AMP);
+   x += dx;
+   y += dy;
+
+   /* Normalize radius: (1+x)^2 ~ 1+2x, for small x */
+   s = AMP * AMP - x * x - y * y;
+   s /= 2 * AMP;
+   s += AMP;
+   x = (s * x) / AMP;
+   y = (s * y) / AMP;
+
+   for (int j = 0; size && j < channels; ++j, i += 2)
+   *data++ = x;
+   }
+}
+
 void sound_create_square_wave(uint sample_rate, unsigned short *data, int size,
  uint freq, uint channels)
 {
diff --git a/include/sound.h b/include/sound.h
index dab9ea186e..cf9c3e8fb7 100644
--- a/include/sound.h
+++ b/include/sound.h
@@ -34,6 +34,18 @@ struct sound_uc_priv {
int setup_done;
 };
 
+/**
+ * Generates sine wave sound data for 1 second
+ *
+ * @sample_rate: Sample rate in Hz
+ * @data: data buffer pointer
+ * @size: size of the buffer in bytes
+ * @freq: frequency of the wave
+ * @channels: Number of channels to use
+ */
+void sound_create_sine_wave(uint sample_rate, unsigned short *data, int size,
+   uint freq, uint channels);
+
 /**
  * Generates square wave sound data for 1 second
  *
-- 
2.37.2



Re: [PATCH] Enforce buffer boundaries on RNDIS USB Gadget

2022-12-04 Thread Szymon Heidrich
On 04/12/2022 20:12, Marek Vasut wrote:
> On 12/3/22 15:59, Szymon Heidrich wrote:
>> On 20/11/2022 16:02, Fabio Estevam wrote:
>>> Szymon,
>>>
>>> On Thu, Nov 17, 2022 at 4:46 PM Szymon Heidrich
>>>  wrote:

 Prevent access to arbitrary memory locations in gen_ndis_set_resp
 via manipulation of buf->InformationBufferOffset. Lack of validation
 of BufOffset could be exploited to dump arbitrary memory contents
 via NDIS packet filter.

 Signed-off-by: Szymon Heidrich 
>>>
>>> Please run ./scripts/get_maintainer.pl on your patch and copy the 
>>> maintainers.
>>>
>>
>> Hello Fabio,
>>
>> Sorry I missed adding Lukasz and Marek - I'll keep that in mind for future.
>>
>> Is there anything else missing from my side?
> 
> There have been various security fixes recently which broke other things, so 
> I am being careful now.
> 

Sure, I completely understand that.
Thank you for your time and review.

 diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
 index 13c327ea38..3948f2cc9a 100644
 --- a/drivers/usb/gadget/rndis.c
 +++ b/drivers/usb/gadget/rndis.c
 @@ -855,14 +855,17 @@ static int rndis_set_response(int configNr, 
 rndis_set_msg_type *buf)
  rndis_set_cmplt_type    *resp;
  rndis_resp_t    *r;

 +   BufLength = get_unaligned_le32(>InformationBufferLength);
 +   BufOffset = get_unaligned_le32(>InformationBufferOffset);
 +   if ((BufOffset > RNDIS_MAX_TOTAL_SIZE - 8) ||
 +   (BufLength > RNDIS_MAX_TOTAL_SIZE - 8 - BufOffset))
 +   return -EINVAL;
 +
  r = rndis_add_response(configNr, sizeof(rndis_set_cmplt_type));
  if (!r)
  return -ENOMEM;
  resp = (rndis_set_cmplt_type *) r->buf;

 -   BufLength = get_unaligned_le32(>InformationBufferLength);
 -   BufOffset = get_unaligned_le32(>InformationBufferOffset);
 -
> 
> Reading through the RNDIS code, do you think the rndis_query_response and 
> others which use buffer/offset data from the message should also be sanitized 
> the same way ? I can imagine the query can be used to do test for 1bit of 
> data all over the memory too.


I added the extra validation in rndis_set_response as with the current 
implementation
it is possible to manipulate InformationBufferOffset to exploit 
OID_GEN_CURRENT_PACKET_FILTER 
to set arbitrary memory contents within a 32byte offset as the devices packet 
filter. 
This value may be next retrieved using gen_ndis_query_resp so one may extract 
specific memory 
regions two bytes a time.

As for rndis_query_response I didn't touch it as the buffer offset and length 
passed to gen_ndis_query_resp
are not used. Please let me know in case I'm missing something.


Re: Pull request for efi-2023-01-rc3

2022-12-04 Thread Tom Rini
On Fri, Dec 02, 2022 at 08:49:48PM +0100, Heinrich Schuchardt wrote:

> Dear Tom,
> 
> The following changes since commit a32f6341ccf2ea69f64fe87b9d07fd87325a2056:
> 
>   Merge branch '2022-12-02-assorted-updates' (2022-12-02 10:00:55 -0500)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-efi.git
> tags/efi-2023-01-rc3
> 
> for you to fetch changes up to 30124c2bb96decd737963c043b26407791859faf:
> 
>   doc: eficonfig: add description for UEFI Secure Boot Configuration
> (2022-12-02 19:17:25 +0100)
> 
> Gitlab CI showed no issues:
> https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/14290
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v8 03/10] arm_ffa: introduce Arm FF-A low-level driver

2022-12-04 Thread Simon Glass
Hi Rob,

On Tue, 29 Nov 2022 at 05:22, Rob Herring  wrote:
>
> On Fri, Nov 25, 2022 at 3:18 PM Simon Glass  wrote:
> >
> > Hi Abdellatif,
> >
> > On Thu, 24 Nov 2022 at 06:21, Abdellatif El Khlifi 
> >  wrote:
> > >
> > > On Tue, Nov 22, 2022 at 07:09:16PM -0700, Simon Glass wrote:
> > > >  should be called 'priov' and should beHi Abdellatif,
> > > >
> >
> > [..]
> >
> > > > > +/**
> > > > > + * ffa_device_get - create, bind and probe the arm_ffa device
> > > > > + * @pdev: the address of a device pointer (to be filled when the 
> > > > > arm_ffa bus device is created
> > > > > + *   successfully)
> > > > > + *
> > > > > + * This function makes sure the arm_ffa device is
> > > > > + * created, bound to this driver, probed and ready to use.
> > > > > + * Arm FF-A transport is implemented through a single U-Boot
> > > > > + * device managing the FF-A bus (arm_ffa).
> > > > > + *
> > > > > + * Return:
> > > > > + *
> > > > > + * 0 on success. Otherwise, failure
> > > > > + */
> > > > > +int ffa_device_get(struct udevice **pdev)
> > > > > +{
> > > > > +   int ret;
> > > > > +   struct udevice *dev = NULL;
> > > > > +
> > > > > +   ret = device_bind(dm_root(), DM_DRIVER_GET(arm_ffa), 
> > > > > FFA_DRV_NAME, NULL, ofnode_null(),
> > > > > + );
> > > >
> > > > Please add a DT binding. Even if only temporary, we need something for 
> > > > this.
> > >
> > > Thanks for the feedback. I'm happy to address all the comments.
> > >
> > > Regarding DT binding and FF-A discovery. We agreed with Linaro and Rob 
> > > Herring
> > > about the following:
> > >
> > > - DT is only for what we failed to make discoverable. For hardware, we're 
> > > stuck
> > >   with it. We shouldn't repeat that for software interfaces. This 
> > > approach is
> > >   already applied in the FF-A kernel driver which comes with no DT 
> > > support and
> > >   discovers the bus with bus_register() API [1].
> >
> > This may be the UEFI view, but it is not how U-Boot works. This is not 
> > something we are 'stuck' with. It is how we define what is present on a 
> > device. This is how the PCI bus works in U-Boot. It is best practice in 
> > U-Boot to use the device tree to make this things visible and configurable. 
> > Unlike with Linux there is no other way to provide configuration needed by 
> > these devices.
>
> Where do you get UEFI out of this?

I assume it was UEFI as there was no discussion about this in U-Boot.
Which firmware project was consulted about this?

>
> It is the discoverability of hardware that is fixed (and we are stuck
> with). We can't change hardware. The disoverability may be PCI
> VID/PID, USB device descriptors, or nothing. We only use DT when those
> are not sufficient. For a software interface, there is no reason to
> make them non-discoverable as the interface can be fixed (at least for
> new things like FF-A).

Here I am talking about the controller itself, the top-level node in
the device tree. For PCI this is a device tree node and it should be
the same here. So I am not saying that the devices on the bus need to
be in the device tree (that can be optional, but may be useful in some
situations where it is status and known). We need something like:

ff-a {
compatible = "something";
};

I don't know what mechanism is actually used to communicate with it,
but that will be enough to get the top-level driver started.

If Linux does not want to use the node, that it another thing, but I
respectfully request that U-Boot's needs be considered more carefully.
I'd also like to see more willingness to accommodate open-source
software in these designs.

Regards,
Simon


Re: [PATCH] usb: gadget: dfu: Fix check of transfer direction

2022-12-04 Thread Marek Vasut

On 11/30/22 19:58, Fabio Estevam wrote:

Adding Marek and Sultan

On Wed, Nov 30, 2022 at 3:55 PM  wrote:


From: Hugo SIMELIERE 

Commit fbce985e28eaca3af82afecc11961aadaf971a7e to fix CVE-2022-2347
blocks DFU usb requests.
The verification of the transfer direction was done by an equality
but it is a bit mask.

Signed-off-by: Hugo SIMELIERE 


Reviewed-by: Marek Vasut 
Tested-by: Marek Vasut 

Thanks !


Re: [PATCH] Enforce buffer boundaries on RNDIS USB Gadget

2022-12-04 Thread Marek Vasut

On 12/3/22 15:59, Szymon Heidrich wrote:

On 20/11/2022 16:02, Fabio Estevam wrote:

Szymon,

On Thu, Nov 17, 2022 at 4:46 PM Szymon Heidrich
 wrote:


Prevent access to arbitrary memory locations in gen_ndis_set_resp
via manipulation of buf->InformationBufferOffset. Lack of validation
of BufOffset could be exploited to dump arbitrary memory contents
via NDIS packet filter.

Signed-off-by: Szymon Heidrich 


Please run ./scripts/get_maintainer.pl on your patch and copy the maintainers.



Hello Fabio,

Sorry I missed adding Lukasz and Marek - I'll keep that in mind for future.

Is there anything else missing from my side?


There have been various security fixes recently which broke other 
things, so I am being careful now.



diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index 13c327ea38..3948f2cc9a 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -855,14 +855,17 @@ static int rndis_set_response(int configNr, 
rndis_set_msg_type *buf)
 rndis_set_cmplt_type*resp;
 rndis_resp_t*r;

+   BufLength = get_unaligned_le32(>InformationBufferLength);
+   BufOffset = get_unaligned_le32(>InformationBufferOffset);
+   if ((BufOffset > RNDIS_MAX_TOTAL_SIZE - 8) ||
+   (BufLength > RNDIS_MAX_TOTAL_SIZE - 8 - BufOffset))
+   return -EINVAL;
+
 r = rndis_add_response(configNr, sizeof(rndis_set_cmplt_type));
 if (!r)
 return -ENOMEM;
 resp = (rndis_set_cmplt_type *) r->buf;

-   BufLength = get_unaligned_le32(>InformationBufferLength);
-   BufOffset = get_unaligned_le32(>InformationBufferOffset);
-


Reading through the RNDIS code, do you think the rndis_query_response 
and others which use buffer/offset data from the message should also be 
sanitized the same way ? I can imagine the query can be used to do test 
for 1bit of data all over the memory too.


Re: [PATCH] dfu: Make DFU virtual backend SPL friendly

2022-12-04 Thread Marek Vasut

On 11/30/22 11:42, Patrick Delaunay wrote:

Define stub for dfu_*_virt function in SPL, because
CONFIG_SPL_DFU_VIRT is not defined.

This patch avoids compilation issue in dfu_fill_entity() when
CONFIG_SPL_DFU is activated because the dfu_fill_entity_virt()
function is not available.

Fixes: ec44cace4b8d2 ("dfu: add DFU virtual backend")
Reported-by: Marek Vasut 
Signed-off-by: Patrick Delaunay 
---
See initial patch proposal:
http://patchwork.ozlabs.org/project/uboot/patch/20221128193917.236188-1-ma...@denx.de/

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

diff --git a/include/dfu.h b/include/dfu.h
index dcb9cd9d799a..0794ef19 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -495,7 +495,7 @@ static inline int dfu_fill_entity_mtd(struct dfu_entity 
*dfu, char *devstr,
  }
  #endif
  
-#ifdef CONFIG_DFU_VIRT

+#if CONFIG_IS_ENABLED(DFU_VIRT)
  int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr,
 char **argv, int argc);
  int dfu_write_medium_virt(struct dfu_entity *dfu, u64 offset,


Reviewed-by: Marek Vasut 
Tested-by: Marek Vasut 


Re: [PATCH 091/149] global: Migrate CONFIG_MXC_USB_FLAGS et al to CFG

2022-12-04 Thread Tom Rini
On Sun, Dec 04, 2022 at 10:13:22AM -0500, Tom Rini wrote:

> Perform simple renames of:
>CONFIG_MXC_USB_FLAGS to CFG_MXC_USB_FLAGS
>CONFIG_MXC_USB_PORT to CFG_MXC_USB_PORT
>CONFIG_MXC_USB_PORTSC to CFG_MXC_USB_PORTSC
> 
> Signed-off-by: Tom Rini 

Duplicate posting because I once again hit the maximum number of emails
in a row I can send before Google says No, and then off by one in my
resending.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH 144/149] CI: Replace unmigrated symbol test with non-Kconfig introduction test

2022-12-04 Thread Tom Rini
On Sun, Dec 04, 2022 at 10:14:15AM -0500, Tom Rini wrote:

> Now that all symbols have been migrated to Kconfig, or are part of the
> CFG namespace we do not need a complex check for unmigrated CONFIG
> symbols. Any instance of #define (or #undef) or a CONFIG value is wrong,
> so cause CI to fail.
> 
> This test is not as strict as possible yet as we have more symbols that
> were not previously caught to deal with.
> 
> Signed-off-by: Tom Rini 

At this point in the series, I want to make a few comments.

First, before applying, there are some recent other series I'll be
taking, such as the one to convert keymile platforms, which makes some
of the patches here irrelevant.

Second, and as implied by the last few patches in this series, the regex
pattern here finds more symbols, some of which we can ignore.  For
example, the final form of this test will just ignore arch/*/dts/ as
CONFIG symbols defined there are coming in from Linux and not our
concern.  And include/linux/kconfig.h defines CONFIG_IS_ENABLED, etc, so
also valid defines.  But there's a lot of oddball defines out there,
which I intend to deal with.  Starting with symbols which do NOT follow
the pattern of '#defineSPACECONFIG_...' just because there's only a few
of them, and dealing with those manually makes scripting something in
the form of "for every symbol, is there a non-define usage of it" should
get rid of many of them, as unused code.  The hopefully follow up to
that is usage in code that should be removed anyhow as it's never
enabled (and not something like an RTC driver that should be enabled for
sandbox as it's otherwise up to date).

Third, this is still a big milestone. Everything in the big list of
symbols has been handled and tooling is in place to catch
re-introductions. I want to thank everyone for their hard work getting
us here.

-- 
Tom


signature.asc
Description: PGP signature


[PATCH 1/1] test: test sandbox sound driver more rigorously

2022-12-04 Thread Heinrich Schuchardt
Consider unexpected values for frequency:

* negative frequency
* zero frequency
* frequency exceeding sampling frequency

As in these cases the sum of the samples is zero also check the count of
the samples.

Signed-off-by: Heinrich Schuchardt 
---
 arch/sandbox/include/asm/test.h | 10 ++
 drivers/sound/sandbox.c |  9 +
 test/dm/sound.c | 11 +++
 3 files changed, 30 insertions(+)

diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index 0406085917..568738c16d 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -188,6 +188,16 @@ int sandbox_get_setup_called(struct udevice *dev);
  */
 int sandbox_get_sound_active(struct udevice *dev);
 
+/**
+ * sandbox_get_sound_count() - Read back the count of the sound data so far
+ *
+ * This data is provided to the sandbox driver by the sound play() method.
+ *
+ * @dev: Device to check
+ * Return: count of audio data
+ */
+int sandbox_get_sound_count(struct udevice *dev);
+
 /**
  * sandbox_get_sound_sum() - Read back the sum of the sound data so far
  *
diff --git a/drivers/sound/sandbox.c b/drivers/sound/sandbox.c
index 4a2c87a84c..c6cbd81fdb 100644
--- a/drivers/sound/sandbox.c
+++ b/drivers/sound/sandbox.c
@@ -29,6 +29,7 @@ struct sandbox_i2s_priv {
 struct sandbox_sound_priv {
int setup_called;   /* Incremented when setup() method is called */
bool active;/* TX data is being sent */
+   int count;  /* Use to count the provided audio data */
int sum;/* Use to sum the provided audio data */
bool allow_beep;/* true to allow the start_beep() interface */
int frequency_hz;   /* Beep frequency if active, else 0 */
@@ -68,6 +69,13 @@ int sandbox_get_sound_active(struct udevice *dev)
return priv->active;
 }
 
+int sandbox_get_sound_count(struct udevice *dev)
+{
+   struct sandbox_sound_priv *priv = dev_get_priv(dev);
+
+   return priv->count;
+}
+
 int sandbox_get_sound_sum(struct udevice *dev)
 {
struct sandbox_sound_priv *priv = dev_get_priv(dev);
@@ -168,6 +176,7 @@ static int sandbox_sound_play(struct udevice *dev, void 
*data, uint data_size)
 
for (i = 0; i < data_size; i++)
priv->sum += ((uint8_t *)data)[i];
+   priv->count += data_size;
 
return i2s_tx_data(uc_priv->i2s, data, data_size);
 }
diff --git a/test/dm/sound.c b/test/dm/sound.c
index b73f6ab111..15d545ab5a 100644
--- a/test/dm/sound.c
+++ b/test/dm/sound.c
@@ -26,8 +26,19 @@ static int dm_test_sound(struct unit_test_state *uts)
ut_asserteq(0, sandbox_get_setup_called(dev));
 
ut_assertok(sound_beep(dev, 1, 100));
+   ut_asserteq(48, sandbox_get_sound_count(dev));
ut_asserteq(4560, sandbox_get_sound_sum(dev));
ut_assertok(sound_beep(dev, 1, 100));
+   ut_asserteq(96, sandbox_get_sound_count(dev));
+   ut_asserteq(9120, sandbox_get_sound_sum(dev));
+   ut_assertok(sound_beep(dev, 1, -100));
+   ut_asserteq(144, sandbox_get_sound_count(dev));
+   ut_asserteq(9120, sandbox_get_sound_sum(dev));
+   ut_assertok(sound_beep(dev, 1, 0));
+   ut_asserteq(192, sandbox_get_sound_count(dev));
+   ut_asserteq(9120, sandbox_get_sound_sum(dev));
+   ut_assertok(sound_beep(dev, 1, INT_MAX));
+   ut_asserteq(240, sandbox_get_sound_count(dev));
ut_asserteq(9120, sandbox_get_sound_sum(dev));
ut_asserteq(false, sandbox_get_sound_active(dev));
 
-- 
2.37.2



Re: [PATCH v1] mtd: parsers: ofpart: Fix parsing when size-cells is 0

2022-12-04 Thread Marek Vasut

On 12/4/22 13:59, Thorsten Leemhuis wrote:

On 04.12.22 13:50, Marek Vasut wrote:

On 12/2/22 16:56, Thorsten Leemhuis wrote:

On 02.12.22 15:31, Marek Vasut wrote:

On 12/2/22 15:05, Miquel Raynal wrote:
[...]

3. To fix the current situation:
  Immediately revert commit (and prevent it from being backported):
  753395ea1e45 ("ARM: dts: imx7: Fix NAND controller size-cells")
  This way your own boot flow is fixed in the short term.


Here I disagree, the fix is correct and I think we shouldn't proliferate
incorrect DTs which don't match the binding document. Rather, if a
bootloader generates incorrect (new) DT entries, I believe the driver
should implement a fixup and warn user about this. PC does that as well
with broken ACPI tables as far as I can tell.


Well, that might be the right solution in the long run, that's up for
others to decide, but we need to fix this *quickly*. For two reasons
actually: the 6.1 release is near and the change was backported to
stable already.

For details wrt to the "quickly", see "Prioritize work on fixing
regressions" here:
https://docs.kernel.org/process/handling-regressions.html

IOW: Ideally it should be fixed by Sunday.

I'll hence likely soon will point Linus to this and suggest to revert
this, unless there are strong reasons against that or some sort of
agreement on a better solution.


You might want to wait until everyone is back on Monday, the discussion
is still ongoing, but it seems to be getting to a conclusion.


Yeah, came to a similar conclusion, but want to mentioned it
nevertheless and already have this prepared (together will appropriate
links to the discussion):

```
A regression causing boot failures on iMX7 (due to a backport this is
also affecting 6.0.y) could be fixed with a quick revert as well. But
looks like there is no need for it, after some back and forth the
developers that care are close to come to an agreement how to fix the
problem properly soonish:
```


ACK, thanks


[PATCH 1/1] cmd: fix long text for sound command

2022-12-04 Thread Heinrich Schuchardt
Make it clear that if only 1 parameter is provided this is the duration.

The ISO symbol for hertz is Hz.

Fixes: c0c88533fffd ("Sound: Add command for audio playback")
Signed-off-by: Heinrich Schuchardt 
---
 cmd/sound.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/sound.c b/cmd/sound.c
index f82f2aa670..20ac3f758e 100644
--- a/cmd/sound.c
+++ b/cmd/sound.c
@@ -86,5 +86,5 @@ U_BOOT_CMD(
sound, 4, 1, do_sound,
"sound sub-system",
"init - initialise the sound driver\n"
-   "sound play [len] [freq] - play a sound for len ms at freq hz\n"
+   "sound play [len [freq]] - play a sound for len ms at freq Hz\n"
 );
-- 
2.37.2



[PATCH 1/1] doc: man-page for the sound command

2022-12-04 Thread Heinrich Schuchardt
Provide a man-page for the sound command.

Signed-off-by: Heinrich Schuchardt 
---
 doc/usage/cmd/sound.rst | 41 +
 doc/usage/index.rst |  1 +
 2 files changed, 42 insertions(+)
 create mode 100644 doc/usage/cmd/sound.rst

diff --git a/doc/usage/cmd/sound.rst b/doc/usage/cmd/sound.rst
new file mode 100644
index 00..bfde3ff6ee
--- /dev/null
+++ b/doc/usage/cmd/sound.rst
@@ -0,0 +1,41 @@
+.. SPDX-License-Identifier: GPL-2.0+
+.. Copyright 2022, Heinrich Schuchardt 
+
+sound command
+=
+
+Synopsis
+
+
+::
+
+sound init
+sound play [len] [freq]
+
+Description
+---
+
+The *sound* command is used to play a beep sound.
+
+sound init
+initializes the sound driver.
+
+sound play
+plays a square wave sound. It does not depend on previously calling
+*sound init*.
+
+len
+duration of the sound in ms
+
+freq
+frequency of the sound in Hz
+
+Configuration
+-
+
+The sound command is enabled by CONFIG_CMD_SOUND=y.
+
+Return value
+
+
+The return value $? is 0 (true) if the command succeeds, 1 (false) otherwise.
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index 0bc82887e9..bbd40a6e18 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -73,6 +73,7 @@ Shell commands
cmd/scp03
cmd/setexpr
cmd/size
+   cmd/sound
cmd/temperature
cmd/tftpput
cmd/true
-- 
2.37.2



[PATCH 145/149] kbuild: Remove checking for adhoc CONFIG symbols

2022-12-04 Thread Tom Rini
At this point all listed adhoc CONFIG symbols have been migrated to
Kconfig or removed from the tree or renamed to CFG (or similar). We also
now have CI tests that will error on any new introductions, and
checkpatch.pl also looks. We can now remove these hooks and related
scripts.

Signed-off-by: Tom Rini 
---
 Makefile |   8 --
 scripts/build-whitelist.sh   |  45 --
 scripts/check-config.sh  |  63 -
 scripts/config_whitelist.txt | 261 ---
 tools/moveconfig.py  |  32 +
 5 files changed, 2 insertions(+), 407 deletions(-)
 delete mode 100755 scripts/build-whitelist.sh
 delete mode 100755 scripts/check-config.sh

diff --git a/Makefile b/Makefile
index eba39194e331..da2fd0faa050 100644
--- a/Makefile
+++ b/Makefile
@@ -1073,10 +1073,6 @@ cmd_lzma = lzma -c -z -k -9 $< > $@
 
 cfg: u-boot.cfg
 
-quiet_cmd_cfgcheck = CFGCHK  $2
-cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \
-   $(srctree)/scripts/config_whitelist.txt $(srctree)
-
 quiet_cmd_ofcheck = OFCHK   $2
 cmd_ofcheck = $(srctree)/scripts/check-of.sh $2 \
$(srctree)/scripts/of_allowlist.txt
@@ -1144,10 +1140,6 @@ endif
$(call deprecated,CONFIG_TIMER,Timer drivers,v2023.01,$(if $(strip 
$(CFG_SYS_TIMER_RATE)$(CFG_SYS_TIMER_COUNTER)),x))
$(call deprecated,CONFIG_DM_SERIAL,Serial 
drivers,v2023.04,$(CONFIG_SERIAL))
$(call deprecated,CONFIG_DM_SCSI,SCSI drivers,v2023.04,$(CONFIG_SCSI))
-   @# Check that this build does not use CONFIG options that we do not
-   @# know about unless they are in Kconfig. All the existing CONFIG
-   @# options are whitelisted, so new ones should not be added.
-   $(call cmd,cfgcheck,u-boot.cfg)
@# Check that this build does not override OF_HAS_PRIOR_STAGE by
@# disabling OF_BOARD.
$(call cmd,ofcheck,$(KCONFIG_CONFIG))
diff --git a/scripts/build-whitelist.sh b/scripts/build-whitelist.sh
deleted file mode 100755
index 37630c0271cd..
--- a/scripts/build-whitelist.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2016 Google, Inc
-# Written by Simon Glass 
-#
-
-# This script creates the configuration whitelist file. This file contains
-# all the config options which are allowed to be used outside Kconfig.
-# Please do not add things to the whitelist. Instead, add your new option
-# to Kconfig.
-#
-export LC_ALL=C LC_COLLATE=C
-
-# Looks for the rest of the CONFIG options, but exclude those in Kconfig and
-# defconfig files.
-#
-git grep CONFIG_ | \
-   egrep -vi "(Kconfig:|defconfig:|README|\.py|\.pl:)" \
-   | tr ' \t' '\n\n' \
-   | sed -n 's/^\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' \
-   |sort |uniq >scripts/config_whitelist.txt.tmp1;
-
-# Finally, we need a list of the valid Kconfig options to exclude these from
-# the whitelist.
-cat `find . -name "Kconfig*"` |sed -n \
-   -e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
-   -e 's/^\s*menuconfig *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
-   |sort |uniq >scripts/config_whitelist.txt.tmp2
-
-# Use only the options that are present in the first file but not the second.
-comm -23 scripts/config_whitelist.txt.tmp1 scripts/config_whitelist.txt.tmp2 \
-   |sort |uniq >scripts/config_whitelist.txt.tmp3
-
-# If scripts/config_whitelist.txt already exists, take the intersection of the
-# current list and the new one.  We do not want to increase whitelist options.
-if [ -r scripts/config_whitelist.txt ]; then
-   comm -12 scripts/config_whitelist.txt.tmp3 scripts/config_whitelist.txt 
\
-   > scripts/config_whitelist.txt.tmp4
-   mv scripts/config_whitelist.txt.tmp4 scripts/config_whitelist.txt
-else
-   mv scripts/config_whitelist.txt.tmp3 scripts/config_whitelist.txt
-fi
-
-rm scripts/config_whitelist.txt.tmp*
-
-unset LC_ALL LC_COLLATE
diff --git a/scripts/check-config.sh b/scripts/check-config.sh
deleted file mode 100755
index cc1c9a54d951..
--- a/scripts/check-config.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2016 Google, Inc
-# Written by Simon Glass 
-#
-# Check that the u-boot.cfg file provided does not introduce any new
-# ad-hoc CONFIG options
-#
-# Use scripts/build-whitelist.sh to generate the list of current ad-hoc
-# CONFIG options (those which are not in Kconfig).
-
-# Usage
-#check-config.sh   
-#
-# For example:
-#   scripts/check-config.sh b/chromebook_link/u-boot.cfg kconfig_whitelist.txt 
.
-
-set -e
-set -u
-
-PROG_NAME="${0##*/}"
-
-usage() {
-   echo "$PROG_NAME   "
-   exit 1
-}
-
-[ $# -ge 3 ] || usage
-
-path="$1"
-whitelist="$2"
-srctree="$3"
-
-# Temporary files
-configs="${path}.configs"
-suspects="${path}.suspects"
-ok="${path}.ok"
-new_adhoc="${path}.adhoc"
-
-export LC_ALL=C
-export LC_COLLATE=C
-
-cat ${path} |sed -nr 's/^#define (CONFIG_[A-Za-z0-9_]*).*/\1/p' |sort |uniq \
-   >${configs}
-
-comm -23 ${configs} ${whitelist} > ${suspects}
-
-cat `find 

[PATCH 149/149] common/spl/spl_ram: Remove unused default

2022-12-04 Thread Tom Rini
We ask for CONFIG_SPL_LOAD_FIT_ADDRESS in Kconfig, so we cannot define
it in C as a fall-back. However, this option previously was buried under
"if ... endif" Kconfig logic. Rework a number of config options to now
have more robust dependency lines so that we can ask this address when
needed. With that done, we can remove the fallback in spl_ram.c.

Signed-off-by: Tom Rini 
---
 boot/Kconfig | 29 +++--
 common/spl/spl_ram.c |  4 
 2 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/boot/Kconfig b/boot/Kconfig
index 668270cc6605..65613a01491d 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -36,10 +36,9 @@ config TIMESTAMP
  loaded that does not, the message 'Wrong FIT format: no timestamp'
  is shown.
 
-if FIT
-
 config FIT_EXTERNAL_OFFSET
hex "FIT external data offset"
+   depends on FIT
default 0x0
help
  This specifies a data offset in fit image.
@@ -50,6 +49,7 @@ config FIT_EXTERNAL_OFFSET
 
 config FIT_FULL_CHECK
bool "Do a full check of the FIT before using it"
+   depends on FIT
default y
help
  Enable this do a full check of the FIT to make sure it is valid. This
@@ -59,7 +59,7 @@ config FIT_FULL_CHECK
 
 config FIT_SIGNATURE
bool "Enable signature verification of FIT uImages"
-   depends on DM
+   depends on DM && FIT
select HASH
imply RSA
imply RSA_VERIFY
@@ -97,7 +97,7 @@ config FIT_RSASSA_PSS
 
 config FIT_CIPHER
bool "Enable ciphering data in a FIT uImages"
-   depends on DM
+   depends on DM && FIT
select AES
help
  Enable the feature of data ciphering/unciphering in the tool mkimage
@@ -105,6 +105,7 @@ config FIT_CIPHER
 
 config FIT_VERBOSE
bool "Show verbose messages when FIT images fail"
+   depends on FIT
help
  Generally a system will have valid FIT images so debug messages
  are a waste of code space. If you are debugging your images then
@@ -113,6 +114,7 @@ config FIT_VERBOSE
 
 config FIT_BEST_MATCH
bool "Select the best match for the kernel device tree"
+   depends on FIT
help
  When no configuration is explicitly selected, default to the
  one whose fdt's compatibility field best matches that of
@@ -122,6 +124,7 @@ config FIT_BEST_MATCH
 
 config FIT_IMAGE_POST_PROCESS
bool "Enable post-processing of FIT artifacts after loading by U-Boot"
+   depends on FIT
depends on TI_SECURE_DEVICE || SOCFPGA_SECURE_VAB_AUTH
default y if TI_SECURE_DEVICE
help
@@ -137,15 +140,14 @@ config FIT_IMAGE_POST_PROCESS
 
 config FIT_PRINT
 bool "Support FIT printing"
+   depends on FIT
 default y
 help
   Support printing the content of the fitImage in a verbose manner.
 
-if SPL
-
 config SPL_FIT
bool "Support Flattened Image Tree within SPL"
-   depends on SPL
+   depends on SPL && FIT
select SPL_HASH
select SPL_OF_LIBFDT
 
@@ -157,13 +159,13 @@ config SPL_FIT_PRINT
 
 config SPL_FIT_FULL_CHECK
bool "Do a full check of the FIT before using it"
+   depends on SPL_FIT
help
  Enable this do a full check of the FIT to make sure it is valid. This
  helps to protect against carefully crafted FITs which take advantage
  of bugs or omissions in the code. This includes a bad structure,
  multiple root nodes and the like.
 
-
 config SPL_FIT_SIGNATURE
bool "Enable signature verification of FIT firmware within SPL"
depends on SPL_DM
@@ -196,6 +198,7 @@ config SPL_FIT_RSASSA_PSS
 
 config SPL_LOAD_FIT
bool "Enable SPL loading U-Boot as a FIT (basic fitImage features)"
+   depends on SPL && FIT
select SPL_FIT
help
  Normally with the SPL framework a legacy image is generated as part
@@ -217,7 +220,7 @@ config SPL_LOAD_FIT
 
 config SPL_LOAD_FIT_ADDRESS
hex "load address of fit image"
-   depends on SPL_LOAD_FIT
+   depends on SPL_LOAD_FIT || SPL_RAM_SUPPORT || TPL_RAM_SUPPORT
default 0x0
help
  Specify the load address of the fit image that will be loaded
@@ -243,6 +246,7 @@ config SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ
 
 config SPL_LOAD_FIT_FULL
bool "Enable SPL loading U-Boot as a FIT (full fitImage features)"
+   depends on FIT
select SPL_FIT
help
  Normally with the SPL framework a legacy image is generated as part
@@ -277,7 +281,8 @@ config SPL_FIT_SOURCE
 
 config USE_SPL_FIT_GENERATOR
bool "Use a script to generate the .its script"
-   default y if SPL_FIT && (!ARCH_SUNXI && !RISCV)
+   depends on SPL_FIT
+   default y if !ARCH_SUNXI && !RISCV
 
 config SPL_FIT_GENERATOR
string ".its file generator script for U-Boot FIT image"
@@ -290,8 +295,6 @@ config SPL_FIT_GENERATOR
  passed a list of supported device tree 

[PATCH 148/149] cf_spi.c: Rename CONFIG_SPI_IDLE_VAL to SPI_IDLE_VAL

2022-12-04 Thread Tom Rini
This value is never changed by boards, so just rename it to
SPI_IDLE_VAL to fit with the rest of the code.

Signed-off-by: Tom Rini 
---
 drivers/spi/cf_spi.c  | 12 ++--
 drivers/spi/sandbox_spi.c |  4 
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/spi/cf_spi.c b/drivers/spi/cf_spi.c
index ea23357090fe..1a841b5dcefc 100644
--- a/drivers/spi/cf_spi.c
+++ b/drivers/spi/cf_spi.c
@@ -32,11 +32,11 @@ struct coldfire_spi_priv {
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifndef CONFIG_SPI_IDLE_VAL
+#ifndef SPI_IDLE_VAL
 #if defined(CONFIG_SPI_MMC)
-#define CONFIG_SPI_IDLE_VAL0x
+#define SPI_IDLE_VAL   0x
 #else
-#define CONFIG_SPI_IDLE_VAL0x0
+#define SPI_IDLE_VAL   0x0
 #endif
 #endif
 
@@ -184,7 +184,7 @@ static int coldfire_spi_xfer(struct udevice *dev, unsigned 
int bitlen,
}
 
if (din) {
-   cfspi_tx(cfspi, ctrl, CONFIG_SPI_IDLE_VAL);
+   cfspi_tx(cfspi, ctrl, SPI_IDLE_VAL);
if (cfspi->charbit == 16)
*spi_rd16++ = cfspi_rx(cfspi);
else
@@ -208,7 +208,7 @@ static int coldfire_spi_xfer(struct udevice *dev, unsigned 
int bitlen,
}
 
if (din) {
-   cfspi_tx(cfspi, ctrl, CONFIG_SPI_IDLE_VAL);
+   cfspi_tx(cfspi, ctrl, SPI_IDLE_VAL);
if (cfspi->charbit == 16)
*spi_rd16 = cfspi_rx(cfspi);
else
@@ -216,7 +216,7 @@ static int coldfire_spi_xfer(struct udevice *dev, unsigned 
int bitlen,
}
} else {
/* dummy read */
-   cfspi_tx(cfspi, ctrl, CONFIG_SPI_IDLE_VAL);
+   cfspi_tx(cfspi, ctrl, SPI_IDLE_VAL);
cfspi_rx(cfspi);
}
 
diff --git a/drivers/spi/sandbox_spi.c b/drivers/spi/sandbox_spi.c
index 0564d8b55e70..f844597d04cf 100644
--- a/drivers/spi/sandbox_spi.c
+++ b/drivers/spi/sandbox_spi.c
@@ -24,10 +24,6 @@
 #include 
 #include 
 
-#ifndef CONFIG_SPI_IDLE_VAL
-# define CONFIG_SPI_IDLE_VAL 0xFF
-#endif
-
 /**
  * struct sandbox_spi_priv - Sandbox SPI private data
  *
-- 
2.25.1



[PATCH 146/149] post: Move CONFIG_SYS_POST to CFG_SYS_POST

2022-12-04 Thread Tom Rini
Migrate the rest of the CONFIG_SYS_POST macros over to CFG_SYS_POST
namespace.

Signed-off-by: Tom Rini 
---
 doc/README.POST   | 12 +--
 drivers/serial/serial-uclass.c|  2 +-
 drivers/serial/serial.c   |  2 +-
 include/post.h| 50 ++--
 include/serial.h  |  4 +-
 post/cpu/mpc83xx/ecc.c|  8 +-
 post/drivers/flash.c  | 14 ++--
 post/drivers/i2c.c| 20 ++---
 post/drivers/rtc.c|  4 +-
 post/lib_powerpc/andi.c   |  2 +-
 post/lib_powerpc/asm.S|  2 +-
 post/lib_powerpc/b.c  |  2 +-
 post/lib_powerpc/cmp.c|  2 +-
 post/lib_powerpc/cmpi.c   |  2 +-
 post/lib_powerpc/complex.c|  2 +-
 post/lib_powerpc/cpu.c|  4 +-
 post/lib_powerpc/cr.c |  2 +-
 post/lib_powerpc/fpu/20001122-1.c |  4 +-
 post/lib_powerpc/fpu/20010114-2.c |  4 +-
 post/lib_powerpc/fpu/20010226-1.c |  4 +-
 post/lib_powerpc/fpu/980619-1.c   |  4 +-
 post/lib_powerpc/fpu/acc1.c   |  4 +-
 post/lib_powerpc/fpu/compare-fp-1.c   |  4 +-
 post/lib_powerpc/fpu/fpu.c|  4 +-
 post/lib_powerpc/fpu/mul-subnormal-single-1.c |  4 +-
 post/lib_powerpc/load.c   |  2 +-
 post/lib_powerpc/multi.c  |  2 +-
 post/lib_powerpc/rlwimi.c |  2 +-
 post/lib_powerpc/rlwinm.c |  2 +-
 post/lib_powerpc/rlwnm.c  |  2 +-
 post/lib_powerpc/srawi.c  |  2 +-
 post/lib_powerpc/store.c  |  2 +-
 post/lib_powerpc/string.c |  2 +-
 post/lib_powerpc/three.c  |  2 +-
 post/lib_powerpc/threei.c |  2 +-
 post/lib_powerpc/threex.c |  2 +-
 post/lib_powerpc/two.c|  2 +-
 post/lib_powerpc/twox.c   |  2 +-
 post/post.c   |  6 +-
 post/tests.c  | 78 +--
 40 files changed, 138 insertions(+), 138 deletions(-)

diff --git a/doc/README.POST b/doc/README.POST
index 5d92f3fe6e91..1366f95c6623 100644
--- a/doc/README.POST
+++ b/doc/README.POST
@@ -649,15 +649,15 @@ not need any modifications for porting them to another 
board/CPU.
 
 For verifying the I2C bus, a full I2C bus scanning will be performed
 using the i2c_probe() routine. If a board defines
-CONFIG_SYS_POST_I2C_ADDRS the I2C test will pass if all devices
-listed in CONFIG_SYS_POST_I2C_ADDRS are found, and no additional
-devices are detected.  If CONFIG_SYS_POST_I2C_ADDRS is not defined
+CFG_SYS_POST_I2C_ADDRS the I2C test will pass if all devices
+listed in CFG_SYS_POST_I2C_ADDRS are found, and no additional
+devices are detected.  If CFG_SYS_POST_I2C_ADDRS is not defined
 the test will pass if any I2C device is found.
 
-The CONFIG_SYS_POST_I2C_IGNORES define can be used to list I2C
+The CFG_SYS_POST_I2C_IGNORES define can be used to list I2C
 devices which may or may not be present when using
-CONFIG_SYS_POST_I2C_ADDRS.  The I2C POST test will pass regardless
-if the devices in CONFIG_SYS_POST_I2C_IGNORES are found or not.
+CFG_SYS_POST_I2C_ADDRS.  The I2C POST test will pass regardless
+if the devices in CFG_SYS_POST_I2C_IGNORES are found or not.
 This is useful in cases when I2C devices are optional (eg on a
 daughtercard that may or may not be present) or not critical
 to board operation.
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 7240d763d12e..77d3f373721f 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -526,7 +526,7 @@ static int serial_post_probe(struct udevice *dev)
ops->getconfig += gd->reloc_off;
if (ops->setconfig)
ops->setconfig += gd->reloc_off;
-#if CFG_POST & CONFIG_SYS_POST_UART
+#if CFG_POST & CFG_SYS_POST_UART
if (ops->loop)
ops->loop += gd->reloc_off;
 #endif
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 369a8e38e3e2..9a380d7c5e7e 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -458,7 +458,7 @@ void default_serial_puts(const char *s)
dev->putc(*s++);
 }
 
-#if CFG_POST & CONFIG_SYS_POST_UART
+#if CFG_POST & CFG_SYS_POST_UART
 static const int bauds[] = CFG_SYS_BAUDRATE_TABLE;
 
 /**
diff --git a/include/post.h b/include/post.h
index e68d5c89020c..411206950648 100644
--- a/include/post.h
+++ b/include/post.h
@@ -17,8 +17,8 @@
 #if defined(CONFIG_POST)
 
 #ifndef CFG_POST_EXTERNAL_WORD_FUNCS
-#ifdef CONFIG_SYS_POST_WORD_ADDR
-#define _POST_WORD_ADDRCONFIG_SYS_POST_WORD_ADDR
+#ifdef 

[PATCH 144/149] CI: Replace unmigrated symbol test with non-Kconfig introduction test

2022-12-04 Thread Tom Rini
Now that all symbols have been migrated to Kconfig, or are part of the
CFG namespace we do not need a complex check for unmigrated CONFIG
symbols. Any instance of #define (or #undef) or a CONFIG value is wrong,
so cause CI to fail.

This test is not as strict as possible yet as we have more symbols that
were not previously caught to deal with.

Signed-off-by: Tom Rini 
---
 .azure-pipelines.yml | 31 ++-
 .gitlab-ci.yml   | 28 +---
 2 files changed, 11 insertions(+), 48 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index add8847225f0..e102f6bf2af8 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -53,37 +53,18 @@ stages:
 -j$(sysctl -n hw.logicalcpu)
 displayName: 'Perform tools-only build'
 
-  - job: check_for_migrated_symbols_in_board_header
-displayName: 'Check for migrated symbols in board header'
+  - job: check_for_new_CONFIG_symbols_outside_Kconfig
+displayName: 'Check for new CONFIG symbols outside Kconfig'
 pool:
   vmImage: $(ubuntu_vm)
 container:
   image: $(ci_runner_image)
   options: $(container_option)
 steps:
-  - script: |
-  KSYMLST=`mktemp`
-  KUSEDLST=`mktemp`
-  RET=0
-  cat `find . -name "Kconfig*"` | \
- sed -n -e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
- -e 's/^\s*menuconfig *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
- | sort -u > $KSYMLST
-  for CFG in `find include/configs -name "*.h"`; do
- (grep '#define[[:blank:]]CONFIG_' $CFG | \
-sed -n 's/#define.\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' ; \
-grep '#undef[[:blank:]]CONFIG_' $CFG | \
-sed -n 's/#undef.\(CONFIG_[A-Za-z0-9_]*\).*/\1/p') | \
-sort -u > ${KUSEDLST} || true
- NUM=`comm -123 --total --output-delimiter=, ${KSYMLST} 
${KUSEDLST} | \
-cut -d , -f 3`
- if [[ $NUM -ne 0 ]]; then
-echo "Unmigrated symbols found in $CFG:"
-comm -12 ${KSYMLST} ${KUSEDLST}
-RET=1
- fi
-  done
-  exit $RET
+  # If grep succeeds and finds a match the test fails as we should
+  # have no matches.
+  - script: git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_' \
+  include/configs `find arch -name config.h` && exit 1 || exit 0
 
   - job: cppcheck
 displayName: 'Static code analysis with cppcheck'
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 91d5e0c4a8c8..f84d08a729e1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -124,31 +124,13 @@ build all other platforms:
 exit $ret;
   fi;
 
-check for migrated symbols in board header:
+check for new CONFIG symbols outside Kconfig:
   stage: testsuites
   script:
-- KSYMLST=`mktemp`;
-  KUSEDLST=`mktemp`;
-  RET=0;
-  cat `find . -name "Kconfig*"` |
- sed -n -e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p'
- -e 's/^\s*menuconfig *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p'
- | sort -u > $KSYMLST;
-  for CFG in `find include/configs -name "*.h"`; do
- (grep '#define[[:blank:]]CONFIG_' $CFG |
-sed -n 's/#define.\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' ;
-grep '#undef[[:blank:]]CONFIG_' $CFG |
-sed -n 's/#undef.\(CONFIG_[A-Za-z0-9_]*\).*/\1/p') |
-sort -u > ${KUSEDLST} || true;
- NUM=`comm -123 --total --output-delimiter=, ${KSYMLST} ${KUSEDLST} |
-cut -d , -f 3`;
- if [[ $NUM -ne 0 ]]; then
-echo "Unmigrated symbols found in $CFG:";
-comm -12 ${KSYMLST} ${KUSEDLST};
-RET=1;
- fi;
-  done;
-  exit $RET
+# If grep succeeds and finds a match the test fails as we should
+# have no matches.
+- git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
+include/configs `find arch -name config.h` && exit 1 || exit 0
 
 # QA jobs for code analytics
 # static code analysis with cppcheck (we can add --enable=all later)
-- 
2.25.1



[PATCH 143/149] checkpatch.pl: Update CONFIG logic in U-Boot section

2022-12-04 Thread Tom Rini
Now that all CONFIG symbols are in Kconfig, checkpatch.pl should check
for and error on any case of define/undef CONFIG_*.

Signed-off-by: Tom Rini 
---
 scripts/checkpatch.pl   | 8 
 tools/patman/test_checkpatch.py | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index fe13e265a3fe..ccfcbb3e1255 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2630,10 +2630,10 @@ sub u_boot_line {
 "strl$1 is preferred over strn$1 because it always 
produces a nul-terminated string\n" . $herecurr);
}
 
-   # use defconfig to manage CONFIG_CMD options
-   if ($line =~ /\+\s*#\s*(define|undef)\s+(CONFIG_CMD\w*)\b/) {
-   ERROR("DEFINE_CONFIG_CMD",
- "All commands are managed by Kconfig\n" . $herecurr);
+   # use Kconfig for all CONFIG symbols
+   if ($line =~ /\+\s*#\s*(define|undef)\s+(CONFIG_\w*)\b/) {
+   ERROR("DEFINE_CONFIG_SYM",
+ "All CONFIG symbols are managed by Kconfig\n" . 
$herecurr);
}
 
# Don't put common.h and dm.h in header files
diff --git a/tools/patman/test_checkpatch.py b/tools/patman/test_checkpatch.py
index 8960cd505f82..4c2ab6e590ed 100644
--- a/tools/patman/test_checkpatch.py
+++ b/tools/patman/test_checkpatch.py
@@ -396,7 +396,7 @@ index 000..2234c87
 """Test for enabling/disabling commands using preprocesor"""
 pm = PatchMaker()
 pm.add_line('common/main.c', '#undef CONFIG_CMD_WHICH')
-self.check_single_message(pm, 'DEFINE_CONFIG_CMD', 'error')
+self.check_single_message(pm, 'DEFINE_CONFIG_SYM', 'error')
 
 def test_barred_include_in_hdr(self):
 """Test for using a barred include in a header file"""
-- 
2.25.1



[PATCH 147/149] pci-rcar-gen3: Rename CONFIG_SEND_ENABLE

2022-12-04 Thread Tom Rini
We rename the symbol CONFIG_SEND_ENABLE to just SEND_ENABLE, and remove
the second whitespace following the define.

Signed-off-by: Tom Rini 
---
 drivers/pci/pci-rcar-gen3.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/pci-rcar-gen3.c b/drivers/pci/pci-rcar-gen3.c
index 49029238d350..1252ef74c581 100644
--- a/drivers/pci/pci-rcar-gen3.c
+++ b/drivers/pci/pci-rcar-gen3.c
@@ -27,7 +27,7 @@
 
 #define PCIECAR0x10
 #define PCIECCTLR  0x18
-#define  CONFIG_SEND_ENABLEBIT(31)
+#define SEND_ENABLEBIT(31)
 #define  TYPE0 (0 << 8)
 #define  TYPE1 BIT(8)
 #define PCIECDR0x20
@@ -170,9 +170,9 @@ static int rcar_pcie_config_access(const struct udevice 
*udev,
 
/* Enable the configuration access */
if (!PCI_BUS(bdf))
-   writel(CONFIG_SEND_ENABLE | TYPE0, priv->regs + PCIECCTLR);
+   writel(SEND_ENABLE | TYPE0, priv->regs + PCIECCTLR);
else
-   writel(CONFIG_SEND_ENABLE | TYPE1, priv->regs + PCIECCTLR);
+   writel(SEND_ENABLE | TYPE1, priv->regs + PCIECCTLR);
 
/* Check for errors */
if (readl(priv->regs + PCIEERRFR) & UNSUPPORTED_REQUEST)
-- 
2.25.1



[PATCH 142/149] kbuild: Remove uncmd_spl logic

2022-12-04 Thread Tom Rini
At this point in the conversion there should be no need to have logic to
disable some symbol during the SPL build as all symbols should have an
SPL counterpart.

The main real changes done here are that we now must make proper use of
CONFIG_IS_ENABLED(DM_SERIAL) rather than many of the odd tricks we
developed prior to CONFIG_IS_ENABLED() being available.

Signed-off-by: Tom Rini 
---
 board/freescale/common/i2c_common.c|  2 +-
 board/freescale/common/i2c_common.h|  2 +-
 drivers/misc/gsc.c |  2 +-
 drivers/serial/Makefile| 17 +
 drivers/serial/atmel_usart.c   |  8 +++-
 drivers/serial/serial-uclass.c |  6 +++---
 drivers/serial/serial_mtk.c|  3 +--
 drivers/serial/serial_pl01x.c  | 11 +++
 drivers/serial/serial_pl01x_internal.h |  2 +-
 include/config_uncmd_spl.h | 21 -
 include/configs/kmcent2.h  |  2 +-
 include/configs/mv-common.h|  2 +-
 include/configs/sunxi-common.h |  2 +-
 include/configs/ti_omap4_common.h  |  2 +-
 include/configs/x530.h |  2 +-
 include/ns16550.h  | 10 +-
 scripts/Makefile.autoconf  |  1 -
 scripts/Makefile.build |  1 -
 scripts/Makefile.uncmd_spl | 14 --
 19 files changed, 25 insertions(+), 85 deletions(-)
 delete mode 100644 include/config_uncmd_spl.h
 delete mode 100644 scripts/Makefile.uncmd_spl

diff --git a/board/freescale/common/i2c_common.c 
b/board/freescale/common/i2c_common.c
index 0f09ed7d34f6..119ed3c6171b 100644
--- a/board/freescale/common/i2c_common.c
+++ b/board/freescale/common/i2c_common.c
@@ -9,7 +9,7 @@
 #include 
 #include "i2c_common.h"
 
-#ifdef CONFIG_DM_I2C
+#if CONFIG_IS_ENABLED(DM_I2C)
 
 /* If DM is in use, retrieve the chip for the specified bus number */
 int fsl_i2c_get_device(int address, int bus, DEVICE_HANDLE_T *dev)
diff --git a/board/freescale/common/i2c_common.h 
b/board/freescale/common/i2c_common.h
index 840ad6618314..77a7b6aedd7b 100644
--- a/board/freescale/common/i2c_common.h
+++ b/board/freescale/common/i2c_common.h
@@ -9,7 +9,7 @@
 #define __NXP_I2C_COMMON_H__
 
 /* Common functionality shared by the I2C drivers for VID and the mux. */
-#ifdef CONFIG_DM_I2C
+#if CONFIG_IS_ENABLED(DM_I2C)
 #define DEVICE_HANDLE_T struct udevice *
 
 #define I2C_READ(dev, register, data, length) \
diff --git a/drivers/misc/gsc.c b/drivers/misc/gsc.c
index ec24ca807b07..65c9c2c6ce37 100644
--- a/drivers/misc/gsc.c
+++ b/drivers/misc/gsc.c
@@ -77,7 +77,7 @@ enum {
GSC_SC_RST_CAUSE_MAX= 10,
 };
 
-#if (IS_ENABLED(CONFIG_DM_I2C))
+#if CONFIG_IS_ENABLED(DM_I2C)
 
 struct gsc_priv {
int gscver;
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 33fa56822114..37d3f82dbd87 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -3,30 +3,15 @@
 # (C) Copyright 2006-2009
 # Wolfgang Denk, DENX Software Engineering, w...@denx.de.
 
-ifdef CONFIG_SPL_BUILD
-
-ifeq ($(CONFIG_$(SPL_TPL_)BUILD)$(CONFIG_$(SPL_TPL_)DM_SERIAL),yy)
-obj-y += serial-uclass.o
-else
-obj-y += serial.o
-endif
-
-else
-
-ifdef CONFIG_DM_SERIAL
+ifeq ($(CONFIG_$(SPL_TPL_)DM_SERIAL),y)
 obj-y += serial-uclass.o
 else
 obj-y += serial.o
 endif
 
-endif
-
-ifdef CONFIG_DM_SERIAL
 obj-$(CONFIG_PL01X_SERIAL) += serial_pl01x.o
-else
 obj-$(CONFIG_PL011_SERIAL) += serial_pl01x.o
 obj-$(CONFIG_$(SPL_)SYS_NS16550_SERIAL) += serial_ns16550.o
-endif
 
 obj-$(CONFIG_ALTERA_UART) += altera_uart.o
 obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index 9d97bc865445..9853f49c94ff 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -18,7 +18,7 @@
 #include 
 
 #include 
-#ifdef CONFIG_DM_SERIAL
+#if CONFIG_IS_ENABLED(DM_SERIAL)
 #include 
 #endif
 #include 
@@ -28,7 +28,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifndef CONFIG_DM_SERIAL
+#if !CONFIG_IS_ENABLED(DM_SERIAL)
 static void atmel_serial_setbrg_internal(atmel_usart3_t *usart, int id,
 int baudrate)
 {
@@ -133,9 +133,7 @@ __weak struct serial_device *default_serial_console(void)
 {
return _serial_drv;
 }
-#endif
-
-#ifdef CONFIG_DM_SERIAL
+#else
 enum serial_clk_type {
CLK_TYPE_NORMAL = 0,
CLK_TYPE_DBGU,
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index c02106747a08..7240d763d12e 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -407,7 +407,7 @@ void serial_stdio_init(void)
 {
 }
 
-#if defined(CONFIG_DM_STDIO)
+#if CONFIG_IS_ENABLED(DM_STDIO)
 
 #if CONFIG_IS_ENABLED(SERIAL_PRESENT)
 static void serial_stub_putc(struct stdio_dev *sdev, const char ch)
@@ -505,7 +505,7 @@ U_BOOT_ENV_CALLBACK(baudrate, on_baudrate);
 static int serial_post_probe(struct udevice *dev)
 {
struct dm_serial_ops *ops = 

[PATCH 141/149] bcmcygnus: Convert CONFIG_IPROC to Kconfig

2022-12-04 Thread Tom Rini
Select this symbol as needed.

Signed-off-by: Tom Rini 
---
 arch/arm/Kconfig| 4 
 arch/arm/include/asm/iproc-common/configs.h | 3 ---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 42576e503a4a..d7318cad8f63 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -599,6 +599,9 @@ config ARM64_SUPPORT_AARCH32
help
  This ARM64 system supports AArch32 execution state.
 
+config IPROC
+   bool
+
 config S5P
def_bool y if ARCH_EXYNOS || ARCH_S5PC1XX
 
@@ -704,6 +707,7 @@ config TARGET_BCMCYGNUS
bool "Support bcmcygnus"
select CPU_V7A
select GPIO_EXTRA_HEADER
+   select IPROC
imply BCM_SF2_ETH
imply BCM_SF2_ETH_GMAC
imply CMD_HASH
diff --git a/arch/arm/include/asm/iproc-common/configs.h 
b/arch/arm/include/asm/iproc-common/configs.h
index c63c27dac7e1..ce831bc13a7e 100644
--- a/arch/arm/include/asm/iproc-common/configs.h
+++ b/arch/arm/include/asm/iproc-common/configs.h
@@ -8,9 +8,6 @@
 
 #include 
 
-/* Architecture, CPU, chip, etc */
-#define CONFIG_IPROC
-
 /* Memory Info */
 #define CFG_SYS_SDRAM_BASE 0x6100
 
-- 
2.25.1



[PATCH 140/149] configs: Remove unused or redundant CONFIG symbols

2022-12-04 Thread Tom Rini
A number of CONFIG symbols have crept in that are never referenced in
code, so drop them here. Further, we have two symbols being enabled
in headers while already enabled correctly in Kconfig, so these lines
can also be removed.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 1 +
 arch/arm/include/asm/arch-fsl-layerscape/config.h | 1 -
 arch/arm/mach-mvebu/include/mach/config.h | 3 ---
 include/configs/cgtqmx8.h | 1 -
 include/configs/imx8mp_rsb3720.h  | 9 -
 include/configs/imx8mq_cm.h   | 1 -
 include/configs/imx8mq_evk.h  | 1 -
 include/configs/imx8mq_phanbell.h | 1 -
 include/configs/imx8qm_mek.h  | 1 -
 include/configs/imx8qxp_mek.h | 1 -
 include/configs/kontron_pitx_imx8m.h  | 1 -
 include/configs/librem5.h | 6 --
 include/configs/pico-imx8mq.h | 1 -
 13 files changed, 1 insertion(+), 27 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig 
b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
index 2862257e1f2c..9656c52e955f 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
+++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
@@ -29,6 +29,7 @@ config ARCH_LS1028A
select ESBC_HDR_LS if CHAIN_OF_TRUST
select FSL_LAYERSCAPE
select FSL_LSCH3
+   select FSL_TZASC_400
select GICV3
select NXP_LSCH3_2
select SYS_FSL_HAS_CCI400
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/config.h 
b/arch/arm/include/asm/arch-fsl-layerscape/config.h
index 12758c8dd1ca..516c9eab0478 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/config.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/config.h
@@ -160,7 +160,6 @@
 
 #elif defined(CONFIG_ARCH_LS1028A)
 #define CFG_SYS_FSL_CLUSTER_CLOCKS { 1, 1 }
-#define CONFIG_FSL_TZASC_400
 
 /* TZ Protection Controller Definitions */
 #define TZPC_BASE  0x0220
diff --git a/arch/arm/mach-mvebu/include/mach/config.h 
b/arch/arm/mach-mvebu/include/mach/config.h
index 96a08104ff46..610274754837 100644
--- a/arch/arm/mach-mvebu/include/mach/config.h
+++ b/arch/arm/mach-mvebu/include/mach/config.h
@@ -27,7 +27,4 @@
 
 #define MV_UART_CONSOLE_BASE   MVEBU_UART0_BASE
 
-/* Needed for SPI NOR booting in SPL */
-#define CONFIG_DM_SEQ_ALIAS1
-
 #endif /* __MVEBU_CONFIG_H */
diff --git a/include/configs/cgtqmx8.h b/include/configs/cgtqmx8.h
index 91454df19720..98d4d8cf4bd9 100644
--- a/include/configs/cgtqmx8.h
+++ b/include/configs/cgtqmx8.h
@@ -12,7 +12,6 @@
 #include 
 
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_SERIAL_LPUART_BASE  0x5a06
 #define CFG_MALLOC_F_ADDR  0x0012
 
 #endif
diff --git a/include/configs/imx8mp_rsb3720.h b/include/configs/imx8mp_rsb3720.h
index 495ca313db28..d4ab6a6207d6 100644
--- a/include/configs/imx8mp_rsb3720.h
+++ b/include/configs/imx8mp_rsb3720.h
@@ -28,12 +28,6 @@
  * GD_FLG_FULL_MALLOC_INIT \
  * set \
  */
-
-
-#if defined(CONFIG_NAND_BOOT)
-#define CONFIG_SPL_NAND_MXS
-#endif
-
 #endif
 
 /* ENET Config */
@@ -158,9 +152,6 @@
 #define FSL_FSPI_FLASH_NUM 1
 #define FSPI0_BASE_ADDR0x30bb
 #define FSPI0_AMBA_BASE0x0
-#define CONFIG_FSPI_QUAD_SUPPORT
-
-#define CONFIG_SYS_FSL_FSPI_AHB
 #endif
 
 #ifdef CONFIG_NAND_MXS
diff --git a/include/configs/imx8mq_cm.h b/include/configs/imx8mq_cm.h
index 828bd6723727..7cf482d6de15 100644
--- a/include/configs/imx8mq_cm.h
+++ b/include/configs/imx8mq_cm.h
@@ -11,7 +11,6 @@
 #include 
 
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_SPL_PTE_RAM_BASE0x4158
 
 /* malloc f used before GD_FLG_FULL_MALLOC_INIT set */
 #define CFG_MALLOC_F_ADDR  0x182000
diff --git a/include/configs/imx8mq_evk.h b/include/configs/imx8mq_evk.h
index d2de2900c063..d2e1649400a7 100644
--- a/include/configs/imx8mq_evk.h
+++ b/include/configs/imx8mq_evk.h
@@ -12,7 +12,6 @@
 
 #ifdef CONFIG_SPL_BUILD
 /*#define CONFIG_ENABLE_DDR_TRAINING_DEBUG*/
-#define CONFIG_SYS_SPL_PTE_RAM_BASE0x4158
 
 /* malloc f used before GD_FLG_FULL_MALLOC_INIT set */
 #define CFG_MALLOC_F_ADDR  0x182000
diff --git a/include/configs/imx8mq_phanbell.h 
b/include/configs/imx8mq_phanbell.h
index bfde15e6240f..b66fc18fa5e8 100644
--- a/include/configs/imx8mq_phanbell.h
+++ b/include/configs/imx8mq_phanbell.h
@@ -11,7 +11,6 @@
 
 #ifdef CONFIG_SPL_BUILD
 /*#define CONFIG_ENABLE_DDR_TRAINING_DEBUG*/
-#define CONFIG_SYS_SPL_PTE_RAM_BASE0x4158
 
 /* malloc f used before GD_FLG_FULL_MALLOC_INIT set */
 #define CFG_MALLOC_F_ADDR  0x182000
diff --git a/include/configs/imx8qm_mek.h b/include/configs/imx8qm_mek.h
index 

[PATCH 139/149] librem5: Rename CONFIG_POWER_BD71837 symbols

2022-12-04 Thread Tom Rini
Rename the CONFIG_POWER_BD71837_I2C_* symbols to not have the CONFIG
prefix and be local to the file they are used in.

Signed-off-by: Tom Rini 
---
 board/purism/librem5/spl.c | 8 +---
 include/configs/librem5.h  | 4 
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/board/purism/librem5/spl.c b/board/purism/librem5/spl.c
index 1bfd948806f2..1a203b459990 100644
--- a/board/purism/librem5/spl.c
+++ b/board/purism/librem5/spl.c
@@ -322,6 +322,8 @@ void disable_charger_bq25895(void)
 }
 
 #define I2C_PMIC   0
+#define POWER_BD71837_I2C_BUS  0
+#define POWER_BD71837_I2C_ADDR 0x4B
 
 int power_bd71837_init(unsigned char bus)
 {
@@ -336,7 +338,7 @@ int power_bd71837_init(unsigned char bus)
p->name = name;
p->interface = I2C_PMIC;
p->number_of_regs = BD718XX_MAX_REGISTER;
-   p->hw.i2c.addr = CONFIG_POWER_BD71837_I2C_ADDR;
+   p->hw.i2c.addr = POWER_BD71837_I2C_ADDR;
p->hw.i2c.tx_num = 1;
p->bus = bus;
 
@@ -357,10 +359,10 @@ int power_init_board(void)
/*
 * Init PMIC
 */
-   rv = power_bd71837_init(CONFIG_POWER_BD71837_I2C_BUS);
+   rv = power_bd71837_init(POWER_BD71837_I2C_BUS);
if (rv) {
log_err("%s: power_bd71837_init(%d) error %d\n", __func__,
-   CONFIG_POWER_BD71837_I2C_BUS, rv);
+   POWER_BD71837_I2C_BUS, rv);
goto out;
}
 
diff --git a/include/configs/librem5.h b/include/configs/librem5.h
index 9e4d373e56d5..e17190ce9c5d 100644
--- a/include/configs/librem5.h
+++ b/include/configs/librem5.h
@@ -19,10 +19,6 @@
 
 #define CONFIG_SPL_ABORT_ON_RAW_IMAGE /* For RAW image gives a error info not 
panic */
 
-#define CONFIG_POWER_BD71837
-#define CONFIG_POWER_BD71837_I2C_BUS   0
-#define CONFIG_POWER_BD71837_I2C_ADDR  0x4B
-
 #endif /* CONFIG_SPL_BUILD*/
 
 #define CFG_SYS_FSL_USDHC_NUM  2
-- 
2.25.1



[PATCH 138/149] global: Migrate CONFIG_X86_REFCODE_RUN_ADDR to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_X86_REFCODE_RUN_ADDR to 
CFG_X86_REFCODE_RUN_ADDR

Signed-off-by: Tom Rini 
---
 arch/x86/cpu/broadwell/refcode.c | 4 ++--
 include/configs/x86-chromebook.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/cpu/broadwell/refcode.c b/arch/x86/cpu/broadwell/refcode.c
index 3b7ec2b74e8e..df2df7972e98 100644
--- a/arch/x86/cpu/broadwell/refcode.c
+++ b/arch/x86/cpu/broadwell/refcode.c
@@ -99,7 +99,7 @@ static int cpu_run_reference_code(void)
pei_data->saved_data = (void *)
 
src = (char *)hdr + hdr->payload_begin_offset;
-   dest = (char *)CONFIG_X86_REFCODE_RUN_ADDR;
+   dest = (char *)CFG_X86_REFCODE_RUN_ADDR;
 
size = hdr->payload_end_offset - hdr->payload_begin_offset;
debug("Copying refcode from %p to %p, size %x\n", src, dest, size);
@@ -112,7 +112,7 @@ static int cpu_run_reference_code(void)
func = (asmlinkage int (*)(void *))dest;
debug("Running reference code at %p\n", func);
 #ifdef DEBUG
-   print_buffer(CONFIG_X86_REFCODE_RUN_ADDR, (void *)func, 1, 0x40, 0);
+   print_buffer(CFG_X86_REFCODE_RUN_ADDR, (void *)func, 1, 0x40, 0);
 #endif
ret = func(pei_data);
if (ret != 0) {
diff --git a/include/configs/x86-chromebook.h b/include/configs/x86-chromebook.h
index 8bbbe51ecb57..98abb00927ad 100644
--- a/include/configs/x86-chromebook.h
+++ b/include/configs/x86-chromebook.h
@@ -8,7 +8,7 @@
 
 #define CFG_X86_MRC_ADDR   0xfffa
 #define CFG_X86_REFCODE_ADDR   0xffea
-#define CONFIG_X86_REFCODE_RUN_ADDR0
+#define CFG_X86_REFCODE_RUN_ADDR   0
 
 #define VIDEO_IO_OFFSET0
 
-- 
2.25.1



[PATCH 137/149] global: Migrate CONFIG_X86_REFCODE_ADDR to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_X86_REFCODE_ADDR to CFG_X86_REFCODE_ADDR

Signed-off-by: Tom Rini 
---
 arch/x86/cpu/broadwell/refcode.c | 2 +-
 arch/x86/dts/u-boot.dtsi | 2 +-
 include/configs/x86-chromebook.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/cpu/broadwell/refcode.c b/arch/x86/cpu/broadwell/refcode.c
index 94c2e05346a6..3b7ec2b74e8e 100644
--- a/arch/x86/cpu/broadwell/refcode.c
+++ b/arch/x86/cpu/broadwell/refcode.c
@@ -78,7 +78,7 @@ static int cpu_run_reference_code(void)
int ret, dummy;
int size;
 
-   hdr = (struct rmodule_header *)CONFIG_X86_REFCODE_ADDR;
+   hdr = (struct rmodule_header *)CFG_X86_REFCODE_ADDR;
debug("Extracting code from rmodule at %p\n", hdr);
if (hdr->magic != RMODULE_MAGIC) {
debug("Invalid rmodule magic\n");
diff --git a/arch/x86/dts/u-boot.dtsi b/arch/x86/dts/u-boot.dtsi
index 454efc17614e..e0de33180910 100644
--- a/arch/x86/dts/u-boot.dtsi
+++ b/arch/x86/dts/u-boot.dtsi
@@ -149,7 +149,7 @@
 #endif
 #ifdef CONFIG_HAVE_REFCODE
intel-refcode {
-   offset = ;
+   offset = ;
};
 #endif
 #ifdef CONFIG_TPL
diff --git a/include/configs/x86-chromebook.h b/include/configs/x86-chromebook.h
index 059e3a0d8a2c..8bbbe51ecb57 100644
--- a/include/configs/x86-chromebook.h
+++ b/include/configs/x86-chromebook.h
@@ -7,7 +7,7 @@
 #define _X86_CHROMEBOOK_H
 
 #define CFG_X86_MRC_ADDR   0xfffa
-#define CONFIG_X86_REFCODE_ADDR0xffea
+#define CFG_X86_REFCODE_ADDR   0xffea
 #define CONFIG_X86_REFCODE_RUN_ADDR0
 
 #define VIDEO_IO_OFFSET0
-- 
2.25.1



[PATCH 136/149] global: Migrate CONFIG_X86_MRC_ADDR to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_X86_MRC_ADDR to CFG_X86_MRC_ADDR

Signed-off-by: Tom Rini 
---
 arch/x86/cpu/intel_common/mrc.c  | 2 +-
 arch/x86/dts/u-boot.dtsi | 2 +-
 include/configs/x86-chromebook.h | 2 +-
 tools/binman/binman.rst  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/cpu/intel_common/mrc.c b/arch/x86/cpu/intel_common/mrc.c
index a4918fbad61a..69405d740b47 100644
--- a/arch/x86/cpu/intel_common/mrc.c
+++ b/arch/x86/cpu/intel_common/mrc.c
@@ -200,7 +200,7 @@ static int sdram_initialise(struct udevice *dev, struct 
udevice *me_dev,
 
debug("PEI data at %p:\n", pei_data);
 
-   data = (char *)CONFIG_X86_MRC_ADDR;
+   data = (char *)CFG_X86_MRC_ADDR;
if (data) {
int rv;
ulong start;
diff --git a/arch/x86/dts/u-boot.dtsi b/arch/x86/dts/u-boot.dtsi
index 24e692f988d8..454efc17614e 100644
--- a/arch/x86/dts/u-boot.dtsi
+++ b/arch/x86/dts/u-boot.dtsi
@@ -86,7 +86,7 @@
 #endif
 #ifdef CONFIG_HAVE_MRC
intel-mrc {
-   offset = ;
+   offset = ;
};
 #endif
 #ifdef CONFIG_FSP_VERSION1
diff --git a/include/configs/x86-chromebook.h b/include/configs/x86-chromebook.h
index 41fb499ae4f7..059e3a0d8a2c 100644
--- a/include/configs/x86-chromebook.h
+++ b/include/configs/x86-chromebook.h
@@ -6,7 +6,7 @@
 #ifndef _X86_CHROMEBOOK_H
 #define _X86_CHROMEBOOK_H
 
-#define CONFIG_X86_MRC_ADDR0xfffa
+#define CFG_X86_MRC_ADDR   0xfffa
 #define CONFIG_X86_REFCODE_ADDR0xffea
 #define CONFIG_X86_REFCODE_RUN_ADDR0
 
diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst
index e7b231e07120..69e4b00239c1 100644
--- a/tools/binman/binman.rst
+++ b/tools/binman/binman.rst
@@ -298,7 +298,7 @@ C preprocessor::
 
 #ifdef CONFIG_HAVE_MRC
 intel-mrc {
-offset = ;
+offset = ;
 };
 #endif
 
-- 
2.25.1



[PATCH 135/149] global: Migrate CONFIG_WATCHDOG_PRESC et al to CFG

2022-12-04 Thread Tom Rini
Perform simple renames of:
   CONFIG_WATCHDOG_PRESC to CFG_WATCHDOG_PRESC
   CONFIG_WATCHDOG_RC to CFG_WATCHDOG_RC

Signed-off-by: Tom Rini 
---
 arch/powerpc/cpu/mpc85xx/cpu.c | 2 +-
 include/configs/kmcent2.h  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index 0abcc01b8574..e8a3e82765fc 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu.c
@@ -357,7 +357,7 @@ void
 init_85xx_watchdog(void)
 {
mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WATCHDOG_MASK) |
- TCR_WP(CONFIG_WATCHDOG_PRESC) | TCR_WRC(CONFIG_WATCHDOG_RC));
+ TCR_WP(CFG_WATCHDOG_PRESC) | TCR_WRC(CFG_WATCHDOG_RC));
 }
 
 void
diff --git a/include/configs/kmcent2.h b/include/configs/kmcent2.h
index 1eaf1968321c..9bb8cd19033e 100644
--- a/include/configs/kmcent2.h
+++ b/include/configs/kmcent2.h
@@ -375,8 +375,8 @@ int get_scl(void);
 /*
  * Hardware Watchdog
  */
-#define CONFIG_WATCHDOG_PRESC 34   /* wdog prescaler 2^(64-34) ~10min */
-#define CONFIG_WATCHDOG_RC WRC_CHIP/* reset chip on watchdog event */
+#define CFG_WATCHDOG_PRESC 34  /* wdog prescaler 2^(64-34) ~10min */
+#define CFG_WATCHDOG_RC WRC_CHIP   /* reset chip on watchdog event */
 
 /*
  * For booting Linux, the board info and command line data
-- 
2.25.1



[PATCH 129/149] global: Migrate CONFIG_TESTPIN_REG to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_TESTPIN_REG to CFG_TESTPIN_REG

Signed-off-by: Tom Rini 
---
 board/keymile/km83xx/km83xx.c | 2 +-
 include/configs/kmcoge5ne.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 73e3709bbba2..9ec1dbc6f97b 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -216,7 +216,7 @@ int post_hotkeys_pressed(void)
int testpin = 0;
struct km_bec_fpga *base =
(struct km_bec_fpga *)CFG_SYS_KMBEC_FPGA_BASE;
-   int testpin_reg = in_8(>CONFIG_TESTPIN_REG);
+   int testpin_reg = in_8(>CFG_TESTPIN_REG);
testpin = (testpin_reg & CFG_TESTPIN_MASK) != 0;
debug("post_hotkeys_pressed: %d\n", !testpin);
return testpin;
diff --git a/include/configs/kmcoge5ne.h b/include/configs/kmcoge5ne.h
index 0bd789b26b06..f67e81f2b3e3 100644
--- a/include/configs/kmcoge5ne.h
+++ b/include/configs/kmcoge5ne.h
@@ -35,7 +35,7 @@
 #define CFG_POST (CFG_SYS_POST_MEMORY|CFG_SYS_POST_MEM_REGIONS)
 #define CFG_POST_EXTERNAL_WORD_FUNCS /* use own functions, not generic */
 #define CPM_POST_WORD_ADDR  CONFIG_SYS_MEMTEST_END
-#define CONFIG_TESTPIN_REG  gprt3  /* for kmcoge5ne */
+#define CFG_TESTPIN_REG  gprt3 /* for kmcoge5ne */
 #define CFG_TESTPIN_MASK 0x20  /* for kmcoge5ne */
 
 #endif /* CONFIG */
-- 
2.25.1



[PATCH 134/149] global: Migrate CONFIG_VSC7385_IMAGE et al to CFG

2022-12-04 Thread Tom Rini
Perform simple renames of:
   CONFIG_VSC7385_IMAGE to CFG_VSC7385_IMAGE
   CONFIG_VSC7385_IMAGE_SIZE to CFG_VSC7385_IMAGE_SIZE

Signed-off-by: Tom Rini 
---
 board/freescale/mpc837xerdb/mpc837xerdb.c   | 6 +++---
 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +-
 include/configs/MPC837XERDB.h   | 4 ++--
 include/configs/p1_p2_rdb_pc.h  | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c 
b/board/freescale/mpc837xerdb/mpc837xerdb.c
index 8b1bfe0a9f91..97884a397964 100644
--- a/board/freescale/mpc837xerdb/mpc837xerdb.c
+++ b/board/freescale/mpc837xerdb/mpc837xerdb.c
@@ -206,9 +206,9 @@ int misc_init_r(void)
 {
int rc = 0;
 
-#ifdef CONFIG_VSC7385_IMAGE
-   if (vsc7385_upload_firmware((void *) CONFIG_VSC7385_IMAGE,
-   CONFIG_VSC7385_IMAGE_SIZE)) {
+#ifdef CFG_VSC7385_IMAGE
+   if (vsc7385_upload_firmware((void *) CFG_VSC7385_IMAGE,
+   CFG_VSC7385_IMAGE_SIZE)) {
puts("Failure uploading VSC7385 microcode.\n");
rc = 1;
}
diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c 
b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
index 4d7d042eaf3b..602b7f0156ba 100644
--- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
+++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
@@ -355,7 +355,7 @@ int board_early_init_r(void)
vscfw_addr = hextoul(tmp, NULL);
printf("uploading VSC7385 microcode from %x\n", vscfw_addr);
if (vsc7385_upload_firmware((void *)vscfw_addr,
-   CONFIG_VSC7385_IMAGE_SIZE))
+   CFG_VSC7385_IMAGE_SIZE))
puts("Failure uploading VSC7385 microcode.\n");
} else {
puts("No address specified for VSC7385 microcode.\n");
diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h
index 07c989d98906..70b1c399241e 100644
--- a/include/configs/MPC837XERDB.h
+++ b/include/configs/MPC837XERDB.h
@@ -42,8 +42,8 @@
 #ifdef CONFIG_VSC7385_ENET
 
 /* The flash address and size of the VSC7385 firmware image */
-#define CONFIG_VSC7385_IMAGE   0xFE7FE000
-#define CONFIG_VSC7385_IMAGE_SIZE  8192
+#define CFG_VSC7385_IMAGE  0xFE7FE000
+#define CFG_VSC7385_IMAGE_SIZE 8192
 
 #endif
 
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index be7680198299..f5bd09134499 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -270,7 +270,7 @@
 #endif
 
 /* The size of the VSC7385 firmware image */
-#define CONFIG_VSC7385_IMAGE_SIZE  8192
+#define CFG_VSC7385_IMAGE_SIZE 8192
 #endif
 
 #ifndef __VSCFW_ADDR
-- 
2.25.1



[PATCH 133/149] global: Migrate CONFIG_USB_ISP1301_I2C_ADDR to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_USB_ISP1301_I2C_ADDR to 
CFG_USB_ISP1301_I2C_ADDR

Signed-off-by: Tom Rini 
---
 drivers/usb/host/ohci-lpc32xx.c | 2 +-
 include/configs/devkit3250.h| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ohci-lpc32xx.c b/drivers/usb/host/ohci-lpc32xx.c
index 3be0b311a36e..a04b2961b961 100644
--- a/drivers/usb/host/ohci-lpc32xx.c
+++ b/drivers/usb/host/ohci-lpc32xx.c
@@ -69,7 +69,7 @@ struct otg_regs {
 #define OTG1_DM_PULLDOWN   (1 << 3)
 #define OTG1_VBUS_DRV  (1 << 5)
 
-#define ISP1301_I2C_ADDR   CONFIG_USB_ISP1301_I2C_ADDR
+#define ISP1301_I2C_ADDR   CFG_USB_ISP1301_I2C_ADDR
 
 #define ISP1301_I2C_MODE_CONTROL_1_SET 0x04
 #define ISP1301_I2C_MODE_CONTROL_1_CLR 0x05
diff --git a/include/configs/devkit3250.h b/include/configs/devkit3250.h
index 9cfee381d4ac..d85aeaafe519 100644
--- a/include/configs/devkit3250.h
+++ b/include/configs/devkit3250.h
@@ -53,7 +53,7 @@
 /*
  * USB
  */
-#define CONFIG_USB_ISP1301_I2C_ADDR0x2d
+#define CFG_USB_ISP1301_I2C_ADDR   0x2d
 
 /*
  * U-Boot General Configurations
-- 
2.25.1



[PATCH 132/149] global: Migrate CONFIG_USART_ID to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_USART_ID to CFG_USART_ID

Signed-off-by: Tom Rini 
---
 drivers/serial/atmel_usart.c| 2 +-
 include/configs/corvus.h| 2 +-
 include/configs/sam9x60_curiosity.h | 2 +-
 include/configs/sam9x60ek.h | 2 +-
 include/configs/smartweb.h  | 2 +-
 include/configs/taurus.h| 2 +-
 include/configs/vinco.h | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index 56655427b06b..9d97bc865445 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -73,7 +73,7 @@ static void atmel_serial_activate(atmel_usart3_t *usart)
 static void atmel_serial_setbrg(void)
 {
atmel_serial_setbrg_internal((atmel_usart3_t *)CFG_USART_BASE,
-CONFIG_USART_ID, gd->baudrate);
+CFG_USART_ID, gd->baudrate);
 }
 
 static int atmel_serial_init(void)
diff --git a/include/configs/corvus.h b/include/configs/corvus.h
index c9eb75d93088..f2675e0ec864 100644
--- a/include/configs/corvus.h
+++ b/include/configs/corvus.h
@@ -29,7 +29,7 @@
 
 /* serial console */
 #define CFG_USART_BASE ATMEL_BASE_DBGU
-#define CONFIG_USART_IDATMEL_ID_SYS
+#define CFG_USART_ID   ATMEL_ID_SYS
 
 /* SDRAM */
 #define CFG_SYS_SDRAM_BASE   ATMEL_BASE_CS6
diff --git a/include/configs/sam9x60_curiosity.h 
b/include/configs/sam9x60_curiosity.h
index 204020d5ee74..e79f80f17f61 100644
--- a/include/configs/sam9x60_curiosity.h
+++ b/include/configs/sam9x60_curiosity.h
@@ -14,7 +14,7 @@
 #define CFG_SYS_AT91_MAIN_CLOCK2400/* 24 MHz crystal */
 
 #define CFG_USART_BASE   ATMEL_BASE_DBGU
-#define CONFIG_USART_ID 0 /* ignored in arm */
+#define CFG_USART_ID 0 /* ignored in arm */
 
 /* SDRAM */
 #define CFG_SYS_SDRAM_BASE 0x2000
diff --git a/include/configs/sam9x60ek.h b/include/configs/sam9x60ek.h
index 800b98ff98af..2c761821efb1 100644
--- a/include/configs/sam9x60ek.h
+++ b/include/configs/sam9x60ek.h
@@ -15,7 +15,7 @@
 #define CFG_SYS_AT91_MAIN_CLOCK2400/* 24 MHz crystal */
 
 #define CFG_USART_BASE   ATMEL_BASE_DBGU
-#define CONFIG_USART_ID 0 /* ignored in arm */
+#define CFG_USART_ID 0 /* ignored in arm */
 
 /*
  * define CONFIG_USB_EHCI_HCD to enable USB Hi-Speed (aka 2.0)
diff --git a/include/configs/smartweb.h b/include/configs/smartweb.h
index f9a5aa9e32d0..75a1670e3317 100644
--- a/include/configs/smartweb.h
+++ b/include/configs/smartweb.h
@@ -62,7 +62,7 @@
 
 /* serial console */
 #define CFG_USART_BASE ATMEL_BASE_DBGU
-#define CONFIG_USART_IDATMEL_ID_SYS
+#define CFG_USART_ID   ATMEL_ID_SYS
 
 /* DFU class support */
 #define DFU_MANIFEST_POLL_TIMEOUT  25000
diff --git a/include/configs/taurus.h b/include/configs/taurus.h
index 88870d6fdf69..174b848e2595 100644
--- a/include/configs/taurus.h
+++ b/include/configs/taurus.h
@@ -35,7 +35,7 @@
 /* Misc CPU related */
 
 #define CFG_USART_BASE ATMEL_BASE_DBGU
-#define CONFIG_USART_IDATMEL_ID_SYS
+#define CFG_USART_ID   ATMEL_ID_SYS
 
 /*
  * SDRAM: 1 bank, min 32, max 128 MB
diff --git a/include/configs/vinco.h b/include/configs/vinco.h
index 3b4032301f6e..68c56df5435e 100644
--- a/include/configs/vinco.h
+++ b/include/configs/vinco.h
@@ -18,7 +18,7 @@
 
 /* serial console */
 #define CFG_USART_BASE 0xfc00c000
-#define CONFIG_USART_ID30
+#define CFG_USART_ID   30
 
 /* Timer */
 #define CFG_SYS_TIMER_COUNTER  0xfc06863c
-- 
2.25.1



[PATCH 131/149] global: Migrate CONFIG_USART_BASE to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_USART_BASE to CFG_USART_BASE

Signed-off-by: Tom Rini 
---
 drivers/serial/atmel_usart.c| 10 +-
 include/configs/corvus.h|  2 +-
 include/configs/sam9x60_curiosity.h |  2 +-
 include/configs/sam9x60ek.h |  2 +-
 include/configs/smartweb.h  |  2 +-
 include/configs/taurus.h|  2 +-
 include/configs/vinco.h |  2 +-
 7 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index 90ccdf6b2945..56655427b06b 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -72,13 +72,13 @@ static void atmel_serial_activate(atmel_usart3_t *usart)
 
 static void atmel_serial_setbrg(void)
 {
-   atmel_serial_setbrg_internal((atmel_usart3_t *)CONFIG_USART_BASE,
+   atmel_serial_setbrg_internal((atmel_usart3_t *)CFG_USART_BASE,
 CONFIG_USART_ID, gd->baudrate);
 }
 
 static int atmel_serial_init(void)
 {
-   atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
+   atmel_usart3_t *usart = (atmel_usart3_t *)CFG_USART_BASE;
 
atmel_serial_init_internal(usart);
serial_setbrg();
@@ -89,7 +89,7 @@ static int atmel_serial_init(void)
 
 static void atmel_serial_putc(char c)
 {
-   atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
+   atmel_usart3_t *usart = (atmel_usart3_t *)CFG_USART_BASE;
 
if (c == '\n')
serial_putc('\r');
@@ -100,7 +100,7 @@ static void atmel_serial_putc(char c)
 
 static int atmel_serial_getc(void)
 {
-   atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
+   atmel_usart3_t *usart = (atmel_usart3_t *)CFG_USART_BASE;
 
while (!(readl(>csr) & USART3_BIT(RXRDY)))
 schedule();
@@ -109,7 +109,7 @@ static int atmel_serial_getc(void)
 
 static int atmel_serial_tstc(void)
 {
-   atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
+   atmel_usart3_t *usart = (atmel_usart3_t *)CFG_USART_BASE;
return (readl(>csr) & USART3_BIT(RXRDY)) != 0;
 }
 
diff --git a/include/configs/corvus.h b/include/configs/corvus.h
index 8a61086ecc15..c9eb75d93088 100644
--- a/include/configs/corvus.h
+++ b/include/configs/corvus.h
@@ -28,7 +28,7 @@
 #define CFG_SYS_AT91_MAIN_CLOCK  1200 /* from 12 MHz crystal */
 
 /* serial console */
-#define CONFIG_USART_BASE  ATMEL_BASE_DBGU
+#define CFG_USART_BASE ATMEL_BASE_DBGU
 #define CONFIG_USART_IDATMEL_ID_SYS
 
 /* SDRAM */
diff --git a/include/configs/sam9x60_curiosity.h 
b/include/configs/sam9x60_curiosity.h
index f44ce909b918..204020d5ee74 100644
--- a/include/configs/sam9x60_curiosity.h
+++ b/include/configs/sam9x60_curiosity.h
@@ -13,7 +13,7 @@
 #define CFG_SYS_AT91_SLOW_CLOCK32768
 #define CFG_SYS_AT91_MAIN_CLOCK2400/* 24 MHz crystal */
 
-#define CONFIG_USART_BASE   ATMEL_BASE_DBGU
+#define CFG_USART_BASE   ATMEL_BASE_DBGU
 #define CONFIG_USART_ID 0 /* ignored in arm */
 
 /* SDRAM */
diff --git a/include/configs/sam9x60ek.h b/include/configs/sam9x60ek.h
index 27b39ebf4174..800b98ff98af 100644
--- a/include/configs/sam9x60ek.h
+++ b/include/configs/sam9x60ek.h
@@ -14,7 +14,7 @@
 #define CFG_SYS_AT91_SLOW_CLOCK32768
 #define CFG_SYS_AT91_MAIN_CLOCK2400/* 24 MHz crystal */
 
-#define CONFIG_USART_BASE   ATMEL_BASE_DBGU
+#define CFG_USART_BASE   ATMEL_BASE_DBGU
 #define CONFIG_USART_ID 0 /* ignored in arm */
 
 /*
diff --git a/include/configs/smartweb.h b/include/configs/smartweb.h
index 762f61470b15..f9a5aa9e32d0 100644
--- a/include/configs/smartweb.h
+++ b/include/configs/smartweb.h
@@ -61,7 +61,7 @@
 #define CFG_SYS_NAND_READY_PIN AT91_PIN_PC13
 
 /* serial console */
-#define CONFIG_USART_BASE  ATMEL_BASE_DBGU
+#define CFG_USART_BASE ATMEL_BASE_DBGU
 #define CONFIG_USART_IDATMEL_ID_SYS
 
 /* DFU class support */
diff --git a/include/configs/taurus.h b/include/configs/taurus.h
index 855218a8901e..88870d6fdf69 100644
--- a/include/configs/taurus.h
+++ b/include/configs/taurus.h
@@ -34,7 +34,7 @@
 
 /* Misc CPU related */
 
-#define CONFIG_USART_BASE  ATMEL_BASE_DBGU
+#define CFG_USART_BASE ATMEL_BASE_DBGU
 #define CONFIG_USART_IDATMEL_ID_SYS
 
 /*
diff --git a/include/configs/vinco.h b/include/configs/vinco.h
index 0698ae1d1c6e..3b4032301f6e 100644
--- a/include/configs/vinco.h
+++ b/include/configs/vinco.h
@@ -17,7 +17,7 @@
 /* The value in the common file is too far away for the VInCo platform */
 
 /* serial console */
-#define CONFIG_USART_BASE  0xfc00c000
+#define CFG_USART_BASE 0xfc00c000
 #define CONFIG_USART_ID30
 
 /* Timer */
-- 
2.25.1



[PATCH 127/149] global: Migrate CONFIG_TEGRA_BOARD_STRING to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_TEGRA_BOARD_STRING to CFG_TEGRA_BOARD_STRING

Signed-off-by: Tom Rini 
---
 arch/arm/mach-tegra/board2.c  | 2 +-
 include/configs/beaver.h  | 2 +-
 include/configs/cardhu.h  | 2 +-
 include/configs/cei-tk1-som.h | 2 +-
 include/configs/dalmore.h | 2 +-
 include/configs/harmony.h | 2 +-
 include/configs/jetson-tk1.h  | 2 +-
 include/configs/medcom-wide.h | 2 +-
 include/configs/nyan-big.h| 2 +-
 include/configs/p2371-.h  | 2 +-
 include/configs/p2371-2180.h  | 2 +-
 include/configs/p2571.h   | 2 +-
 include/configs/p2771-.h  | 2 +-
 include/configs/p3450-.h  | 2 +-
 include/configs/paz00.h   | 2 +-
 include/configs/plutux.h  | 2 +-
 include/configs/seaboard.h| 2 +-
 include/configs/tec-ng.h  | 2 +-
 include/configs/tec.h | 2 +-
 include/configs/trimslice.h   | 2 +-
 include/configs/venice2.h | 2 +-
 include/configs/ventana.h | 2 +-
 22 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index 54bbd8a776e9..c7a45f4ff82a 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -89,7 +89,7 @@ int checkboard(void)
 {
int board_id = tegra_board_id();
 
-   printf("Board: %s", CONFIG_TEGRA_BOARD_STRING);
+   printf("Board: %s", CFG_TEGRA_BOARD_STRING);
if (board_id != -1)
printf(", ID: %d\n", board_id);
printf("\n");
diff --git a/include/configs/beaver.h b/include/configs/beaver.h
index 7e0e47796073..e622b7127e36 100644
--- a/include/configs/beaver.h
+++ b/include/configs/beaver.h
@@ -11,7 +11,7 @@
 #include "tegra30-common.h"
 
 /* High-level configuration options */
-#define CONFIG_TEGRA_BOARD_STRING  "NVIDIA Beaver"
+#define CFG_TEGRA_BOARD_STRING "NVIDIA Beaver"
 
 /* Board-specific serial config */
 #define CFG_SYS_NS16550_COM1   NV_PA_APB_UARTA_BASE
diff --git a/include/configs/cardhu.h b/include/configs/cardhu.h
index 64d713a19691..82729eb95cf6 100644
--- a/include/configs/cardhu.h
+++ b/include/configs/cardhu.h
@@ -11,7 +11,7 @@
 #include "tegra30-common.h"
 
 /* High-level configuration options */
-#define CONFIG_TEGRA_BOARD_STRING  "NVIDIA Cardhu"
+#define CFG_TEGRA_BOARD_STRING "NVIDIA Cardhu"
 
 #define BOARD_EXTRA_ENV_SETTINGS \
"board_name=cardhu-a04\0" \
diff --git a/include/configs/cei-tk1-som.h b/include/configs/cei-tk1-som.h
index e49eb602081d..fbd38b77fe55 100644
--- a/include/configs/cei-tk1-som.h
+++ b/include/configs/cei-tk1-som.h
@@ -16,7 +16,7 @@
 #include "tegra124-common.h"
 
 /* High-level configuration options */
-#define CONFIG_TEGRA_BOARD_STRING  "CEI tk1-som"
+#define CFG_TEGRA_BOARD_STRING "CEI tk1-som"
 
 /* Board-specific serial config */
 #define CFG_SYS_NS16550_COM1   NV_PA_APB_UARTD_BASE
diff --git a/include/configs/dalmore.h b/include/configs/dalmore.h
index c9009e396237..095554157fae 100644
--- a/include/configs/dalmore.h
+++ b/include/configs/dalmore.h
@@ -11,7 +11,7 @@
 #include "tegra114-common.h"
 
 /* High-level configuration options */
-#define CONFIG_TEGRA_BOARD_STRING  "NVIDIA Dalmore"
+#define CFG_TEGRA_BOARD_STRING "NVIDIA Dalmore"
 
 /* Board-specific serial config */
 #define CFG_SYS_NS16550_COM1   NV_PA_APB_UARTD_BASE
diff --git a/include/configs/harmony.h b/include/configs/harmony.h
index a1a66bfb64e0..cae7acdb70b2 100644
--- a/include/configs/harmony.h
+++ b/include/configs/harmony.h
@@ -11,7 +11,7 @@
 #include "tegra20-common.h"
 
 /* High-level configuration options */
-#define CONFIG_TEGRA_BOARD_STRING  "NVIDIA Harmony"
+#define CFG_TEGRA_BOARD_STRING "NVIDIA Harmony"
 
 /* Board-specific serial config */
 
diff --git a/include/configs/jetson-tk1.h b/include/configs/jetson-tk1.h
index aa9e1d811a50..9858f8ff2b5d 100644
--- a/include/configs/jetson-tk1.h
+++ b/include/configs/jetson-tk1.h
@@ -12,7 +12,7 @@
 #include "tegra124-common.h"
 
 /* High-level configuration options */
-#define CONFIG_TEGRA_BOARD_STRING  "NVIDIA Jetson TK1"
+#define CFG_TEGRA_BOARD_STRING "NVIDIA Jetson TK1"
 
 /* Board-specific serial config */
 #define CFG_SYS_NS16550_COM1   NV_PA_APB_UARTD_BASE
diff --git a/include/configs/medcom-wide.h b/include/configs/medcom-wide.h
index efac0febdf81..8dbe741278a6 100644
--- a/include/configs/medcom-wide.h
+++ b/include/configs/medcom-wide.h
@@ -12,7 +12,7 @@
 #include "tegra20-common.h"
 
 /* High-level configuration options */
-#define CONFIG_TEGRA_BOARD_STRING  "Avionic Design Medcom-Wide"
+#define CFG_TEGRA_BOARD_STRING "Avionic Design Medcom-Wide"
 
 /* Board-specific serial config */
 #define CFG_SYS_NS16550_COM1   NV_PA_APB_UARTD_BASE
diff --git a/include/configs/nyan-big.h b/include/configs/nyan-big.h
index e885526e625f..c04d402deb0c 100644
--- a/include/configs/nyan-big.h
+++ b/include/configs/nyan-big.h
@@ -12,7 +12,7 @@
 #include "tegra124-common.h"
 
 /* High-level configuration options */
-#define 

[PATCH 130/149] global: Migrate CONFIG_TSEC_TBICR_SETTINGS to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_TSEC_TBICR_SETTINGS to CFG_TSEC_TBICR_SETTINGS

Signed-off-by: Tom Rini 
---
 drivers/net/tsec.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index f465409d8c8e..8833e3098d52 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -29,14 +29,14 @@
)
 
 /* By default force the TBI PHY into 1000Mbps full duplex when in SGMII mode */
-#ifndef CONFIG_TSEC_TBICR_SETTINGS
-#define CONFIG_TSEC_TBICR_SETTINGS ( \
+#ifndef CFG_TSEC_TBICR_SETTINGS
+#define CFG_TSEC_TBICR_SETTINGS ( \
TBICR_PHY_RESET \
| TBICR_ANEG_ENABLE \
| TBICR_FULL_DUPLEX \
| TBICR_SPEED1_SET \
)
-#endif /* CONFIG_TSEC_TBICR_SETTINGS */
+#endif /* CFG_TSEC_TBICR_SETTINGS */
 
 /* Configure the TBI for SGMII operation */
 static void tsec_configure_serdes(struct tsec_private *priv)
@@ -50,7 +50,7 @@ static void tsec_configure_serdes(struct tsec_private *priv)
tsec_local_mdio_write(priv->phyregs_sgmii, in_be32(>regs->tbipa),
  0, TBI_TBICON, TBICON_CLK_SELECT);
tsec_local_mdio_write(priv->phyregs_sgmii, in_be32(>regs->tbipa),
- 0, TBI_CR, CONFIG_TSEC_TBICR_SETTINGS);
+ 0, TBI_CR, CFG_TSEC_TBICR_SETTINGS);
 }
 
 /* the 'way' for ethernet-CRC-32. Spliced in from Linux lib/crc32.c
-- 
2.25.1



[PATCH 128/149] global: Migrate CONFIG_TESTPIN_MASK to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_TESTPIN_MASK to CFG_TESTPIN_MASK

Signed-off-by: Tom Rini 
---
 board/keymile/km83xx/km83xx.c | 2 +-
 include/configs/kmcoge5ne.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 88afc76bbbf6..73e3709bbba2 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -217,7 +217,7 @@ int post_hotkeys_pressed(void)
struct km_bec_fpga *base =
(struct km_bec_fpga *)CFG_SYS_KMBEC_FPGA_BASE;
int testpin_reg = in_8(>CONFIG_TESTPIN_REG);
-   testpin = (testpin_reg & CONFIG_TESTPIN_MASK) != 0;
+   testpin = (testpin_reg & CFG_TESTPIN_MASK) != 0;
debug("post_hotkeys_pressed: %d\n", !testpin);
return testpin;
 }
diff --git a/include/configs/kmcoge5ne.h b/include/configs/kmcoge5ne.h
index b6386bdbcb7e..0bd789b26b06 100644
--- a/include/configs/kmcoge5ne.h
+++ b/include/configs/kmcoge5ne.h
@@ -36,6 +36,6 @@
 #define CFG_POST_EXTERNAL_WORD_FUNCS /* use own functions, not generic */
 #define CPM_POST_WORD_ADDR  CONFIG_SYS_MEMTEST_END
 #define CONFIG_TESTPIN_REG  gprt3  /* for kmcoge5ne */
-#define CONFIG_TESTPIN_MASK 0x20   /* for kmcoge5ne */
+#define CFG_TESTPIN_MASK 0x20  /* for kmcoge5ne */
 
 #endif /* CONFIG */
-- 
2.25.1



[PATCH 126/149] global: Migrate CONFIG_SYS_I2C_DIRECT_BUS to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_SYS_I2C_DIRECT_BUS to CFG_SYS_I2C_DIRECT_BUS

Signed-off-by: Tom Rini 
---
 README |  4 ++--
 cmd/i2c.c  |  4 ++--
 drivers/i2c/i2c_core.c | 10 +-
 include/i2c.h  |  8 
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/README b/README
index a9b225e45ecb..fe571f7ef0a6 100644
--- a/README
+++ b/README
@@ -843,7 +843,7 @@ The following options need to be configured:
CFG_SYS_NUM_I2C_BUSES
Hold the number of i2c buses you want to use.
 
-   CONFIG_SYS_I2C_DIRECT_BUS
+   CFG_SYS_I2C_DIRECT_BUS
define this, if you don't use i2c muxes on your hardware.
if CFG_SYS_I2C_MAX_HOPS is not defined or == 0 you can
omit this define.
@@ -855,7 +855,7 @@ The following options need to be configured:
 
CFG_SYS_I2C_BUSES
hold a list of buses you want to use, only used if
-   CONFIG_SYS_I2C_DIRECT_BUS is not defined, for example
+   CFG_SYS_I2C_DIRECT_BUS is not defined, for example
a board with CFG_SYS_I2C_MAX_HOPS = 1 and
CFG_SYS_NUM_I2C_BUSES = 9:
 
diff --git a/cmd/i2c.c b/cmd/i2c.c
index f204061cf09f..dd803ee22719 100644
--- a/cmd/i2c.c
+++ b/cmd/i2c.c
@@ -1699,7 +1699,7 @@ static int do_i2c_show_bus(struct cmd_tbl *cmdtp, int 
flag, int argc,
 
for (i = 0; i < CFG_SYS_NUM_I2C_BUSES; i++) {
printf("Bus %d:\t%s", i, I2C_ADAP_NR(i)->name);
-#ifndef CONFIG_SYS_I2C_DIRECT_BUS
+#ifndef CFG_SYS_I2C_DIRECT_BUS
int j;
 
for (j = 0; j < CFG_SYS_I2C_MAX_HOPS; j++) {
@@ -1735,7 +1735,7 @@ static int do_i2c_show_bus(struct cmd_tbl *cmdtp, int 
flag, int argc,
return -1;
}
printf("Bus %d:\t%s", i, I2C_ADAP_NR(i)->name);
-#ifndef CONFIG_SYS_I2C_DIRECT_BUS
+#ifndef CFG_SYS_I2C_DIRECT_BUS
int j;
for (j = 0; j < CFG_SYS_I2C_MAX_HOPS; j++) {
if (i2c_bus[i].next_hop[j].chip == 0)
diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
index 7f65db23205a..fe0cd75d94a1 100644
--- a/drivers/i2c/i2c_core.c
+++ b/drivers/i2c/i2c_core.c
@@ -33,14 +33,14 @@ struct i2c_adapter *i2c_get_adapter(int index)
return i2c_adap_p;
 }
 
-#if !defined(CONFIG_SYS_I2C_DIRECT_BUS)
+#if !defined(CFG_SYS_I2C_DIRECT_BUS)
 struct i2c_bus_hose i2c_bus[CFG_SYS_NUM_I2C_BUSES] =
CFG_SYS_I2C_BUSES;
 #endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifndef CONFIG_SYS_I2C_DIRECT_BUS
+#ifndef CFG_SYS_I2C_DIRECT_BUS
 /*
  * i2c_mux_set()
  * -
@@ -237,7 +237,7 @@ int i2c_set_bus_num(unsigned int bus)
if ((bus == I2C_BUS) && (I2C_ADAP->init_done > 0))
return 0;
 
-#ifndef CONFIG_SYS_I2C_DIRECT_BUS
+#ifndef CFG_SYS_I2C_DIRECT_BUS
if (bus >= CFG_SYS_NUM_I2C_BUSES)
return -1;
 #endif
@@ -249,7 +249,7 @@ int i2c_set_bus_num(unsigned int bus)
return -2;
}
 
-#ifndef CONFIG_SYS_I2C_DIRECT_BUS
+#ifndef CFG_SYS_I2C_DIRECT_BUS
i2c_mux_disconnect_all();
 #endif
 
@@ -257,7 +257,7 @@ int i2c_set_bus_num(unsigned int bus)
if (I2C_ADAP->init_done == 0)
i2c_init_bus(bus, I2C_ADAP->speed, I2C_ADAP->slaveaddr);
 
-#ifndef CONFIG_SYS_I2C_DIRECT_BUS
+#ifndef CFG_SYS_I2C_DIRECT_BUS
i2c_mux_set_all();
 #endif
return 0;
diff --git a/include/i2c.h b/include/i2c.h
index 3811b26c08e0..ef3820eaba7c 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -635,12 +635,12 @@ void i2c_early_init_f(void);
 
 #if !defined(CFG_SYS_I2C_MAX_HOPS)
 /* no muxes used bus = i2c adapters */
-#define CONFIG_SYS_I2C_DIRECT_BUS  1
+#define CFG_SYS_I2C_DIRECT_BUS 1
 #define CFG_SYS_I2C_MAX_HOPS   0
 #define CFG_SYS_NUM_I2C_BUSES  ll_entry_count(struct i2c_adapter, i2c)
 #else
 /* we use i2c muxes */
-#undef CONFIG_SYS_I2C_DIRECT_BUS
+#undef CFG_SYS_I2C_DIRECT_BUS
 #endif
 
 /* define the I2C bus number for RTC and DTT if not already done */
@@ -691,7 +691,7 @@ struct i2c_adapter {
 
 struct i2c_adapter *i2c_get_adapter(int index);
 
-#ifndef CONFIG_SYS_I2C_DIRECT_BUS
+#ifndef CFG_SYS_I2C_DIRECT_BUS
 struct i2c_mux {
int id;
charname[16];
@@ -720,7 +720,7 @@ extern struct i2c_bus_hose  i2c_bus[];
 #defineI2C_ADAPI2C_ADAP_NR(gd->cur_i2c_bus)
 #define I2C_ADAP_HWNR  (I2C_ADAP->hwadapnr)
 
-#ifndef CONFIG_SYS_I2C_DIRECT_BUS
+#ifndef CFG_SYS_I2C_DIRECT_BUS
 #define I2C_MUX_PCA9540_ID 1
 #define I2C_MUX_PCA9540{I2C_MUX_PCA9540_ID, "PCA9540B"}
 #define I2C_MUX_PCA9542_ID 2
-- 
2.25.1



[PATCH 123/149] global: Migrate CONFIG_SMP_PEN_ADDR to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_SMP_PEN_ADDR to CFG_SMP_PEN_ADDR

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/nonsec_virt.S | 4 ++--
 board/samsung/arndale/arndale.c  | 4 ++--
 include/configs/arndale.h| 2 +-
 include/configs/km/pg-wcom-ls102xa.h | 2 +-
 include/configs/ls1021aiot.h | 2 +-
 include/configs/ls1021aqds.h | 2 +-
 include/configs/ls1021atwr.h | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arm/cpu/armv7/nonsec_virt.S b/arch/arm/cpu/armv7/nonsec_virt.S
index b6d144f065d2..dcf9a7165f03 100644
--- a/arch/arm/cpu/armv7/nonsec_virt.S
+++ b/arch/arm/cpu/armv7/nonsec_virt.S
@@ -205,11 +205,11 @@ ENTRY(_nonsec_init)
bx  lr
 ENDPROC(_nonsec_init)
 
-#ifdef CONFIG_SMP_PEN_ADDR
+#ifdef CFG_SMP_PEN_ADDR
 /* void __weak smp_waitloop(unsigned previous_address); */
 ENTRY(smp_waitloop)
wfi
-   ldr r1, =CONFIG_SMP_PEN_ADDR@ load start address
+   ldr r1, =CFG_SMP_PEN_ADDR   @ load start address
ldr r1, [r1]
 #ifdef CONFIG_PEN_ADDR_BIG_ENDIAN
rev r1, r1
diff --git a/board/samsung/arndale/arndale.c b/board/samsung/arndale/arndale.c
index a992dc684291..3ebf600e1d7c 100644
--- a/board/samsung/arndale/arndale.c
+++ b/board/samsung/arndale/arndale.c
@@ -112,10 +112,10 @@ int checkboard(void)
 }
 #endif
 
-#ifdef CONFIG_SMP_PEN_ADDR
+#ifdef CFG_SMP_PEN_ADDR
 void smp_set_core_boot_addr(unsigned long addr, int corenr)
 {
-   writel(addr, CONFIG_SMP_PEN_ADDR);
+   writel(addr, CFG_SMP_PEN_ADDR);
 
/* make sure this write is really executed */
__asm__ volatile ("dsb\n");
diff --git a/include/configs/arndale.h b/include/configs/arndale.h
index 8acc525b11c9..b56effcd411e 100644
--- a/include/configs/arndale.h
+++ b/include/configs/arndale.h
@@ -16,7 +16,7 @@
 
 /* Miscellaneous configurable options */
 
-#define CONFIG_SMP_PEN_ADDR0x0202
+#define CFG_SMP_PEN_ADDR   0x0202
 
 /* The PERIPHBASE in the CBAR register is wrong on the Arndale, so override it 
*/
 #define CFG_ARM_GIC_BASE_ADDRESS   0x1048
diff --git a/include/configs/km/pg-wcom-ls102xa.h 
b/include/configs/km/pg-wcom-ls102xa.h
index a5dde8e441c9..d7ecd5ebe052 100644
--- a/include/configs/km/pg-wcom-ls102xa.h
+++ b/include/configs/km/pg-wcom-ls102xa.h
@@ -161,7 +161,7 @@
{1, {I2C_NULL_HOP} }, \
}
 
-#define CONFIG_SMP_PEN_ADDR0x01ee0200
+#define CFG_SMP_PEN_ADDR   0x01ee0200
 
 #define HWCONFIG_BUFFER_SIZE   256
 
diff --git a/include/configs/ls1021aiot.h b/include/configs/ls1021aiot.h
index 53d9936f4e77..83ab94ec444c 100644
--- a/include/configs/ls1021aiot.h
+++ b/include/configs/ls1021aiot.h
@@ -68,7 +68,7 @@
 
 #define FSL_PCIE_COMPAT"fsl,ls1021a-pcie"
 
-#define CONFIG_SMP_PEN_ADDR0x01ee0200
+#define CFG_SMP_PEN_ADDR   0x01ee0200
 
 #define HWCONFIG_BUFFER_SIZE   256
 
diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h
index 78432e558117..e4e5522a2384 100644
--- a/include/configs/ls1021aqds.h
+++ b/include/configs/ls1021aqds.h
@@ -242,7 +242,7 @@
  * MMC
  */
 
-#define CONFIG_SMP_PEN_ADDR0x01ee0200
+#define CFG_SMP_PEN_ADDR   0x01ee0200
 
 #define HWCONFIG_BUFFER_SIZE   256
 
diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h
index a387eeab472a..eb8fb042723a 100644
--- a/include/configs/ls1021atwr.h
+++ b/include/configs/ls1021atwr.h
@@ -133,7 +133,7 @@
 
 /* GPIO */
 
-#define CONFIG_SMP_PEN_ADDR0x01ee0200
+#define CFG_SMP_PEN_ADDR   0x01ee0200
 
 #define HWCONFIG_BUFFER_SIZE   256
 
-- 
2.25.1



[PATCH 125/149] global: Migrate CONFIG_STD_DEVICES_SETTINGS to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_STD_DEVICES_SETTINGS to 
CFG_STD_DEVICES_SETTINGS

Signed-off-by: Tom Rini 
---
 include/configs/bayleybay.h   | 2 +-
 include/configs/cherryhill.h  | 2 +-
 include/configs/chromebook_coral.h| 4 ++--
 include/configs/chromebook_samus.h| 4 ++--
 include/configs/conga-qeval20-qa3-e3845.h | 2 +-
 include/configs/coreboot.h| 2 +-
 include/configs/cougarcanyon2.h   | 2 +-
 include/configs/crownbay.h| 2 +-
 include/configs/dfi-bt700.h   | 2 +-
 include/configs/efi-x86_app.h | 2 +-
 include/configs/efi-x86_payload.h | 2 +-
 include/configs/galileo.h | 2 +-
 include/configs/minnowmax.h   | 2 +-
 include/configs/qemu-x86.h| 2 +-
 include/configs/slimbootloader.h  | 4 ++--
 include/configs/som-db5800-som-6867.h | 2 +-
 include/configs/theadorable-x86-common.h  | 2 +-
 include/configs/x86-chromebook.h  | 2 +-
 include/configs/x86-common.h  | 2 +-
 19 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/include/configs/bayleybay.h b/include/configs/bayleybay.h
index b347125f2fa0..b0df328cd84b 100644
--- a/include/configs/bayleybay.h
+++ b/include/configs/bayleybay.h
@@ -12,7 +12,7 @@
 
 #include 
 
-#define CONFIG_STD_DEVICES_SETTINGS"stdin=serial,usbkbd\0" \
+#define CFG_STD_DEVICES_SETTINGS   "stdin=serial,usbkbd\0" \
"stdout=serial,vidconsole\0" \
"stderr=serial,vidconsole\0"
 
diff --git a/include/configs/cherryhill.h b/include/configs/cherryhill.h
index 726c43d35ea0..d6ce70a96aea 100644
--- a/include/configs/cherryhill.h
+++ b/include/configs/cherryhill.h
@@ -8,7 +8,7 @@
 
 #include 
 
-#define CONFIG_STD_DEVICES_SETTINGS"stdin=usbkbd,serial\0" \
+#define CFG_STD_DEVICES_SETTINGS   "stdin=usbkbd,serial\0" \
"stdout=vidconsole,serial\0" \
"stderr=vidconsole,serial\0"
 
diff --git a/include/configs/chromebook_coral.h 
b/include/configs/chromebook_coral.h
index d14c1d445b25..43fdc394416d 100644
--- a/include/configs/chromebook_coral.h
+++ b/include/configs/chromebook_coral.h
@@ -13,8 +13,8 @@
 #include 
 #include 
 
-#undef CONFIG_STD_DEVICES_SETTINGS
-#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,i8042-kbd,serial\0" \
+#undef CFG_STD_DEVICES_SETTINGS
+#define CFG_STD_DEVICES_SETTINGS "stdin=usbkbd,i8042-kbd,serial\0" \
"stdout=vidconsole,serial\0" \
"stderr=vidconsole,serial\0"
 
diff --git a/include/configs/chromebook_samus.h 
b/include/configs/chromebook_samus.h
index e29be3fda4ac..03a1033c5735 100644
--- a/include/configs/chromebook_samus.h
+++ b/include/configs/chromebook_samus.h
@@ -15,8 +15,8 @@
 #include 
 #include 
 
-#undef CONFIG_STD_DEVICES_SETTINGS
-#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,i8042-kbd,serial\0" \
+#undef CFG_STD_DEVICES_SETTINGS
+#define CFG_STD_DEVICES_SETTINGS "stdin=usbkbd,i8042-kbd,serial\0" \
"stdout=vidconsole,serial\0" \
"stderr=vidconsole,serial\0"
 
diff --git a/include/configs/conga-qeval20-qa3-e3845.h 
b/include/configs/conga-qeval20-qa3-e3845.h
index 6f431725269c..60617e6fec25 100644
--- a/include/configs/conga-qeval20-qa3-e3845.h
+++ b/include/configs/conga-qeval20-qa3-e3845.h
@@ -12,7 +12,7 @@
 
 #include 
 
-#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial\0" \
+#define CFG_STD_DEVICES_SETTINGS "stdin=serial\0" \
"stdout=serial\0" \
"stderr=serial\0"
 
diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h
index f73004386fda..b4f49bf5289d 100644
--- a/include/configs/coreboot.h
+++ b/include/configs/coreboot.h
@@ -15,7 +15,7 @@
 
 #include 
 
-#define CONFIG_STD_DEVICES_SETTINGS"stdin=serial,i8042-kbd,usbkbd\0" \
+#define CFG_STD_DEVICES_SETTINGS   "stdin=serial,i8042-kbd,usbkbd\0" \
"stdout=serial,vidconsole\0" \
"stderr=serial,vidconsole\0"
 
diff --git a/include/configs/cougarcanyon2.h b/include/configs/cougarcanyon2.h
index b64c7df1b25f..31639e48da88 100644
--- a/include/configs/cougarcanyon2.h
+++ b/include/configs/cougarcanyon2.h
@@ -8,7 +8,7 @@
 
 #include 
 
-#define CONFIG_STD_DEVICES_SETTINGS"stdin=serial,i8042-kbd,usbkbd\0" \
+#define CFG_STD_DEVICES_SETTINGS   "stdin=serial,i8042-kbd,usbkbd\0" \
"stdout=serial,vga\0" \
"stderr=serial,vga\0"
 
diff --git a/include/configs/crownbay.h b/include/configs/crownbay.h
index ff74deb3d400..387bb8800e89 100644
--- a/include/configs/crownbay.h
+++ 

[PATCH 124/149] global: Migrate CONFIG_STACKBASE to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_STACKBASE to CFG_STACKBASE

Signed-off-by: Tom Rini 
---
 include/configs/tegra-common.h| 2 +-
 include/configs/tegra114-common.h | 2 +-
 include/configs/tegra124-common.h | 2 +-
 include/configs/tegra20-common.h  | 2 +-
 include/configs/tegra30-common.h  | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h
index 66cf7ae5847e..bde7ffce008f 100644
--- a/include/configs/tegra-common.h
+++ b/include/configs/tegra-common.h
@@ -45,7 +45,7 @@
 #define CFG_SYS_BOOTMAPSZ  (256 << 20) /* 256M */
 
 #ifndef CONFIG_ARM64
-#define CFG_SYS_INIT_RAM_ADDR  CONFIG_STACKBASE
+#define CFG_SYS_INIT_RAM_ADDR  CFG_STACKBASE
 #define CFG_SYS_INIT_RAM_SIZE  CONFIG_SYS_MALLOC_LEN
 
 /* Defines for SPL */
diff --git a/include/configs/tegra114-common.h 
b/include/configs/tegra114-common.h
index 87ec1f5a99d6..ab4fa5504c52 100644
--- a/include/configs/tegra114-common.h
+++ b/include/configs/tegra114-common.h
@@ -15,7 +15,7 @@
 /*
  * Miscellaneous configurable options
  */
-#define CONFIG_STACKBASE   0x8380  /* 56MB */
+#define CFG_STACKBASE  0x8380  /* 56MB */
 
 /*---
  * Physical Memory Map
diff --git a/include/configs/tegra124-common.h 
b/include/configs/tegra124-common.h
index 0485fea6ccb8..b413e2512128 100644
--- a/include/configs/tegra124-common.h
+++ b/include/configs/tegra124-common.h
@@ -17,7 +17,7 @@
 /*
  * Miscellaneous configurable options
  */
-#define CONFIG_STACKBASE   0x8380  /* 56MB */
+#define CFG_STACKBASE  0x8380  /* 56MB */
 
 /*---
  * Physical Memory Map
diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h
index 617bfb2197cf..a313ac2041a9 100644
--- a/include/configs/tegra20-common.h
+++ b/include/configs/tegra20-common.h
@@ -16,7 +16,7 @@
 /*
  * Miscellaneous configurable options
  */
-#define CONFIG_STACKBASE   0x0380  /* 56MB */
+#define CFG_STACKBASE  0x0380  /* 56MB */
 
 /*---
  * Physical Memory Map
diff --git a/include/configs/tegra30-common.h b/include/configs/tegra30-common.h
index 04fcf11ed82d..c57d2d157e33 100644
--- a/include/configs/tegra30-common.h
+++ b/include/configs/tegra30-common.h
@@ -16,7 +16,7 @@
 /*
  * Miscellaneous configurable options
  */
-#define CONFIG_STACKBASE   0x8380  /* 56MB */
+#define CFG_STACKBASE  0x8380  /* 56MB */
 
 /*
  * Memory layout for where various images get loaded by boot scripts:
-- 
2.25.1



[PATCH 122/149] global: Migrate CONFIG_SLIC to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_SLIC to CFG_SLIC

Signed-off-by: Tom Rini 
---
 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +-
 include/configs/p1_p2_rdb_pc.h  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c 
b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
index df9f6ae47322..4d7d042eaf3b 100644
--- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
+++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
@@ -187,7 +187,7 @@ void board_gpio_init(void)
setbits_be32(>gpdat, 0x0008);
 #endif
 
-#ifdef CONFIG_SLIC
+#ifdef CFG_SLIC
/* reset SLIC */
setbits_be32(>gpdir, 0x0004);
setbits_be32(>gpdat, 0x0004);
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index 832ad9c3ece0..be7680198299 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -13,7 +13,7 @@
 #include 
 
 #if defined(CONFIG_TARGET_P1020RDB_PC)
-#define CONFIG_SLIC
+#define CFG_SLIC
 #define __SW_BOOT_MASK 0x03
 #define __SW_BOOT_NOR  0x5c
 #define __SW_BOOT_SPI  0x1c
@@ -42,7 +42,7 @@
  * 011101 800 800 400 667 PCIe-2 Core0 boot; Core1 hold-off
  */
 #if defined(CONFIG_TARGET_P1020RDB_PD)
-#define CONFIG_SLIC
+#define CFG_SLIC
 #define __SW_BOOT_MASK 0x03
 #define __SW_BOOT_NOR  0x64
 #define __SW_BOOT_SPI  0x34
-- 
2.25.1



[PATCH 121/149] global: Migrate CONFIG_SH_ETHER_USE_PORT to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_SH_ETHER_USE_PORT to CFG_SH_ETHER_USE_PORT

Signed-off-by: Tom Rini 
---
 README| 2 +-
 drivers/net/sh_eth.c  | 6 +++---
 include/configs/alt.h | 2 +-
 include/configs/condor.h  | 2 +-
 include/configs/gose.h| 2 +-
 include/configs/grpeach.h | 2 +-
 include/configs/koelsch.h | 2 +-
 include/configs/lager.h   | 2 +-
 include/configs/porter.h  | 2 +-
 include/configs/silk.h| 2 +-
 include/configs/stout.h   | 2 +-
 11 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/README b/README
index 217fbaf55757..a9b225e45ecb 100644
--- a/README
+++ b/README
@@ -541,7 +541,7 @@ The following options need to be configured:
CONFIG_SH_ETHER
Support for Renesas on-chip Ethernet controller
 
-   CONFIG_SH_ETHER_USE_PORT
+   CFG_SH_ETHER_USE_PORT
Define the number of ports to be used
 
CFG_SH_ETHER_PHY_ADDR
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 3bf94cb2f7eb..8f162ca58fbb 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -30,8 +30,8 @@
 
 #include "sh_eth.h"
 
-#ifndef CONFIG_SH_ETHER_USE_PORT
-# error "Please define CONFIG_SH_ETHER_USE_PORT"
+#ifndef CFG_SH_ETHER_USE_PORT
+# error "Please define CFG_SH_ETHER_USE_PORT"
 #endif
 #ifndef CFG_SH_ETHER_PHY_ADDR
 # error "Please define CFG_SH_ETHER_PHY_ADDR"
@@ -693,7 +693,7 @@ static int sh_ether_probe(struct udevice *udev)
 
priv->bus = miiphy_get_dev_by_name(udev->name);
 
-   eth->port = CONFIG_SH_ETHER_USE_PORT;
+   eth->port = CFG_SH_ETHER_USE_PORT;
eth->port_info[eth->port].phy_addr = CFG_SH_ETHER_PHY_ADDR;
eth->port_info[eth->port].iobase =
(void __iomem *)(uintptr_t)(BASE_IO_ADDR + 0x800 * eth->port);
diff --git a/include/configs/alt.h b/include/configs/alt.h
index 53c31562a5d0..8f03762583e9 100644
--- a/include/configs/alt.h
+++ b/include/configs/alt.h
@@ -21,7 +21,7 @@
 #define RCAR_GEN2_UBOOT_SDRAM_SIZE (512 * 1024 * 1024)
 
 /* SH Ether */
-#define CONFIG_SH_ETHER_USE_PORT   0
+#define CFG_SH_ETHER_USE_PORT  0
 #define CFG_SH_ETHER_PHY_ADDR  0x1
 #define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
diff --git a/include/configs/condor.h b/include/configs/condor.h
index 2c9817cf02c5..50c8d1733838 100644
--- a/include/configs/condor.h
+++ b/include/configs/condor.h
@@ -14,7 +14,7 @@
 /* Environment compatibility */
 
 /* SH Ether */
-#define CONFIG_SH_ETHER_USE_PORT   0
+#define CFG_SH_ETHER_USE_PORT  0
 #define CFG_SH_ETHER_PHY_ADDR  0x1
 #define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
diff --git a/include/configs/gose.h b/include/configs/gose.h
index ed7dd70dd964..7ae0726518da 100644
--- a/include/configs/gose.h
+++ b/include/configs/gose.h
@@ -20,7 +20,7 @@
 #define RCAR_GEN2_UBOOT_SDRAM_SIZE (512u * 1024 * 1024)
 
 /* SH Ether */
-#define CONFIG_SH_ETHER_USE_PORT   0
+#define CFG_SH_ETHER_USE_PORT  0
 #define CFG_SH_ETHER_PHY_ADDR  0x1
 #define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
diff --git a/include/configs/grpeach.h b/include/configs/grpeach.h
index 6a11aa61f0fb..8de4a36e931a 100644
--- a/include/configs/grpeach.h
+++ b/include/configs/grpeach.h
@@ -17,7 +17,7 @@
 #define CFG_SYS_SDRAM_SIZE (10 * 1024 * 1024)
 
 /* Network interface */
-#define CONFIG_SH_ETHER_USE_PORT   0
+#define CFG_SH_ETHER_USE_PORT  0
 #define CFG_SH_ETHER_PHY_ADDR  0
 #define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_MII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
diff --git a/include/configs/koelsch.h b/include/configs/koelsch.h
index 31d0795f07fb..d47d70178ccd 100644
--- a/include/configs/koelsch.h
+++ b/include/configs/koelsch.h
@@ -20,7 +20,7 @@
 #define RCAR_GEN2_UBOOT_SDRAM_SIZE (512 * 1024 * 1024)
 
 /* SH Ether */
-#define CONFIG_SH_ETHER_USE_PORT   0
+#define CFG_SH_ETHER_USE_PORT  0
 #define CFG_SH_ETHER_PHY_ADDR  0x1
 #define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
diff --git a/include/configs/lager.h b/include/configs/lager.h
index 991fc9020ee0..2577c7a7da67 100644
--- a/include/configs/lager.h
+++ b/include/configs/lager.h
@@ -21,7 +21,7 @@
 #define RCAR_GEN2_UBOOT_SDRAM_SIZE (512 * 1024 * 1024)
 
 /* SH Ether */
-#define CONFIG_SH_ETHER_USE_PORT   0
+#define CFG_SH_ETHER_USE_PORT  0
 #define CFG_SH_ETHER_PHY_ADDR  0x1
 #define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
diff --git a/include/configs/porter.h b/include/configs/porter.h
index 1587c5c5397c..2cb430be8b0d 100644
--- a/include/configs/porter.h
+++ b/include/configs/porter.h
@@ -22,7 +22,7 @@
 #define RCAR_GEN2_UBOOT_SDRAM_SIZE (1024u * 1024 * 1024)
 
 /* SH Ether */
-#define CONFIG_SH_ETHER_USE_PORT   0
+#define CFG_SH_ETHER_USE_PORT  0
 #define CFG_SH_ETHER_PHY_ADDR  0x1

[PATCH 120/149] global: Migrate CONFIG_SH_ETHER_PHY_MODE to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_SH_ETHER_PHY_MODE to CFG_SH_ETHER_PHY_MODE

Signed-off-by: Tom Rini 
---
 include/configs/alt.h | 2 +-
 include/configs/condor.h  | 2 +-
 include/configs/gose.h| 2 +-
 include/configs/grpeach.h | 2 +-
 include/configs/koelsch.h | 2 +-
 include/configs/lager.h   | 2 +-
 include/configs/porter.h  | 2 +-
 include/configs/silk.h| 2 +-
 include/configs/stout.h   | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/configs/alt.h b/include/configs/alt.h
index 06ab5ce669b9..53c31562a5d0 100644
--- a/include/configs/alt.h
+++ b/include/configs/alt.h
@@ -23,7 +23,7 @@
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CFG_SH_ETHER_PHY_ADDR  0x1
-#define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
+#define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
diff --git a/include/configs/condor.h b/include/configs/condor.h
index 43b88f127213..2c9817cf02c5 100644
--- a/include/configs/condor.h
+++ b/include/configs/condor.h
@@ -16,7 +16,7 @@
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CFG_SH_ETHER_PHY_ADDR  0x1
-#define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
+#define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
diff --git a/include/configs/gose.h b/include/configs/gose.h
index 5184db41061f..ed7dd70dd964 100644
--- a/include/configs/gose.h
+++ b/include/configs/gose.h
@@ -22,7 +22,7 @@
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CFG_SH_ETHER_PHY_ADDR  0x1
-#define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
+#define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
diff --git a/include/configs/grpeach.h b/include/configs/grpeach.h
index 8ba9b73672c8..6a11aa61f0fb 100644
--- a/include/configs/grpeach.h
+++ b/include/configs/grpeach.h
@@ -19,7 +19,7 @@
 /* Network interface */
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CFG_SH_ETHER_PHY_ADDR  0
-#define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_MII
+#define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_MII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
diff --git a/include/configs/koelsch.h b/include/configs/koelsch.h
index 2910336def6c..31d0795f07fb 100644
--- a/include/configs/koelsch.h
+++ b/include/configs/koelsch.h
@@ -22,7 +22,7 @@
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CFG_SH_ETHER_PHY_ADDR  0x1
-#define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
+#define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
diff --git a/include/configs/lager.h b/include/configs/lager.h
index 815239a73bd4..991fc9020ee0 100644
--- a/include/configs/lager.h
+++ b/include/configs/lager.h
@@ -23,7 +23,7 @@
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CFG_SH_ETHER_PHY_ADDR  0x1
-#define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
+#define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
diff --git a/include/configs/porter.h b/include/configs/porter.h
index f732aeb47b56..1587c5c5397c 100644
--- a/include/configs/porter.h
+++ b/include/configs/porter.h
@@ -24,7 +24,7 @@
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CFG_SH_ETHER_PHY_ADDR  0x1
-#define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
+#define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
diff --git a/include/configs/silk.h b/include/configs/silk.h
index 005eed154947..21100c46b1cb 100644
--- a/include/configs/silk.h
+++ b/include/configs/silk.h
@@ -24,7 +24,7 @@
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CFG_SH_ETHER_PHY_ADDR  0x1
-#define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
+#define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
diff --git a/include/configs/stout.h b/include/configs/stout.h
index cf90e4d46457..51f4420ed6fa 100644
--- a/include/configs/stout.h
+++ b/include/configs/stout.h
@@ -28,7 +28,7 @@
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CFG_SH_ETHER_PHY_ADDR  0x1
-#define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
+#define CFG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define 

[PATCH 116/149] global: Migrate CONFIG_SH_ETHER_ALIGNE_SIZE to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_SH_ETHER_ALIGNE_SIZE to 
CFG_SH_ETHER_ALIGNE_SIZE

Signed-off-by: Tom Rini 
---
 drivers/net/sh_eth.c  |  4 ++--
 drivers/net/sh_eth.h  | 16 
 include/configs/alt.h |  2 +-
 include/configs/condor.h  |  2 +-
 include/configs/gose.h|  2 +-
 include/configs/grpeach.h |  2 +-
 include/configs/koelsch.h |  2 +-
 include/configs/lager.h   |  2 +-
 include/configs/porter.h  |  2 +-
 include/configs/silk.h|  2 +-
 include/configs/stout.h   |  2 +-
 11 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 0c584a23b97e..90e47d93aada 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -41,7 +41,7 @@
!CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
 #define flush_cache_wback(addr, len)\
flush_dcache_range((unsigned long)addr, \
-   (unsigned long)(addr + ALIGN(len, CONFIG_SH_ETHER_ALIGNE_SIZE)))
+   (unsigned long)(addr + ALIGN(len, CFG_SH_ETHER_ALIGNE_SIZE)))
 #else
 #define flush_cache_wback(...)
 #endif
@@ -49,7 +49,7 @@
 #if defined(CONFIG_SH_ETHER_CACHE_INVALIDATE) && defined(CONFIG_ARM)
 #define invalidate_cache(addr, len)\
{   \
-   unsigned long line_size = CONFIG_SH_ETHER_ALIGNE_SIZE;  \
+   unsigned long line_size = CFG_SH_ETHER_ALIGNE_SIZE; \
unsigned long start, end;   \
\
start = (unsigned long)addr;\
diff --git a/drivers/net/sh_eth.h b/drivers/net/sh_eth.h
index 520f7f732574..1c07610e1ac7 100644
--- a/drivers/net/sh_eth.h
+++ b/drivers/net/sh_eth.h
@@ -29,8 +29,8 @@
 #endif /* defined(CONFIG_SH) */
 
 /* base padding size is 16 */
-#ifndef CONFIG_SH_ETHER_ALIGNE_SIZE
-#define CONFIG_SH_ETHER_ALIGNE_SIZE 16
+#ifndef CFG_SH_ETHER_ALIGNE_SIZE
+#define CFG_SH_ETHER_ALIGNE_SIZE 16
 #endif
 
 /* Number of supported ports */
@@ -47,7 +47,7 @@
 
 /* The size of the tx descriptor is determined by how much padding is used.
4, 20, or 52 bytes of padding can be used */
-#define TX_DESC_PADDING(CONFIG_SH_ETHER_ALIGNE_SIZE - 12)
+#define TX_DESC_PADDING(CFG_SH_ETHER_ALIGNE_SIZE - 12)
 
 /* Tx descriptor. We always use 3 bytes of padding */
 struct tx_desc_s {
@@ -62,9 +62,9 @@ struct tx_desc_s {
 
 /* The size of the rx descriptor is determined by how much padding is used.
4, 20, or 52 bytes of padding can be used */
-#define RX_DESC_PADDING(CONFIG_SH_ETHER_ALIGNE_SIZE - 12)
+#define RX_DESC_PADDING(CFG_SH_ETHER_ALIGNE_SIZE - 12)
 /* aligned cache line size */
-#define RX_BUF_ALIGNE_SIZE (CONFIG_SH_ETHER_ALIGNE_SIZE > 32 ? 64 : 32)
+#define RX_BUF_ALIGNE_SIZE (CFG_SH_ETHER_ALIGNE_SIZE > 32 ? 64 : 32)
 
 /* Rx descriptor. We always use 4 bytes of padding */
 struct rx_desc_s {
@@ -388,11 +388,11 @@ enum DMAC_M_BIT {
 #endif
 };
 
-#if CONFIG_SH_ETHER_ALIGNE_SIZE == 64
+#if CFG_SH_ETHER_ALIGNE_SIZE == 64
 # define EMDR_DESC EDMR_DL1
-#elif CONFIG_SH_ETHER_ALIGNE_SIZE == 32
+#elif CFG_SH_ETHER_ALIGNE_SIZE == 32
 # define EMDR_DESC EDMR_DL0
-#elif CONFIG_SH_ETHER_ALIGNE_SIZE == 16 /* Default */
+#elif CFG_SH_ETHER_ALIGNE_SIZE == 16 /* Default */
 # define EMDR_DESC 0
 #endif
 
diff --git a/include/configs/alt.h b/include/configs/alt.h
index 29f4d06b7f83..f06ceed47f0c 100644
--- a/include/configs/alt.h
+++ b/include/configs/alt.h
@@ -26,7 +26,7 @@
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CONFIG_SH_ETHER_CACHE_WRITEBACK
 #define CONFIG_SH_ETHER_CACHE_INVALIDATE
-#define CONFIG_SH_ETHER_ALIGNE_SIZE64
+#define CFG_SH_ETHER_ALIGNE_SIZE   64
 
 /* Board Clock */
 
diff --git a/include/configs/condor.h b/include/configs/condor.h
index 819184996e69..6d7c788163d3 100644
--- a/include/configs/condor.h
+++ b/include/configs/condor.h
@@ -19,7 +19,7 @@
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CONFIG_SH_ETHER_CACHE_WRITEBACK
 #define CONFIG_SH_ETHER_CACHE_INVALIDATE
-#define CONFIG_SH_ETHER_ALIGNE_SIZE64
+#define CFG_SH_ETHER_ALIGNE_SIZE   64
 
 /* Board Clock */
 /* XTAL_CLK : 33.33MHz */
diff --git a/include/configs/gose.h b/include/configs/gose.h
index 45f0ec6f6a0e..93157de470bd 100644
--- a/include/configs/gose.h
+++ b/include/configs/gose.h
@@ -25,7 +25,7 @@
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CONFIG_SH_ETHER_CACHE_WRITEBACK
 #define CONFIG_SH_ETHER_CACHE_INVALIDATE
-#define CONFIG_SH_ETHER_ALIGNE_SIZE64
+#define CFG_SH_ETHER_ALIGNE_SIZE   64
 
 /* Board Clock */
 
diff --git a/include/configs/grpeach.h b/include/configs/grpeach.h
index dd6b22de7bac..5b91e6ff039b 100644
--- a/include/configs/grpeach.h
+++ b/include/configs/grpeach.h
@@ -22,6 +22,6 @@
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_MII
 #define CONFIG_SH_ETHER_CACHE_WRITEBACK
 #define CONFIG_SH_ETHER_CACHE_INVALIDATE
-#define CONFIG_SH_ETHER_ALIGNE_SIZE64
+#define CFG_SH_ETHER_ALIGNE_SIZE   64
 
 #endif /* 

[PATCH 119/149] global: Migrate CONFIG_SH_ETHER_PHY_ADDR to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_SH_ETHER_PHY_ADDR to CFG_SH_ETHER_PHY_ADDR

Signed-off-by: Tom Rini 
---
 README| 2 +-
 drivers/net/sh_eth.c  | 6 +++---
 include/configs/alt.h | 2 +-
 include/configs/condor.h  | 2 +-
 include/configs/gose.h| 2 +-
 include/configs/grpeach.h | 2 +-
 include/configs/koelsch.h | 2 +-
 include/configs/lager.h   | 2 +-
 include/configs/porter.h  | 2 +-
 include/configs/silk.h| 2 +-
 include/configs/stout.h   | 2 +-
 11 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/README b/README
index 5f688d70f32f..217fbaf55757 100644
--- a/README
+++ b/README
@@ -544,7 +544,7 @@ The following options need to be configured:
CONFIG_SH_ETHER_USE_PORT
Define the number of ports to be used
 
-   CONFIG_SH_ETHER_PHY_ADDR
+   CFG_SH_ETHER_PHY_ADDR
Define the ETH PHY's address
 
CFG_SH_ETHER_CACHE_WRITEBACK
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 0053733075ed..3bf94cb2f7eb 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -33,8 +33,8 @@
 #ifndef CONFIG_SH_ETHER_USE_PORT
 # error "Please define CONFIG_SH_ETHER_USE_PORT"
 #endif
-#ifndef CONFIG_SH_ETHER_PHY_ADDR
-# error "Please define CONFIG_SH_ETHER_PHY_ADDR"
+#ifndef CFG_SH_ETHER_PHY_ADDR
+# error "Please define CFG_SH_ETHER_PHY_ADDR"
 #endif
 
 #if defined(CFG_SH_ETHER_CACHE_WRITEBACK) && \
@@ -694,7 +694,7 @@ static int sh_ether_probe(struct udevice *udev)
priv->bus = miiphy_get_dev_by_name(udev->name);
 
eth->port = CONFIG_SH_ETHER_USE_PORT;
-   eth->port_info[eth->port].phy_addr = CONFIG_SH_ETHER_PHY_ADDR;
+   eth->port_info[eth->port].phy_addr = CFG_SH_ETHER_PHY_ADDR;
eth->port_info[eth->port].iobase =
(void __iomem *)(uintptr_t)(BASE_IO_ADDR + 0x800 * eth->port);
 
diff --git a/include/configs/alt.h b/include/configs/alt.h
index 2b7832527347..06ab5ce669b9 100644
--- a/include/configs/alt.h
+++ b/include/configs/alt.h
@@ -22,7 +22,7 @@
 
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
-#define CONFIG_SH_ETHER_PHY_ADDR   0x1
+#define CFG_SH_ETHER_PHY_ADDR  0x1
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
diff --git a/include/configs/condor.h b/include/configs/condor.h
index 3f99cbf9dab9..43b88f127213 100644
--- a/include/configs/condor.h
+++ b/include/configs/condor.h
@@ -15,7 +15,7 @@
 
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
-#define CONFIG_SH_ETHER_PHY_ADDR   0x1
+#define CFG_SH_ETHER_PHY_ADDR  0x1
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
diff --git a/include/configs/gose.h b/include/configs/gose.h
index 45a537341b0e..5184db41061f 100644
--- a/include/configs/gose.h
+++ b/include/configs/gose.h
@@ -21,7 +21,7 @@
 
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
-#define CONFIG_SH_ETHER_PHY_ADDR   0x1
+#define CFG_SH_ETHER_PHY_ADDR  0x1
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
diff --git a/include/configs/grpeach.h b/include/configs/grpeach.h
index 3fde61407094..8ba9b73672c8 100644
--- a/include/configs/grpeach.h
+++ b/include/configs/grpeach.h
@@ -18,7 +18,7 @@
 
 /* Network interface */
 #define CONFIG_SH_ETHER_USE_PORT   0
-#define CONFIG_SH_ETHER_PHY_ADDR   0
+#define CFG_SH_ETHER_PHY_ADDR  0
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_MII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
diff --git a/include/configs/koelsch.h b/include/configs/koelsch.h
index b3b6f03e08d4..2910336def6c 100644
--- a/include/configs/koelsch.h
+++ b/include/configs/koelsch.h
@@ -21,7 +21,7 @@
 
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
-#define CONFIG_SH_ETHER_PHY_ADDR   0x1
+#define CFG_SH_ETHER_PHY_ADDR  0x1
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
diff --git a/include/configs/lager.h b/include/configs/lager.h
index 16d15ccdd913..815239a73bd4 100644
--- a/include/configs/lager.h
+++ b/include/configs/lager.h
@@ -22,7 +22,7 @@
 
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
-#define CONFIG_SH_ETHER_PHY_ADDR   0x1
+#define CFG_SH_ETHER_PHY_ADDR  0x1
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
 #define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
diff --git a/include/configs/porter.h b/include/configs/porter.h
index f217141af8c0..f732aeb47b56 100644
--- a/include/configs/porter.h
+++ b/include/configs/porter.h
@@ -23,7 +23,7 @@
 
 /* SH Ether */
 #define CONFIG_SH_ETHER_USE_PORT   0
-#define CONFIG_SH_ETHER_PHY_ADDR   0x1
+#define CFG_SH_ETHER_PHY_ADDR 

[PATCH 118/149] global: Migrate CONFIG_SH_ETHER_CACHE_WRITEBACK to CFG

2022-12-04 Thread Tom Rini
Perform a simple rename of CONFIG_SH_ETHER_CACHE_WRITEBACK to 
CFG_SH_ETHER_CACHE_WRITEBACK

Signed-off-by: Tom Rini 
---
 README| 2 +-
 drivers/net/sh_eth.c  | 2 +-
 include/configs/alt.h | 2 +-
 include/configs/condor.h  | 2 +-
 include/configs/gose.h| 2 +-
 include/configs/grpeach.h | 2 +-
 include/configs/koelsch.h | 2 +-
 include/configs/lager.h   | 2 +-
 include/configs/porter.h  | 2 +-
 include/configs/silk.h| 2 +-
 include/configs/stout.h   | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/README b/README
index 2d3a48e88a59..5f688d70f32f 100644
--- a/README
+++ b/README
@@ -547,7 +547,7 @@ The following options need to be configured:
CONFIG_SH_ETHER_PHY_ADDR
Define the ETH PHY's address
 
-   CONFIG_SH_ETHER_CACHE_WRITEBACK
+   CFG_SH_ETHER_CACHE_WRITEBACK
If this option is set, the driver enables cache flush.
 
 - TPM Support:
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 63b21969d5cc..0053733075ed 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -37,7 +37,7 @@
 # error "Please define CONFIG_SH_ETHER_PHY_ADDR"
 #endif
 
-#if defined(CONFIG_SH_ETHER_CACHE_WRITEBACK) && \
+#if defined(CFG_SH_ETHER_CACHE_WRITEBACK) && \
!CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
 #define flush_cache_wback(addr, len)\
flush_dcache_range((unsigned long)addr, \
diff --git a/include/configs/alt.h b/include/configs/alt.h
index 7a29157ef440..2b7832527347 100644
--- a/include/configs/alt.h
+++ b/include/configs/alt.h
@@ -24,7 +24,7 @@
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CONFIG_SH_ETHER_PHY_ADDR   0x1
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
-#define CONFIG_SH_ETHER_CACHE_WRITEBACK
+#define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
 
diff --git a/include/configs/condor.h b/include/configs/condor.h
index fa3edef9b300..3f99cbf9dab9 100644
--- a/include/configs/condor.h
+++ b/include/configs/condor.h
@@ -17,7 +17,7 @@
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CONFIG_SH_ETHER_PHY_ADDR   0x1
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
-#define CONFIG_SH_ETHER_CACHE_WRITEBACK
+#define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
 
diff --git a/include/configs/gose.h b/include/configs/gose.h
index e54f4b24e048..45a537341b0e 100644
--- a/include/configs/gose.h
+++ b/include/configs/gose.h
@@ -23,7 +23,7 @@
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CONFIG_SH_ETHER_PHY_ADDR   0x1
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
-#define CONFIG_SH_ETHER_CACHE_WRITEBACK
+#define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
 
diff --git a/include/configs/grpeach.h b/include/configs/grpeach.h
index 5ae17f70e909..3fde61407094 100644
--- a/include/configs/grpeach.h
+++ b/include/configs/grpeach.h
@@ -20,7 +20,7 @@
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CONFIG_SH_ETHER_PHY_ADDR   0
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_MII
-#define CONFIG_SH_ETHER_CACHE_WRITEBACK
+#define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
 
diff --git a/include/configs/koelsch.h b/include/configs/koelsch.h
index 1d8aa6def88f..b3b6f03e08d4 100644
--- a/include/configs/koelsch.h
+++ b/include/configs/koelsch.h
@@ -23,7 +23,7 @@
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CONFIG_SH_ETHER_PHY_ADDR   0x1
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
-#define CONFIG_SH_ETHER_CACHE_WRITEBACK
+#define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
 
diff --git a/include/configs/lager.h b/include/configs/lager.h
index bb8cc5fecb7a..16d15ccdd913 100644
--- a/include/configs/lager.h
+++ b/include/configs/lager.h
@@ -24,7 +24,7 @@
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CONFIG_SH_ETHER_PHY_ADDR   0x1
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
-#define CONFIG_SH_ETHER_CACHE_WRITEBACK
+#define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
 
diff --git a/include/configs/porter.h b/include/configs/porter.h
index 143e9a4672f1..f217141af8c0 100644
--- a/include/configs/porter.h
+++ b/include/configs/porter.h
@@ -25,7 +25,7 @@
 #define CONFIG_SH_ETHER_USE_PORT   0
 #define CONFIG_SH_ETHER_PHY_ADDR   0x1
 #define CONFIG_SH_ETHER_PHY_MODE PHY_INTERFACE_MODE_RMII
-#define CONFIG_SH_ETHER_CACHE_WRITEBACK
+#define CFG_SH_ETHER_CACHE_WRITEBACK
 #define CFG_SH_ETHER_CACHE_INVALIDATE
 #define CFG_SH_ETHER_ALIGNE_SIZE   64
 
diff --git a/include/configs/silk.h b/include/configs/silk.h
index 

  1   2   3   >