[PATCH v5 00/44] More tidy-ups of Kconfig options

This series was split out of the old 'split config' splc series. It contains clean-up patches which do not depend on split config.
This is available at u-boot-dm/spld-working
The size changes look pretty good: https://paste.debian.net/1271742/
The remaining patches will move into a new 'splg' series (G for Good).
[1] https://patchwork.ozlabs.org/project/uboot/list/?series=341504&state=*
Changes in v5: - Fix reply typo - Change approach and expand notes after more investigation - Drop FSL_ISBC_KEY_EXT patch as it changes the size - Drop PHY_CADENCE_SIERRA patch as it changes the size
Changes in v4: - Avoid use of def_bool - Modify to get rid of def_bool - Adjust Kconfig ordering - Just fix the typo - Reduce and rename commit - Reduce and rename commit - Fix 'wanderboard' typo - Reduce and rename commit
Changes in v3: - Add new patch to disable QFW bootmeth in SPL - Move the option down to the non-SPL part of drivers/Makefile - Correct 'VPL' typo - Use a consistent format for the comment - Fix a transitory build error with sandbox_spl - Add a new patch to disallow commands in SPL
Changes in v2: - Rebase to previous series
Simon Glass (44): mtd: Drop unused kb9202_nand driver mtd: Drop unused CONFIG_ONENAND_U_BOOT sh4: Drop unused twl6030 driver moveconfig: Update to detect / correct missing SPL Kconfigs bootstd: Disable QFW bootmeth in SPL Correct SPL uses of ARCH_MVEBU Correct SPL uses of DISPLAY_AER_FULL Correct SPL uses of MULTIPLEXER Correct SPL use of PG_WCOM_UBOOT_UPDATE_SUPPORTED Correct SPL uses of PHY_FIXED boot: Add Kconfigs for BOOTMETH_VBE_REQUEST Correct SPL use of DM_RNG lib: Add a Kconfig for SPL_BZIP2 moveconfig: Various minor improvements sandbox: Expand size for VPL image event: Add Kconfig options for SPL bootstd: Correct 'VPL' typo env: Avoid checking ENV_IS_IN when env disabled env: Allow VPL environment to be nowhere lib: Add VPL options for SHA1 and SHA256 x86: Use string functions for all 32-bit builds lib: Fix build condition for tiny-printf sandbox: Tidy up RTC options sandbox: Use the generic VPL option to enable VPL sandbox: Tidy up I2C options fixdep: Add support for VPL fixdep: Refactor to make testing easier fixdep: Add some tests for parse_config_line() test: Add SPL versions of the TEST_KCONFIG options lib: Add an SPL config for LIB_UUID test: Tidy up sandbox handling in test-main x86: Fix up use of X86_32BIT_INIT and X86_64 options Add VPL options for BLOBLIST rockchip: Avoid checking environment without ENV_SUPPORT freescale: Drop old pre-DM_ETH code imx: Use SATA instead of CMD_SATA net: Add an SPL config for atheros freescale: Fix odd use of ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE serial: Support ns16550 driver in TPL dm: Add a TPL symbol for simple-bus x86: coral: Add missing TPL options power: wandboard: Add a missing CONFIG venice: Simplify conditions for network init command: Don't allow commands in SPL
Makefile | 1 - arch/arm/cpu/armv7/ls102xa/fdt.c | 12 - arch/powerpc/include/asm/config_mpc85xx.h | 6 +- arch/sandbox/dts/sandbox.dts | 4 +- arch/sandbox/dts/sandbox.dtsi | 6 +- arch/sandbox/dts/sandbox_vpl.dtsi | 4 +- arch/sandbox/include/asm/rtc.h | 2 +- arch/x86/cpu/qemu/qemu.c | 2 +- arch/x86/include/asm/msr.h | 2 +- arch/x86/include/asm/string.h | 2 +- arch/x86/lib/Makefile | 2 +- board/gateworks/venice/venice.c | 6 +- board/keymile/common/common.c | 2 +- board/solidrun/mx6cuboxi/mx6cuboxi.c | 2 +- .../puma_rk3399/puma-rk3399.c | 2 +- .../ringneck_px30/ringneck-px30.c | 2 +- boot/Kconfig | 22 +- boot/Makefile | 5 +- boot/vbe_request.c | 2 +- cmd/nvedit.c | 2 + common/Kconfig | 51 +- configs/chromebook_coral_defconfig | 3 + configs/wandboard_defconfig | 1 + disk/Kconfig | 8 + drivers/Makefile | 2 +- drivers/core/Kconfig | 7 + drivers/i2c/Kconfig | 20 + drivers/input/Makefile | 1 - drivers/input/twl6030.c | 47 -- drivers/mmc/fsl_esdhc.c | 6 +- drivers/mmc/fsl_esdhc_imx.c | 4 +- drivers/mmc/mv_sdhci.c | 4 +- drivers/mtd/nand/raw/Makefile | 1 - drivers/mtd/nand/raw/kb9202_nand.c | 134 ---- drivers/mux/Makefile | 2 +- drivers/net/mvneta.c | 4 +- drivers/net/phy/Kconfig | 3 + drivers/rtc/Kconfig | 18 + drivers/rtc/Makefile | 4 +- drivers/serial/Kconfig | 6 + drivers/sysreset/sysreset_mpc83xx.c | 4 +- env/Kconfig | 10 + include/command.h | 2 +- include/mux.h | 2 +- lib/Kconfig | 30 + lib/Makefile | 2 +- net/mdio-uclass.c | 2 +- scripts/basic/fixdep.c | 162 ++++- test/lib/Kconfig | 20 +- test/test-main.c | 10 +- tools/moveconfig.py | 594 +++++++++++++----- 51 files changed, 831 insertions(+), 421 deletions(-) delete mode 100644 drivers/input/twl6030.c delete mode 100644 drivers/mtd/nand/raw/kb9202_nand.c

This is not used since time out of mind.
Drop the driver and Kconfig option.
Signed-off-by: Simon Glass sjg@chromium.org Acked-by: Michael Trimarchi michael@amarulasolutions.com ---
(no changes since v1)
drivers/mtd/nand/raw/Makefile | 1 - drivers/mtd/nand/raw/kb9202_nand.c | 134 ----------------------------- 2 files changed, 135 deletions(-) delete mode 100644 drivers/mtd/nand/raw/kb9202_nand.c
diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile index 666323e2219..add2b4cf655 100644 --- a/drivers/mtd/nand/raw/Makefile +++ b/drivers/mtd/nand/raw/Makefile @@ -56,7 +56,6 @@ obj-$(CONFIG_NAND_DENALI) += denali.o obj-$(CONFIG_NAND_DENALI_DT) += denali_dt.o obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o -obj-$(CONFIG_NAND_KB9202) += kb9202_nand.o obj-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o obj-$(CONFIG_NAND_KMETER1) += kmeter1_nand.o obj-$(CONFIG_NAND_LPC32XX_MLC) += lpc32xx_nand_mlc.o diff --git a/drivers/mtd/nand/raw/kb9202_nand.c b/drivers/mtd/nand/raw/kb9202_nand.c deleted file mode 100644 index 9d26532c780..00000000000 --- a/drivers/mtd/nand/raw/kb9202_nand.c +++ /dev/null @@ -1,134 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * (C) Copyright 2006 - * KwikByte kb9200_dev@kwikbyte.com - * - * (C) Copyright 2009 - * Matthias Kaehlcke matthias@kaehlcke.net - */ - -#include <common.h> -#include <linux/mtd/rawnand.h> -#include <asm/io.h> -#include <asm/arch/AT91RM9200.h> -#include <asm/arch/hardware.h> - -#include <nand.h> - -/* - * hardware specific access to control-lines - */ - -#define MASK_ALE (1 << 22) /* our ALE is A22 */ -#define MASK_CLE (1 << 21) /* our CLE is A21 */ - -#define KB9202_NAND_NCE (1 << 28) /* EN* on D28 */ -#define KB9202_NAND_BUSY (1 << 29) /* RB* on D29 */ - -#define KB9202_SMC2_NWS (1 << 2) -#define KB9202_SMC2_TDF (1 << 8) -#define KB9202_SMC2_RWSETUP (1 << 24) -#define KB9202_SMC2_RWHOLD (1 << 29) - -/* - * Board-specific function to access device control signals - */ -static void kb9202_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) -{ - struct nand_chip *this = mtd_to_nand(mtd); - - if (ctrl & NAND_CTRL_CHANGE) { - ulong IO_ADDR_W = (ulong) this->IO_ADDR_W; - - /* clear ALE and CLE bits */ - IO_ADDR_W &= ~(MASK_ALE | MASK_CLE); - - if (ctrl & NAND_CLE) - IO_ADDR_W |= MASK_CLE; - - if (ctrl & NAND_ALE) - IO_ADDR_W |= MASK_ALE; - - this->IO_ADDR_W = (void *) IO_ADDR_W; - - if (ctrl & NAND_NCE) - writel(KB9202_NAND_NCE, AT91C_PIOC_CODR); - else - writel(KB9202_NAND_NCE, AT91C_PIOC_SODR); - } - - if (cmd != NAND_CMD_NONE) - writeb(cmd, this->IO_ADDR_W); -} - - -/* - * Board-specific function to access the device ready signal. - */ -static int kb9202_nand_ready(struct mtd_info *mtd) -{ - return readl(AT91C_PIOC_PDSR) & KB9202_NAND_BUSY; -} - - -/* - * Board-specific NAND init. Copied from include/linux/mtd/nand.h for reference. - * - * struct nand_chip - NAND Private Flash Chip Data - * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device - * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device - * @hwcontrol: [BOARDSPECIFIC] hardwarespecific function for accesing control-lines - * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line - * If set to NULL no access to ready/busy is available and the ready/busy information - * is read from the chip status register - * @enable_hwecc: [BOARDSPECIFIC] function to enable (reset) hardware ecc generator. Must only - * be provided if a hardware ECC is available - * @eccmode: [BOARDSPECIFIC] mode of ecc, see defines - * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) - * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about - * special functionality. See the defines for further explanation -*/ -/* - * This routine initializes controller and GPIOs. - */ -int board_nand_init(struct nand_chip *nand) -{ - unsigned int value; - - nand->ecc.mode = NAND_ECC_SOFT; - nand->cmd_ctrl = kb9202_nand_hwcontrol; - nand->dev_ready = kb9202_nand_ready; - - /* in case running outside of bootloader */ - writel(1 << AT91C_ID_PIOC, AT91C_PMC_PCER); - - /* setup nand flash access (allow ample margin) */ - /* 4 wait states, 1 setup, 1 hold, 1 float for 8-bit device */ - writel(AT91C_SMC2_WSEN | KB9202_SMC2_NWS | KB9202_SMC2_TDF | - AT91C_SMC2_DBW_8 | KB9202_SMC2_RWSETUP | KB9202_SMC2_RWHOLD, - AT91C_SMC_CSR3); - - /* enable internal NAND controller */ - value = readl(AT91C_EBI_CSA); - value |= AT91C_EBI_CS3A_SMC_SmartMedia; - writel(value, AT91C_EBI_CSA); - - /* enable SMOE/SMWE */ - writel(AT91C_PC1_BFRDY_SMOE | AT91C_PC3_BFBAA_SMWE, AT91C_PIOC_ASR); - writel(AT91C_PC1_BFRDY_SMOE | AT91C_PC3_BFBAA_SMWE, AT91C_PIOC_PDR); - writel(AT91C_PC1_BFRDY_SMOE | AT91C_PC3_BFBAA_SMWE, AT91C_PIOC_OER); - - /* set NCE to high */ - writel(KB9202_NAND_NCE, AT91C_PIOC_SODR); - - /* disable output on pin connected to the busy line of the NAND */ - writel(KB9202_NAND_BUSY, AT91C_PIOC_ODR); - - /* enable the PIO to control NCE and BUSY */ - writel(KB9202_NAND_NCE | KB9202_NAND_BUSY, AT91C_PIOC_PER); - - /* enable output for NCE */ - writel(KB9202_NAND_NCE, AT91C_PIOC_OER); - - return (0); -}

On Wed, Feb 22, 2023 at 09:33:42AM -0700, Simon Glass wrote:
This is not used since time out of mind.
Drop the driver and Kconfig option.
Signed-off-by: Simon Glass sjg@chromium.org Acked-by: Michael Trimarchi michael@amarulasolutions.com
Applied to u-boot/next, thanks!

This option does not exist, so the Makefile rule does nothing. Drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
Makefile | 1 - 1 file changed, 1 deletion(-)
diff --git a/Makefile b/Makefile index 54f894dab84..20608b6a800 100644 --- a/Makefile +++ b/Makefile @@ -956,7 +956,6 @@ endif # Always append INPUTS so that arch config.mk's can add custom ones INPUTS-y += u-boot.srec u-boot.bin u-boot.sym System.map binary_size_check
-INPUTS-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin ifeq ($(CONFIG_SPL_FSL_PBL),y) INPUTS-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin else

On Wed, Feb 22, 2023 at 09:33:43AM -0700, Simon Glass wrote:
This option does not exist, so the Makefile rule does nothing. Drop it.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

This is not used. Drop the driver and Kconfig option.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/input/Makefile | 1 - drivers/input/twl6030.c | 47 ----------------------------------------- 2 files changed, 48 deletions(-) delete mode 100644 drivers/input/twl6030.c
diff --git a/drivers/input/Makefile b/drivers/input/Makefile index 14c0ea73254..71f315adf6f 100644 --- a/drivers/input/Makefile +++ b/drivers/input/Makefile @@ -14,5 +14,4 @@ obj-$(CONFIG_APPLE_SPI_KEYB) += apple_spi_kbd.o obj-$(CONFIG_I8042_KEYB) += i8042.o obj-$(CONFIG_TEGRA_KEYBOARD) += input.o tegra-kbc.o obj-$(CONFIG_TWL4030_INPUT) += twl4030.o -obj-$(CONFIG_TWL6030_INPUT) += twl6030.o endif diff --git a/drivers/input/twl6030.c b/drivers/input/twl6030.c deleted file mode 100644 index 76bd3488fc6..00000000000 --- a/drivers/input/twl6030.c +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * TWL6030 input - * - * Copyright (C) 2016 Paul Kocialkowski contact@paulk.fr - */ - -#include <twl6030.h> - -int twl6030_input_power_button(void) -{ - u8 value; - - twl6030_i2c_read_u8(TWL6030_CHIP_PM, TWL6030_STS_HW_CONDITIONS, &value); - - /* Power button is active low. */ - if (value & TWL6030_STS_HW_CONDITIONS_PWRON) - return 0; - - return 1; -} - -int twl6030_input_charger(void) -{ - u8 value; - - twl6030_i2c_read_u8(TWL6030_CHIP_CHARGER, TWL6030_CONTROLLER_STAT1, - &value); - - if (value & TWL6030_CONTROLLER_STAT1_VAC_DET) - return 1; - - return 0; -} - -int twl6030_input_usb(void) -{ - u8 value; - - twl6030_i2c_read_u8(TWL6030_CHIP_CHARGER, TWL6030_CONTROLLER_STAT1, - &value); - - if (value & TWL6030_CONTROLLER_STAT1_VBUS_DET) - return 1; - - return 0; -}

On Wed, Feb 22, 2023 at 09:33:44AM -0700, Simon Glass wrote:
This is not used. Drop the driver and Kconfig option.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

This adds quite a few more features, all designed to detect problems with Kconfig options and their use. It can find options mentioned in the source code which are not in the Kconfig and vice versa. It can convert SPL usages of non-SPL Kconfig options (i.e. changing CONFIG_IS_ENABLED() to IS_ENABLED() and CONFIG_$(SPL)_FOO to CONFIG_FOO, creating commits automatically if requested.
These features are only useful for code clean-up, not for normal development.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v2)
Changes in v2: - Rebase to previous series
tools/moveconfig.py | 599 +++++++++++++++++++++++++++++++++----------- 1 file changed, 456 insertions(+), 143 deletions(-)
diff --git a/tools/moveconfig.py b/tools/moveconfig.py index c4d72ede368..b3ac2672737 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -20,6 +20,7 @@ import doctest import filecmp import fnmatch import glob +import io import multiprocessing import os import queue @@ -118,6 +119,16 @@ def check_clean_directory(): if os.path.exists(fname): sys.exit("source tree is not clean, please run 'make mrproper'")
+def write_commit(msg): + """Create a new commit with all modified files + + Args: + msg (str): Commit message + """ + subprocess.call(['git', 'add', '-u']) + rc = subprocess.call(['git', 'commit', '-s', '-m', msg]) + return rc == 0 + def get_make_cmd(): """Get the command name of GNU Make.
@@ -1606,30 +1617,59 @@ def prefix_config(cfg): return op + cfg
-RE_MK_CONFIGS = re.compile('CONFIG_($(SPL_(?:TPL_)?))?([A-Za-z0-9_]*)') -RE_IFDEF = re.compile('(ifdef|ifndef)') -RE_C_CONFIGS = re.compile('CONFIG_([A-Za-z0-9_]*)') -RE_CONFIG_IS = re.compile('CONFIG_IS_ENABLED(([A-Za-z0-9_]*))') +RE_MK_CONFIGS = re.compile(r'CONFIG_($(SPL_(?:TPL_)?))?([A-Za-z0-9_]*)') + +# Makefile ifdefs: this only handles 'else' on its own line, so not +# 'else ifeq ...', for example +RE_IF = re.compile(r'^(ifdef|ifndef|endif|ifeq|ifneq|else)([^,]*,([^,]*)))?.*$') + +# Normal CONFIG options in C +RE_C_CONFIGS = re.compile(r'CONFIG_([A-Za-z0-9_]*)') + +# CONFIG_IS_ENABLED() construct +RE_CONFIG_IS = re.compile(r'CONFIG_IS_ENABLED(([A-Za-z0-9_]*))') + +# Preprocessor #if/#ifdef directives, etc. +RE_IFDEF = re.compile(r'^\s*#\s*(ifdef|ifndef|endif|if|elif|else)\s*(?:#.*)?(.*)$')
class ConfigUse: - def __init__(self, cfg, is_spl, fname, rest): + """Holds information about a use of a CONFIG option""" + def __init__(self, cfg, is_spl, conds, fname, rest, is_mk): + """Set up a new use of a CONFIG option + + Args: + cfg (str): Config option, without the CONFIG_ + is_spl (bool): True if it indicates an SPL option, i.e. has a + $(SPL_) or similar, False if not + conds (list of str): List of conditions for this use, e.g. + ['SPL_BUILD'] + fname (str): Filename contining the use + rest (str): Entire line from the file + is_mk (bool): True if this is in a Makefile, False if not + """ self.cfg = cfg self.is_spl = is_spl + self.conds = list(c for c in conds if '(NONE)' not in c) self.fname = fname self.rest = rest + self.is_mk = is_mk
def __hash__(self): return hash((self.cfg, self.is_spl))
-def scan_makefiles(fnames): + def __str__(self): + return (f'ConfigUse({self.cfg}, is_spl={self.is_spl}, ' + f'is_mk={self.is_mk}, fname={self.fname}, rest={self.rest}') + +def scan_makefiles(fname_dict): """Scan Makefiles looking for Kconfig options
Looks for uses of CONFIG options in Makefiles
Args: - fnames (list of tuple): - str: Makefile filename where the option was found - str: Line of the Makefile + fname_dict (dict lines): + key: Makefile filename where the option was found + value: List of str lines of the Makefile
Returns: tuple: @@ -1646,46 +1686,81 @@ def scan_makefiles(fnames): ('$(SPL_)', 'MARY') >>> RE_MK_CONFIGS.search('CONFIG_$(SPL_TPL_)MARY').groups() ('$(SPL_TPL_)', 'MARY') + >>> RE_IF.match('ifdef CONFIG_SPL_BUILD').groups() + ('ifdef', None, None) + >>> RE_IF.match('endif # CONFIG_SPL_BUILD').groups() + ('endif', None, None) + >>> RE_IF.match('endif').groups() + ('endif', None, None) + >>> RE_IF.match('else').groups() + ('else', None, None) """ all_uses = collections.defaultdict(list) fname_uses = {} - for fname, rest in fnames: - m_iter = RE_MK_CONFIGS.finditer(rest) - found = False - for m in m_iter: - found = True - real_opt = m.group(2) - if real_opt == '': - continue - is_spl = False - if m.group(1): - is_spl = True - use = ConfigUse(real_opt, is_spl, fname, rest) - if fname not in fname_uses: - fname_uses[fname] = set() - fname_uses[fname].add(use) - all_uses[use].append(rest) + for fname, rest_list in fname_dict.items(): + conds = [] + for rest in rest_list: + m_iter = RE_MK_CONFIGS.finditer(rest) + m_cond = RE_IF.match(rest) + #print('line', conds, m_cond and m_cond.group(1) or '.', rest) + last_use = None + use = None + for m in m_iter: + real_opt = m.group(2) + if real_opt == '': + continue + is_spl = False + if m.group(1): + is_spl = True + use = ConfigUse(real_opt, is_spl, conds, fname, rest, True) + if fname not in fname_uses: + fname_uses[fname] = set() + fname_uses[fname].add(use) + all_uses[use].append(rest) + last_use = use + if m_cond: + cfg = last_use.cfg if last_use else '(NONE)' + cond = m_cond.group(1) + if cond == 'ifdef': + conds.append(cfg) + elif cond == 'ifndef': + conds.append(f'~{cfg}') + elif cond == 'ifeq': + #print('todo', fname, m_cond.group(3), fname, rest) + conds.append(f'{m_cond.group(3)}={cfg}') + elif cond == 'ifneq': + conds.append(f'{m_cond.group(3)}={cfg}') + #print('todo', m_cond.group(3)) + elif cond == 'endif': + conds.pop() + elif cond == 'else': + cond = conds.pop() + if cond.startswith('~'): + cond = cond[1:] + else: + cond = f'~{cond}' + conds.append(cond) + else: + print(f'unknown condition: {rest}') + if conds: + print(f'leftover {conds}') return all_uses, fname_uses
- -def scan_src_files(fnames): +def scan_src_files(fname_dict, all_uses, fname_uses): """Scan source files (other than Makefiles) looking for Kconfig options
Looks for uses of CONFIG options
Args: - fnames (list of tuple): - str: Makefile filename where the option was found - str: Line of the Makefile - - Returns: - tuple: - dict: all_uses - key (ConfigUse): object - value (list of str): matching lines - dict: Uses by filename - key (str): filename - value (set of ConfigUse): uses in that filename + fname_dict (dict): + key (str): Filename + value (list of ConfigUse): List of uses in that filename + all_uses (dict): to add more uses to: + key (ConfigUse): object + value (list of str): matching lines + fname (dict): to add more uses-by-filename to + key (str): filename + value (set of ConfigUse): uses in that filename
>>> RE_C_CONFIGS.search('CONFIG_FRED').groups() ('FRED',) @@ -1693,39 +1768,78 @@ def scan_src_files(fnames): ('MARY',) >>> RE_CONFIG_IS.search('#if CONFIG_IS_ENABLED(OF_PLATDATA)').groups() ('OF_PLATDATA',) + >>> RE_IFDEF.match('#ifdef CONFIG_SPL_BUILD').groups() + ('ifdef', 'CONFIG_SPL_BUILD') + >>> RE_IFDEF.match('#endif # CONFIG_SPL_BUILD').groups() + ('endif', '') + >>> RE_IFDEF.match('#endif').groups() + ('endif', '') + >>> RE_IFDEF.match('#else').groups() + ('else', '') + >>> RE_IFDEF.match(' # if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)').groups() + ('if', 'defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)') """ def add_uses(m_iter, is_spl): + last_use = None for m in m_iter: found = True real_opt = m.group(1) if real_opt == '': continue - use = ConfigUse(real_opt, is_spl, fname, rest) + use = ConfigUse(real_opt, is_spl, conds, fname, rest, False) if fname not in fname_uses: fname_uses[fname] = set() fname_uses[fname].add(use) all_uses[use].append(rest) - - all_uses = collections.defaultdict(list) - fname_uses = {} - for fname, rest in fnames: - m_iter = RE_C_CONFIGS.finditer(rest) - add_uses(m_iter, False) - - m_iter2 = RE_CONFIG_IS.finditer(rest) - add_uses(m_iter2, True) - - return all_uses, fname_uses + last_use = use + return last_use + + for fname, rest_list in fname_dict.items(): + conds = [] + for rest in rest_list: + m_iter = RE_C_CONFIGS.finditer(rest) + m_cond = RE_IFDEF.match(rest) + last_use1 = add_uses(m_iter, False) + + m_iter2 = RE_CONFIG_IS.finditer(rest) + last_use2 = add_uses(m_iter2, True) + last_use = last_use1 or last_use2 + if m_cond: + cfg = last_use.cfg if last_use else '(NONE)' + cond = m_cond.group(1) + #print(fname, rest, cond, conds) + if cond == 'ifdef': + conds.append(cfg) + elif cond == 'ifndef': + conds.append(f'~{cfg}') + elif cond == 'if': + #print('todo', fname, m_cond.group(3), fname, rest) + conds.append(f'{m_cond.group(2)}={cfg}') + elif cond == 'endif': + conds.pop() + elif cond == 'else': + cond = conds.pop() + if cond.startswith('~'): + cond = cond[1:] + else: + cond = f'~{cond}' + conds.append(cond) + elif cond == 'elif': + cond = conds.pop() + conds.append(cfg) + else: + print(f'{fname}: unknown condition: {rest}')
MODE_NORMAL, MODE_SPL, MODE_PROPER = range(3)
-def do_scan_source(path, do_update): +def do_scan_source(path, do_update, show_conflicts, do_commit): """Scan the source tree for Kconfig inconsistencies
Args: path (str): Path to source tree - do_update (bool) : True to write to scripts/kconf_... files + do_update (bool): True to write to scripts/kconf_... files + show_conflicts (bool): True to show conflicts """ def is_not_proper(name): for prefix in SPL_PREFIXES: @@ -1754,7 +1868,7 @@ def do_scan_source(path, do_update): """ # Make sure we know about all the options not_found = collections.defaultdict(list) - for use, rest in all_uses.items(): + for use, _ in all_uses.items(): name = use.cfg if name in IGNORE_SYMS: continue @@ -1766,7 +1880,6 @@ def do_scan_source(path, do_update): # If it is an SPL symbol, try prepending all SPL_ prefixes to # find at least one SPL symbol if use.is_spl: - add_to_dict = False for prefix in SPL_PREFIXES: try_name = prefix + name sym = kconf.syms.get(try_name) @@ -1784,7 +1897,6 @@ def do_scan_source(path, do_update): elif not use.is_spl: check = False else: # MODE_NORMAL - debug = False sym = kconf.syms.get(name) if not sym: proper_name = is_not_proper(name) @@ -1819,105 +1931,304 @@ def do_scan_source(path, do_update): for i, use in enumerate(uses[name]): print(f'{" " if i else ""}{use.fname}: {use.rest.strip()}')
+ def do_scan(): + """Scan the source tree
- print('Scanning Kconfig') - kconf = KconfigScanner().conf - print(f'Scanning source in {path}') - args = ['git', 'grep', '-E', r'IS_ENABLED|\bCONFIG'] - with subprocess.Popen(args, stdout=subprocess.PIPE) as proc: - out, err = proc.communicate() - lines = out.splitlines() - re_fname = re.compile('^([^:]*):(.*)') - src_list = [] - mk_list = [] - for line in lines: - linestr = line.decode('utf-8') - m_fname = re_fname.search(linestr) - if not m_fname: - continue - fname, rest = m_fname.groups() - dirname, leaf = os.path.split(fname) - root, ext = os.path.splitext(leaf) - if ext == '.autoconf': - pass - elif ext in ['.c', '.h', '.S', '.lds', '.dts', '.dtsi', '.asl', '.cfg', - '.env', '.tmpl']: - src_list.append([fname, rest]) - elif 'Makefile' in root or ext == '.mk': - mk_list.append([fname, rest]) - elif ext in ['.yml', '.sh', '.py', '.awk', '.pl', '.rst', '', '.sed']: - pass - elif 'Kconfig' in root or 'Kbuild' in root: - pass - elif 'README' in root: - pass - elif dirname in ['configs']: - pass - elif dirname.startswith('doc') or dirname.startswith('scripts/kconfig'): - pass + This runs a 'git grep' and then picks out uses of CONFIG options from + the resulting output + + Returns: tuple + dict of uses of CONFIG in Makefiles: + key (str): Filename + value (list of ConfigUse): List of uses in that filename + dict of uses of CONFIG in source files: + key (str): Filename + value (list of ConfigUse): List of uses in that filename + """ + def finish_file(last_fname, rest_list): + if is_mkfile: + mk_dict[last_fname] = rest_list + else: + src_dict[last_fname] = rest_list + rest_list = [] + + print(f'Scanning source in {path}') + args = ['git', 'grep', '-E', + r'IS_ENABLED|\bCONFIG|CONFIG_SPL_BUILD|if|else|endif'] + with subprocess.Popen(args, stdout=subprocess.PIPE) as proc: + out, _ = proc.communicate() + lines = out.splitlines() + re_fname = re.compile('^([^:]*):(.*)') + src_dict = collections.OrderedDict() + mk_dict = collections.OrderedDict() + last_fname = None + rest_list = [] + is_mkfile = None + for line in lines: + linestr = line.decode('utf-8') + m_fname = re_fname.search(linestr) + if not m_fname: + continue + fname, rest = m_fname.groups() + if fname != last_fname: + finish_file(last_fname, rest_list) + rest_list = [] + last_fname = fname + + dirname, leaf = os.path.split(fname) + root, ext = os.path.splitext(leaf) + #if dirname != '' or root != 'Makefile': + #continue + if (dirname.startswith('test') or + dirname.startswith('lib/efi_selftest')): + # Ignore test code since it is mostly only for sandbox + pass + elif ext == '.autoconf': + pass + elif ext in ['.c', '.h', '.S', '.lds', '.dts', '.dtsi', '.asl', + '.cfg', '.env', '.tmpl']: + rest_list.append(rest) + is_mkfile = False + elif 'Makefile' in root or ext == '.mk': + rest_list.append(rest) + is_mkfile = True + elif ext in ['.yml', '.sh', '.py', '.awk', '.pl', '.rst', '', '.sed', + '.src', '.inc', '.l', '.i_shipped', '.txt', '.cmd', + '.cfg', '.y', '.cocci', '.ini', '.asn1', '.base', + '.cnf', '.patch', '.mak', '.its', '.svg', '.tcl', + '.css', '.config', '.conf']: + pass + elif 'Kconfig' in root or 'Kbuild' in root: + pass + elif 'README' in root: + pass + elif dirname in ['configs']: + pass + elif dirname.startswith('doc') or dirname.startswith('scripts/kconfig'): + pass + else: + print(f'Not sure how to handle file {fname}') + finish_file(last_fname, rest_list) + return mk_dict, src_dict + + def check_mk_missing(all_uses, spl_not_found, proper_not_found): + # Make sure we know about all the options in Makefiles + print('\nCONFIG options present in Makefiles but not Kconfig:') + not_found = check_not_found(all_uses, MODE_NORMAL) + show_uses(not_found) + + print('\nCONFIG options present in Makefiles but not Kconfig (SPL):') + not_found = check_not_found(all_uses, MODE_SPL) + show_uses(not_found) + spl_not_found |= set(is_not_proper(key) or key for key in not_found.keys()) + + print('\nCONFIG options used as Proper in Makefiles but without a non-SPL_ variant:') + not_found = check_not_found(all_uses, MODE_PROPER) + show_uses(not_found) + proper_not_found |= set(key for key in not_found.keys()) + + def check_src_missing(all_uses, spl_not_found, proper_not_found): + # Make sure we know about all the options in source files + print('\nCONFIG options present in source but not Kconfig:') + not_found = check_not_found(all_uses, MODE_NORMAL) + show_uses(not_found) + + print('\nCONFIG options present in source but not Kconfig (SPL):') + not_found = check_not_found(all_uses, MODE_SPL) + show_uses(not_found) + spl_not_found |= set(is_not_proper(key) or key + for key in not_found.keys()) + + print('\nCONFIG options used as Proper in source but without a non-SPL_ variant:') + not_found = check_not_found(all_uses, MODE_PROPER) + show_uses(not_found) + proper_not_found |= set(key for key in not_found.keys()) + + def show_summary(spl_not_found, proper_not_found): + print('\nCONFIG options used as SPL but without an SPL_ variant:') + for item in sorted(spl_not_found): + print(f' {item}') + + print('\nCONFIG options used as Proper but without a non-SPL_ variant:') + for item in sorted(proper_not_found): + print(f' {item}') + + def write_update(spl_not_found, proper_not_found): + with open(os.path.join(path, 'scripts', 'conf_nospl'), + encoding='utf-8') as out: + print('# These options should not be enabled in SPL builds\n', + file=out) + for item in sorted(spl_not_found): + print(item, file=out) + with open(os.path.join(path, 'scripts', 'conf_noproper'), 'w', + encoding='utf-8') as out: + print('# These options should not be enabled in Proper builds\n', + file=out) + for item in sorted(proper_not_found): + print(item, file=out) + + def check_conflict(kconf, all_uses, show): + """Check conflicts between uses of CONFIG options in source + + Sometimes an option is used in an SPL context in once place and not in + another. For example if we see CONFIG_SPL_FOO and CONFIG_FOO then we + don't know whether FOO should be enabled in SPL if CONFIG_FOO is + enabled, or only if CONFIG_SPL_FOO is enabled., + + This function detects such situations + + Args: + kconf (Kconfiglib.Kconfig): Kconfig tree read from source + all_uses (dict): dict to add more uses to: + key (ConfigUse): object + value (list of str): matching lines + show (bool): True to show the problems + + Returns: + dict of conflicts: + key: filename + value: list of ConfigUse objects + """ + conflict_dict = collections.defaultdict(list) + cfg_dict = collections.defaultdict(list) + + uses = collections.defaultdict(list) + for use in all_uses: + uses[use.cfg].append(use) + + bad = 0 + for cfg in sorted(uses): + use_list = uses[cfg] + + # Check if + # - there is no SPL_ version of the symbol, and + # - some uses are SPL and some are not + is_spl = list(set(u.is_spl for u in use_list)) + if len(is_spl) > 1 and f'SPL_{cfg}' not in kconf.syms: + if show: + print(f'{cfg}: {is_spl}') + for use in use_list: + if show: + print(f' spl={use.is_spl}: {use.conds} {use.fname} {use.rest}') + if use.is_spl: + conflict_dict[use.fname].append(use) + cfg_dict[use.cfg].append(use) + bad += 1 + print(f'total bad: {bad}') + return conflict_dict, cfg_dict + + def replace_in_file(fname, use_or_uses): + """Replace a CONFIG pattern in a file + + Args: + fname (str): Filename to replace in + use_or_uses (ConfigUse or list of ConfigUse): Uses to replace + """ + with open(fname, encoding='utf-8') as inf: + data = inf.read() + out = io.StringIO() + + if isinstance(use_or_uses, list): + uses = use_or_uses else: - print(f'Not sure how to handle file {fname}') + uses = [use_or_uses]
- # Scan the Makefiles - all_uses, fname_uses = scan_makefiles(mk_list) + re_cfgs = [] + for use in uses: + if use.is_mk: + expr = r'CONFIG_(?:$(SPL_(?:TPL_)?))%s\b' % use.cfg + else: + expr = r'CONFIG_IS_ENABLED(%s)' % use.cfg + re_cfgs.append(re.compile(expr)) + + for line in data.splitlines(): + new_line = line + if 'CONFIG_' in line: + todo = [] + for i, re_cfg in enumerate(re_cfgs): + if not re_cfg.search(line): + todo.append(re_cfg) + use = uses[i] + if use.is_mk: + new_line = re_cfg.sub(f'CONFIG_{use.cfg}', new_line) + else: + new = f'IS_ENABLED(CONFIG_{use.cfg})' + new_line = re_cfg.sub(new, new_line) + re_cfgs = todo + out.write(new_line) + out.write('\n') + out_data = out.getvalue() + if out_data == data: + print(f'\n\nfailed with {fname}\n\n') + with open(fname, 'w', encoding='utf-8') as outf: + outf.write(out_data) + + def update_source(conflicts): + """Replace any SPL constructs with plain non-SPL ones + + CONFIG_IS_ENABLED(FOO) becomes IS_ENABLED(CONFIG_FOO) + CONFIG$_(SPL_TPL_)FOO becomes CONFIG_FOO
- spl_not_found = set() - proper_not_found = set() + Args: + conflicts (dict): dict of conflicts: + key (str): filename + value (list of ConfigUse): uses within that file + """ + print(f'Updating {len(conflicts)} files') + for fname, uses in conflicts.items(): + replace_in_file(fname, uses)
- # Make sure we know about all the options - print('\nCONFIG options present in Makefiles but not Kconfig:') - not_found = check_not_found(all_uses, MODE_NORMAL) - show_uses(not_found) + def create_commits(cfg_dict): + """Create a set of commits to fix SPL conflicts
- print('\nCONFIG options present in Makefiles but not Kconfig (SPL):') - not_found = check_not_found(all_uses, MODE_SPL) - show_uses(not_found) - spl_not_found |= set([is_not_proper(key) or key for key in not_found.keys()]) + """ + print(f'Creating {len(cfg_dict)} commits') + for cfg, uses in cfg_dict.items(): + print(f'Processing {cfg}') + for use in uses: + #print(f' {use.fname}: {use}') + replace_in_file(use.fname, use) + plural = 's' if len(uses) > 1 else '' + msg = f'Correct SPL use{plural} of {cfg}' + msg += f'\n\nThis converts {len(uses)} usage{plural} ' + msg += 'of this option to the non-SPL form, since there is\n' + msg += f'no SPL_{cfg} defined in Kconfig' + if not write_commit(msg): + print('failed\n', uses) + break
- print('\nCONFIG options used as Proper in Makefiles but without a non-SPL_ variant:') - not_found = check_not_found(all_uses, MODE_PROPER) - show_uses(not_found) - proper_not_found |= set([key for key in not_found.keys()]) + print('Scanning Kconfig') + kconf = KconfigScanner().conf
- # Scan the source code - all_uses, fname_uses = scan_src_files(src_list) + all_uses = collections.defaultdict(list) + fname_uses = {} + mk_dict, src_dict = do_scan() + + # Scan the Makefiles + all_uses, fname_uses = scan_makefiles(mk_dict) + scan_src_files(src_dict, all_uses, fname_uses)
- # Make sure we know about all the options - print('\nCONFIG options present in source but not Kconfig:') - not_found = check_not_found(all_uses, MODE_NORMAL) - show_uses(not_found) + conflicts, cfg_dict = check_conflict(kconf, all_uses, show_conflicts)
- print('\nCONFIG options present in source but not Kconfig (SPL):') - not_found = check_not_found(all_uses, MODE_SPL) - show_uses(not_found) - spl_not_found |= set([is_not_proper(key) or key for key in not_found.keys()]) + if do_update: + update_source(conflicts) + if do_commit: + create_commits(cfg_dict)
- print('\nCONFIG options used as Proper in source but without a non-SPL_ variant:') - not_found = check_not_found(all_uses, MODE_PROPER) - show_uses(not_found) - proper_not_found |= set([key for key in not_found.keys()]) + # Look for CONFIG options that are not found + spl_not_found = set() + proper_not_found = set() + check_mk_missing(all_uses, spl_not_found, proper_not_found)
- print('\nCONFIG options used as SPL but without an SPL_ variant:') - for item in sorted(spl_not_found): - print(f' {item}') + # Scan the source code + scan_src_files(src_dict, all_uses, fname_uses) + check_src_missing(all_uses, spl_not_found, proper_not_found)
- print('\nCONFIG options used as Proper but without a non-SPL_ variant:') - for item in sorted(proper_not_found): - print(f' {item}') + show_summary(spl_not_found, proper_not_found)
# Write out the updated information if do_update: - with open(os.path.join(path, 'scripts', 'conf_nospl'), 'w') as out: - print('# These options should not be enabled in SPL builds\n', - file=out) - for item in sorted(spl_not_found): - print(item, file=out) - with open(os.path.join(path, 'scripts', 'conf_noproper'), 'w') as out: - print('# These options should not be enabled in Proper builds\n', - file=out) - for item in sorted(proper_not_found): - print(item, file=out) - + write_update(spl_not_found, proper_not_found)
def main(): try: @@ -1957,9 +2268,11 @@ doc/develop/moveconfig.rst for documentation.''' parser.add_argument('-i', '--imply', action='store_true', default=False, help='find options which imply others') parser.add_argument('-I', '--imply-flags', type=str, default='', - help="control the -i option ('help' for help") + help="control the -i option ('help' for help)") parser.add_argument('-j', '--jobs', type=int, default=cpu_count, help='the number of jobs to run simultaneously') + parser.add_argument('-l', '--list-problems', action='store_true', + help='list problems found with --scan-source') parser.add_argument('-n', '--dry-run', action='store_true', default=False, help='perform a trial run (show log with no changes)') parser.add_argument('-r', '--git-ref', type=str, @@ -1991,7 +2304,8 @@ doc/develop/moveconfig.rst for documentation.''' unittest.main()
if args.scan_source: - do_scan_source(os.getcwd(), args.update) + do_scan_source(os.getcwd(), args.update, args.list_problems, + args.commit) return
if not any((len(configs), args.force_sync, args.build_db, args.imply, @@ -2049,7 +2363,6 @@ doc/develop/moveconfig.rst for documentation.''' cleanup_readme(configs, args)
if args.commit: - subprocess.call(['git', 'add', '-u']) if configs: msg = 'Convert %s %sto Kconfig' % (configs[0], 'et al ' if len(configs) > 1 else '') @@ -2058,7 +2371,7 @@ doc/develop/moveconfig.rst for documentation.''' else: msg = 'configs: Resync with savedefconfig' msg += '\n\nRsync all defconfig files using moveconfig.py' - subprocess.call(['git', 'commit', '-s', '-m', msg]) + write_commit(msg)
if args.build_db: with open(CONFIG_DATABASE, 'w', encoding='utf-8') as fd:

Move this Makefile line into the non-SPL area so we don't have to repy on the SPL_TPL_ macro.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v5: - Fix reply typo
Changes in v3: - Add new patch to disable QFW bootmeth in SPL
boot/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/boot/Makefile b/boot/Makefile index 5424b6fafcc..b9a12236798 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
obj-$(CONFIG_PXE_UTILS) += pxe_utils.o +obj-$(CONFIG_QFW) += bootmeth_qfw.o
endif
@@ -26,7 +27,6 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootstd-uclass.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO) += bootmeth_distro.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO_PXE) += bootmeth_pxe.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EFILOADER) += bootmeth_efi.o -obj-$(CONFIG_$(SPL_TPL_)QFW) += bootmeth_qfw.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SANDBOX) += bootmeth_sandbox.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SCRIPT) += bootmeth_script.o ifdef CONFIG_$(SPL_TPL_)BOOTSTD_FULL

On Wed, Feb 22, 2023 at 09:33:46AM -0700, Simon Glass wrote:
Move this Makefile line into the non-SPL area so we don't have to repy on the SPL_TPL_ macro.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

This converts 2 usages of this option to the non-SPL form, since there is no SPL_ARCH_MVEBU defined in Kconfig
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/mmc/mv_sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c index 336ebf14102..20049981473 100644 --- a/drivers/mmc/mv_sdhci.c +++ b/drivers/mmc/mv_sdhci.c @@ -64,7 +64,7 @@ int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks) host->ops = &mv_ops; #endif
- if (CONFIG_IS_ENABLED(ARCH_MVEBU)) { + if (IS_ENABLED(CONFIG_ARCH_MVEBU)) { /* Configure SDHCI MBUS mbus bridge windows */ sdhci_mvebu_mbus_config((void __iomem *)regbase); } @@ -103,7 +103,7 @@ static int mv_sdhci_probe(struct udevice *dev) if (ret) return ret;
- if (CONFIG_IS_ENABLED(ARCH_MVEBU)) { + if (IS_ENABLED(CONFIG_ARCH_MVEBU)) { /* Configure SDHCI MBUS mbus bridge windows */ sdhci_mvebu_mbus_config(host->ioaddr); }

This converts 2 usages of this option to the non-SPL form, since there is no SPL_DISPLAY_AER_FULL defined in Kconfig
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/sysreset/sysreset_mpc83xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/sysreset/sysreset_mpc83xx.c b/drivers/sysreset/sysreset_mpc83xx.c index c9a03266595..ca48328f7b5 100644 --- a/drivers/sysreset/sysreset_mpc83xx.c +++ b/drivers/sysreset/sysreset_mpc83xx.c @@ -107,7 +107,7 @@ static int print_83xx_arb_event(bool force, char *buf, int size) if (!force && !gd->arch.arbiter_event_address) return 0;
- if (CONFIG_IS_ENABLED(DISPLAY_AER_FULL)) { + if (IS_ENABLED(CONFIG_DISPLAY_AER_FULL)) { res = snprintf(buf, size, "Arbiter Event Status:\n" " %s: 0x%08lX\n" @@ -184,7 +184,7 @@ static int mpc83xx_sysreset_get_status(struct udevice *dev, char *buf, int size) * TODO(mario.six@gdsys.cc): Move this into a dedicated * arbiter driver */ - if (CONFIG_IS_ENABLED(DISPLAY_AER_FULL) || + if (IS_ENABLED(CONFIG_DISPLAY_AER_FULL) || IS_ENABLED(CONFIG_DISPLAY_AER_BRIEF)) { /* * If there was a bus monitor reset event, we force the arbiter

On Wed, Feb 22, 2023 at 09:33:48AM -0700, Simon Glass wrote:
This converts 2 usages of this option to the non-SPL form, since there is no SPL_DISPLAY_AER_FULL defined in Kconfig
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

This converts 3 usages of this option to the non-SPL form, since there is no SPL_MULTIPLEXER defined in Kconfig
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Tom Rini trini@konsulko.com ---
(no changes since v3)
Changes in v3: - Move the option down to the non-SPL part of drivers/Makefile
drivers/Makefile | 2 +- drivers/mux/Makefile | 2 +- include/mux.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/Makefile b/drivers/Makefile index 15d19d0c8a3..58be410135d 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -18,7 +18,6 @@ obj-$(CONFIG_$(SPL_TPL_)INPUT) += input/ obj-$(CONFIG_$(SPL_TPL_)LED) += led/ obj-$(CONFIG_$(SPL_TPL_)MMC) += mmc/ obj-y += mtd/ -obj-$(CONFIG_$(SPL_)MULTIPLEXER) += mux/ obj-$(CONFIG_$(SPL_TPL_)ETH) += net/ obj-$(CONFIG_$(SPL_TPL_)PCH) += pch/ obj-$(CONFIG_$(SPL_TPL_)PCI) += pci/ @@ -87,6 +86,7 @@ obj-$(CONFIG_FASTBOOT) += fastboot/ obj-$(CONFIG_FWU_MDATA) += fwu-mdata/ obj-y += misc/ obj-$(CONFIG_MMC) += mmc/ +obj-$(CONFIG_MULTIPLEXER) += mux/ obj-$(CONFIG_NVME) += nvme/ obj-$(CONFIG_PCI_ENDPOINT) += pci_endpoint/ obj-y += dfu/ diff --git a/drivers/mux/Makefile b/drivers/mux/Makefile index 78ebf04c7a9..d4e24789d33 100644 --- a/drivers/mux/Makefile +++ b/drivers/mux/Makefile @@ -3,5 +3,5 @@ # (C) Copyright 2019 # Jean-Jacques Hiblot jjhiblot@ti.com
-obj-$(CONFIG_$(SPL_)MULTIPLEXER) += mux-uclass.o +obj-$(CONFIG_MULTIPLEXER) += mux-uclass.o obj-$(CONFIG_$(SPL_)MUX_MMIO) += mmio.o diff --git a/include/mux.h b/include/mux.h index 9f809912742..c92d887591e 100644 --- a/include/mux.h +++ b/include/mux.h @@ -23,7 +23,7 @@ struct udevice; struct mux_control;
-#if CONFIG_IS_ENABLED(MULTIPLEXER) +#if IS_ENABLED(CONFIG_MULTIPLEXER) /** * mux_control_states() - Query the number of multiplexer states. * @mux: The mux-control to query.

On Wed, Feb 22, 2023 at 09:33:49AM -0700, Simon Glass wrote:
This converts 3 usages of this option to the non-SPL form, since there is no SPL_MULTIPLEXER defined in Kconfig
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Tom Rini trini@konsulko.com
Applied to u-boot/next, thanks!

This converts 1 usage of this option to the non-SPL form, since there is no SPL_PG_WCOM_UBOOT_UPDATE_SUPPORTED defined in Kconfig
Signed-off-by: Simon Glass sjg@chromium.org Aleksandar Gerasimovski aleksandar.gerasimovski@hitachienergy.com ---
(no changes since v1)
board/keymile/common/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 8c282f9952a..991022ac833 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -78,7 +78,7 @@ int set_km_env(void) return 0; }
-#if CONFIG_IS_ENABLED(PG_WCOM_UBOOT_UPDATE_SUPPORTED) +#if IS_ENABLED(CONFIG_PG_WCOM_UBOOT_UPDATE_SUPPORTED) #if ((!IS_ENABLED(CONFIG_PG_WCOM_UBOOT_BOOTPACKAGE) && \ !IS_ENABLED(CONFIG_PG_WCOM_UBOOT_UPDATE)) || \ (IS_ENABLED(CONFIG_PG_WCOM_UBOOT_BOOTPACKAGE) && \

On Wed, Feb 22, 2023 at 09:33:50AM -0700, Simon Glass wrote:
This converts 1 usage of this option to the non-SPL form, since there is no SPL_PG_WCOM_UBOOT_UPDATE_SUPPORTED defined in Kconfig
Signed-off-by: Simon Glass sjg@chromium.org Aleksandar Gerasimovski aleksandar.gerasimovski@hitachienergy.com
Applied to u-boot/next, thanks!

This converts 3 usages of this option to the non-SPL form, since there is no SPL_PHY_FIXED defined in Kconfig
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/net/mvneta.c | 4 ++-- net/mdio-uclass.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c index 0fbfad11d45..24933473fa0 100644 --- a/drivers/net/mvneta.c +++ b/drivers/net/mvneta.c @@ -815,7 +815,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp) mvreg_write(pp, MVNETA_SDMA_CONFIG, val);
/* Enable PHY polling in hardware if not in fixed-link mode */ - if (!CONFIG_IS_ENABLED(PHY_FIXED) || + if (!IS_ENABLED(CONFIG_PHY_FIXED) || pp->phydev->phy_id != PHY_FIXED_ID) { mvreg_write(pp, MVNETA_PHY_ADDR, pp->phydev->addr);
@@ -1176,7 +1176,7 @@ static void mvneta_adjust_link(struct udevice *dev) * be added). Also, why is ADVERT_FC enabled if we don't enable * inband AN at all? */ - if (CONFIG_IS_ENABLED(PHY_FIXED) && + if (IS_ENABLED(CONFIG_PHY_FIXED) && pp->phydev->phy_id == PHY_FIXED_ID) val = MVNETA_GMAC_IB_BYPASS_AN_EN | MVNETA_GMAC_SET_FC_EN | diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c index d80037d0ac7..e758cc66d7e 100644 --- a/net/mdio-uclass.c +++ b/net/mdio-uclass.c @@ -175,7 +175,7 @@ static struct phy_device *dm_eth_connect_phy_handle(struct udevice *ethdev, struct phy_device *phy; ofnode phynode;
- if (CONFIG_IS_ENABLED(PHY_FIXED) && + if (IS_ENABLED(CONFIG_PHY_FIXED) && ofnode_phy_is_fixed_link(dev_ofnode(ethdev), &phynode)) { phy = phy_connect(NULL, 0, ethdev, interface); goto out;

On Wed, Feb 22, 2023 at 09:33:51AM -0700, Simon Glass wrote:
This converts 3 usages of this option to the non-SPL form, since there is no SPL_PHY_FIXED defined in Kconfig
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

Allow this to be enabled separately in U-Boot proper and in SPL, since it is not needed in SPL.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v4)
Changes in v4: - Avoid use of def_bool
boot/Kconfig | 20 ++++++++++++++++++++ boot/Makefile | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/boot/Kconfig b/boot/Kconfig index 5f491625c82..b89916c109c 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -528,6 +528,26 @@ config VPL_BOOTMETH_VBE
if BOOTMETH_VBE
+config BOOTMETH_VBE_REQUEST + bool "Support for serving VBE OS requests" + default y + help + Enables support for looking that the requests made by the + Operating System being booted. These requests result in additions to + the device tree /chosen node, added during the device tree fixup + phase. + +config SPL_BOOTMETH_VBE_REQUEST + bool "Support for serving VBE OS requests (SPL)" + depends on SPL + help + Enables support for looking that the requests made by the + Operating System being booted. These requests result in additions to + the device tree /chosen node, added during the device tree fixup + phase. + + This is only useful if you are booting an OS direct from SPL. + config BOOTMETH_VBE_SIMPLE bool "Bootdev support for VBE 'simple' method" default y diff --git a/boot/Makefile b/boot/Makefile index b9a12236798..88193a1b60e 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -52,7 +52,8 @@ endif
obj-$(CONFIG_$(SPL_TPL_)EXPO) += expo.o scene.o scene_menu.o
-obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE) += vbe.o vbe_request.o +obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE) += vbe.o +obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_REQUEST) += vbe_request.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_SIMPLE) += vbe_simple.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_SIMPLE_FW) += vbe_simple_fw.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_SIMPLE_OS) += vbe_simple_os.o

On Wed, Feb 22, 2023 at 09:33:52AM -0700, Simon Glass wrote:
Allow this to be enabled separately in U-Boot proper and in SPL, since it is not needed in SPL.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

This converts 1 usage of this option to the non-SPL form, since there is no SPL_DM_RNG defined in Kconfig
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
boot/vbe_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/boot/vbe_request.c b/boot/vbe_request.c index 45f1d2b7e17..312edfa2bdb 100644 --- a/boot/vbe_request.c +++ b/boot/vbe_request.c @@ -36,7 +36,7 @@ static int handle_random_req(ofnode node, int default_size, u32 size; int ret;
- if (!CONFIG_IS_ENABLED(DM_RNG)) + if (!IS_ENABLED(CONFIG_DM_RNG)) return -ENOTSUPP;
if (ofnode_read_u32(node, "vbe,size", &size)) {

On Wed, Feb 22, 2023 at 09:33:53AM -0700, Simon Glass wrote:
This converts 1 usage of this option to the non-SPL form, since there is no SPL_DM_RNG defined in Kconfig
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

This is implicitly used in the source and seems useful, so add it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
lib/Kconfig | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/lib/Kconfig b/lib/Kconfig index 83e5edd73b0..1c93f523b3a 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -727,6 +727,12 @@ config ZSTD_LIB_MINIFY
endif
+config SPL_BZIP2 + bool "Enable bzip2 decompression support for SPL build" + depends on SPL + help + This enables support for bzip2 compression algorithm for SPL boot. + config SPL_LZ4 bool "Enable LZ4 decompression support in SPL" depends on SPL

On Wed, Feb 22, 2023 at 09:33:54AM -0700, Simon Glass wrote:
This is implicitly used in the source and seems useful, so add it.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

It turns out that the conf_noproper file is not neeed, since if an option does not appear in U-Boot proper we can just omit it from the autoconf for that build. Drop it.
Also add more control over what is output from the tool.
Add this in here. It should be added to the previous series (splb).
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/moveconfig.py | 91 +++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 48 deletions(-)
diff --git a/tools/moveconfig.py b/tools/moveconfig.py index b3ac2672737..ec2afa92e46 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -1833,13 +1833,20 @@ def scan_src_files(fname_dict, all_uses, fname_uses):
MODE_NORMAL, MODE_SPL, MODE_PROPER = range(3)
-def do_scan_source(path, do_update, show_conflicts, do_commit): +def do_scan_source(path, do_update, do_update_source, show_conflicts, + do_commit): """Scan the source tree for Kconfig inconsistencies
Args: path (str): Path to source tree - do_update (bool): True to write to scripts/kconf_... files - show_conflicts (bool): True to show conflicts + do_update (bool): True to write to scripts/conf_nospl file + do_update_source (bool): True to update source to remove invalid use of + CONFIG_IS_ENABLED() + show_conflicts (bool): True to show conflicts between the source code + and the Kconfig (such as missing options, or options which imply an + SPL option that does not exist) + do_commit (bool): Create commits to remove use of SPL_TPL_ and + CONFIG_IS_ENABLED macros when there is no SPL symbol. """ def is_not_proper(name): for prefix in SPL_PREFIXES: @@ -1977,9 +1984,7 @@ def do_scan_source(path, do_update, show_conflicts, do_commit):
dirname, leaf = os.path.split(fname) root, ext = os.path.splitext(leaf) - #if dirname != '' or root != 'Makefile': - #continue - if (dirname.startswith('test') or + if (dirname.startswith('test/') or dirname.startswith('lib/efi_selftest')): # Ignore test code since it is mostly only for sandbox pass @@ -2011,38 +2016,25 @@ def do_scan_source(path, do_update, show_conflicts, do_commit): finish_file(last_fname, rest_list) return mk_dict, src_dict
- def check_mk_missing(all_uses, spl_not_found, proper_not_found): + def check_missing(all_uses, spl_not_found, proper_not_found, + show_conflicts): # Make sure we know about all the options in Makefiles - print('\nCONFIG options present in Makefiles but not Kconfig:') not_found = check_not_found(all_uses, MODE_NORMAL) - show_uses(not_found) + if show_conflicts: + print('\nCONFIG options present in source but not Kconfig:') + show_uses(not_found)
- print('\nCONFIG options present in Makefiles but not Kconfig (SPL):') not_found = check_not_found(all_uses, MODE_SPL) - show_uses(not_found) spl_not_found |= set(is_not_proper(key) or key for key in not_found.keys()) + if show_conflicts: + print('\nCONFIG options present in source but not Kconfig (SPL):') + show_uses(not_found)
- print('\nCONFIG options used as Proper in Makefiles but without a non-SPL_ variant:') not_found = check_not_found(all_uses, MODE_PROPER) - show_uses(not_found) - proper_not_found |= set(key for key in not_found.keys()) - - def check_src_missing(all_uses, spl_not_found, proper_not_found): - # Make sure we know about all the options in source files - print('\nCONFIG options present in source but not Kconfig:') - not_found = check_not_found(all_uses, MODE_NORMAL) - show_uses(not_found) - - print('\nCONFIG options present in source but not Kconfig (SPL):') - not_found = check_not_found(all_uses, MODE_SPL) - show_uses(not_found) - spl_not_found |= set(is_not_proper(key) or key - for key in not_found.keys()) - - print('\nCONFIG options used as Proper in source but without a non-SPL_ variant:') - not_found = check_not_found(all_uses, MODE_PROPER) - show_uses(not_found) proper_not_found |= set(key for key in not_found.keys()) + if show_conflicts: + print('\nCONFIG options used as Proper in source but without a non-SPL_ variant:') + show_uses(not_found)
def show_summary(spl_not_found, proper_not_found): print('\nCONFIG options used as SPL but without an SPL_ variant:') @@ -2053,19 +2045,24 @@ def do_scan_source(path, do_update, show_conflicts, do_commit): for item in sorted(proper_not_found): print(f' {item}')
- def write_update(spl_not_found, proper_not_found): - with open(os.path.join(path, 'scripts', 'conf_nospl'), + def write_update(spl_not_found): + with open(os.path.join(path, 'scripts', 'conf_nospl'), 'w', encoding='utf-8') as out: - print('# These options should not be enabled in SPL builds\n', + print('''# Options which are never enabled in SPL. + +Generally, options which have no SPL_ prefix (e.g. CONFIG_FOO) apply to all +SPL build phases. This allows things like ARCH_ARM to propagate to all builds +without the hassle of generating a separate SPL version fo each phase. But in +some cases this is not wanted. + +This file lists options which don't have an SPL equivalent, but still should not +be enabled in SPL builds. It is necessary since kconfig cannot tell (just by +looking at the Kconfig description) whether it applies to Proper builds only, +or to all builds. +''', file=out) for item in sorted(spl_not_found): print(item, file=out) - with open(os.path.join(path, 'scripts', 'conf_noproper'), 'w', - encoding='utf-8') as out: - print('# These options should not be enabled in Proper builds\n', - file=out) - for item in sorted(proper_not_found): - print(item, file=out)
def check_conflict(kconf, all_uses, show): """Check conflicts between uses of CONFIG options in source @@ -2210,7 +2207,7 @@ def do_scan_source(path, do_update, show_conflicts, do_commit):
conflicts, cfg_dict = check_conflict(kconf, all_uses, show_conflicts)
- if do_update: + if do_update_source: update_source(conflicts) if do_commit: create_commits(cfg_dict) @@ -2218,17 +2215,13 @@ def do_scan_source(path, do_update, show_conflicts, do_commit): # Look for CONFIG options that are not found spl_not_found = set() proper_not_found = set() - check_mk_missing(all_uses, spl_not_found, proper_not_found) - - # Scan the source code - scan_src_files(src_dict, all_uses, fname_uses) - check_src_missing(all_uses, spl_not_found, proper_not_found) + check_missing(all_uses, spl_not_found, proper_not_found, show_conflicts)
show_summary(spl_not_found, proper_not_found)
# Write out the updated information if do_update: - write_update(spl_not_found, proper_not_found) + write_update(spl_not_found)
def main(): try: @@ -2289,6 +2282,8 @@ doc/develop/moveconfig.rst for documentation.''' help="respond 'yes' to any prompts") parser.add_argument('-u', '--update', action='store_true', default=False, help="update scripts/ files (use with --scan-source)") + parser.add_argument('-U', '--update-source', action='store_true', + help="update source code (use with --scan-source)") parser.add_argument('-v', '--verbose', action='store_true', default=False, help='show any build errors as boards are built') parser.add_argument('configs', nargs='*') @@ -2304,8 +2299,8 @@ doc/develop/moveconfig.rst for documentation.''' unittest.main()
if args.scan_source: - do_scan_source(os.getcwd(), args.update, args.list_problems, - args.commit) + do_scan_source(os.getcwd(), args.update, args.update_source, + args.list_problems, args.commit) return
if not any((len(configs), args.force_sync, args.build_db, args.imply,

Allow this to get larger to accommodate more test code with LTO disabled.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
arch/sandbox/dts/sandbox_vpl.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/sandbox/dts/sandbox_vpl.dtsi b/arch/sandbox/dts/sandbox_vpl.dtsi index 1fba537f135..c7dc00a8d2d 100644 --- a/arch/sandbox/dts/sandbox_vpl.dtsi +++ b/arch/sandbox/dts/sandbox_vpl.dtsi @@ -17,8 +17,8 @@ * provide plenty of space for ELF files with debug info so that * gdb can be used */ - offset = <0x400000>; - size = <0xdffc00>; + offset = <0x800000>; + size = <0x2000000>;
fit { fit,external-offset = <0>;

On Wed, Feb 22, 2023 at 09:33:56AM -0700, Simon Glass wrote:
Allow this to get larger to accommodate more test code with LTO disabled.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

Add options to enable events in SPL. This is mostly so the code can be excluded from SPL builds.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v4)
Changes in v4: - Modify to get rid of def_bool - Adjust Kconfig ordering
common/Kconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/common/Kconfig b/common/Kconfig index e3a5e1be1e9..33c3b1dbf0f 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -631,6 +631,26 @@ config EVENT_DEBUG events, such as event-type names. This adds to the code size of U-Boot so can be turned off for production builds.
+config SPL_EVENT + bool # General-purpose event-handling mechanism in SPL + depends on SPL + help + This adds a framework for general purpose sending and processing of + events, to allow interested parties to be alerted when something + happens. This is an attempt to stem the flow of weak functions, + hooks, functions in board_f.c and board_r.c and the Kconfig options + below. + + See doc/develop/event.rst for more information. + +config SPL_EVENT_DYNAMIC + bool + depends on SPL_EVENT && EVENT_DYNAMIC + help + Enable this to support adding an event spy at runtime, without adding + it to the EVENT_SPY() linker list. This increases code size slightly + but provides more flexibility for boards and subsystems that need it. + endif # EVENT
config ARCH_EARLY_INIT_R

On Wed, Feb 22, 2023 at 09:33:57AM -0700, Simon Glass wrote:
Add options to enable events in SPL. This is mostly so the code can be excluded from SPL builds.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

Correct a 'VPL' typo in the Kconfig.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v4)
Changes in v4: - Just fix the typo
Changes in v3: - Correct 'VPL' typo - Use a consistent format for the comment
boot/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/boot/Kconfig b/boot/Kconfig index b89916c109c..d646369f55c 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -385,7 +385,7 @@ config BOOTSTD_FULL as well as the "boot_targets" environment variable
config SPL_BOOTSTD - bool "Standard boot support in VPL" + bool "Standard boot support in SPL" depends on SPL && SPL_DM && SPL_OF_CONTROL && SPL_BLK default y if VPL help

On Wed, Feb 22, 2023 at 09:33:58AM -0700, Simon Glass wrote:
Correct a 'VPL' typo in the Kconfig.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

This check is not needed when the environment is not enabled, e.g. in SPL. Add a condition to handle this.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
cmd/nvedit.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 7cbc3fd573a..277293679df 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -59,11 +59,13 @@ DECLARE_GLOBAL_DATA_PTR;
#endif
+#if CONFIG_IS_ENABLED(ENV_SUPPORT) #if !defined(ENV_IS_IN_DEVICE) && \ !defined(CONFIG_ENV_IS_NOWHERE) # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\ NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE #endif +#endif /* ENV_SUPPORT */
/* * Maximum expected input data size for import command

On Wed, Feb 22, 2023 at 09:33:59AM -0700, Simon Glass wrote:
This check is not needed when the environment is not enabled, e.g. in SPL. Add a condition to handle this.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v1)
cmd/nvedit.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 7cbc3fd573a..277293679df 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -59,11 +59,13 @@ DECLARE_GLOBAL_DATA_PTR;
#endif
+#if CONFIG_IS_ENABLED(ENV_SUPPORT) #if !defined(ENV_IS_IN_DEVICE) && \ !defined(CONFIG_ENV_IS_NOWHERE) # error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\ NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE #endif +#endif /* ENV_SUPPORT */
We need to move this kind of sanity enforcement to Kconfig, and drop the #error.

Add an option to put the VPL environment nowhere (not in storage).
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
env/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/env/Kconfig b/env/Kconfig index 6e24eee55f2..2bbe4c466a6 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -860,6 +860,16 @@ config TPL_ENV_IS_IN_FLASH
endif
+if VPL_ENV_SUPPORT + +config VPL_ENV_IS_NOWHERE + bool "VPL Environment is not stored" + default y if ENV_IS_NOWHERE + help + Similar to ENV_IS_NOWHERE, used for VPL environment. + +endif # VPL_ENV_SUPPORT + config USE_BOOTFILE bool "Add a 'bootfile' environment variable" help

On Wed, Feb 22, 2023 at 09:34:00AM -0700, Simon Glass wrote:
Add an option to put the VPL environment nowhere (not in storage).
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

Add these options so these algorithms can be used in VPL.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
lib/Kconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/lib/Kconfig b/lib/Kconfig index 1c93f523b3a..08318843231 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -579,6 +579,26 @@ config SPL_SHA_PROG_HW_ACCEL
endif
+config VPL_SHA1 + bool "Enable SHA1 support in VPL" + depends on VPL + default y if SHA1 + help + This option enables support of hashing using SHA1 algorithm. + The hash is calculated in software. + The SHA1 algorithm produces a 160-bit (20-byte) hash value + (digest). + +config VPL_SHA256 + bool "Enable SHA256 support in VPL" + depends on VPL + default y if SHA256 + help + This option enables support of hashing using SHA256 algorithm. + The hash is calculated in software. + The SHA256 algorithm produces a 256-bit (32-byte) hash value + (digest). + if SHA_HW_ACCEL
config SHA512_HW_ACCEL

On Wed, Feb 22, 2023 at 09:34:01AM -0700, Simon Glass wrote:
Add these options so these algorithms can be used in VPL.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

At present these are not included in SPL. They do add to code size but are a bit faster, so adjust the setting to add them.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
arch/x86/include/asm/string.h | 2 +- arch/x86/lib/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/string.h b/arch/x86/include/asm/string.h index c15b264a5c0..0254a022160 100644 --- a/arch/x86/include/asm/string.h +++ b/arch/x86/include/asm/string.h @@ -14,7 +14,7 @@ extern char *strrchr(const char *s, int c); #undef __HAVE_ARCH_STRCHR extern char *strchr(const char *s, int c);
-#ifdef CONFIG_X86_64 +#if CONFIG_IS_ENABLED(X86_64)
#undef __HAVE_ARCH_MEMCPY extern void *memcpy(void *, const void *, __kernel_size_t); diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index a6f22441474..ea7ff2bcf38 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -4,7 +4,7 @@ # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
obj-y += bdinfo.o -ifndef CONFIG_X86_64 +ifndef CONFIG_$(SPL_TPL_)X86_64 ifndef CONFIG_TPL_BUILD obj-y += bios.o obj-y += bios_asm.o

On Wed, Feb 22, 2023 at 09:34:02AM -0700, Simon Glass wrote:
At present these are not included in SPL. They do add to code size but are a bit faster, so adjust the setting to add them.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v1)
arch/x86/include/asm/string.h | 2 +- arch/x86/lib/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/string.h b/arch/x86/include/asm/string.h index c15b264a5c0..0254a022160 100644 --- a/arch/x86/include/asm/string.h +++ b/arch/x86/include/asm/string.h @@ -14,7 +14,7 @@ extern char *strrchr(const char *s, int c); #undef __HAVE_ARCH_STRCHR extern char *strchr(const char *s, int c);
-#ifdef CONFIG_X86_64 +#if CONFIG_IS_ENABLED(X86_64)
#undef __HAVE_ARCH_MEMCPY extern void *memcpy(void *, const void *, __kernel_size_t); diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index a6f22441474..ea7ff2bcf38 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -4,7 +4,7 @@ # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
obj-y += bdinfo.o -ifndef CONFIG_X86_64 +ifndef CONFIG_$(SPL_TPL_)X86_64 ifndef CONFIG_TPL_BUILD obj-y += bios.o obj-y += bios_asm.o
This is just.. confusing. Please re-work the string selection code to be more direct, with a new symbol if needed. And please re-examine if SPL_X86_64 is needed as a symbol at all.

Hi Tom.
On Thu, 2 Mar 2023 at 13:37, Tom Rini trini@konsulko.com wrote:
On Wed, Feb 22, 2023 at 09:34:02AM -0700, Simon Glass wrote:
At present these are not included in SPL. They do add to code size but are a bit faster, so adjust the setting to add them.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v1)
arch/x86/include/asm/string.h | 2 +- arch/x86/lib/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
I've moved this to another series, x86-specific.
Regards, Simon

This should be checking for any SPL build. Drop the use of SPL_TPL_ since it is not necessary and will not work with split config.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Makefile b/lib/Makefile index a282e40258c..10aa7ac0298 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -127,7 +127,7 @@ obj-$(CONFIG_LIB_UUID) += uuid.o obj-$(CONFIG_LIB_RAND) += rand.o obj-y += panic.o
-ifeq ($(CONFIG_$(SPL_TPL_)BUILD),y) +ifeq ($(CONFIG_SPL_BUILD),y) # SPL U-Boot may use full-printf, tiny-printf or none at all ifdef CONFIG_$(SPL_TPL_)USE_TINY_PRINTF obj-$(CONFIG_$(SPL_TPL_)SPRINTF) += tiny-printf.o

On Wed, Feb 22, 2023 at 09:34:03AM -0700, Simon Glass wrote:
This should be checking for any SPL build. Drop the use of SPL_TPL_ since it is not necessary and will not work with split config.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

At present we enable the sandbox RTC driver for all builds. Add a separate Kconfig option to control this, so that it can be disabled in TPL, where it is not needed.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v3)
Changes in v3: - Fix a transitory build error with sandbox_spl
arch/sandbox/dts/sandbox.dts | 2 +- arch/sandbox/dts/sandbox.dtsi | 6 +++--- arch/sandbox/include/asm/rtc.h | 2 +- drivers/rtc/Kconfig | 18 ++++++++++++++++++ drivers/rtc/Makefile | 4 ++-- 5 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index a4c1b8f6cb7..e9b6745d2db 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -76,7 +76,7 @@ clock-frequency = <400000>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c0>; - bootph-all; + bootph-pre-ram; };
pcic: pci@0 { diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi index 1f446e62e16..30a305c4d20 100644 --- a/arch/sandbox/dts/sandbox.dtsi +++ b/arch/sandbox/dts/sandbox.dtsi @@ -115,7 +115,7 @@ reg = <0x43>; compatible = "sandbox-rtc"; sandbox,emul = <&emul0>; - bootph-all; + bootph-pre-ram; }; sandbox_pmic: sandbox_pmic { reg = <0x40>; @@ -126,7 +126,7 @@ };
i2c_emul: emul { - bootph-all; + bootph-pre-ram; reg = <0xff>; compatible = "sandbox,i2c-emul-parent"; emul_eeprom: emul-eeprom { @@ -136,7 +136,7 @@ #emul-cells = <0>; }; emul0: emul0 { - bootph-all; + bootph-pre-ram; compatible = "sandbox,i2c-rtc-emul"; #emul-cells = <0>; }; diff --git a/arch/sandbox/include/asm/rtc.h b/arch/sandbox/include/asm/rtc.h index 025cd6c67cf..bf3ac5ea1ec 100644 --- a/arch/sandbox/include/asm/rtc.h +++ b/arch/sandbox/include/asm/rtc.h @@ -40,7 +40,7 @@ enum { * @reg: Register values */ struct sandbox_i2c_rtc_plat_data { -#if CONFIG_IS_ENABLED(OF_PLATDATA) +#if CONFIG_IS_ENABLED(OF_PLATDATA) && IS_ENABLED(CONFIG_RTC_SANDBOX) struct dtd_sandbox_i2c_rtc_emul dtplat; #endif long base_time; diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 35b6ed4d7c7..fcfda2847c8 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -231,6 +231,24 @@ config RTC_M41T62 Enable driver for ST's M41T62 compatible RTC devices (like RV-4162). It is a serial (I2C) real-time clock (RTC) with alarm.
+config RTC_SANDBOX + bool "Enable sandbox RTC driver" + depends on SANDBOX && DM_RTC + default y + help + Enable the sandbox RTC driver. This driver connects to the RTC + emulator and is used to test the RTC uclasses and associated code, + as well as the I2C subsystem. + +config SPL_RTC_SANDBOX + bool "Enable sandbox RTC driver (SPL)" + depends on SANDBOX && SPL_DM_RTC + default y + help + Enable the sandbox RTC driver. This driver connects to the RTC + emulator and is used to test the RTC uclasses and associated code, + as well as the I2C subsystem. + config RTC_STM32 bool "Enable STM32 RTC driver" depends on DM_RTC diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 447551e15aa..b6c9029c8f0 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -16,7 +16,7 @@ obj-$(CONFIG_RTC_DS3231) += ds3231.o obj-$(CONFIG_RTC_DS3232) += ds3232.o obj-$(CONFIG_RTC_EMULATION) += emul_rtc.o obj-$(CONFIG_RTC_HT1380) += ht1380.o -obj-$(CONFIG_SANDBOX) += i2c_rtc_emul.o +obj-$(CONFIG_$(SPL_TPL_)RTC_SANDBOX) += i2c_rtc_emul.o obj-$(CONFIG_RTC_ISL1208) += isl1208.o obj-$(CONFIG_RTC_M41T62) += m41t62.o obj-$(CONFIG_RTC_MC13XXX) += mc13xxx-rtc.o @@ -35,6 +35,6 @@ obj-$(CONFIG_RTC_RX8025) += rx8025.o obj-$(CONFIG_RTC_RX8010SJ) += rx8010sj.o obj-$(CONFIG_RTC_S35392A) += s35392a.o obj-$(CONFIG_RTC_STM32) += stm32_rtc.o -obj-$(CONFIG_SANDBOX) += sandbox_rtc.o +obj-$(CONFIG_$(SPL_TPL_)RTC_SANDBOX) += sandbox_rtc.o obj-$(CONFIG_RTC_ABX80X) += abx80x.o obj-$(CONFIG_RTC_ZYNQMP) += zynqmp_rtc.o

On Wed, Feb 22, 2023 at 09:34:04AM -0700, Simon Glass wrote:
At present we enable the sandbox RTC driver for all builds. Add a separate Kconfig option to control this, so that it can be disabled in TPL, where it is not needed.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

Avoid using CONFIG_SANDBOX_VPL since we have a generic option which works just as well.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
arch/sandbox/dts/sandbox.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index e9b6745d2db..12d3eff5fa7 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -103,6 +103,6 @@ #include "cros-ec-keyboard.dtsi" #include "sandbox_pmic.dtsi"
-#ifdef CONFIG_SANDBOX_VPL +#if IS_ENABLED(CONFIG_SUPPORT_VPL) #include "sandbox_vpl.dtsi" #endif

On Wed, Feb 22, 2023 at 09:34:05AM -0700, Simon Glass wrote:
Avoid using CONFIG_SANDBOX_VPL since we have a generic option which works just as well.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

At present we enable the sandbox I2C driver for all builds. Add a separate Kconfig option to control this, so that it can be disabled in TPL, where it is not needed.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/i2c/Kconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 3279fef1eb0..1077c331c30 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -47,6 +47,16 @@ config SPL_DM_I2C device (bus child) info is kept as parent platdata. The interface is defined in include/i2c.h.
+config TPL_DM_I2C + bool "Enable Driver Model for I2C drivers in TPL" + depends on TPL_DM && DM_I2C + help + Enable driver model for I2C. The I2C uclass interface: probe, read, + write and speed, is implemented with the bus drivers operations, + which provide methods for bus setting and data transfer. Each chip + device (bus child) info is kept as parent platdata. The interface + is defined in include/i2c.h. + config VPL_DM_I2C bool "Enable Driver Model for I2C drivers in VPL" depends on VPL_DM && DM_I2C @@ -508,6 +518,16 @@ config SYS_I2C_ROCKCHIP config SYS_I2C_SANDBOX bool "Sandbox I2C driver" depends on SANDBOX && DM_I2C + default y + help + Enable I2C support for sandbox. This is an emulation of a real I2C + bus. Devices can be attached to the bus using the device tree + which specifies the driver to use. See sandbox.dts as an example. + +config SPL_SYS_I2C_SANDBOX + bool "Sandbox I2C driver (SPL)" + depends on SPL && SANDBOX && DM_I2C + default y help Enable I2C support for sandbox. This is an emulation of a real I2C bus. Devices can be attached to the bus using the device tree

Hello Simon,
On 22.02.23 17:34, Simon Glass wrote:
At present we enable the sandbox I2C driver for all builds. Add a separate Kconfig option to control this, so that it can be disabled in TPL, where it is not needed.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v1)
drivers/i2c/Kconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
Reviewed-by: Heiko Schocher hs@denx.de
bye, Heiko

On Wed, Feb 22, 2023 at 09:34:06AM -0700, Simon Glass wrote:
At present we enable the sandbox I2C driver for all builds. Add a separate Kconfig option to control this, so that it can be disabled in TPL, where it is not needed.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Heiko Schocher hs@denx.de
Applied to u-boot/next, thanks!

Add VPL files into the mix so that we can fix up the dependencies there.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
scripts/basic/fixdep.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 5ced0f6b069..3d40bd7ee25 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -421,6 +421,8 @@ int main(int argc, char *argv[]) strcpy(tmp_buf, "SPL_"); else if (!strncmp(target, "tpl/", 4)) strcpy(tmp_buf, "TPL_"); + else if (!strncmp(target, "vpl/", 4)) + strcpy(tmp_buf, "VPL_"); /* end U-Boot hack */
xprintf("cmd_%s := %s\n\n", target, cmdline);

Move the config parsing into a separate function so that it is possible to write tests for the function.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
scripts/basic/fixdep.c | 87 ++++++++++++++++++++++++++---------------- 1 file changed, 54 insertions(+), 33 deletions(-)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 3d40bd7ee25..a49d35ba5f6 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -236,47 +236,68 @@ static int str_ends_with(const char *s, int slen, const char *sub) return !memcmp(s + slen - sublen, sub, sublen); }
-static void parse_config_file(const char *p) +static const char *parse_config_line(const char *p, const char **endp) { const char *q, *r; - const char *start = p;
- while ((p = strstr(p, "CONFIG_"))) { - if (p > start && (isalnum(p[-1]) || p[-1] == '_')) { - p += 7; - continue; - } - p += 7; + p = strstr(p, "CONFIG_"); + if (!p) { + *endp = NULL; + return NULL; + } + if ((isalnum(p[-1]) || p[-1] == '_')) { + *endp = p + 7; + return NULL; + } + p += 7; + q = p; + while (isalnum(*q) || *q == '_') + q++; + if (str_ends_with(p, q - p, "_MODULE")) + r = q - 7; + else + r = q; + /* + * U-Boot also handles + * CONFIG_IS_ENABLED(...) + * CONFIG_VAL(...) + */ + if ((q - p == 10 && !memcmp(p, "IS_ENABLED(", 11)) || + (q - p == 3 && !memcmp(p, "VAL(", 4))) { + p = q + 1; q = p; while (isalnum(*q) || *q == '_') q++; - if (str_ends_with(p, q - p, "_MODULE")) - r = q - 7; - else - r = q; - /* - * U-Boot also handles - * CONFIG_IS_ENABLED(...) - * CONFIG_VAL(...) - */ - if ((q - p == 10 && !memcmp(p, "IS_ENABLED(", 11)) || - (q - p == 3 && !memcmp(p, "VAL(", 4))) { - p = q + 1; - q = p; - while (isalnum(*q) || *q == '_') - q++; - r = q; - if (r > p && tmp_buf[0]) { - memcpy(tmp_buf + 4, p, r - p); - r = tmp_buf + 4 + (r - p); - p = tmp_buf; - } + r = q; + if (r > p && tmp_buf[0]) { + memcpy(tmp_buf + 4, p, r - p); + r = tmp_buf + 4 + (r - p); + p = tmp_buf; } - /* end U-Boot hack */ + } + /* end U-Boot hack */ + *endp = r; + + if (r > p) + return p;
- if (r > p) - use_config(p, r - p); - p = q; + return NULL; +} + +static void parse_config_file(const char *base) +{ + const char *p; + + if (!*base) + return; + p = base + 1; + while (p) { + const char *out, *end; + + out = parse_config_line(p, &end); + if (out) + use_config(out, end - out); + p = end; } }

Add tests for this code to cover the basic cases.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
scripts/basic/fixdep.c | 73 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index a49d35ba5f6..fe8180ab4e7 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -425,11 +425,84 @@ static void parse_dep_file(char *m, const char *target) xprintf("$(deps_%s):\n", target); }
+#define CHECKP(expect, got) \ + if (expect != got) { \ + fprintf(stderr, "Test failed at line %d: expect %ld, got %ld\n", \ + __LINE__, expect - buf, got - buf); \ + return 1; \ + } + +#define CHECK(expect, got) \ + if (expect != got) { \ + fprintf(stderr, "Test failed at line %d: expect %p, got %p\n", \ + __LINE__, expect, got); \ + return 1; \ + } + +static int run_tests(void) +{ + const char *out, *end; + char buf_s[40], *buf = buf_s + 1; + + /* make sure the previous char doesn't look like part of the CONFIG */ + buf_s[0] = ' '; + + strcpy(buf, ""); + out = parse_config_line(buf, &end); + CHECK(NULL, out); + CHECK(NULL, end); + + strcpy(buf, "nothing"); + out = parse_config_line(buf, &end); + CHECK(NULL, out); + CHECK(NULL, end); + + strcpy(buf, "CONFIG_OPTION_MORE"); + out = parse_config_line(buf, &end); + CHECKP(buf + 7, out); + CHECKP(buf + 18, end); + + strcpy(buf, "some CONFIG_OPTION_MORE"); + out = parse_config_line(buf, &end); + CHECKP(buf + 12, out); + CHECKP(buf + 23, end); + + strcpy(buf, "some CONFIG_OPTION_MORE here"); + out = parse_config_line(buf, &end); + CHECKP(buf + 12, out); + CHECKP(buf + 23, end); + + strcpy(buf, "CONFIG_OPTION_MODULE"); + out = parse_config_line(buf, &end); + CHECKP(buf + 7, out); + CHECKP(buf + 13, end); + + strcpy(buf, "CONFIG_IS_ENABLED(FRED)"); + out = parse_config_line(buf, &end); + CHECKP(buf + 18, out); + CHECKP(buf + 22, end); + + strcpy(buf, "CONFIG_VAL(MARY)"); + out = parse_config_line(buf, &end); + CHECKP(buf + 11, out); + CHECKP(buf + 15, end); + + return 0; +} + int main(int argc, char *argv[]) { const char *depfile, *target, *cmdline; void *buf;
+ if (argc == 2 && !strcmp("-t", argv[1])) { + if (run_tests()) { + fprintf(stderr, "Tests failed\n"); + return 1; + } + printf("Tests passed\n"); + return 0; + } if (argc != 4) usage();

These are needed since we need a separate value in SPL and Proper.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
test/lib/Kconfig | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/test/lib/Kconfig b/test/lib/Kconfig index dbb03e4a36f..134cbb85b83 100644 --- a/test/lib/Kconfig +++ b/test/lib/Kconfig @@ -18,6 +18,24 @@ config TEST_KCONFIG_VALUE int "Value associated with the option" depends on TEST_KCONFIG_ENABLE help - This is the value whgch is present if TEST_KCONFIG_ENABLE is enabled. + This is the value which is present if TEST_KCONFIG_ENABLE is enabled. + +config SPL_TEST_KCONFIG + bool "Enable detection of Kconfig macro errors (SPL)" + help + This is used to test that the IF_ENABLED_INT() macro causes a build error + if the value is used when the CONFIG Is not enabled. + +config SPL_TEST_KCONFIG_ENABLE + bool "Option to enable (SPL)" + help + This is the option that controls whether the value is present. + +config SPL_TEST_KCONFIG_VALUE + int "Value associated with the option (SPL" + depends on SPL_TEST_KCONFIG_ENABLE + help + This is the value which is present if SPL_TEST_KCONFIG_ENABLE is + enabled.
endif # SANDBOX

This is selected by PARTITION_UUIDS which has a separate option for SPL. Add an SPL option for LIB_UUID also, so that we can keep them consistent.
Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c which wants to call a uuid function in SPL.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
disk/Kconfig | 8 ++++++++ lib/Kconfig | 4 ++++ 2 files changed, 12 insertions(+)
diff --git a/disk/Kconfig b/disk/Kconfig index c9b9dbaf1a6..817b7c8c76d 100644 --- a/disk/Kconfig +++ b/disk/Kconfig @@ -149,6 +149,7 @@ config SPL_PARTITION_UUIDS bool "Enable support of UUID for partition in SPL" depends on SPL_PARTITIONS default y if SPL_EFI_PARTITION + select SPL_LIB_UUID
config PARTITION_TYPE_GUID bool "Enable support of GUID for partition type" @@ -157,4 +158,11 @@ config PARTITION_TYPE_GUID Activate the configuration of GUID type for EFI partition
+config SPL_PARTITION_TYPE_GUID + bool "Enable support of GUID for partition type (SPL)" + depends on SPL_EFI_PARTITION + help + Activate the configuration of GUID type + for EFI partition + endmenu diff --git a/lib/Kconfig b/lib/Kconfig index 08318843231..4278b240554 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -74,6 +74,10 @@ config HAVE_PRIVATE_LIBGCC config LIB_UUID bool
+config SPL_LIB_UUID + depends on SPL + bool + config SEMIHOSTING bool "Support semihosting" depends on ARM || RISCV

Am 22. Februar 2023 17:34:11 MEZ schrieb Simon Glass sjg@chromium.org:
This is selected by PARTITION_UUIDS which has a separate option for SPL. Add an SPL option for LIB_UUID also, so that we can keep them consistent.
Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c which wants to call a uuid function in SPL.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v1)
disk/Kconfig | 8 ++++++++ lib/Kconfig | 4 ++++ 2 files changed, 12 insertions(+)
diff --git a/disk/Kconfig b/disk/Kconfig index c9b9dbaf1a6..817b7c8c76d 100644 --- a/disk/Kconfig +++ b/disk/Kconfig @@ -149,6 +149,7 @@ config SPL_PARTITION_UUIDS bool "Enable support of UUID for partition in SPL" depends on SPL_PARTITIONS default y if SPL_EFI_PARTITION
- select SPL_LIB_UUID
config PARTITION_TYPE_GUID bool "Enable support of GUID for partition type" @@ -157,4 +158,11 @@ config PARTITION_TYPE_GUID Activate the configuration of GUID type for EFI partition
+config SPL_PARTITION_TYPE_GUID
Hello Simon,
you have seen my series for using the partition type guid to load main U-Boot. I would like to put that change into v2023.04.
If my series goes in first, we will have to add a patch to this series to adjust dependencies.
Can we use the mmc driver in sandbox_spl for testing loading main U-Boot from mmc based on different criteria like partition number, partion_type_guid, file name?
Best regards
Heinrich
- bool "Enable support of GUID for partition type (SPL)"
- depends on SPL_EFI_PARTITION
- help
Activate the configuration of GUID type
for EFI partition
endmenu diff --git a/lib/Kconfig b/lib/Kconfig index 08318843231..4278b240554 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -74,6 +74,10 @@ config HAVE_PRIVATE_LIBGCC config LIB_UUID bool
+config SPL_LIB_UUID
- depends on SPL
- bool
config SEMIHOSTING bool "Support semihosting" depends on ARM || RISCV

Hi Heinrich,
On Wed, 22 Feb 2023 at 23:19, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Am 22. Februar 2023 17:34:11 MEZ schrieb Simon Glass sjg@chromium.org:
This is selected by PARTITION_UUIDS which has a separate option for SPL. Add an SPL option for LIB_UUID also, so that we can keep them consistent.
Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c which wants to call a uuid function in SPL.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v1)
disk/Kconfig | 8 ++++++++ lib/Kconfig | 4 ++++ 2 files changed, 12 insertions(+)
diff --git a/disk/Kconfig b/disk/Kconfig index c9b9dbaf1a6..817b7c8c76d 100644 --- a/disk/Kconfig +++ b/disk/Kconfig @@ -149,6 +149,7 @@ config SPL_PARTITION_UUIDS bool "Enable support of UUID for partition in SPL" depends on SPL_PARTITIONS default y if SPL_EFI_PARTITION
select SPL_LIB_UUID
config PARTITION_TYPE_GUID bool "Enable support of GUID for partition type" @@ -157,4 +158,11 @@ config PARTITION_TYPE_GUID Activate the configuration of GUID type for EFI partition
+config SPL_PARTITION_TYPE_GUID
Hello Simon,
you have seen my series for using the partition type guid to load main U-Boot. I would like to put that change into v2023.04.
If my series goes in first, we will have to add a patch to this series to adjust dependencies.
OK
Can we use the mmc driver in sandbox_spl for testing loading main U-Boot from mmc based on different criteria like partition number, partion_type_guid, file name?
Yes you can.
But I suggest using sandbox_vpl, since in that build we are using OF_REAL in SPL, i.e. it has an actual device tree. That means you won't have to adjust the sandbox mmc driver to use of-platdata (not that it would be particularly tricky).
You'll need to update 'TEST_PY_TEST_SPEC: "test_vpl_help or test_spl"' in CI though, so it runs.
Regards, Simon

On Wed, Feb 22, 2023 at 09:34:11AM -0700, Simon Glass wrote:
This is selected by PARTITION_UUIDS which has a separate option for SPL. Add an SPL option for LIB_UUID also, so that we can keep them consistent.
Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c which wants to call a uuid function in SPL.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

This is pretty messy at present since it relies on a SPL_SANDBOX option that does not exist. Use the normal options instead, so that it will work with split config.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
test/test-main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/test/test-main.c b/test/test-main.c index ea959f4e859..b3c30d92937 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -46,14 +46,14 @@ enum fdtchk_t { */ static enum fdtchk_t fdt_action(void) { - /* Do a copy for sandbox (but only the U-Boot build, not SPL) */ - if (CONFIG_IS_ENABLED(SANDBOX)) - return FDTCHK_COPY; - /* For sandbox SPL builds, do nothing */ - if (IS_ENABLED(CONFIG_SANDBOX)) + if (IS_ENABLED(CONFIG_SANDBOX) && IS_ENABLED(CONFIG_SPL_BUILD)) return FDTCHK_NONE;
+ /* Do a copy for sandbox (but only the U-Boot build, not SPL) */ + if (IS_ENABLED(CONFIG_SANDBOX)) + return FDTCHK_COPY; + /* For all other boards, do a checksum */ return FDTCHK_CHECKSUM; }

On Wed, Feb 22, 2023 at 09:34:12AM -0700, Simon Glass wrote:
This is pretty messy at present since it relies on a SPL_SANDBOX option that does not exist. Use the normal options instead, so that it will work with split config.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

Drop the invalid SPL_ in a CONFIG_IS_ENABLED() usage. Use the correct X86_64 option in msr.h since SPL may be 32-bit when U-Bout proper is not.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v4)
Changes in v4: - Reduce and rename commit
arch/x86/cpu/qemu/qemu.c | 2 +- arch/x86/include/asm/msr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/cpu/qemu/qemu.c b/arch/x86/cpu/qemu/qemu.c index e54082df7f9..274978c023b 100644 --- a/arch/x86/cpu/qemu/qemu.c +++ b/arch/x86/cpu/qemu/qemu.c @@ -97,7 +97,7 @@ static void qemu_chipset_init(void) } }
-#if !CONFIG_IS_ENABLED(SPL_X86_32BIT_INIT) +#if CONFIG_IS_ENABLED(X86_32BIT_INIT) int arch_cpu_init(void) { post_code(POST_CPU_INIT); diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index 27764fc56cb..eb3ddde8c07 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h @@ -59,7 +59,7 @@ static inline unsigned long long native_read_tscp(unsigned int *aux) * edx:eax, while for x86_64 it doesn't mean rdx:rax or edx:eax. Instead, * it means rax *or* rdx. */ -#ifdef CONFIG_X86_64 +#if CONFIG_IS_ENABLED(X86_64) #define DECLARE_ARGS(val, low, high) unsigned low, high #define EAX_EDX_VAL(val, low, high) ((low) | ((u64)(high) << 32)) #define EAX_EDX_ARGS(val, low, high) "a" (low), "d" (high)

On Wed, Feb 22, 2023 at 09:34:13AM -0700, Simon Glass wrote:
Drop the invalid SPL_ in a CONFIG_IS_ENABLED() usage. Use the correct X86_64 option in msr.h since SPL may be 32-bit when U-Bout proper is not.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v4)
Changes in v4:
- Reduce and rename commit
arch/x86/cpu/qemu/qemu.c | 2 +- arch/x86/include/asm/msr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
This changes spl on chromebook_link64 a lot, have you confirmed it there?

Hi Tom,
On Fri, 3 Mar 2023 at 07:50, Tom Rini trini@konsulko.com wrote:
On Wed, Feb 22, 2023 at 09:34:13AM -0700, Simon Glass wrote:
Drop the invalid SPL_ in a CONFIG_IS_ENABLED() usage. Use the correct X86_64 option in msr.h since SPL may be 32-bit when U-Bout proper is not.
Signed-off-by: Simon Glass sjg@chromium.org
(no changes since v4)
Changes in v4:
- Reduce and rename commit
arch/x86/cpu/qemu/qemu.c | 2 +- arch/x86/include/asm/msr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
This changes spl on chromebook_link64 a lot, have you confirmed it there?
No, the lab is broken...will do at some point.
Regards, Simon

We can use this feature in VPL, so add some options for it. Also fix a typo in the SPL help while we are here.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
common/Kconfig | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/common/Kconfig b/common/Kconfig index 33c3b1dbf0f..a6b10a251a0 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1063,7 +1063,7 @@ choice prompt "Bloblist location in TPL" help Select the location of the bloblist, via various means. Typically - you should use the same value for SPL as for U-Boot, since they need + you should use the same value for TPL as for U-Boot, since they need to look in the same place. But if BLOBLIST_ALLOC is used, then a fresh bloblist will be created each time, since there is no shared address (between phases) for the bloblist. @@ -1086,6 +1086,35 @@ endchoice
endif # TPL_BLOBLIST
+if VPL_BLOBLIST + +choice + prompt "Bloblist location in VPL" + help + Select the location of the bloblist, via various means. Typically + you should use the same value for VPL as for U-Boot, since they need + to look in the same place. But if BLOBLIST_ALLOC is used, then a + fresh bloblist will be created each time, since there is no shared + address (between phases) for the bloblist. + +config VPL_BLOBLIST_FIXED + bool "Place bloblist at a fixed address in memory" + help + Select this to used a fixed memory address for the bloblist. If the + bloblist exists at this address from a previous phase, it used as is. + If not it is created at this address in VPL. + +config VPL_BLOBLIST_ALLOC + bool "Allocate bloblist" + help + Allocate the bloblist using malloc(). This avoids the need to + specify a fixed address on systems where this is unknown or can + change at runtime. + +endchoice + +endif # VPL_BLOBLIST + endmenu
source "common/spl/Kconfig"

On Wed, Feb 22, 2023 at 09:34:14AM -0700, Simon Glass wrote:
We can use this feature in VPL, so add some options for it. Also fix a typo in the SPL help while we are here.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

With split config, this causes a build error in SPL where the environment may not be enabled. It affects two rk3399 boards. Add a condition.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
board/theobroma-systems/puma_rk3399/puma-rk3399.c | 2 +- board/theobroma-systems/ringneck_px30/ringneck-px30.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c index 97f398bd754..34839dcb9f1 100644 --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c @@ -136,7 +136,7 @@ int mmc_get_env_dev(void) return CONFIG_SYS_MMC_ENV_DEV; }
-#if !IS_ENABLED(CONFIG_ENV_IS_NOWHERE) +#if IS_ENABLED(CONFIG_ENV_SUPPORT) && !IS_ENABLED(CONFIG_ENV_IS_NOWHERE) #error Please enable CONFIG_ENV_IS_NOWHERE #endif
diff --git a/board/theobroma-systems/ringneck_px30/ringneck-px30.c b/board/theobroma-systems/ringneck_px30/ringneck-px30.c index 47d1a40ef7c..9eb2fcfc48f 100644 --- a/board/theobroma-systems/ringneck_px30/ringneck-px30.c +++ b/board/theobroma-systems/ringneck_px30/ringneck-px30.c @@ -118,7 +118,7 @@ int mmc_get_env_dev(void) return CONFIG_SYS_MMC_ENV_DEV; }
-#if !IS_ENABLED(CONFIG_ENV_IS_NOWHERE) +#if IS_ENABLED(CONFIG_ENV_SUPPORT) && !IS_ENABLED(CONFIG_ENV_IS_NOWHERE) #error Please enable CONFIG_ENV_IS_NOWHERE #endif

Hi Simon,
On 2/22/23 17:34, Simon Glass wrote:
With split config, this causes a build error in SPL where the environment may not be enabled. It affects two rk3399 boards. Add a condition.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Quentin Schulz foss+uboot@0leil.net
Cheers, Quentin

This is used by ls1021atwr_sdcard_ifc_SECURE_BOOT with split config, but is not needed anymore, since Ethernet migration is complete. Drop it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
arch/arm/cpu/armv7/ls102xa/fdt.c | 12 ------------ 1 file changed, 12 deletions(-)
diff --git a/arch/arm/cpu/armv7/ls102xa/fdt.c b/arch/arm/cpu/armv7/ls102xa/fdt.c index 599b7e18ef3..a5c5c780ae8 100644 --- a/arch/arm/cpu/armv7/ls102xa/fdt.c +++ b/arch/arm/cpu/armv7/ls102xa/fdt.c @@ -25,11 +25,7 @@ DECLARE_GLOBAL_DATA_PTR;
void ft_fixup_enet_phy_connect_type(void *fdt) { -#ifdef CONFIG_DM_ETH struct udevice *dev; -#else - struct eth_device *dev; -#endif struct tsec_private *priv; const char *enet_path, *phy_path; char enet[16]; @@ -37,12 +33,8 @@ void ft_fixup_enet_phy_connect_type(void *fdt) int phy_node; int i = 0; uint32_t ph; -#ifdef CONFIG_DM_ETH char *name[3] = { "ethernet@2d10000", "ethernet@2d50000", "ethernet@2d90000" }; -#else - char *name[3] = { "eTSEC1", "eTSEC2", "eTSEC3" }; -#endif
for (; i < ARRAY_SIZE(name); i++) { dev = eth_get_dev_by_name(name[i]); @@ -53,11 +45,7 @@ void ft_fixup_enet_phy_connect_type(void *fdt) continue; }
-#ifdef CONFIG_DM_ETH priv = dev_get_priv(dev); -#else - priv = dev->priv; -#endif if (priv->flags & TSEC_SGMII) continue;

On Wed, Feb 22, 2023 at 09:34:16AM -0700, Simon Glass wrote:
This is used by ls1021atwr_sdcard_ifc_SECURE_BOOT with split config, but is not needed anymore, since Ethernet migration is complete. Drop it.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

This causes a build failure on mx6cuboxi with split config, since CMD_SATA shows up as enabled in SPl (because there is no SPL_CMD_SATA).
The condition is wrong anyway, so change it to use SATA instead.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
board/solidrun/mx6cuboxi/mx6cuboxi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c index 7c44379ec4a..cb14c2f30c9 100644 --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c @@ -275,7 +275,7 @@ int board_early_init_f(void) { setup_iomux_uart();
-#ifdef CONFIG_CMD_SATA +#ifdef CONFIG_SATA setup_sata(); #endif setup_fec();

Hi Simon,
On Wed, Feb 22 2023, Simon Glass wrote:
This causes a build failure on mx6cuboxi with split config, since CMD_SATA shows up as enabled in SPl (because there is no SPL_CMD_SATA).
The condition is wrong anyway, so change it to use SATA instead.
Signed-off-by: Simon Glass sjg@chromium.org
This conflicts with
https://patchwork.ozlabs.org/project/uboot/patch/20230222013821.1144691-19-t...
baruch
(no changes since v1)
board/solidrun/mx6cuboxi/mx6cuboxi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c index 7c44379ec4a..cb14c2f30c9 100644 --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c @@ -275,7 +275,7 @@ int board_early_init_f(void) { setup_iomux_uart();
-#ifdef CONFIG_CMD_SATA +#ifdef CONFIG_SATA setup_sata(); #endif setup_fec();

Hi,
On Wed, 22 Feb 2023 at 09:45, Baruch Siach baruch@tkos.co.il wrote:
Hi Simon,
On Wed, Feb 22 2023, Simon Glass wrote:
This causes a build failure on mx6cuboxi with split config, since CMD_SATA shows up as enabled in SPl (because there is no SPL_CMD_SATA).
The condition is wrong anyway, so change it to use SATA instead.
Signed-off-by: Simon Glass sjg@chromium.org
This conflicts with
https://patchwork.ozlabs.org/project/uboot/patch/20230222013821.1144691-19-t...
Thanks...they are similar, just that my one is getting rid of the CONFIG_IS_ENABLED() too.
I think it might be best to bring in Troy's series to -next ASAP and then I can adjust the one I just sent accordingly. I have not looked in detail, but it seems like a good step along the way.
Regards, Simon
baruch
(no changes since v1)
board/solidrun/mx6cuboxi/mx6cuboxi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c index 7c44379ec4a..cb14c2f30c9 100644 --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c @@ -275,7 +275,7 @@ int board_early_init_f(void) { setup_iomux_uart();
-#ifdef CONFIG_CMD_SATA +#ifdef CONFIG_SATA setup_sata(); #endif setup_fec();
-- ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

On Wed, Feb 22, 2023 at 09:34:17AM -0700, Simon Glass wrote:
This causes a build failure on mx6cuboxi with split config, since CMD_SATA shows up as enabled in SPl (because there is no SPL_CMD_SATA).
The condition is wrong anyway, so change it to use SATA instead.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

Add a new SPL_PHY_ATHEROS to avoid a build error on am335x_evm with split config.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Ramon Fried rfried.dev@gmail.com ---
(no changes since v1)
drivers/net/phy/Kconfig | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 5eaff053a09..6806e3c0903 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -106,6 +106,9 @@ config PHY_AQUANTIA_FW_NAME config PHY_ATHEROS bool "Atheros Ethernet PHYs support"
+config SPL_PHY_ATHEROS + bool "Atheros Ethernet PHYs support (SPL)" + config PHY_BROADCOM bool "Broadcom Ethernet PHYs support"

On Wed, Feb 22, 2023 at 09:34:18AM -0700, Simon Glass wrote:
Add a new SPL_PHY_ATHEROS to avoid a build error on am335x_evm with split config.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Ramon Fried rfried.dev@gmail.com
Applied to u-boot/next, thanks!

This is not a CONFIG option so we should not be using IS_ENABLED() on it, particularly not when it is not defined to anything, so shows up as calling IS_ENABLED() with no arguments.
Just check it normally.
For fsl_esdhc.c set it to 0 at the top of the file if it is not defined. This sort-of matches the behaviour in fsl_esdhc_mmc.c which seem to have a similar problem.
This fixes a build error with split config on T2080QDS.
Note: This should be handled in the devicetree.
Signed-off-by: Simon Glass sjg@chromium.org --- No size changes on affected boards:
aarch64: w+ ls1088aqds ls1088aqds_qspi ls1088aqds_qspi_SECURE_BOOT ls1088aqds_sdcard_ifc ls1088aqds_sdcard_qspi ls1088aqds_tfa ls1088ardb_qspi ls1088ardb_qspi_SECURE_BOOT ls1088ardb_sdcard_qspi ls1088ardb_sdcard_qspi_SECURE_BOOT ls1088ardb_tfa ls1088ardb_tfa_SECURE_BOOT ls2080aqds ls2080aqds_nand ls2080aqds_qspi ls2080aqds_sdcard ls2080aqds_SECURE_BOOT ls2088aqds_tfa arm: w+ am57xx_hs_evm_usb powerpc: w+ P2041RDB P2041RDB_NAND P2041RDB_SDCARD P2041RDB_SPIFLASH T1024RDB T1024RDB_NAND T1024RDB_SDCARD T1024RDB_SPIFLASH T1042D4RDB T1042D4RDB_NAND T1042D4RDB_SDCARD T1042D4RDB_SPIFLASH T2080QDS T2080QDS_NAND T2080QDS_SDCARD T2080QDS_SECURE_BOOT T2080QDS_SPIFLASH T2080QDS_SRIO_PCIE_BOOT T2080RDB T2080RDB_NAND T2080RDB_revD T2080RDB_revD_NAND T2080RDB_revD_SDCARD T2080RDB_revD_SPIFLASH T2080RDB_SDCARD T2080RDB_SPIFLASH kmcent2
Changes in v5: - Change approach and expand notes after more investigation
arch/powerpc/include/asm/config_mpc85xx.h | 6 +++--- drivers/mmc/fsl_esdhc.c | 6 +++++- drivers/mmc/fsl_esdhc_imx.c | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/include/asm/config_mpc85xx.h b/arch/powerpc/include/asm/config_mpc85xx.h index d990ecff96f..358ccef7f1d 100644 --- a/arch/powerpc/include/asm/config_mpc85xx.h +++ b/arch/powerpc/include/asm/config_mpc85xx.h @@ -134,7 +134,7 @@ #define CFG_FM_PLAT_CLK_DIV 1 #define CFG_SYS_FM1_CLK CFG_FM_PLAT_CLK_DIV #define CFG_SYS_FM_MURAM_SIZE 0x30000 -#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0 #define QE_MURAM_SIZE 0x6000UL #define MAX_QE_RISC 1 #define QE_NUM_OF_SNUM 28 @@ -147,7 +147,7 @@ #define CFG_SYS_FM1_CLK 0 #define CFG_QBMAN_CLK_DIV 1 #define CFG_SYS_FM_MURAM_SIZE 0x30000 -#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0 #define QE_MURAM_SIZE 0x6000UL #define MAX_QE_RISC 1 #define QE_NUM_OF_SNUM 28 @@ -166,7 +166,7 @@ #define CFG_SYS_PME_CLK CFG_PME_PLAT_CLK_DIV #define CFG_SYS_FM1_CLK 0 #define CFG_SYS_FM_MURAM_SIZE 0x28000 -#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0
#elif defined(CONFIG_ARCH_C29X) diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index d5066666698..ecb9c3b30c9 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -34,6 +34,10 @@
DECLARE_GLOBAL_DATA_PTR;
+#ifndef ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0 +#endif + struct fsl_esdhc { uint dsaddr; /* SDMA system address register */ uint blkattr; /* Block attributes register */ @@ -325,7 +329,7 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc, (timeout == 4 || timeout == 8 || timeout == 12)) timeout++;
- if (IS_ENABLED(ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE)) + if (ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE) timeout = 0xE;
esdhc_clrsetbits32(®s->sysctl, SYSCTL_TIMEOUT_MASK, timeout << 16); diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index 66caf683f74..9d9ffd0990a 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -43,6 +43,8 @@ #ifndef ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE #ifdef CONFIG_FSL_USDHC #define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 1 +#else +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0 #endif #endif
@@ -375,7 +377,7 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc, (timeout == 4 || timeout == 8 || timeout == 12)) timeout++;
- if (IS_ENABLED(ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE)) + if (ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE) timeout = 0xE;
esdhc_clrsetbits32(®s->sysctl, SYSCTL_TIMEOUT_MASK, timeout << 16);

On Wed, Feb 22, 2023 at 09:34:19AM -0700, Simon Glass wrote:
This is not a CONFIG option so we should not be using IS_ENABLED() on it, particularly not when it is not defined to anything, so shows up as calling IS_ENABLED() with no arguments.
Just check it normally.
For fsl_esdhc.c set it to 0 at the top of the file if it is not defined. This sort-of matches the behaviour in fsl_esdhc_mmc.c which seem to have a similar problem.
This fixes a build error with split config on T2080QDS.
Note: This should be handled in the devicetree.
Signed-off-by: Simon Glass sjg@chromium.org
No size changes on affected boards:
aarch64: w+ ls1088aqds ls1088aqds_qspi ls1088aqds_qspi_SECURE_BOOT ls1088aqds_sdcard_ifc ls1088aqds_sdcard_qspi ls1088aqds_tfa ls1088ardb_qspi ls1088ardb_qspi_SECURE_BOOT ls1088ardb_sdcard_qspi ls1088ardb_sdcard_qspi_SECURE_BOOT ls1088ardb_tfa ls1088ardb_tfa_SECURE_BOOT ls2080aqds ls2080aqds_nand ls2080aqds_qspi ls2080aqds_sdcard ls2080aqds_SECURE_BOOT ls2088aqds_tfa arm: w+ am57xx_hs_evm_usb powerpc: w+ P2041RDB P2041RDB_NAND P2041RDB_SDCARD P2041RDB_SPIFLASH T1024RDB T1024RDB_NAND T1024RDB_SDCARD T1024RDB_SPIFLASH T1042D4RDB T1042D4RDB_NAND T1042D4RDB_SDCARD T1042D4RDB_SPIFLASH T2080QDS T2080QDS_NAND T2080QDS_SDCARD T2080QDS_SECURE_BOOT T2080QDS_SPIFLASH T2080QDS_SRIO_PCIE_BOOT T2080RDB T2080RDB_NAND T2080RDB_revD T2080RDB_revD_NAND T2080RDB_revD_SDCARD T2080RDB_revD_SPIFLASH T2080RDB_SDCARD T2080RDB_SPIFLASH kmcent2
Changes in v5:
- Change approach and expand notes after more investigation
arch/powerpc/include/asm/config_mpc85xx.h | 6 +++--- drivers/mmc/fsl_esdhc.c | 6 +++++- drivers/mmc/fsl_esdhc_imx.c | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/include/asm/config_mpc85xx.h b/arch/powerpc/include/asm/config_mpc85xx.h index d990ecff96f..358ccef7f1d 100644 --- a/arch/powerpc/include/asm/config_mpc85xx.h +++ b/arch/powerpc/include/asm/config_mpc85xx.h @@ -134,7 +134,7 @@ #define CFG_FM_PLAT_CLK_DIV 1 #define CFG_SYS_FM1_CLK CFG_FM_PLAT_CLK_DIV #define CFG_SYS_FM_MURAM_SIZE 0x30000 -#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0 #define QE_MURAM_SIZE 0x6000UL #define MAX_QE_RISC 1 #define QE_NUM_OF_SNUM 28 @@ -147,7 +147,7 @@ #define CFG_SYS_FM1_CLK 0 #define CFG_QBMAN_CLK_DIV 1 #define CFG_SYS_FM_MURAM_SIZE 0x30000 -#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0 #define QE_MURAM_SIZE 0x6000UL #define MAX_QE_RISC 1 #define QE_NUM_OF_SNUM 28 @@ -166,7 +166,7 @@ #define CFG_SYS_PME_CLK CFG_PME_PLAT_CLK_DIV #define CFG_SYS_FM1_CLK 0 #define CFG_SYS_FM_MURAM_SIZE 0x28000 -#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0
#elif defined(CONFIG_ARCH_C29X) diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index d5066666698..ecb9c3b30c9 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -34,6 +34,10 @@
DECLARE_GLOBAL_DATA_PTR;
+#ifndef ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0 +#endif
struct fsl_esdhc { uint dsaddr; /* SDMA system address register */ uint blkattr; /* Block attributes register */ @@ -325,7 +329,7 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc, (timeout == 4 || timeout == 8 || timeout == 12)) timeout++;
- if (IS_ENABLED(ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE))
if (ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE) timeout = 0xE;
esdhc_clrsetbits32(®s->sysctl, SYSCTL_TIMEOUT_MASK, timeout << 16);
diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index 66caf683f74..9d9ffd0990a 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -43,6 +43,8 @@ #ifndef ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE #ifdef CONFIG_FSL_USDHC #define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 1 +#else +#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE 0 #endif #endif
@@ -375,7 +377,7 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc, (timeout == 4 || timeout == 8 || timeout == 12)) timeout++;
- if (IS_ENABLED(ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE))
if (ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE) timeout = 0xE;
esdhc_clrsetbits32(®s->sysctl, SYSCTL_TIMEOUT_MASK, timeout << 16);
Looking at commit 52faec31827e ("mmc: fsl_esdhc: replace most #ifdefs by IS_ENABLED()") this is going backwards. The original logic was to define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE to set timeout to 0xE as "ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE" is a boolean, not a value-holder.

Add options for this since they are needed by P1020RDB-PC_NAND.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/serial/Kconfig | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index bb5083201b3..6f40c051604 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -731,6 +731,12 @@ config SPL_SYS_NS16550_SERIAL default y if SYS_NS16550_SERIAL || ARCH_SUNXI || ARCH_OMAP2PLUS select SYS_NS16550
+config TPL_SYS_NS16550_SERIAL + bool "NS16550 UART or compatible legacy driver in TPL" + depends on TPL && !TPL_DM_SERIAL + default y if SYS_NS16550_SERIAL || ARCH_SUNXI || ARCH_OMAP2PLUS + select SYS_NS16550 + config SYS_NS16550 bool "NS16550 UART or compatible" help

On Wed, Feb 22, 2023 at 09:34:20AM -0700, Simon Glass wrote:
Add options for this since they are needed by P1020RDB-PC_NAND.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

This is used in some x86 code, so add a symbol for it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/core/Kconfig | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index 6fc8854b574..0f755aa702e 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -301,6 +301,13 @@ config SPL_SIMPLE_BUS Supports the 'simple-bus' driver, which is used on some systems in SPL.
+config TPL_SIMPLE_BUS + bool "Support simple-bus driver in TPL" + depends on TPL_DM && TPL_OF_CONTROL + help + Supports the 'simple-bus' driver, which is used on some systems + in TPL. + config SIMPLE_BUS_CORRECT_RANGE bool "Decode the 'simple-bus' <range> by honoring the #address-cells and #size-cells" depends on SIMPLE_BUS

On Wed, Feb 22, 2023 at 09:34:21AM -0700, Simon Glass wrote:
This is used in some x86 code, so add a symbol for it.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

Some options should be enabled which are missing. Fix this.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v4)
Changes in v4: - Reduce and rename commit
configs/chromebook_coral_defconfig | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/configs/chromebook_coral_defconfig b/configs/chromebook_coral_defconfig index 401506e2193..f5995f22004 100644 --- a/configs/chromebook_coral_defconfig +++ b/configs/chromebook_coral_defconfig @@ -87,6 +87,7 @@ CONFIG_TFTP_TSIZE=y CONFIG_USE_ROOTPATH=y CONFIG_REGMAP=y CONFIG_SYSCON=y +CONFIG_TPL_SIMPLE_BUS=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_LBA48=y CONFIG_SYS_64BIT_LBA=y @@ -96,6 +97,8 @@ CONFIG_SYS_I2C_DW=y CONFIG_MISC=y CONFIG_CROS_EC=y CONFIG_CROS_EC_LPC=y +CONFIG_SPL_P2SB=y +CONFIG_TPL_P2SB=y CONFIG_SPI_FLASH_WINBOND=y # CONFIG_X86_PCH7 is not set # CONFIG_X86_PCH9 is not set

On Wed, Feb 22, 2023 at 09:34:22AM -0700, Simon Glass wrote:
Some options should be enabled which are missing. Fix this.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

We should enable pmic in SPL since it is used.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v4)
Changes in v4: - Fix 'wanderboard' typo - Reduce and rename commit
configs/wandboard_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/wandboard_defconfig b/configs/wandboard_defconfig index a6baff1e24c..05383f6e47b 100644 --- a/configs/wandboard_defconfig +++ b/configs/wandboard_defconfig @@ -71,6 +71,7 @@ CONFIG_MII=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y CONFIG_DM_PMIC=y +CONFIG_SPL_DM_PMIC=y CONFIG_DM_PMIC_PFUZE100=y CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y

On Wed, Feb 22, 2023 at 09:34:23AM -0700, Simon Glass wrote:
We should enable pmic in SPL since it is used.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

The conditions in this code do not align when doing an SPL build with split config. Use __maybe_unused to avoid needing to be so explicit.
Of course a better solution would be to refactor all of this to avoid using #ifdef.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
board/gateworks/venice/venice.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/board/gateworks/venice/venice.c b/board/gateworks/venice/venice.c index c4d86c26a9b..e6fa7eb3d73 100644 --- a/board/gateworks/venice/venice.c +++ b/board/gateworks/venice/venice.c @@ -41,8 +41,7 @@ int board_fit_config_name_match(const char *name) return -1; }
-#if (IS_ENABLED(CONFIG_NET)) -static int setup_fec(void) +static int __maybe_unused setup_fec(void) { struct iomuxc_gpr_base_regs *gpr = (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR; @@ -58,7 +57,7 @@ static int setup_fec(void) return 0; }
-static int setup_eqos(void) +static int __maybe_unused setup_eqos(void) { struct iomuxc_gpr_base_regs *gpr = (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR; @@ -71,6 +70,7 @@ static int setup_eqos(void) return set_clk_eqos(ENET_125MHZ); }
+#if (IS_ENABLED(CONFIG_NET)) int board_phy_config(struct phy_device *phydev) { unsigned short val;

On Wed, Feb 22, 2023 at 09:34:24AM -0700, Simon Glass wrote:
The conditions in this code do not align when doing an SPL build with split config. Use __maybe_unused to avoid needing to be so explicit.
Of course a better solution would be to refactor all of this to avoid using #ifdef.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

At present we compile commands into U-Boot SPL even though they cannot be used. This wastes space. Adjust the condition to avoid this.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v5: - Drop FSL_ISBC_KEY_EXT patch as it changes the size - Drop PHY_CADENCE_SIERRA patch as it changes the size
Changes in v3: - Add a new patch to disallow commands in SPL
include/command.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/command.h b/include/command.h index 0db48980624..1b018cb98e7 100644 --- a/include/command.h +++ b/include/command.h @@ -376,7 +376,7 @@ int cmd_source_script(ulong addr, const char *fit_uname, const char *confname); U_BOOT_SUBCMDS_DO_CMD(_cmdname) \ U_BOOT_SUBCMDS_COMPLETE(_cmdname)
-#ifdef CONFIG_CMDLINE +#if CONFIG_IS_ENABLED(CMDLINE) #define U_BOOT_CMDREP_MKENT_COMPLETE(_name, _maxargs, _cmd_rep, \ _usage, _help, _comp) \ { #_name, _maxargs, _cmd_rep, cmd_discard_repeatable, \

On Wed, Feb 22, 2023 at 09:34:25AM -0700, Simon Glass wrote:
At present we compile commands into U-Boot SPL even though they cannot be used. This wastes space. Adjust the condition to avoid this.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v5:
- Drop FSL_ISBC_KEY_EXT patch as it changes the size
- Drop PHY_CADENCE_SIERRA patch as it changes the size
Changes in v3:
- Add a new patch to disallow commands in SPL
include/command.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
As a follow-up, "git grep -l u_boot_list_2_cmd" shows some lds scripts that I believe can be updated, after this change.
And in reviewing this change, yes, a few boards now discard some functionality, but, it looks like it's reasonable and not that we're removing some intentional but odd configurations.

On Wed, Feb 22, 2023 at 09:34:25AM -0700, Simon Glass wrote:
At present we compile commands into U-Boot SPL even though they cannot be used. This wastes space. Adjust the condition to avoid this.
Signed-off-by: Simon Glass sjg@chromium.org
Applied to u-boot/next, thanks!

On Wed, Feb 22, 2023 at 09:33:41AM -0700, Simon Glass wrote:
This series was split out of the old 'split config' splc series. It contains clean-up patches which do not depend on split config.
This is available at u-boot-dm/spld-working
The size changes look pretty good: https://paste.debian.net/1271742/
The remaining patches will move into a new 'splg' series (G for Good).
[1] https://patchwork.ozlabs.org/project/uboot/list/?series=341504&state=*
Changes in v5:
- Fix reply typo
- Change approach and expand notes after more investigation
- Drop FSL_ISBC_KEY_EXT patch as it changes the size
- Drop PHY_CADENCE_SIERRA patch as it changes the size
Changes in v4:
- Avoid use of def_bool
- Modify to get rid of def_bool
- Adjust Kconfig ordering
- Just fix the typo
- Reduce and rename commit
- Reduce and rename commit
- Fix 'wanderboard' typo
- Reduce and rename commit
Changes in v3:
- Add new patch to disable QFW bootmeth in SPL
- Move the option down to the non-SPL part of drivers/Makefile
- Correct 'VPL' typo
- Use a consistent format for the comment
- Fix a transitory build error with sandbox_spl
- Add a new patch to disallow commands in SPL
Changes in v2:
- Rebase to previous series
Simon Glass (44): mtd: Drop unused kb9202_nand driver mtd: Drop unused CONFIG_ONENAND_U_BOOT sh4: Drop unused twl6030 driver moveconfig: Update to detect / correct missing SPL Kconfigs bootstd: Disable QFW bootmeth in SPL Correct SPL uses of ARCH_MVEBU Correct SPL uses of DISPLAY_AER_FULL Correct SPL uses of MULTIPLEXER Correct SPL use of PG_WCOM_UBOOT_UPDATE_SUPPORTED Correct SPL uses of PHY_FIXED boot: Add Kconfigs for BOOTMETH_VBE_REQUEST Correct SPL use of DM_RNG lib: Add a Kconfig for SPL_BZIP2 moveconfig: Various minor improvements sandbox: Expand size for VPL image event: Add Kconfig options for SPL bootstd: Correct 'VPL' typo env: Avoid checking ENV_IS_IN when env disabled env: Allow VPL environment to be nowhere lib: Add VPL options for SHA1 and SHA256 x86: Use string functions for all 32-bit builds lib: Fix build condition for tiny-printf sandbox: Tidy up RTC options sandbox: Use the generic VPL option to enable VPL sandbox: Tidy up I2C options fixdep: Add support for VPL fixdep: Refactor to make testing easier fixdep: Add some tests for parse_config_line() test: Add SPL versions of the TEST_KCONFIG options lib: Add an SPL config for LIB_UUID test: Tidy up sandbox handling in test-main x86: Fix up use of X86_32BIT_INIT and X86_64 options Add VPL options for BLOBLIST rockchip: Avoid checking environment without ENV_SUPPORT freescale: Drop old pre-DM_ETH code imx: Use SATA instead of CMD_SATA net: Add an SPL config for atheros freescale: Fix odd use of ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE serial: Support ns16550 driver in TPL dm: Add a TPL symbol for simple-bus x86: coral: Add missing TPL options power: wandboard: Add a missing CONFIG venice: Simplify conditions for network init command: Don't allow commands in SPL
I've applied almost all of this series. I've left the moveconfig.py stuff for now as I'm not sure it's useful until split config. I've followed up about the X86_32BIT_INIT patch as I do want to see that boot-tested, and I've left the ns16650 TPL patch as both that feel like "split config makes this an issue" rather than an issue we have today and fwiw, the dependencies are wrong in that there's no TPL for omap2 which I didn't reply directly to, I only noticed as reviewing the series locally before merging.

Hi Tom,
On Fri, 3 Mar 2023 at 16:43, Tom Rini trini@konsulko.com wrote:
On Wed, Feb 22, 2023 at 09:33:41AM -0700, Simon Glass wrote:
This series was split out of the old 'split config' splc series. It contains clean-up patches which do not depend on split config.
This is available at u-boot-dm/spld-working
The size changes look pretty good: https://paste.debian.net/1271742/
The remaining patches will move into a new 'splg' series (G for Good).
[1] https://patchwork.ozlabs.org/project/uboot/list/?series=341504&state=*
Changes in v5:
- Fix reply typo
- Change approach and expand notes after more investigation
- Drop FSL_ISBC_KEY_EXT patch as it changes the size
- Drop PHY_CADENCE_SIERRA patch as it changes the size
Changes in v4:
- Avoid use of def_bool
- Modify to get rid of def_bool
- Adjust Kconfig ordering
- Just fix the typo
- Reduce and rename commit
- Reduce and rename commit
- Fix 'wanderboard' typo
- Reduce and rename commit
Changes in v3:
- Add new patch to disable QFW bootmeth in SPL
- Move the option down to the non-SPL part of drivers/Makefile
- Correct 'VPL' typo
- Use a consistent format for the comment
- Fix a transitory build error with sandbox_spl
- Add a new patch to disallow commands in SPL
Changes in v2:
- Rebase to previous series
Simon Glass (44): mtd: Drop unused kb9202_nand driver mtd: Drop unused CONFIG_ONENAND_U_BOOT sh4: Drop unused twl6030 driver moveconfig: Update to detect / correct missing SPL Kconfigs bootstd: Disable QFW bootmeth in SPL Correct SPL uses of ARCH_MVEBU Correct SPL uses of DISPLAY_AER_FULL Correct SPL uses of MULTIPLEXER Correct SPL use of PG_WCOM_UBOOT_UPDATE_SUPPORTED Correct SPL uses of PHY_FIXED boot: Add Kconfigs for BOOTMETH_VBE_REQUEST Correct SPL use of DM_RNG lib: Add a Kconfig for SPL_BZIP2 moveconfig: Various minor improvements sandbox: Expand size for VPL image event: Add Kconfig options for SPL bootstd: Correct 'VPL' typo env: Avoid checking ENV_IS_IN when env disabled env: Allow VPL environment to be nowhere lib: Add VPL options for SHA1 and SHA256 x86: Use string functions for all 32-bit builds lib: Fix build condition for tiny-printf sandbox: Tidy up RTC options sandbox: Use the generic VPL option to enable VPL sandbox: Tidy up I2C options fixdep: Add support for VPL fixdep: Refactor to make testing easier fixdep: Add some tests for parse_config_line() test: Add SPL versions of the TEST_KCONFIG options lib: Add an SPL config for LIB_UUID test: Tidy up sandbox handling in test-main x86: Fix up use of X86_32BIT_INIT and X86_64 options Add VPL options for BLOBLIST rockchip: Avoid checking environment without ENV_SUPPORT freescale: Drop old pre-DM_ETH code imx: Use SATA instead of CMD_SATA net: Add an SPL config for atheros freescale: Fix odd use of ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE serial: Support ns16550 driver in TPL dm: Add a TPL symbol for simple-bus x86: coral: Add missing TPL options power: wandboard: Add a missing CONFIG venice: Simplify conditions for network init command: Don't allow commands in SPL
I've applied almost all of this series. I've left the moveconfig.py stuff for now as I'm not sure it's useful until split config. I've followed up about the X86_32BIT_INIT patch as I do want to see that boot-tested, and I've left the ns16650 TPL patch as both that feel like "split config makes this an issue" rather than an issue we have today and fwiw, the dependencies are wrong in that there's no TPL for omap2 which I didn't reply directly to, I only noticed as reviewing the series locally before merging.
OK, thanks for that. Do you think it is worth picking up the fixdep ones also? The VPL thing is a bug and the others are for tests.
I will see if I can get some time by next week to do another spin. How can we get more eyes on the Kconfig-language proposal?
Regards, Simon

On Mon, Mar 06, 2023 at 11:20:42AM -0700, Simon Glass wrote:
Hi Tom,
On Fri, 3 Mar 2023 at 16:43, Tom Rini trini@konsulko.com wrote:
On Wed, Feb 22, 2023 at 09:33:41AM -0700, Simon Glass wrote:
This series was split out of the old 'split config' splc series. It contains clean-up patches which do not depend on split config.
This is available at u-boot-dm/spld-working
The size changes look pretty good: https://paste.debian.net/1271742/
The remaining patches will move into a new 'splg' series (G for Good).
[1] https://patchwork.ozlabs.org/project/uboot/list/?series=341504&state=*
Changes in v5:
- Fix reply typo
- Change approach and expand notes after more investigation
- Drop FSL_ISBC_KEY_EXT patch as it changes the size
- Drop PHY_CADENCE_SIERRA patch as it changes the size
Changes in v4:
- Avoid use of def_bool
- Modify to get rid of def_bool
- Adjust Kconfig ordering
- Just fix the typo
- Reduce and rename commit
- Reduce and rename commit
- Fix 'wanderboard' typo
- Reduce and rename commit
Changes in v3:
- Add new patch to disable QFW bootmeth in SPL
- Move the option down to the non-SPL part of drivers/Makefile
- Correct 'VPL' typo
- Use a consistent format for the comment
- Fix a transitory build error with sandbox_spl
- Add a new patch to disallow commands in SPL
Changes in v2:
- Rebase to previous series
Simon Glass (44): mtd: Drop unused kb9202_nand driver mtd: Drop unused CONFIG_ONENAND_U_BOOT sh4: Drop unused twl6030 driver moveconfig: Update to detect / correct missing SPL Kconfigs bootstd: Disable QFW bootmeth in SPL Correct SPL uses of ARCH_MVEBU Correct SPL uses of DISPLAY_AER_FULL Correct SPL uses of MULTIPLEXER Correct SPL use of PG_WCOM_UBOOT_UPDATE_SUPPORTED Correct SPL uses of PHY_FIXED boot: Add Kconfigs for BOOTMETH_VBE_REQUEST Correct SPL use of DM_RNG lib: Add a Kconfig for SPL_BZIP2 moveconfig: Various minor improvements sandbox: Expand size for VPL image event: Add Kconfig options for SPL bootstd: Correct 'VPL' typo env: Avoid checking ENV_IS_IN when env disabled env: Allow VPL environment to be nowhere lib: Add VPL options for SHA1 and SHA256 x86: Use string functions for all 32-bit builds lib: Fix build condition for tiny-printf sandbox: Tidy up RTC options sandbox: Use the generic VPL option to enable VPL sandbox: Tidy up I2C options fixdep: Add support for VPL fixdep: Refactor to make testing easier fixdep: Add some tests for parse_config_line() test: Add SPL versions of the TEST_KCONFIG options lib: Add an SPL config for LIB_UUID test: Tidy up sandbox handling in test-main x86: Fix up use of X86_32BIT_INIT and X86_64 options Add VPL options for BLOBLIST rockchip: Avoid checking environment without ENV_SUPPORT freescale: Drop old pre-DM_ETH code imx: Use SATA instead of CMD_SATA net: Add an SPL config for atheros freescale: Fix odd use of ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE serial: Support ns16550 driver in TPL dm: Add a TPL symbol for simple-bus x86: coral: Add missing TPL options power: wandboard: Add a missing CONFIG venice: Simplify conditions for network init command: Don't allow commands in SPL
I've applied almost all of this series. I've left the moveconfig.py stuff for now as I'm not sure it's useful until split config. I've followed up about the X86_32BIT_INIT patch as I do want to see that boot-tested, and I've left the ns16650 TPL patch as both that feel like "split config makes this an issue" rather than an issue we have today and fwiw, the dependencies are wrong in that there's no TPL for omap2 which I didn't reply directly to, I only noticed as reviewing the series locally before merging.
OK, thanks for that. Do you think it is worth picking up the fixdep ones also? The VPL thing is a bug and the others are for tests.
I will see if I can get some time by next week to do another spin. How can we get more eyes on the Kconfig-language proposal?
Sorry, I should have chimed in sooner. I was thinking perhaps the next step would be to re-sync our Kconfig support with 6.2 or whatever, and see what the reaction is to the refactoring patches.

(trimming cc list)
Hi Tom,
On Sat, 11 Mar 2023 at 07:29, Tom Rini trini@konsulko.com wrote:
On Mon, Mar 06, 2023 at 11:20:42AM -0700, Simon Glass wrote:
Hi Tom,
On Fri, 3 Mar 2023 at 16:43, Tom Rini trini@konsulko.com wrote:
On Wed, Feb 22, 2023 at 09:33:41AM -0700, Simon Glass wrote:
This series was split out of the old 'split config' splc series. It contains clean-up patches which do not depend on split config.
This is available at u-boot-dm/spld-working
The size changes look pretty good: https://paste.debian.net/1271742/
The remaining patches will move into a new 'splg' series (G for Good).
[1] https://patchwork.ozlabs.org/project/uboot/list/?series=341504&state=*
Changes in v5:
- Fix reply typo
- Change approach and expand notes after more investigation
- Drop FSL_ISBC_KEY_EXT patch as it changes the size
- Drop PHY_CADENCE_SIERRA patch as it changes the size
Changes in v4:
- Avoid use of def_bool
- Modify to get rid of def_bool
- Adjust Kconfig ordering
- Just fix the typo
- Reduce and rename commit
- Reduce and rename commit
- Fix 'wanderboard' typo
- Reduce and rename commit
Changes in v3:
- Add new patch to disable QFW bootmeth in SPL
- Move the option down to the non-SPL part of drivers/Makefile
- Correct 'VPL' typo
- Use a consistent format for the comment
- Fix a transitory build error with sandbox_spl
- Add a new patch to disallow commands in SPL
Changes in v2:
- Rebase to previous series
Simon Glass (44): mtd: Drop unused kb9202_nand driver mtd: Drop unused CONFIG_ONENAND_U_BOOT sh4: Drop unused twl6030 driver moveconfig: Update to detect / correct missing SPL Kconfigs bootstd: Disable QFW bootmeth in SPL Correct SPL uses of ARCH_MVEBU Correct SPL uses of DISPLAY_AER_FULL Correct SPL uses of MULTIPLEXER Correct SPL use of PG_WCOM_UBOOT_UPDATE_SUPPORTED Correct SPL uses of PHY_FIXED boot: Add Kconfigs for BOOTMETH_VBE_REQUEST Correct SPL use of DM_RNG lib: Add a Kconfig for SPL_BZIP2 moveconfig: Various minor improvements sandbox: Expand size for VPL image event: Add Kconfig options for SPL bootstd: Correct 'VPL' typo env: Avoid checking ENV_IS_IN when env disabled env: Allow VPL environment to be nowhere lib: Add VPL options for SHA1 and SHA256 x86: Use string functions for all 32-bit builds lib: Fix build condition for tiny-printf sandbox: Tidy up RTC options sandbox: Use the generic VPL option to enable VPL sandbox: Tidy up I2C options fixdep: Add support for VPL fixdep: Refactor to make testing easier fixdep: Add some tests for parse_config_line() test: Add SPL versions of the TEST_KCONFIG options lib: Add an SPL config for LIB_UUID test: Tidy up sandbox handling in test-main x86: Fix up use of X86_32BIT_INIT and X86_64 options Add VPL options for BLOBLIST rockchip: Avoid checking environment without ENV_SUPPORT freescale: Drop old pre-DM_ETH code imx: Use SATA instead of CMD_SATA net: Add an SPL config for atheros freescale: Fix odd use of ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE serial: Support ns16550 driver in TPL dm: Add a TPL symbol for simple-bus x86: coral: Add missing TPL options power: wandboard: Add a missing CONFIG venice: Simplify conditions for network init command: Don't allow commands in SPL
I've applied almost all of this series. I've left the moveconfig.py stuff for now as I'm not sure it's useful until split config. I've followed up about the X86_32BIT_INIT patch as I do want to see that boot-tested, and I've left the ns16650 TPL patch as both that feel like "split config makes this an issue" rather than an issue we have today and fwiw, the dependencies are wrong in that there's no TPL for omap2 which I didn't reply directly to, I only noticed as reviewing the series locally before merging.
OK, thanks for that. Do you think it is worth picking up the fixdep ones also? The VPL thing is a bug and the others are for tests.
I will see if I can get some time by next week to do another spin. How can we get more eyes on the Kconfig-language proposal?
Sorry, I should have chimed in sooner. I was thinking perhaps the next step would be to re-sync our Kconfig support with 6.2 or whatever, and see what the reaction is to the refactoring patches.
OK. I don't have much of a clue about this. I thought perhaps you might have more idea.
I'll send a patch which syncs it. It sort-of builds a few boards but is not right.
Regards, Simon
participants (6)
-
Baruch Siach
-
Heiko Schocher
-
Heinrich Schuchardt
-
Quentin Schulz
-
Simon Glass
-
Tom Rini