[U-Boot] [PATCH 00/16] Add macros to ease our life with independent CONFIGs between U-Boot and SPL

Refer to Simon's question, too: http://lists.denx.de/pipermail/u-boot/2015-July/219598.html
Since U-boot introduced SPL (not since Kconfig), enabling features for U-boot and SPL independently is always a PITA.
- decide if each feature should be supported for SPL or not - Add CONFIG_SPL_FRED_SUPPORT into Makefile.spl - Add #undef include/config_uncmd_spl.h to disable features we do not want to support on SPL - Add "ifdef CONFIG_SPL_BUILD ... endif" here and there to adjust things - Add "#ifdef CONFIG_SPL_BUILD ... #endif" here and there to fix things up
Things are getting more and more crappy.
When U-boot switched to Kconfig, first I introduced separate .config (.config, spl/.config, tpl/.config) to clean up them. But it turned out to be a pain.
So, I believe the current single .config is much better. But I also admit we need something systematic to subdue our PITA.
One possibility is to support "spl-y" in makefiles. (This idea is cribbed from barebox.)
obj-$(CONFIG_FOO) += foo.o spl-$(CONFIG_SPL_FOO) += foo.o
is cleaner than
ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_FOO) += foo.o else obj-$(CONFIG_FOO) += foo.o endif
It is a nice improvement in makefile side. But we still need to do something with C files.
Another option is something like CONFIG_FOO=yyn (yes for U-boot, yes for SPL, no for TPL)
To achieve this, I think a big operation is needed in Kconfig core. I cannot do that. (Of course, Patches are welcome if someone else can do that.)
So, I was thinking of something different.
My idea was inspired by IS_ENABLED() macro in include/linux/kconfig.h.
Linux defines different macros for built-in and module, and it is possible to write #if IS_ENABLED(CONFIG_FOO) ... #endif
instead of
#if defined(CONFIG_FOO) || defined(CONFIG_FOO_MODULE) ... #endif
So, I'd like to propose new macros to write code like
#if CONFIG_IS_ENABLED(FOO) ... #endif
instead of
#if (!defined(CONFIG_SPL_BUILD) && defined(CONFIG_FOO)) || \ (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_FOO)) ... #endif
I hope this series will make our life easier.
Masahiro Yamada (16): ARM: remove vpac270 board support kbuild: fixdep: optimize code slightly kbuild: add a makefile macro useful with per-image config options linux/kconfig.h: add CPP macros useful for per-image config options spl: move SPL driver entries to driver/Makefile dm: unify obj-$(CONFIG_DM) and obj-$(CONFIG_SPL_DM) entries clk: rename CONFIG_SPL_CLK_SUPPORT to CONFIG_SPL_CLK clk: unify obj-$(CONFIG_CLK) and obj-$(CONFIG_SPL_CLK) entries ram: rename CONFIG_SPL_RAM_SUPPORT to CONFIG_SPL_RAM ram: unify obj-$(CONFIG_RAM) and obj-$(CONFIG_SPL_RAM) entries led: rename CONFIG_SPL_LED_SUPPORT to CONFIG_SPL_LED led: unify obj-$(CONFIG_LED) and obj-$(CONFIG_SPL_LED) entries dm: drop CONFIG_DM_DEVICE_REMOVE from uncmd list fdtdec: fix OF_CONTROL switch of: flip CONFIG_SPL_DISABLE_OF_CONTROL into CONFIG_SPL_OF_CONTROL of: clean up OF_CONTROL ifdef conditionals
arch/arm/Kconfig | 10 - arch/arm/cpu/armv7/am33xx/board.c | 2 +- arch/arm/cpu/armv7/exynos/Kconfig | 8 - arch/arm/cpu/armv7/exynos/pinmux.c | 2 +- arch/arm/cpu/armv7/s5pc1xx/Kconfig | 2 - arch/arm/include/asm/arch-exynos/dwmmc.h | 2 - arch/arm/include/asm/arch-exynos/mipi_dsim.h | 2 - arch/arm/include/asm/arch-exynos/mmc.h | 2 - arch/arm/mach-tegra/clock.c | 4 +- arch/arm/mach-tegra/tegra114/clock.c | 4 +- arch/arm/mach-tegra/tegra124/clock.c | 4 +- arch/arm/mach-tegra/tegra20/clock.c | 4 +- arch/arm/mach-tegra/tegra30/clock.c | 4 +- board/vpac270/Kconfig | 9 - board/vpac270/MAINTAINERS | 8 - board/vpac270/Makefile | 13 - board/vpac270/onenand.c | 46 --- board/vpac270/u-boot-spl.lds | 81 ----- board/vpac270/vpac270.c | 126 -------- .../xilinx/microblaze-generic/microblaze-generic.c | 2 +- board/xilinx/zynq/board.c | 2 +- common/cli.c | 4 +- common/spl/spl.c | 3 +- configs/am335x_boneblack_vboot_defconfig | 1 - configs/arches_defconfig | 1 - configs/canyonlands_defconfig | 1 - configs/galileo_defconfig | 1 - configs/microblaze-generic_defconfig | 1 - configs/odroid_defconfig | 1 - configs/origen_defconfig | 1 - configs/s5pc210_universal_defconfig | 1 - configs/socfpga_socrates_defconfig | 1 - configs/trats2_defconfig | 1 - configs/trats_defconfig | 1 - configs/vpac270_nor_128_defconfig | 5 - configs/vpac270_nor_256_defconfig | 5 - configs/vpac270_ond_256_defconfig | 7 - doc/README.scrapyard | 1 + drivers/Makefile | 41 ++- drivers/clk/Kconfig | 2 +- drivers/core/Makefile | 8 +- drivers/core/device.c | 10 +- drivers/core/lists.c | 2 +- drivers/core/root.c | 6 +- drivers/core/uclass.c | 4 +- drivers/gpio/mxc_gpio.c | 2 +- drivers/gpio/vybrid_gpio.c | 2 +- drivers/i2c/s3c24x0_i2c.c | 4 +- drivers/input/Makefile | 3 +- drivers/input/tegra-kbc.c | 2 +- drivers/led/Kconfig | 2 +- drivers/mmc/exynos_dw_mmc.c | 2 +- drivers/mmc/s5p_sdhci.c | 2 +- drivers/mmc/tegra_mmc.c | 2 +- drivers/mmc/zynq_sdhci.c | 2 +- drivers/mtd/spi/sf_probe.c | 6 +- drivers/net/xilinx_emaclite.c | 2 +- drivers/net/zynq_gem.c | 2 +- drivers/power/exynos-tmu.c | 2 +- drivers/power/pmic/pmic_max77686.c | 4 +- drivers/ram/Kconfig | 2 +- drivers/serial/ns16550.c | 2 +- drivers/serial/serial-uclass.c | 4 +- drivers/serial/serial_omap.c | 2 +- drivers/serial/serial_pl01x.c | 2 +- drivers/serial/serial_tegra.c | 4 +- drivers/serial/serial_uniphier.c | 2 +- drivers/serial/serial_zynq.c | 2 +- drivers/sound/max98095.c | 2 +- drivers/sound/wm8994.c | 2 +- drivers/tpm/tpm_tis_i2c.c | 2 +- drivers/video/exynos_dp.c | 4 +- drivers/video/exynos_dp_lowlevel.c | 2 +- drivers/video/exynos_fb.c | 8 +- drivers/video/exynos_fimd.c | 4 +- drivers/video/exynos_mipi_dsi.c | 4 +- drivers/video/tegra.c | 2 +- dts/Kconfig | 6 +- include/cli.h | 2 +- include/config_uncmd_spl.h | 4 - include/configs/microblaze-generic.h | 3 +- include/configs/socfpga_common.h | 2 +- include/configs/vpac270.h | 326 --------------------- include/dm/device-internal.h | 10 +- include/dm/device.h | 4 +- include/dm/uclass-internal.h | 4 +- include/fdtdec.h | 10 - include/linux/kconfig.h | 48 +++ lib/Makefile | 13 +- lib/fdtdec.c | 4 +- scripts/Kbuild.include | 6 + scripts/Makefile.spl | 30 +- scripts/Makefile.uncmd_spl | 5 - scripts/basic/fixdep.c | 33 ++- 94 files changed, 227 insertions(+), 818 deletions(-) delete mode 100644 board/vpac270/Kconfig delete mode 100644 board/vpac270/MAINTAINERS delete mode 100644 board/vpac270/Makefile delete mode 100644 board/vpac270/onenand.c delete mode 100644 board/vpac270/u-boot-spl.lds delete mode 100644 board/vpac270/vpac270.c delete mode 100644 configs/vpac270_nor_128_defconfig delete mode 100644 configs/vpac270_nor_256_defconfig delete mode 100644 configs/vpac270_ond_256_defconfig delete mode 100644 include/configs/vpac270.h

The board-specific linker script board/vpac270/u-boot-spl.lds obstructs further cleanup. This board has not been converted to Generic Board yet in spite of the long-term warning. Remove.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
Marek,
If you want to keep this board: - Please convert it to Generic Board - Please use arch-common linker script
arch/arm/Kconfig | 6 - board/vpac270/Kconfig | 9 -- board/vpac270/MAINTAINERS | 8 - board/vpac270/Makefile | 13 -- board/vpac270/onenand.c | 46 ------ board/vpac270/u-boot-spl.lds | 81 ---------- board/vpac270/vpac270.c | 126 --------------- configs/vpac270_nor_128_defconfig | 5 - configs/vpac270_nor_256_defconfig | 5 - configs/vpac270_ond_256_defconfig | 7 - doc/README.scrapyard | 1 + include/configs/vpac270.h | 326 -------------------------------------- 12 files changed, 1 insertion(+), 632 deletions(-) delete mode 100644 board/vpac270/Kconfig delete mode 100644 board/vpac270/MAINTAINERS delete mode 100644 board/vpac270/Makefile delete mode 100644 board/vpac270/onenand.c delete mode 100644 board/vpac270/u-boot-spl.lds delete mode 100644 board/vpac270/vpac270.c delete mode 100644 configs/vpac270_nor_128_defconfig delete mode 100644 configs/vpac270_nor_256_defconfig delete mode 100644 configs/vpac270_ond_256_defconfig delete mode 100644 include/configs/vpac270.h
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 506463c..103ad7a 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -777,11 +777,6 @@ config TARGET_TRIZEPSIV bool "Support trizepsiv" select CPU_PXA
-config TARGET_VPAC270 - bool "Support vpac270" - select CPU_PXA - select SUPPORT_SPL - config TARGET_XAENIAX bool "Support xaeniax" select CPU_PXA @@ -978,7 +973,6 @@ source "board/toradex/colibri_vf/Kconfig" source "board/trizepsiv/Kconfig" source "board/ttcontrol/vision2/Kconfig" source "board/udoo/Kconfig" -source "board/vpac270/Kconfig" source "board/vscom/baltos/Kconfig" source "board/wandboard/Kconfig" source "board/warp/Kconfig" diff --git a/board/vpac270/Kconfig b/board/vpac270/Kconfig deleted file mode 100644 index 1701b35..0000000 --- a/board/vpac270/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -if TARGET_VPAC270 - -config SYS_BOARD - default "vpac270" - -config SYS_CONFIG_NAME - default "vpac270" - -endif diff --git a/board/vpac270/MAINTAINERS b/board/vpac270/MAINTAINERS deleted file mode 100644 index 1c62765..0000000 --- a/board/vpac270/MAINTAINERS +++ /dev/null @@ -1,8 +0,0 @@ -VPAC270 BOARD -M: Marek Vasut marek.vasut@gmail.com -S: Maintained -F: board/vpac270/ -F: include/configs/vpac270.h -F: configs/vpac270_nor_128_defconfig -F: configs/vpac270_nor_256_defconfig -F: configs/vpac270_ond_256_defconfig diff --git a/board/vpac270/Makefile b/board/vpac270/Makefile deleted file mode 100644 index ad7f7d8..0000000 --- a/board/vpac270/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# Voipac PXA270 Support -# -# Copyright (C) 2010 Marek Vasut marek.vasut@gmail.com -# -# SPDX-License-Identifier: GPL-2.0+ -# - -ifndef CONFIG_SPL_BUILD -obj-y := vpac270.o -else -obj-y := onenand.o -endif diff --git a/board/vpac270/onenand.c b/board/vpac270/onenand.c deleted file mode 100644 index a749b31..0000000 --- a/board/vpac270/onenand.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Voipac PXA270 OneNAND SPL - * - * Copyright (C) 2011 Marek Vasut marek.vasut@gmail.com - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <config.h> -#include <asm/io.h> -#include <onenand_uboot.h> -#include <asm/arch/pxa.h> - -void board_init_f(unsigned long unused) -{ - extern uint32_t _end; - uint32_t tmp; - - asm volatile("mov %0, pc" : "=r"(tmp)); - tmp >>= 24; - - /* The code runs from OneNAND RAM, copy SPL to SRAM and execute it. */ - if (tmp == 0) { - tmp = (uint32_t)&_end - CONFIG_SPL_TEXT_BASE; - onenand_spl_load_image(0, tmp, (void *)CONFIG_SPL_TEXT_BASE); - asm volatile("mov pc, %0" : : "r"(CONFIG_SPL_TEXT_BASE)); - } - - /* Hereby, the code runs from (S)RAM, copy U-Boot and execute it. */ - arch_cpu_init(); - pxa2xx_dram_init(); - onenand_spl_load_image(CONFIG_SPL_ONENAND_LOAD_ADDR, - CONFIG_SPL_ONENAND_LOAD_SIZE, - (void *)CONFIG_SYS_TEXT_BASE); - asm volatile("mov pc, %0" : : "r"(CONFIG_SYS_TEXT_BASE)); - - for (;;) - ; -} - -void __attribute__((noreturn)) hang(void) -{ - for (;;) - ; -} diff --git a/board/vpac270/u-boot-spl.lds b/board/vpac270/u-boot-spl.lds deleted file mode 100644 index a10ea71..0000000 --- a/board/vpac270/u-boot-spl.lds +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2011 Marek Vasut marek.vasut@gmail.com - * on behalf of DENX Software Engineering GmbH - * - * January 2004 - Changed to support H4 device - * Copyright (c) 2004-2008 Texas Instruments - * - * (C) Copyright 2002 - * Gary Jennejohn, DENX Software Engineering, garyj@denx.de - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") -OUTPUT_ARCH(arm) -ENTRY(_start) -SECTIONS -{ - . = CONFIG_SPL_TEXT_BASE; - .text.0 : - { - *(.vectors) - arch/arm/cpu/pxa/start.o (.text*) - arch/arm/lib/built-in.o (.text*) - board/vpac270/built-in.o (.text*) - drivers/mtd/onenand/built-in.o (.text*) - } - - - /* Start of the rest of the SPL */ - . = CONFIG_SPL_TEXT_BASE + 0x800; - - .text.1 : - { - *(.text*) - } - - . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } - - . = ALIGN(4); - .data : { - *(.data*) - } - - . = ALIGN(4); - - __image_copy_end = .; - - .rel.dyn : { - __rel_dyn_start = .; - *(.rel*) - __rel_dyn_end = .; - } - - . = ALIGN(0x800); - - .end : - { - *(.__end) - } - - _image_binary_end = .; - - .bss __rel_dyn_start (OVERLAY) : { - __bss_start = .; - *(.bss*) - . = ALIGN(4); - __bss_end = .; - } - - .dynsym _image_binary_end : { *(.dynsym) } - .dynbss : { *(.dynbss) } - .dynstr : { *(.dynstr*) } - .dynamic : { *(.dynamic*) } - .hash : { *(.hash*) } - .plt : { *(.plt*) } - .interp : { *(.interp*) } - .gnu : { *(.gnu*) } - .ARM.exidx : { *(.ARM.exidx*) } -} diff --git a/board/vpac270/vpac270.c b/board/vpac270/vpac270.c deleted file mode 100644 index 8d777df..0000000 --- a/board/vpac270/vpac270.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Voipac PXA270 Support - * - * Copyright (C) 2010 Marek Vasut marek.vasut@gmail.com - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <asm/arch/hardware.h> -#include <asm/arch/regs-mmc.h> -#include <asm/arch/pxa.h> -#include <netdev.h> -#include <serial.h> -#include <asm/io.h> -#include <usb.h> - -DECLARE_GLOBAL_DATA_PTR; - -/* - * Miscelaneous platform dependent initialisations - */ -int board_init(void) -{ - /* We have RAM, disable cache */ - dcache_disable(); - icache_disable(); - - /* memory and cpu-speed are setup before relocation */ - /* so we do _nothing_ here */ - - /* Arch number of vpac270 */ - gd->bd->bi_arch_number = MACH_TYPE_VPAC270; - - /* adress of boot parameters */ - gd->bd->bi_boot_params = 0xa0000100; - - return 0; -} - -int dram_init(void) -{ -#ifndef CONFIG_ONENAND - pxa2xx_dram_init(); -#endif - gd->ram_size = PHYS_SDRAM_1_SIZE; - return 0; -} - -void dram_init_banksize(void) -{ - gd->bd->bi_dram[0].start = PHYS_SDRAM_1; - gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; - -#ifdef CONFIG_RAM_256M - gd->bd->bi_dram[1].start = PHYS_SDRAM_2; - gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE; -#endif -} - -#ifdef CONFIG_CMD_MMC -int board_mmc_init(bd_t *bis) -{ - pxa_mmc_register(0); - return 0; -} -#endif - -#ifdef CONFIG_CMD_USB -int board_usb_init(int index, enum usb_init_type init) -{ - writel((UHCHR | UHCHR_PCPL | UHCHR_PSPL) & - ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE), - UHCHR); - - writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR); - - while (readl(UHCHR) & UHCHR_FSBIR) - ; - - writel(readl(UHCHR) & ~UHCHR_SSE, UHCHR); - writel((UHCHIE_UPRIE | UHCHIE_RWIE), UHCHIE); - - /* Clear any OTG Pin Hold */ - if (readl(PSSR) & PSSR_OTGPH) - writel(readl(PSSR) | PSSR_OTGPH, PSSR); - - writel(readl(UHCRHDA) & ~(0x200), UHCRHDA); - writel(readl(UHCRHDA) | 0x100, UHCRHDA); - - /* Set port power control mask bits, only 3 ports. */ - writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB); - - /* enable port 2 */ - writel(readl(UP2OCR) | UP2OCR_HXOE | UP2OCR_HXS | - UP2OCR_DMPDE | UP2OCR_DPPDE, UP2OCR); - - return 0; -} - -int board_usb_cleanup(int index, enum usb_init_type init) -{ - return 0; -} - -void usb_board_stop(void) -{ - writel(readl(UHCHR) | UHCHR_FHR, UHCHR); - udelay(11); - writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR); - - writel(readl(UHCCOMS) | 1, UHCCOMS); - udelay(10); - - writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN); - - return; -} -#endif - -#ifdef CONFIG_DRIVER_DM9000 -int board_eth_init(bd_t *bis) -{ - return dm9000_initialize(bis); -} -#endif diff --git a/configs/vpac270_nor_128_defconfig b/configs/vpac270_nor_128_defconfig deleted file mode 100644 index bbc6e6a..0000000 --- a/configs/vpac270_nor_128_defconfig +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG_ARM=y -CONFIG_TARGET_VPAC270=y -CONFIG_SYS_EXTRA_OPTIONS="NOR,RAM_128M" -# CONFIG_CMD_IMLS is not set -# CONFIG_CMD_SETEXPR is not set diff --git a/configs/vpac270_nor_256_defconfig b/configs/vpac270_nor_256_defconfig deleted file mode 100644 index 3f1ae1e..0000000 --- a/configs/vpac270_nor_256_defconfig +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG_ARM=y -CONFIG_TARGET_VPAC270=y -CONFIG_SYS_EXTRA_OPTIONS="NOR,RAM_256M" -# CONFIG_CMD_IMLS is not set -# CONFIG_CMD_SETEXPR is not set diff --git a/configs/vpac270_ond_256_defconfig b/configs/vpac270_ond_256_defconfig deleted file mode 100644 index 7500b7c..0000000 --- a/configs/vpac270_ond_256_defconfig +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG_ARM=y -CONFIG_TARGET_VPAC270=y -CONFIG_SPL=y -CONFIG_SYS_EXTRA_OPTIONS="ONENAND,RAM_256M" -# CONFIG_CMD_IMLS is not set -# CONFIG_CMD_FLASH is not set -# CONFIG_CMD_SETEXPR is not set diff --git a/doc/README.scrapyard b/doc/README.scrapyard index f029a0f..26f9d91 100644 --- a/doc/README.scrapyard +++ b/doc/README.scrapyard @@ -12,6 +12,7 @@ The list should be sorted in reverse chronological order.
Board Arch CPU Commit Removed Last known maintainer/contact ================================================================================================= +vpac270 arm pxa - - Marek Vasut marek.vasut@gmail.com atstk1003 avr32 - e5354b8a 2015-06-10 Haavard Skinnemoen haavard.skinnemoen@atmel.com atstk1004 avr32 - e5354b8a 2015-06-10 Haavard Skinnemoen haavard.skinnemoen@atmel.com atstk1006 avr32 - e5354b8a 2015-06-10 Haavard Skinnemoen haavard.skinnemoen@atmel.com diff --git a/include/configs/vpac270.h b/include/configs/vpac270.h deleted file mode 100644 index 95a69b3..0000000 --- a/include/configs/vpac270.h +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Voipac PXA270 configuration file - * - * Copyright (C) 2010 Marek Vasut marek.vasut@gmail.com - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#ifndef __CONFIG_H -#define __CONFIG_H - -/* - * High Level Board Configuration Options - */ -#define CONFIG_CPU_PXA27X 1 /* Marvell PXA270 CPU */ -#define CONFIG_VPAC270 1 /* Voipac PXA270 board */ -#define CONFIG_SYS_TEXT_BASE 0xa0000000 - -#ifdef CONFIG_ONENAND -#define CONFIG_SPL_ONENAND_SUPPORT -#define CONFIG_SPL_ONENAND_LOAD_ADDR 0x2000 -#define CONFIG_SPL_ONENAND_LOAD_SIZE \ - (512 * 1024 - CONFIG_SPL_ONENAND_LOAD_ADDR) -#define CONFIG_SPL_TEXT_BASE 0x5c000000 -#define CONFIG_SPL_LDSCRIPT "board/vpac270/u-boot-spl.lds" -#endif - -/* - * Environment settings - */ -#define CONFIG_ENV_OVERWRITE -#define CONFIG_SYS_MALLOC_LEN (128*1024) -#define CONFIG_ARCH_CPU_INIT -#define CONFIG_BOOTCOMMAND \ - "if mmc init && fatload mmc 0 0xa4000000 uImage; then " \ - "bootm 0xa4000000; " \ - "fi; " \ - "if usb reset && fatload usb 0 0xa4000000 uImage; then " \ - "bootm 0xa4000000; " \ - "fi; " \ - "if ide reset && fatload ide 0 0xa4000000 uImage; then " \ - "bootm 0xa4000000; " \ - "fi; " \ - "bootm 0x60000;" - -#define CONFIG_EXTRA_ENV_SETTINGS \ - "update_onenand=" \ - "onenand erase 0x0 0x80000 ; " \ - "onenand write 0xa0000000 0x0 0x80000" - -#define CONFIG_BOOTARGS "console=tty0 console=ttyS0,115200" -#define CONFIG_TIMESTAMP -#define CONFIG_BOOTDELAY 2 /* Autoboot delay */ -#define CONFIG_CMDLINE_TAG -#define CONFIG_SETUP_MEMORY_TAGS -#define CONFIG_LZMA /* LZMA compression support */ -#define CONFIG_OF_LIBFDT - -/* - * Serial Console Configuration - */ -#define CONFIG_PXA_SERIAL -#define CONFIG_FFUART 1 -#define CONFIG_CONS_INDEX 3 -#define CONFIG_BAUDRATE 115200 - -/* - * Bootloader Components Configuration - */ -#define CONFIG_CMD_ENV -#define CONFIG_CMD_MMC -#define CONFIG_CMD_USB -#undef CONFIG_LCD -#define CONFIG_CMD_IDE - -#ifdef CONFIG_ONENAND -#define CONFIG_CMD_ONENAND -#else -#undef CONFIG_CMD_ONENAND -#endif - -/* - * Networking Configuration - * chip on the Voipac PXA270 board - */ -#ifdef CONFIG_CMD_NET -#define CONFIG_CMD_PING -#define CONFIG_CMD_DHCP - -#define CONFIG_DRIVER_DM9000 1 -#define CONFIG_DM9000_BASE 0x08000300 /* CS2 */ -#define DM9000_IO (CONFIG_DM9000_BASE) -#define DM9000_DATA (CONFIG_DM9000_BASE + 4) -#define CONFIG_NET_RETRY_COUNT 10 - -#define CONFIG_BOOTP_BOOTFILESIZE -#define CONFIG_BOOTP_BOOTPATH -#define CONFIG_BOOTP_GATEWAY -#define CONFIG_BOOTP_HOSTNAME -#endif - -/* - * MMC Card Configuration - */ -#ifdef CONFIG_CMD_MMC -#define CONFIG_MMC -#define CONFIG_GENERIC_MMC -#define CONFIG_PXA_MMC_GENERIC -#define CONFIG_SYS_MMC_BASE 0xF0000000 -#define CONFIG_CMD_FAT -#define CONFIG_CMD_EXT2 -#define CONFIG_DOS_PARTITION -#endif - -/* - * KGDB - */ -#ifdef CONFIG_CMD_KGDB -#define CONFIG_KGDB_BAUDRATE 230400 /* kgdb serial port speed */ -#endif - -/* - * HUSH Shell Configuration - */ -#define CONFIG_SYS_HUSH_PARSER 1 - -#define CONFIG_SYS_LONGHELP -#ifdef CONFIG_SYS_HUSH_PARSER -#define CONFIG_SYS_PROMPT "$ " -#else -#endif -#define CONFIG_SYS_CBSIZE 256 -#define CONFIG_SYS_PBSIZE \ - (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) -#define CONFIG_SYS_MAXARGS 16 -#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE -#define CONFIG_SYS_DEVICE_NULLDEV 1 -#define CONFIG_CMDLINE_EDITING 1 -#define CONFIG_AUTO_COMPLETE 1 - -/* - * Clock Configuration - */ -#define CONFIG_SYS_CPUSPEED 0x190 /* 312MHz */ - - -/* - * DRAM Map - */ -#define CONFIG_NR_DRAM_BANKS 2 /* 2 banks of DRAM */ -#define PHYS_SDRAM_1 0xa0000000 /* SDRAM Bank #1 */ -#define PHYS_SDRAM_1_SIZE 0x08000000 /* 128 MB */ - -#ifdef CONFIG_RAM_256M -#define PHYS_SDRAM_2 0x80000000 /* SDRAM Bank #2 */ -#define PHYS_SDRAM_2_SIZE 0x08000000 /* 128 MB */ -#endif - -#define CONFIG_SYS_DRAM_BASE 0xa0000000 /* CS0 */ -#ifdef CONFIG_RAM_256M -#define CONFIG_SYS_DRAM_SIZE 0x10000000 /* 256 MB DRAM */ -#else -#define CONFIG_SYS_DRAM_SIZE 0x08000000 /* 128 MB DRAM */ -#endif - -#define CONFIG_SYS_MEMTEST_START 0xa0400000 /* memtest works on */ -#define CONFIG_SYS_MEMTEST_END 0xa0800000 /* 4 ... 8 MB in DRAM */ - -#define CONFIG_SYS_LOAD_ADDR PHYS_SDRAM_1 -#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 -#define CONFIG_SYS_INIT_SP_ADDR 0x5c010000 - -/* - * NOR FLASH - */ -#define CONFIG_SYS_MONITOR_BASE 0x0 -#define CONFIG_SYS_MONITOR_LEN 0x80000 -#define CONFIG_ENV_ADDR \ - (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) -#define CONFIG_ENV_SIZE 0x20000 -#define CONFIG_ENV_SECT_SIZE 0x20000 - -#if defined(CONFIG_CMD_FLASH) /* NOR */ -#define PHYS_FLASH_1 0x00000000 /* Flash Bank #1 */ - -#ifdef CONFIG_RAM_256M -#define PHYS_FLASH_2 0x02000000 /* Flash Bank #2 */ -#endif - -#define CONFIG_SYS_FLASH_CFI -#define CONFIG_FLASH_CFI_DRIVER 1 - -#define CONFIG_SYS_MAX_FLASH_SECT (4 + 255) -#ifdef CONFIG_RAM_256M -#define CONFIG_SYS_MAX_FLASH_BANKS 2 -#define CONFIG_SYS_FLASH_BANKS_LIST { PHYS_FLASH_1, PHYS_FLASH_2 } -#else -#define CONFIG_SYS_MAX_FLASH_BANKS 1 -#define CONFIG_SYS_FLASH_BASE PHYS_FLASH_1 -#endif - -#define CONFIG_SYS_FLASH_ERASE_TOUT (25*CONFIG_SYS_HZ) -#define CONFIG_SYS_FLASH_WRITE_TOUT (25*CONFIG_SYS_HZ) - -#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1 -#define CONFIG_SYS_FLASH_PROTECTION 1 - -#define CONFIG_ENV_IS_IN_FLASH 1 - -#elif defined(CONFIG_CMD_ONENAND) /* OneNAND */ -#define CONFIG_SYS_NO_FLASH -#define CONFIG_SYS_ONENAND_BASE 0x00000000 - -#define CONFIG_ENV_IS_IN_ONENAND 1 - -#else /* No flash */ -#define CONFIG_SYS_NO_FLASH -#define CONFIG_ENV_IS_NOWHERE -#endif - -/* - * IDE - */ -#ifdef CONFIG_CMD_IDE -#define CONFIG_LBA48 -#undef CONFIG_IDE_LED -#undef CONFIG_IDE_RESET - -#define __io - -#define CONFIG_SYS_IDE_MAXBUS 1 -#define CONFIG_SYS_IDE_MAXDEVICE 1 - -#define CONFIG_SYS_ATA_BASE_ADDR 0x0c000000 -#define CONFIG_SYS_ATA_IDE0_OFFSET 0x0 - -#define CONFIG_SYS_ATA_DATA_OFFSET 0x120 -#define CONFIG_SYS_ATA_REG_OFFSET 0x120 -#define CONFIG_SYS_ATA_ALT_OFFSET 0x120 - -#define CONFIG_SYS_ATA_STRIDE 2 -#endif - -/* - * GPIO settings - */ -#define CONFIG_SYS_GPSR0_VAL 0x01308800 -#define CONFIG_SYS_GPSR1_VAL 0x00cf0000 -#define CONFIG_SYS_GPSR2_VAL 0x922ac000 -#define CONFIG_SYS_GPSR3_VAL 0x0161e800 - -#define CONFIG_SYS_GPCR0_VAL 0x00010000 -#define CONFIG_SYS_GPCR1_VAL 0x0 -#define CONFIG_SYS_GPCR2_VAL 0x0 -#define CONFIG_SYS_GPCR3_VAL 0x0 - -#define CONFIG_SYS_GPDR0_VAL 0xcbb18800 -#define CONFIG_SYS_GPDR1_VAL 0xfccfa981 -#define CONFIG_SYS_GPDR2_VAL 0x922affff -#define CONFIG_SYS_GPDR3_VAL 0x0161e904 - -#define CONFIG_SYS_GAFR0_L_VAL 0x00100000 -#define CONFIG_SYS_GAFR0_U_VAL 0xa5da8510 -#define CONFIG_SYS_GAFR1_L_VAL 0x6992901a -#define CONFIG_SYS_GAFR1_U_VAL 0xaaa5a0aa -#define CONFIG_SYS_GAFR2_L_VAL 0xaaaaaaaa -#define CONFIG_SYS_GAFR2_U_VAL 0x4109a401 -#define CONFIG_SYS_GAFR3_L_VAL 0x54010310 -#define CONFIG_SYS_GAFR3_U_VAL 0x00025401 - -#define CONFIG_SYS_PSSR_VAL 0x30 - -/* - * Clock settings - */ -#define CONFIG_SYS_CKEN 0x00500240 -#define CONFIG_SYS_CCCR 0x02000290 - -/* - * Memory settings - */ -#define CONFIG_SYS_MSC0_VAL 0x3ffc95f9 -#define CONFIG_SYS_MSC1_VAL 0x02ccf974 -#define CONFIG_SYS_MSC2_VAL 0x00000000 -#ifdef CONFIG_RAM_256M -#define CONFIG_SYS_MDCNFG_VAL 0x8ad30ad3 -#else -#define CONFIG_SYS_MDCNFG_VAL 0x88000ad3 -#endif -#define CONFIG_SYS_MDREFR_VAL 0x201fe01e -#define CONFIG_SYS_MDMRS_VAL 0x00000000 -#define CONFIG_SYS_FLYCNFG_VAL 0x00000000 -#define CONFIG_SYS_SXCNFG_VAL 0x40044004 - -/* - * PCMCIA and CF Interfaces - */ -#define CONFIG_SYS_MECR_VAL 0x00000001 -#define CONFIG_SYS_MCMEM0_VAL 0x00014307 -#define CONFIG_SYS_MCMEM1_VAL 0x00014307 -#define CONFIG_SYS_MCATT0_VAL 0x0001c787 -#define CONFIG_SYS_MCATT1_VAL 0x0001c787 -#define CONFIG_SYS_MCIO0_VAL 0x0001430f -#define CONFIG_SYS_MCIO1_VAL 0x0001430f - -/* - * LCD - */ -#ifdef CONFIG_LCD -#define CONFIG_VOIPAC_LCD -#endif - -/* - * USB - */ -#ifdef CONFIG_CMD_USB -#define CONFIG_USB_OHCI_NEW -#define CONFIG_SYS_USB_OHCI_CPU_INIT -#define CONFIG_SYS_USB_OHCI_BOARD_INIT -#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2 -#define CONFIG_SYS_USB_OHCI_REGS_BASE 0x4C000000 -#define CONFIG_SYS_USB_OHCI_SLOT_NAME "vpac270" -#define CONFIG_USB_STORAGE -#endif - -#endif /* __CONFIG_H */

On Sunday, July 26, 2015 at 10:26:45 AM, Masahiro Yamada wrote:
The board-specific linker script board/vpac270/u-boot-spl.lds obstructs further cleanup. This board has not been converted to Generic Board yet in spite of the long-term warning. Remove.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com
Hi!
Marek,
If you want to keep this board:
- Please convert it to Generic Board
- Please use arch-common linker script
Yeah, I want to keep this board, but please give me a bit of time to do this. This one and the zipitz2 are the two PXA boards which I have and want to keep.
I recall the u-boot-spl.lds was really needed to keep the size of the SPL under 1kiB ; without this the board was unbootable when using the OneNAND.
Best regards, Marek Vasut

Hi Marek,
2015-07-26 17:49 GMT+09:00 Marek Vasut marex@denx.de:
On Sunday, July 26, 2015 at 10:26:45 AM, Masahiro Yamada wrote:
The board-specific linker script board/vpac270/u-boot-spl.lds obstructs further cleanup. This board has not been converted to Generic Board yet in spite of the long-term warning. Remove.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com
Hi!
Marek,
If you want to keep this board:
- Please convert it to Generic Board
- Please use arch-common linker script
Yeah, I want to keep this board, but please give me a bit of time to do this. This one and the zipitz2 are the two PXA boards which I have and want to keep.
I recall the u-boot-spl.lds was really needed to keep the size of the SPL under 1kiB ; without this the board was unbootable when using the OneNAND.
So, you worked around your problem in a wrong way.
I imagine this linker script means: We build many objects for SPL, but do not want link them. To keep the SPL size under 1kiB, only 4 objects should be linked into the SPL. The correct way of doing this is to disable CONFIGs for SPL, by Kconfig or by include/configs/vpac270.h, but it is troubulesome (or tedious, or impossible at all?), so this weird linker script is needed...
I'd say having per-board linker scripts is a mistake of U-boot. They should be deprecated in the long-run.
Is it possible to replace
drivers/mtd/onenand/built-in.o
with
drivers/built-in.o
Given that any other drivers should be disabled for SPL, this should work.
And it should be enough for my series.

2015-07-26 17:49 GMT+09:00 Marek Vasut marex@denx.de:
On Sunday, July 26, 2015 at 10:26:45 AM, Masahiro Yamada wrote:
The board-specific linker script board/vpac270/u-boot-spl.lds obstructs further cleanup. This board has not been converted to Generic Board yet in spite of the long-term warning. Remove.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com
Hi!
Marek,
If you want to keep this board:
- Please convert it to Generic Board
- Please use arch-common linker script
Yeah, I want to keep this board, but please give me a bit of time to do this. This one and the zipitz2 are the two PXA boards which I have and want to keep.
I recall the u-boot-spl.lds was really needed to keep the size of the SPL under 1kiB ; without this the board was unbootable when using the OneNAND.
I will drop this patch when I send v2.
BTW, I tried building vpac270 ONENAND. It is already over 1kiB.
$ git describe v2015.07-307-g2647394 $ make vpac270_ond_256_defconfig # # configuration written to .config # $ make -s CROSS_COMPILE=arm-unknown-linux-gnueabi- ===================== WARNING ====================== Please convert this board to generic board. Otherwise it will be removed by the end of 2014. See doc/README.generic-board for further information ==================================================== $ ls -l spl/u-boot-spl.bin -rwxrwxr-x 1 masahiro masahiro 2828 Jul 28 00:53 spl/u-boot-spl.bin
It is over 2KB.

On Monday, July 27, 2015 at 05:58:17 PM, Masahiro Yamada wrote:
2015-07-26 17:49 GMT+09:00 Marek Vasut marex@denx.de:
On Sunday, July 26, 2015 at 10:26:45 AM, Masahiro Yamada wrote:
The board-specific linker script board/vpac270/u-boot-spl.lds obstructs further cleanup. This board has not been converted to Generic Board yet in spite of the long-term warning. Remove.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com
Hi!
Marek,
If you want to keep this board:
- Please convert it to Generic Board
- Please use arch-common linker script
Yeah, I want to keep this board, but please give me a bit of time to do this. This one and the zipitz2 are the two PXA boards which I have and want to keep.
I recall the u-boot-spl.lds was really needed to keep the size of the SPL under 1kiB ; without this the board was unbootable when using the OneNAND.
I will drop this patch when I send v2.
BTW, I tried building vpac270 ONENAND. It is already over 1kiB.
$ git describe v2015.07-307-g2647394 $ make vpac270_ond_256_defconfig # # configuration written to .config # $ make -s CROSS_COMPILE=arm-unknown-linux-gnueabi- ===================== WARNING ====================== Please convert this board to generic board. Otherwise it will be removed by the end of 2014. See doc/README.generic-board for further information ==================================================== $ ls -l spl/u-boot-spl.bin -rwxrwxr-x 1 masahiro masahiro 2828 Jul 28 00:53 spl/u-boot-spl.bin
It is over 2KB.
So the hardware spilt already? Aww :-(
I wonder, maybe converting this to TPL might be the correct solution ?
Best regards, Marek Vasut

2015-07-28 7:31 GMT+09:00 Marek Vasut marex@denx.de:
On Monday, July 27, 2015 at 05:58:17 PM, Masahiro Yamada wrote:
2015-07-26 17:49 GMT+09:00 Marek Vasut marex@denx.de:
On Sunday, July 26, 2015 at 10:26:45 AM, Masahiro Yamada wrote:
The board-specific linker script board/vpac270/u-boot-spl.lds obstructs further cleanup. This board has not been converted to Generic Board yet in spite of the long-term warning. Remove.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com
Hi!
Marek,
If you want to keep this board:
- Please convert it to Generic Board
- Please use arch-common linker script
Yeah, I want to keep this board, but please give me a bit of time to do this. This one and the zipitz2 are the two PXA boards which I have and want to keep.
I recall the u-boot-spl.lds was really needed to keep the size of the SPL under 1kiB ; without this the board was unbootable when using the OneNAND.
I will drop this patch when I send v2.
BTW, I tried building vpac270 ONENAND. It is already over 1kiB.
$ git describe v2015.07-307-g2647394 $ make vpac270_ond_256_defconfig # # configuration written to .config # $ make -s CROSS_COMPILE=arm-unknown-linux-gnueabi- ===================== WARNING ====================== Please convert this board to generic board. Otherwise it will be removed by the end of 2014. See doc/README.generic-board for further information ==================================================== $ ls -l spl/u-boot-spl.bin -rwxrwxr-x 1 masahiro masahiro 2828 Jul 28 00:53 spl/u-boot-spl.bin
It is over 2KB.
So the hardware spilt already? Aww :-(
I wonder, maybe converting this to TPL might be the correct solution ?
Maybe, if you could split it into two images.

On Tuesday, July 28, 2015 at 05:53:10 PM, Masahiro Yamada wrote:
[...]
$ git describe v2015.07-307-g2647394 $ make vpac270_ond_256_defconfig # # configuration written to .config # $ make -s CROSS_COMPILE=arm-unknown-linux-gnueabi- ===================== WARNING ====================== Please convert this board to generic board. Otherwise it will be removed by the end of 2014. See doc/README.generic-board for further information ==================================================== $ ls -l spl/u-boot-spl.bin -rwxrwxr-x 1 masahiro masahiro 2828 Jul 28 00:53 spl/u-boot-spl.bin
It is over 2KB.
So the hardware spilt already? Aww :-(
I wonder, maybe converting this to TPL might be the correct solution ?
Maybe, if you could split it into two images.
I think I might need TPL and SPL:
TPL: Load the SDRAM init code into CPU's SRAM from the OneNAND SPL: Load big U-Boot from OneNAND into the main SDRAM
... or maybe we should just sacrifice the machine in the name of progress and be done with it. I don't know when I might have time to fix it afterall.
Best regards, Marek Vasut

Hi Marek,
On 28 July 2015 at 09:57, Marek Vasut marex@denx.de wrote:
On Tuesday, July 28, 2015 at 05:53:10 PM, Masahiro Yamada wrote:
[...]
$ git describe v2015.07-307-g2647394 $ make vpac270_ond_256_defconfig # # configuration written to .config # $ make -s CROSS_COMPILE=arm-unknown-linux-gnueabi- ===================== WARNING ====================== Please convert this board to generic board. Otherwise it will be removed by the end of 2014. See doc/README.generic-board for further information ==================================================== $ ls -l spl/u-boot-spl.bin -rwxrwxr-x 1 masahiro masahiro 2828 Jul 28 00:53 spl/u-boot-spl.bin
It is over 2KB.
So the hardware spilt already? Aww :-(
I wonder, maybe converting this to TPL might be the correct solution ?
Maybe, if you could split it into two images.
I think I might need TPL and SPL:
TPL: Load the SDRAM init code into CPU's SRAM from the OneNAND SPL: Load big U-Boot from OneNAND into the main SDRAM
... or maybe we should just sacrifice the machine in the name of progress and be done with it. I don't know when I might have time to fix it afterall.
Well it sounds like it is already broken. It worries me that SPL has somehow got larger though - any reason for that?
Regards, Simon

On Saturday, August 01, 2015 at 06:08:56 PM, Simon Glass wrote:
Hi Marek,
Hi!
On 28 July 2015 at 09:57, Marek Vasut marex@denx.de wrote:
On Tuesday, July 28, 2015 at 05:53:10 PM, Masahiro Yamada wrote:
[...]
$ git describe v2015.07-307-g2647394 $ make vpac270_ond_256_defconfig # # configuration written to .config # $ make -s CROSS_COMPILE=arm-unknown-linux-gnueabi- ===================== WARNING ====================== Please convert this board to generic board. Otherwise it will be removed by the end of 2014. See doc/README.generic-board for further information ==================================================== $ ls -l spl/u-boot-spl.bin -rwxrwxr-x 1 masahiro masahiro 2828 Jul 28 00:53 spl/u-boot-spl.bin
It is over 2KB.
So the hardware spilt already? Aww :-(
I wonder, maybe converting this to TPL might be the correct solution ?
Maybe, if you could split it into two images.
I think I might need TPL and SPL:
TPL: Load the SDRAM init code into CPU's SRAM from the OneNAND SPL: Load big U-Boot from OneNAND into the main SDRAM
... or maybe we should just sacrifice the machine in the name of progress and be done with it. I don't know when I might have time to fix it afterall.
Well it sounds like it is already broken. It worries me that SPL has somehow got larger though - any reason for that?
I think the machine was always quite borderline and stuffing the SPL into it was always a bit hackish. The changes to the SPL probably just exposed this hackishness.
Best regards, Marek Vasut

If the target string matches "CONFIG_", move the pointer p forward. This saves several 7-chars adjustments.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
scripts/basic/fixdep.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index b304068..46cc1b3 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -251,7 +251,8 @@ static void parse_config_file(const char *map, size_t len) continue; if (memcmp(p, "CONFIG_", 7)) continue; - for (q = p + 7; q < map + len; q++) { + p += 7; + for (q = p; q < map + len; q++) { if (!(isalnum(*q) || *q == '_')) goto found; } @@ -260,9 +261,9 @@ static void parse_config_file(const char *map, size_t len) found: if (!memcmp(q - 7, "_MODULE", 7)) q -= 7; - if( (q-p-7) < 0 ) + if (q - p < 0) continue; - use_config(p+7, q-p-7); + use_config(p, q - p); } }

Commit e02ee2548afe ("kconfig: switch to single .config configuration") made the configuration itself pretty simple, instead, we lost the way to systematically enable/disable config options for each image independently.
Our current strategy is, put entries into Makefile.spl for options we need separate enabling, or once enable the options globally in Kconfig and then undef them in Makefile.uncmd_spl if we do not want to compile the features for SPL at all. Things are getting really messy. Besides, "ifdef CONFIG_SPL_BUILD" are sprinkled everywhere in makefiles.
This commit adds a variable to help describe makefile simpler.
$(SPL_) evaluates to "SPL_" during the SPL build, while to an empty string during building U-boot proper.
So, you can write
obj-$(CONFIG_$(SPL_)FOO) += foo.o
instead of
ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_FOO) += foo.o else obj-$(CONFIG_FOO) += foo.o endif
If CONFIG_SPL_FOO does not exist in Kconfig, it is equivalent to
ifndef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_FOO) += foo.o endif
This is the pattern we often see in our current makefiles.
To take advantage of this macro, we should prefix SPL_ for the SPL version of the option when we need independent control between U-boot and SPL. With this naming scheme, I hope our makefiles will be much simplified.
It means we want to rename existing config options as follows in the long run:
CONFIG_SPL_SERIAL_SUPPORT -> CONFIG_SPL_SERIAL CONFIG_SPL_I2C_SUPPORT -> CONFIG_SPL_I2C CONFIG_SPL_GPIO_SUPPORT -> CONFIG_SPL_GPIO CONFIG_SPL_SPI_SUPPORT -> CONFIG_SPL_SPI CONFIG_SPL_DISABLE_OF_CONTROL -> CONFIG_SPL_OF_CONTROL (inverting the logic)
Then drivers/Makefile would be re-worked as follows:
obj-$(CONFIG_$(SPL_)SERIAL) += serial/ obj-$(CONFIG_$(SPL_)I2C) += i2c/ obj-$(CONFIG_$(SPL_)GPIO) += gpio/ obj-$(CONFIG_$(SPL_)SPI) += spi/ ...
Eventually, SPL-specialized entries in Makefile.spl would go away.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
scripts/Kbuild.include | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index d20f20a..f825f2e 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -294,3 +294,9 @@ why = \
echo-why = $(call escsq, $(strip $(why))) endif + +ifdef CONFIG_SPL_BUILD +SPL_ := SPL_ +else +SPL_ := +endif

The previous commit introduced a useful macro used in makefiles, in order to reference to different variables (CONFIG_... or CONFIG_SPL_...) depending on the build context.
Per-image config option control is a PITA in C sources, too. Here are some macros useful in C/CPP expressions.
CONFIG_IS_ENABLED(FOO) can be used as a shorthand for
(!defined(CONFIG_SPL_BUILD) && defined(CONFIG_FOO)) || \ (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_FOO))
For example, it is useful to describe C code as follows,
#if CONFIG_IS_ENABLED(OF_CONTROL) (device tree code) #else (board file code) #endif
The ifdef conditional above is switched by CONFIG_OF_CONTROL during the U-Boot proper building (CONFIG_SPL_BUILD is not defined), and by CONFIG_SPL_OF_CONTROL during SPL building (CONFIG_SPL_BUILD is defined).
The macro can be used in C context as well, so you can also write the equivalent code as follows:
if (CONFIG_IS_ENABLED(OF_CONTROL)) { (device tree code) } else { (board file code) }
Another useful macro is CONFIG_VALUE(). CONFIG_VALUE(FOO) is expanded into CONFIG_FOO if CONFIG_SPL_BUILD is undefined, and into CONFIG_SPL_FOO if CONFIG_SPL_BUILD is defined.
You can write as follows:
text_base = CONFIG_VALUE(TEXT_BASE);
instead of:
#ifdef CONFIG_SPL_BUILD text_base = CONFIG_SPL_TEXT_BASE; #else text_base = CONFIG_TEXT_BASE; #endif
This commit also adds slight hacking on fixdep so that it can output a correct list of fixed dependencies.
If the fixdep finds CONFIG_IS_ENABLED(FOO) in a source file, we want $(wildcard include/config/foo.h) in the U-boot proper building context, while we want $(wildcard include/config/spl/foo.h) in the SPL build context.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
include/linux/kconfig.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ scripts/basic/fixdep.c | 26 ++++++++++++++++++++++++++ 2 files changed, 74 insertions(+)
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index be342b9..486fb94 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h @@ -43,4 +43,52 @@ */ #define IS_MODULE(option) config_enabled(option##_MODULE)
+/* + * U-Boot add-on: Helper macros to reference to different macros + * (CONFIG_ or CONFIG_SPL_ prefixed), depending on the build context. + */ +#ifdef CONFIG_SPL_BUILD +#define _IS_SPL 1 +#endif + +#define config_val(cfg) _config_val(_IS_SPL, cfg) +#define _config_val(x, cfg) __config_val(x, cfg) +#define __config_val(x, cfg) ___config_val(__ARG_PLACEHOLDER_##x, cfg) +#define ___config_val(arg1_or_junk, cfg) \ + ____config_val(arg1_or_junk CONFIG_SPL_##cfg, CONFIG_##cfg) +#define ____config_val(__ignored, val, ...) val + +/* + * CONFIG_VAL(FOO) evaluates to the value of + * CONFIG_FOO if CONFIG_SPL_BUILD is undefined, + * CONFIG_SPL_FOO if CONFIG_SPL_BUILD is defined. + */ +#define CONFIG_VAL(option) config_val(option) + +/* + * CONFIG_IS_ENABLED(FOO) evaluates to + * 1 if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y' or 'm', + * 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y' or 'm', + * 0 otherwise. + */ +#define CONFIG_IS_ENABLED(option) \ + (config_enabled(CONFIG_VAL(option)) || \ + config_enabled(CONFIG_VAL(option##_MODULE))) + +/* + * CONFIG_IS_BUILTIN(FOO) evaluates to + * 1 if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y', + * 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y', + * 0 otherwise. + */ +#define CONFIG_IS_BUILTIN(option) config_enabled(CONFIG_VAL(option)) + +/* + * CONFIG_IS_MODULE(FOO) evaluates to + * 1 if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'm', + * 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'm', + * 0 otherwise. + */ +#define CONFIG_IS_MODULE(option) config_enabled(CONFIG_VAL(option##_MODULE)) + #endif /* __LINUX_KCONFIG_H */ diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 46cc1b3..20fed03 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -123,6 +123,7 @@ char *target; char *depfile; char *cmdline; +int is_spl_build = 0; /* hack for U-boot */
static void usage(void) { @@ -239,6 +240,7 @@ static void parse_config_file(const char *map, size_t len) /* start at +1, so that p can never be < map */ const int *m = (const int *) map + 1; const char *p, *q; + char tmp_buf[256] = "SPL_"; /* hack for U-Boot */
for (; m < end; m++) { if (*m == INT_CONF) { p = (char *) m ; goto conf; } @@ -263,6 +265,26 @@ static void parse_config_file(const char *map, size_t len) q -= 7; if (q - p < 0) continue; + + /* U-Boot also handles CONFIG_IS_{ENABLED/BUILTIN/MODULE} */ + if ((q - p == 10 && !memcmp(p, "IS_ENABLED(", 11)) || + (q - p == 10 && !memcmp(p, "IS_BUILTIN(", 11)) || + (q - p == 9 && !memcmp(p, "IS_MODULE(", 10))) { + p = q + 1; + for (q = p; q < map + len; q++) + if (*q == ')') + goto found2; + continue; + + found2: + if (is_spl_build) { + memcpy(tmp_buf + 4, p, q - p); + q = tmp_buf + 4 + (q - p); + p = tmp_buf; + } + } + /* end U-Boot hack */ + use_config(p, q - p); } } @@ -456,6 +478,10 @@ int main(int argc, char *argv[]) target = argv[2]; cmdline = argv[3];
+ /* hack for U-boot */ + if (!strncmp(target, "spl/", 4) || !strncmp(target, "tpl/", 4)) + is_spl_build = 1; + print_cmdline(); print_deps();

Nothing special has happened yet. Just preparing for upcoming cleaning.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
drivers/Makefile | 36 ++++++++++++++++++++++++++++++++++++ scripts/Makefile.spl | 30 +----------------------------- 2 files changed, 37 insertions(+), 29 deletions(-)
diff --git a/drivers/Makefile b/drivers/Makefile index 5a35148..2515aab 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -1,3 +1,37 @@ +ifdef CONFIG_SPL_BUILD + +obj-$(CONFIG_SPL_CLK_SUPPORT) += clk/ +obj-$(CONFIG_SPL_DM) += core/ +obj-$(CONFIG_SPL_I2C_SUPPORT) += i2c/ +obj-$(CONFIG_SPL_GPIO_SUPPORT) += gpio/ +obj-$(CONFIG_SPL_MMC_SUPPORT) += mmc/ +obj-$(CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT) += ddr/fsl/ +obj-$(CONFIG_SYS_MVEBU_DDR_A38X) += ddr/marvell/a38x/ +obj-$(CONFIG_SYS_MVEBU_DDR_AXP) += ddr/marvell/axp/ +obj-$(CONFIG_SPL_SERIAL_SUPPORT) += serial/ +obj-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += mtd/spi/ +obj-$(CONFIG_SPL_SPI_SUPPORT) += spi/ +obj-$(CONFIG_SPL_LED_SUPPORT) += led/ +obj-$(CONFIG_SPL_POWER_SUPPORT) += power/ power/pmic/ +obj-$(CONFIG_SPL_POWER_SUPPORT) += power/regulator/ +obj-$(CONFIG_SPL_MTD_SUPPORT) += mtd/ +obj-$(CONFIG_SPL_NAND_SUPPORT) += mtd/nand/ +obj-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += misc/ +obj-$(CONFIG_SPL_ONENAND_SUPPORT) += mtd/onenand/ +obj-$(CONFIG_SPL_DMA_SUPPORT) += dma/ +obj-$(CONFIG_SPL_ETH_SUPPORT) += net/ +obj-$(CONFIG_SPL_ETH_SUPPORT) += net/phy/ +obj-$(CONFIG_SPL_USBETH_SUPPORT) += net/phy/ +obj-$(CONFIG_SPL_RAM_SUPPORT) += ram/ +obj-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += usb/musb-new/ +obj-$(CONFIG_SPL_USBETH_SUPPORT) += usb/gadget/ +obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/ +obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/ +obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/ +obj-$(CONFIG_SPL_SATA_SUPPORT) += block/ + +else + obj-$(CONFIG_CLK) += clk/ obj-$(CONFIG_DM) += core/ obj-$(CONFIG_DM_DEMO) += demo/ @@ -27,3 +61,5 @@ obj-y += input/ # SOC specific infrastructure drivers. obj-y += soc/ obj-y += thermal/ + +endif diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index b1047b5..28bc0d7 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -54,39 +54,11 @@ libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ libs-$(CONFIG_SPL_FRAMEWORK) += common/spl/ libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/ -libs-$(CONFIG_SPL_CLK_SUPPORT) += drivers/clk/ -libs-$(CONFIG_SPL_DM) += drivers/core/ -libs-$(CONFIG_SPL_I2C_SUPPORT) += drivers/i2c/ -libs-$(CONFIG_SPL_GPIO_SUPPORT) += drivers/gpio/ -libs-$(CONFIG_SPL_MMC_SUPPORT) += drivers/mmc/ -libs-$(CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT) += drivers/ddr/fsl/ -libs-$(CONFIG_SYS_MVEBU_DDR_A38X) += drivers/ddr/marvell/a38x/ -libs-$(CONFIG_SYS_MVEBU_DDR_AXP) += drivers/ddr/marvell/axp/ -libs-$(CONFIG_SPL_SERIAL_SUPPORT) += drivers/serial/ -libs-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += drivers/mtd/spi/ -libs-$(CONFIG_SPL_SPI_SUPPORT) += drivers/spi/ +libs-y += drivers/ libs-y += fs/ -libs-$(CONFIG_SPL_LED_SUPPORT) += drivers/led/ libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/ -libs-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ drivers/power/pmic/ -libs-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/regulator/ -libs-$(CONFIG_SPL_MTD_SUPPORT) += drivers/mtd/ -libs-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/ -libs-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += drivers/misc/ -libs-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/ -libs-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/ libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/ libs-$(CONFIG_SPL_NET_SUPPORT) += net/ -libs-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/ -libs-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/phy/ -libs-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/net/phy/ -libs-$(CONFIG_SPL_RAM_SUPPORT) += drivers/ram/ -libs-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += drivers/usb/musb-new/ -libs-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/usb/gadget/ -libs-$(CONFIG_SPL_WATCHDOG_SUPPORT) += drivers/watchdog/ -libs-$(CONFIG_SPL_USB_HOST_SUPPORT) += drivers/usb/host/ -libs-$(CONFIG_OMAP_USB_PHY) += drivers/usb/phy/ -libs-$(CONFIG_SPL_SATA_SUPPORT) += drivers/block/
head-y := $(addprefix $(obj)/,$(head-y)) libs-y := $(addprefix $(obj)/,$(libs-y))

Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
drivers/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/Makefile b/drivers/Makefile index 2515aab..dd57849 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -1,7 +1,8 @@ +obj-$(CONFIG_$(SPL_)DM) += core/ + ifdef CONFIG_SPL_BUILD
obj-$(CONFIG_SPL_CLK_SUPPORT) += clk/ -obj-$(CONFIG_SPL_DM) += core/ obj-$(CONFIG_SPL_I2C_SUPPORT) += i2c/ obj-$(CONFIG_SPL_GPIO_SUPPORT) += gpio/ obj-$(CONFIG_SPL_MMC_SUPPORT) += mmc/ @@ -33,7 +34,6 @@ obj-$(CONFIG_SPL_SATA_SUPPORT) += block/ else
obj-$(CONFIG_CLK) += clk/ -obj-$(CONFIG_DM) += core/ obj-$(CONFIG_DM_DEMO) += demo/ obj-$(CONFIG_BIOSEMU) += bios_emulator/ obj-y += block/

Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
drivers/Makefile | 2 +- drivers/clk/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/Makefile b/drivers/Makefile index dd57849..a1e24c1 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -2,7 +2,7 @@ obj-$(CONFIG_$(SPL_)DM) += core/
ifdef CONFIG_SPL_BUILD
-obj-$(CONFIG_SPL_CLK_SUPPORT) += clk/ +obj-$(CONFIG_SPL_CLK) += clk/ obj-$(CONFIG_SPL_I2C_SUPPORT) += i2c/ obj-$(CONFIG_SPL_GPIO_SUPPORT) += gpio/ obj-$(CONFIG_SPL_MMC_SUPPORT) += mmc/ diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 07eb54c..890f22f 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -8,7 +8,7 @@ config CLK feed into other clocks in a tree structure, with multiplexers to choose the source for each clock.
-config SPL_CLK_SUPPORT +config SPL_CLK bool "Enable clock support in SPL" depends on CLK help

Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
drivers/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/Makefile b/drivers/Makefile index a1e24c1..8d4ac06 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -1,8 +1,8 @@ obj-$(CONFIG_$(SPL_)DM) += core/ +obj-$(CONFIG_$(SPL_)CLK) += clk/
ifdef CONFIG_SPL_BUILD
-obj-$(CONFIG_SPL_CLK) += clk/ obj-$(CONFIG_SPL_I2C_SUPPORT) += i2c/ obj-$(CONFIG_SPL_GPIO_SUPPORT) += gpio/ obj-$(CONFIG_SPL_MMC_SUPPORT) += mmc/ @@ -33,7 +33,6 @@ obj-$(CONFIG_SPL_SATA_SUPPORT) += block/
else
-obj-$(CONFIG_CLK) += clk/ obj-$(CONFIG_DM_DEMO) += demo/ obj-$(CONFIG_BIOSEMU) += bios_emulator/ obj-y += block/

Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
drivers/Makefile | 2 +- drivers/ram/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/Makefile b/drivers/Makefile index 8d4ac06..22d316e 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -23,7 +23,7 @@ obj-$(CONFIG_SPL_DMA_SUPPORT) += dma/ obj-$(CONFIG_SPL_ETH_SUPPORT) += net/ obj-$(CONFIG_SPL_ETH_SUPPORT) += net/phy/ obj-$(CONFIG_SPL_USBETH_SUPPORT) += net/phy/ -obj-$(CONFIG_SPL_RAM_SUPPORT) += ram/ +obj-$(CONFIG_SPL_RAM) += ram/ obj-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += usb/musb-new/ obj-$(CONFIG_SPL_USBETH_SUPPORT) += usb/gadget/ obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/ diff --git a/drivers/ram/Kconfig b/drivers/ram/Kconfig index 642a2d8..ff09f22 100644 --- a/drivers/ram/Kconfig +++ b/drivers/ram/Kconfig @@ -8,7 +8,7 @@ config RAM the RAM size can either be statically defined or dynamically detected.
-config SPL_RAM_SUPPORT +config SPL_RAM bool "Enable RAM support in SPL" depends on RAM help

Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
drivers/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/Makefile b/drivers/Makefile index 22d316e..1baecb4 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -1,5 +1,6 @@ obj-$(CONFIG_$(SPL_)DM) += core/ obj-$(CONFIG_$(SPL_)CLK) += clk/ +obj-$(CONFIG_$(SPL_)RAM) += ram/
ifdef CONFIG_SPL_BUILD
@@ -23,7 +24,6 @@ obj-$(CONFIG_SPL_DMA_SUPPORT) += dma/ obj-$(CONFIG_SPL_ETH_SUPPORT) += net/ obj-$(CONFIG_SPL_ETH_SUPPORT) += net/phy/ obj-$(CONFIG_SPL_USBETH_SUPPORT) += net/phy/ -obj-$(CONFIG_SPL_RAM) += ram/ obj-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += usb/musb-new/ obj-$(CONFIG_SPL_USBETH_SUPPORT) += usb/gadget/ obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/ @@ -45,7 +45,6 @@ obj-$(CONFIG_LED) += led/ obj-y += misc/ obj-y += pcmcia/ obj-y += dfu/ -obj-$(CONFIG_RAM) += ram/ obj-y += rtc/ obj-y += sound/ obj-y += tpm/

Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
drivers/Makefile | 2 +- drivers/led/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/Makefile b/drivers/Makefile index 1baecb4..3188a51 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -13,7 +13,7 @@ obj-$(CONFIG_SYS_MVEBU_DDR_AXP) += ddr/marvell/axp/ obj-$(CONFIG_SPL_SERIAL_SUPPORT) += serial/ obj-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += mtd/spi/ obj-$(CONFIG_SPL_SPI_SUPPORT) += spi/ -obj-$(CONFIG_SPL_LED_SUPPORT) += led/ +obj-$(CONFIG_SPL_LED) += led/ obj-$(CONFIG_SPL_POWER_SUPPORT) += power/ power/pmic/ obj-$(CONFIG_SPL_POWER_SUPPORT) += power/regulator/ obj-$(CONFIG_SPL_MTD_SUPPORT) += mtd/ diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index de5feea..781c410 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -7,7 +7,7 @@ config LED can provide access to board-specific LEDs. Use of the device tree for configuration is encouraged.
-config SPL_LED_SUPPORT +config SPL_LED bool "Enable LED support in SPL" depends on LED help

Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
drivers/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/Makefile b/drivers/Makefile index 3188a51..4901e16 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -1,5 +1,6 @@ obj-$(CONFIG_$(SPL_)DM) += core/ obj-$(CONFIG_$(SPL_)CLK) += clk/ +obj-$(CONFIG_$(SPL_)LED) += led/ obj-$(CONFIG_$(SPL_)RAM) += ram/
ifdef CONFIG_SPL_BUILD @@ -13,7 +14,6 @@ obj-$(CONFIG_SYS_MVEBU_DDR_AXP) += ddr/marvell/axp/ obj-$(CONFIG_SPL_SERIAL_SUPPORT) += serial/ obj-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += mtd/spi/ obj-$(CONFIG_SPL_SPI_SUPPORT) += spi/ -obj-$(CONFIG_SPL_LED) += led/ obj-$(CONFIG_SPL_POWER_SUPPORT) += power/ power/pmic/ obj-$(CONFIG_SPL_POWER_SUPPORT) += power/regulator/ obj-$(CONFIG_SPL_MTD_SUPPORT) += mtd/ @@ -41,7 +41,6 @@ obj-$(CONFIG_CPU) += cpu/ obj-y += crypto/ obj-$(CONFIG_FPGA) += fpga/ obj-y += hwmon/ -obj-$(CONFIG_LED) += led/ obj-y += misc/ obj-y += pcmcia/ obj-y += dfu/

We do not want to compile the DM remove code for SPL. Currently, we undef it in include/config_uncmd_spl.h (for C files) and in scripts/Makefile.uncmd_spl (for Makefiles). This is really ugly.
This commit demonstrates how we can deprecate those two files.
Use $(SPL_) for the entry in the Makfile and CONFIG_IS_ENABLED() in C files.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
drivers/core/Makefile | 2 +- drivers/core/device.c | 6 +++--- drivers/core/uclass.c | 4 ++-- include/config_uncmd_spl.h | 1 - include/dm/device-internal.h | 10 +++++----- include/dm/uclass-internal.h | 4 ++-- scripts/Makefile.uncmd_spl | 2 -- 7 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/drivers/core/Makefile b/drivers/core/Makefile index d3cd968..d7ffac0 100644 --- a/drivers/core/Makefile +++ b/drivers/core/Makefile @@ -9,7 +9,7 @@ obj-$(CONFIG_DEVRES) += devres.o ifndef CONFIG_SPL_BUILD obj-$(CONFIG_OF_CONTROL) += simple-bus.o endif -obj-$(CONFIG_DM_DEVICE_REMOVE) += device-remove.o +obj-$(CONFIG_$(SPL_)DM_DEVICE_REMOVE) += device-remove.o obj-$(CONFIG_DM) += dump.o obj-$(CONFIG_OF_CONTROL) += regmap.o obj-$(CONFIG_OF_CONTROL) += syscon-uclass.o diff --git a/drivers/core/device.c b/drivers/core/device.c index b479be7..47ec9c0 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -140,7 +140,7 @@ int device_bind(struct udevice *parent, const struct driver *drv, return 0;
fail_child_post_bind: - if (IS_ENABLED(CONFIG_DM_DEVICE_REMOVE)) { + if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) { if (drv->unbind && drv->unbind(dev)) { dm_warn("unbind() method failed on dev '%s' on error path\n", dev->name); @@ -148,14 +148,14 @@ fail_child_post_bind: }
fail_bind: - if (IS_ENABLED(CONFIG_DM_DEVICE_REMOVE)) { + if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) { if (uclass_unbind_device(dev)) { dm_warn("Failed to unbind dev '%s' on error path\n", dev->name); } } fail_uclass_bind: - if (IS_ENABLED(CONFIG_DM_DEVICE_REMOVE)) { + if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) { list_del(&dev->sibling_node); if (dev->flags & DM_FLAG_ALLOC_PARENT_PDATA) { free(dev->parent_platdata); diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index aba9880..adf13a7 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -391,7 +391,7 @@ err: return ret; }
-#ifdef CONFIG_DM_DEVICE_REMOVE +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) int uclass_unbind_device(struct udevice *dev) { struct uclass *uc; @@ -471,7 +471,7 @@ int uclass_post_probe_device(struct udevice *dev) return 0; }
-#ifdef CONFIG_DM_DEVICE_REMOVE +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) int uclass_pre_remove_device(struct udevice *dev) { struct uclass_driver *uc_drv; diff --git a/include/config_uncmd_spl.h b/include/config_uncmd_spl.h index c191f56..86cc0c3 100644 --- a/include/config_uncmd_spl.h +++ b/include/config_uncmd_spl.h @@ -32,7 +32,6 @@ #endif
#undef CONFIG_DM_WARN -#undef CONFIG_DM_DEVICE_REMOVE #undef CONFIG_DM_SEQ_ALIAS #undef CONFIG_DM_STDIO
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h index 7da4216..83e7e34 100644 --- a/include/dm/device-internal.h +++ b/include/dm/device-internal.h @@ -87,7 +87,7 @@ int device_probe_child(struct udevice *dev, void *parent_priv); * @dev: Pointer to device to remove * @return 0 if OK, -ve on error (an error here is normally a very bad thing) */ -#ifdef CONFIG_DM_DEVICE_REMOVE +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) int device_remove(struct udevice *dev); #else static inline int device_remove(struct udevice *dev) { return 0; } @@ -101,7 +101,7 @@ static inline int device_remove(struct udevice *dev) { return 0; } * @dev: Pointer to device to unbind * @return 0 if OK, -ve on error */ -#ifdef CONFIG_DM_DEVICE_REMOVE +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) int device_unbind(struct udevice *dev); #else static inline int device_unbind(struct udevice *dev) { return 0; } @@ -112,7 +112,7 @@ static inline int device_unbind(struct udevice *dev) { return 0; } * @dev: The device whose children are to be removed * @return 0 on success, -ve on error */ -#ifdef CONFIG_DM_DEVICE_REMOVE +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) int device_remove_children(struct udevice *dev); #else static inline int device_remove_children(struct udevice *dev) { return 0; } @@ -127,13 +127,13 @@ static inline int device_remove_children(struct udevice *dev) { return 0; } * @dev: The device that is to be stripped of its children * @return 0 on success, -ve on error */ -#ifdef CONFIG_DM_DEVICE_REMOVE +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) int device_unbind_children(struct udevice *dev); #else static inline int device_unbind_children(struct udevice *dev) { return 0; } #endif
-#ifdef CONFIG_DM_DEVICE_REMOVE +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) void device_free(struct udevice *dev); #else static inline void device_free(struct udevice *dev) {} diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h index 9b68508..b51e1da 100644 --- a/include/dm/uclass-internal.h +++ b/include/dm/uclass-internal.h @@ -116,7 +116,7 @@ int uclass_bind_device(struct udevice *dev); * @dev: Pointer to the device * #return 0 on success, -ve on error */ -#ifdef CONFIG_DM_DEVICE_REMOVE +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) int uclass_unbind_device(struct udevice *dev); #else static inline int uclass_unbind_device(struct udevice *dev) { return 0; } @@ -153,7 +153,7 @@ int uclass_post_probe_device(struct udevice *dev); * @dev: Pointer to the device * #return 0 on success, -ve on error */ -#ifdef CONFIG_DM_DEVICE_REMOVE +#if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) int uclass_pre_remove_device(struct udevice *dev); #else static inline int uclass_pre_remove_device(struct udevice *dev) { return 0; } diff --git a/scripts/Makefile.uncmd_spl b/scripts/Makefile.uncmd_spl index 4f05652..a0630d1 100644 --- a/scripts/Makefile.uncmd_spl +++ b/scripts/Makefile.uncmd_spl @@ -15,6 +15,4 @@ CONFIG_DM_SPI= CONFIG_DM_SPI_FLASH= endif
-CONFIG_DM_DEVICE_REMOVE= - endif

There is no case where defined(SPL_DISABLE_OF_CONTROL) is true.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
include/fdtdec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/fdtdec.h b/include/fdtdec.h index 2323603..46a3482 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -48,7 +48,7 @@ struct fdt_memory { #endif
#ifdef CONFIG_OF_CONTROL -# if defined(CONFIG_SPL_BUILD) && defined(SPL_DISABLE_OF_CONTROL) +# if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DISABLE_OF_CONTROL) # define OF_CONTROL 0 # else # define OF_CONTROL 1

As we discussed a couple of times, negative CONFIG options make our life difficult; CONFIG_SYS_NO_FLASH, CONFIG_SYS_DCACHE_OFF, ... and here is another one.
Now, there are actually two boards enabling OF_CONTROL on SPL: - socfpga_arria5_defconfig - socfpga_cyclone5_defconfig
But they were enabled by mistake.
Commit 47a785a9dd97 ("dts: Disable device tree for SPL on all boards") missed to add CONFIG_SPL_DISABLE_OF_CONTROL on those two boards. They were silently enabled with OF_CONTROL on SPL without notifying their maintainers.
After all, there exist no boards to support it in a justified process.
Before being too late, delete all the defines in defconfig files and 'select's in Kconfig, and invert the logic.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
arch/arm/Kconfig | 4 ---- arch/arm/cpu/armv7/exynos/Kconfig | 8 -------- arch/arm/cpu/armv7/s5pc1xx/Kconfig | 2 -- common/spl/spl.c | 2 +- configs/am335x_boneblack_vboot_defconfig | 1 - configs/arches_defconfig | 1 - configs/canyonlands_defconfig | 1 - configs/galileo_defconfig | 1 - configs/microblaze-generic_defconfig | 1 - configs/odroid_defconfig | 1 - configs/origen_defconfig | 1 - configs/s5pc210_universal_defconfig | 1 - configs/socfpga_socrates_defconfig | 1 - configs/trats2_defconfig | 1 - configs/trats_defconfig | 1 - dts/Kconfig | 6 +++--- include/config_uncmd_spl.h | 2 +- include/fdtdec.h | 2 +- lib/Makefile | 8 +++++++- scripts/Makefile.uncmd_spl | 2 +- 20 files changed, 14 insertions(+), 33 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 103ad7a..c00d088 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -647,7 +647,6 @@ config ARCH_SUNXI select DM_GPIO select OF_CONTROL select OF_SEPARATE - select SPL_DISABLE_OF_CONTROL
config TARGET_SNOWBALL bool "Support snowball" @@ -670,7 +669,6 @@ config ARCH_ZYNQ select CPU_V7 select SUPPORT_SPL select OF_CONTROL - select SPL_DISABLE_OF_CONTROL select DM select DM_SPI select DM_SPI_FLASH @@ -684,7 +682,6 @@ config TEGRA select SUPPORT_SPL select SPL select OF_CONTROL - select SPL_DISABLE_OF_CONTROL select CPU_V7 select DM select DM_SPI_FLASH @@ -806,7 +803,6 @@ config ARCH_UNIPHIER select DM select DM_SERIAL select DM_I2C - select SPL_DISABLE_OF_CONTROL help Support for UniPhier SoC family developed by Socionext Inc. (formerly, System LSI Business Division of Panasonic Corporation) diff --git a/arch/arm/cpu/armv7/exynos/Kconfig b/arch/arm/cpu/armv7/exynos/Kconfig index 4a7d82f..09cde42 100644 --- a/arch/arm/cpu/armv7/exynos/Kconfig +++ b/arch/arm/cpu/armv7/exynos/Kconfig @@ -8,7 +8,6 @@ config TARGET_SMDKV310 select SUPPORT_SPL bool "Exynos4210 SMDKV310 board" select OF_CONTROL - select SPL_DISABLE_OF_CONTROL
config TARGET_TRATS bool "Exynos4210 Trats board" @@ -29,7 +28,6 @@ config TARGET_ODROID config TARGET_ODROID_XU3 bool "Exynos5422 Odroid board" select OF_CONTROL - select SPL_DISABLE_OF_CONTROL
config TARGET_ARNDALE bool "Exynos5250 Arndale board" @@ -37,37 +35,31 @@ config TARGET_ARNDALE select CPU_V7_HAS_VIRT select SUPPORT_SPL select OF_CONTROL - select SPL_DISABLE_OF_CONTROL
config TARGET_SMDK5250 bool "SMDK5250 board" select SUPPORT_SPL select OF_CONTROL - select SPL_DISABLE_OF_CONTROL
config TARGET_SNOW bool "Snow board" select SUPPORT_SPL select OF_CONTROL - select SPL_DISABLE_OF_CONTROL
config TARGET_SMDK5420 bool "SMDK5420 board" select SUPPORT_SPL select OF_CONTROL - select SPL_DISABLE_OF_CONTROL
config TARGET_PEACH_PI bool "Peach Pi board" select SUPPORT_SPL select OF_CONTROL - select SPL_DISABLE_OF_CONTROL
config TARGET_PEACH_PIT bool "Peach Pit board" select SUPPORT_SPL select OF_CONTROL - select SPL_DISABLE_OF_CONTROL
endchoice
diff --git a/arch/arm/cpu/armv7/s5pc1xx/Kconfig b/arch/arm/cpu/armv7/s5pc1xx/Kconfig index 792ef59..04acdaa 100644 --- a/arch/arm/cpu/armv7/s5pc1xx/Kconfig +++ b/arch/arm/cpu/armv7/s5pc1xx/Kconfig @@ -7,12 +7,10 @@ choice config TARGET_S5P_GONI bool "S5P Goni board" select OF_CONTROL - select SPL_DISABLE_OF_CONTROL
config TARGET_SMDKC100 bool "Support smdkc100 board" select OF_CONTROL - select SPL_DISABLE_OF_CONTROL
endchoice
diff --git a/common/spl/spl.c b/common/spl/spl.c index 94b01da..45cf925 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -158,7 +158,7 @@ int spl_init(void) gd->malloc_ptr = 0; #endif if (IS_ENABLED(CONFIG_OF_CONTROL) && - !IS_ENABLED(CONFIG_SPL_DISABLE_OF_CONTROL)) { + IS_ENABLED(CONFIG_SPL_OF_CONTROL)) { ret = fdtdec_setup(); if (ret) { debug("fdtdec_setup() returned error %d\n", ret); diff --git a/configs/am335x_boneblack_vboot_defconfig b/configs/am335x_boneblack_vboot_defconfig index b141255..b52ddfd 100644 --- a/configs/am335x_boneblack_vboot_defconfig +++ b/configs/am335x_boneblack_vboot_defconfig @@ -12,5 +12,4 @@ CONFIG_SYS_EXTRA_OPTIONS="EMMC_BOOT,ENABLE_VBOOT" # CONFIG_CMD_FLASH is not set # CONFIG_CMD_SETEXPR is not set CONFIG_OF_CONTROL=y -CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_SPI_FLASH=y diff --git a/configs/arches_defconfig b/configs/arches_defconfig index f979a64..9084a3a 100644 --- a/configs/arches_defconfig +++ b/configs/arches_defconfig @@ -4,4 +4,3 @@ CONFIG_TARGET_CANYONLANDS=y CONFIG_ARCHES=y CONFIG_DEFAULT_DEVICE_TREE="arches" CONFIG_OF_CONTROL=y -CONFIG_SPL_DISABLE_OF_CONTROL=y diff --git a/configs/canyonlands_defconfig b/configs/canyonlands_defconfig index 09172b1..44d4fbd 100644 --- a/configs/canyonlands_defconfig +++ b/configs/canyonlands_defconfig @@ -4,5 +4,4 @@ CONFIG_TARGET_CANYONLANDS=y CONFIG_CANYONLANDS=y CONFIG_DEFAULT_DEVICE_TREE="canyonlands" CONFIG_OF_CONTROL=y -CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_OF_EMBED=y diff --git a/configs/galileo_defconfig b/configs/galileo_defconfig index 1ced47e..14842f3 100644 --- a/configs/galileo_defconfig +++ b/configs/galileo_defconfig @@ -11,7 +11,6 @@ CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y CONFIG_CMD_BOOTSTAGE=y CONFIG_OF_CONTROL=y -CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_SPI_FLASH=y CONFIG_NETDEVICES=y CONFIG_ETH_DESIGNWARE=y diff --git a/configs/microblaze-generic_defconfig b/configs/microblaze-generic_defconfig index 8355c67..060a697 100644 --- a/configs/microblaze-generic_defconfig +++ b/configs/microblaze-generic_defconfig @@ -4,5 +4,4 @@ CONFIG_DEFAULT_DEVICE_TREE="microblaze-generic" CONFIG_SPL=y # CONFIG_CMD_SETEXPR is not set CONFIG_OF_CONTROL=y -CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_OF_EMBED=y diff --git a/configs/odroid_defconfig b/configs/odroid_defconfig index 3104f88..0fb01e7 100644 --- a/configs/odroid_defconfig +++ b/configs/odroid_defconfig @@ -11,7 +11,6 @@ CONFIG_DEFAULT_DEVICE_TREE="exynos4412-odroid" CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y CONFIG_OF_CONTROL=y -CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_DM_I2C=y CONFIG_DM_I2C_COMPAT=y CONFIG_DM_PMIC=y diff --git a/configs/origen_defconfig b/configs/origen_defconfig index 6961978..7e5a37c 100644 --- a/configs/origen_defconfig +++ b/configs/origen_defconfig @@ -10,6 +10,5 @@ CONFIG_SPL=y # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set CONFIG_OF_CONTROL=y -CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_USB=y CONFIG_DM_USB=y diff --git a/configs/s5pc210_universal_defconfig b/configs/s5pc210_universal_defconfig index 21a4708..999da4c 100644 --- a/configs/s5pc210_universal_defconfig +++ b/configs/s5pc210_universal_defconfig @@ -9,6 +9,5 @@ CONFIG_DEFAULT_DEVICE_TREE="exynos4210-universal_c210" # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set CONFIG_OF_CONTROL=y -CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_USB=y CONFIG_DM_USB=y diff --git a/configs/socfpga_socrates_defconfig b/configs/socfpga_socrates_defconfig index 63dda73..140d300 100644 --- a/configs/socfpga_socrates_defconfig +++ b/configs/socfpga_socrates_defconfig @@ -6,7 +6,6 @@ CONFIG_SPL=y # CONFIG_CMD_IMLS is not set # CONFIG_CMD_FLASH is not set CONFIG_OF_CONTROL=y -CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_SPI_FLASH=y CONFIG_NETDEVICES=y CONFIG_ETH_DESIGNWARE=y diff --git a/configs/trats2_defconfig b/configs/trats2_defconfig index f3cbe6d..f2452dc 100644 --- a/configs/trats2_defconfig +++ b/configs/trats2_defconfig @@ -10,6 +10,5 @@ CONFIG_DEFAULT_DEVICE_TREE="exynos4412-trats2" # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set CONFIG_OF_CONTROL=y -CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_USB=y CONFIG_DM_USB=y diff --git a/configs/trats_defconfig b/configs/trats_defconfig index 6553edb..f0ce56a 100644 --- a/configs/trats_defconfig +++ b/configs/trats_defconfig @@ -9,6 +9,5 @@ CONFIG_DEFAULT_DEVICE_TREE="exynos4210-trats" # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set CONFIG_OF_CONTROL=y -CONFIG_SPL_DISABLE_OF_CONTROL=y CONFIG_USB=y CONFIG_DM_USB=y diff --git a/dts/Kconfig b/dts/Kconfig index 09cfefb..d72a909 100644 --- a/dts/Kconfig +++ b/dts/Kconfig @@ -14,9 +14,9 @@ config OF_CONTROL This feature provides for run-time configuration of U-Boot via a flattened device tree.
-config SPL_DISABLE_OF_CONTROL - bool "Disable run-time configuration via Device Tree in SPL" - depends on OF_CONTROL +config SPL_OF_CONTROL + bool "Enable run-time configuration via Device Tree in SPL" + depends on SPL && OF_CONTROL help Some boards use device tree in U-Boot but only have 4KB of SRAM which is not enough to support device tree. Enable this option to diff --git a/include/config_uncmd_spl.h b/include/config_uncmd_spl.h index 86cc0c3..2741fc8 100644 --- a/include/config_uncmd_spl.h +++ b/include/config_uncmd_spl.h @@ -20,7 +20,7 @@ #undef CONFIG_CMD_SNTP #undef CONFIG_CMD_TFTPPUT #undef CONFIG_CMD_TFTPSRV -#ifdef CONFIG_SPL_DISABLE_OF_CONTROL +#ifndef CONFIG_SPL_OF_CONTROL #undef CONFIG_OF_CONTROL #endif
diff --git a/include/fdtdec.h b/include/fdtdec.h index 46a3482..8e03000 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -48,7 +48,7 @@ struct fdt_memory { #endif
#ifdef CONFIG_OF_CONTROL -# if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_DISABLE_OF_CONTROL) +# if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_OF_CONTROL) # define OF_CONTROL 0 # else # define OF_CONTROL 1 diff --git a/lib/Makefile b/lib/Makefile index fd106b9..c6576d8 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -48,7 +48,13 @@ obj-$(CONFIG_BITREVERSE) += bitrev.o obj-y += list_sort.o endif
-ifndef CONFIG_SPL_DISABLE_OF_CONTROL +ifndef CONFIG_SPL_BUILD +obj-$(CONFIG_OF_LIBFDT) += libfdt/ +obj-$(CONFIG_OF_CONTROL) += fdtdec_common.o +obj-$(CONFIG_OF_CONTROL) += fdtdec.o +endif + +ifdef CONFIG_SPL_OF_CONTROL obj-$(CONFIG_OF_LIBFDT) += libfdt/ obj-$(CONFIG_OF_CONTROL) += fdtdec_common.o obj-$(CONFIG_OF_CONTROL) += fdtdec.o diff --git a/scripts/Makefile.uncmd_spl b/scripts/Makefile.uncmd_spl index a0630d1..b90fcb8 100644 --- a/scripts/Makefile.uncmd_spl +++ b/scripts/Makefile.uncmd_spl @@ -3,7 +3,7 @@ # TODO: Invent a better way
ifdef CONFIG_SPL_BUILD -ifdef CONFIG_SPL_DISABLE_OF_CONTROL +ifndef CONFIG_SPL_OF_CONTROL CONFIG_OF_CONTROL= endif

We have flipped CONFIG_SPL_DISABLE_OF_CONTROL. We have cleansing devices, $(SPL_) and CONFIG_IS_ENABLED(), so we are ready to clear away the ugly logic in include/fdtdec.h:
#ifdef CONFIG_OF_CONTROL # if defined(CONFIG_SPL_BUILD) && !defined(SPL_OF_CONTROL) # define OF_CONTROL 0 # else # define OF_CONTROL 1 # endif #else # define OF_CONTROL 0 #endif
Now CONFIG_IS_ENABLED(OF_CONTROL) is the substitute. It refers to CONFIG_OF_CONTROL for U-boot proper and CONFIG_SPL_OF_CONTROL for SPL.
Also, we no longer have to cancel CONFIG_OF_CONTROL in include/config_uncmd_spl.h and scripts/Makefile.spl.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com ---
arch/arm/cpu/armv7/am33xx/board.c | 2 +- arch/arm/cpu/armv7/exynos/pinmux.c | 2 +- arch/arm/include/asm/arch-exynos/dwmmc.h | 2 -- arch/arm/include/asm/arch-exynos/mipi_dsim.h | 2 -- arch/arm/include/asm/arch-exynos/mmc.h | 2 -- arch/arm/mach-tegra/clock.c | 4 ++-- arch/arm/mach-tegra/tegra114/clock.c | 4 ++-- arch/arm/mach-tegra/tegra124/clock.c | 4 ++-- arch/arm/mach-tegra/tegra20/clock.c | 4 ++-- arch/arm/mach-tegra/tegra30/clock.c | 4 ++-- board/xilinx/microblaze-generic/microblaze-generic.c | 2 +- board/xilinx/zynq/board.c | 2 +- common/cli.c | 4 ++-- common/spl/spl.c | 3 +-- drivers/core/Makefile | 6 +++--- drivers/core/device.c | 4 ++-- drivers/core/lists.c | 2 +- drivers/core/root.c | 6 +++--- drivers/gpio/mxc_gpio.c | 2 +- drivers/gpio/vybrid_gpio.c | 2 +- drivers/i2c/s3c24x0_i2c.c | 4 ++-- drivers/input/Makefile | 3 ++- drivers/input/tegra-kbc.c | 2 +- drivers/mmc/exynos_dw_mmc.c | 2 +- drivers/mmc/s5p_sdhci.c | 2 +- drivers/mmc/tegra_mmc.c | 2 +- drivers/mmc/zynq_sdhci.c | 2 +- drivers/mtd/spi/sf_probe.c | 6 +++--- drivers/net/xilinx_emaclite.c | 2 +- drivers/net/zynq_gem.c | 2 +- drivers/power/exynos-tmu.c | 2 +- drivers/power/pmic/pmic_max77686.c | 4 ++-- drivers/serial/ns16550.c | 2 +- drivers/serial/serial-uclass.c | 4 ++-- drivers/serial/serial_omap.c | 2 +- drivers/serial/serial_pl01x.c | 2 +- drivers/serial/serial_tegra.c | 4 ++-- drivers/serial/serial_uniphier.c | 2 +- drivers/serial/serial_zynq.c | 2 +- drivers/sound/max98095.c | 2 +- drivers/sound/wm8994.c | 2 +- drivers/tpm/tpm_tis_i2c.c | 2 +- drivers/video/exynos_dp.c | 4 ++-- drivers/video/exynos_dp_lowlevel.c | 2 +- drivers/video/exynos_fb.c | 8 ++++---- drivers/video/exynos_fimd.c | 4 ++-- drivers/video/exynos_mipi_dsi.c | 4 ++-- drivers/video/tegra.c | 2 +- include/cli.h | 2 +- include/config_uncmd_spl.h | 3 --- include/configs/microblaze-generic.h | 3 ++- include/configs/socfpga_common.h | 2 +- include/dm/device.h | 4 ++-- include/fdtdec.h | 10 ---------- lib/Makefile | 11 ++++------- lib/fdtdec.c | 4 ++-- scripts/Makefile.uncmd_spl | 3 --- 57 files changed, 81 insertions(+), 105 deletions(-)
diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c index 67bef23..089b4d0 100644 --- a/arch/arm/cpu/armv7/am33xx/board.c +++ b/arch/arm/cpu/armv7/am33xx/board.c @@ -61,7 +61,7 @@ U_BOOT_DEVICES(am33xx_gpios) = { #endif };
-# ifndef CONFIG_OF_CONTROL +# if !CONFIG_IS_ENABLED(OF_CONTROL) /* * TODO(sjg@chromium.org): When we can move SPL serial to DM, we can remove * the CONFIGs. At the same time, we should move this to the board files. diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c b/arch/arm/cpu/armv7/exynos/pinmux.c index be43e22..130a844 100644 --- a/arch/arm/cpu/armv7/exynos/pinmux.c +++ b/arch/arm/cpu/armv7/exynos/pinmux.c @@ -864,7 +864,7 @@ int exynos_pinmux_config(int peripheral, int flags) return -1; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) static int exynos4_pinmux_decode_periph_id(const void *blob, int node) { int err; diff --git a/arch/arm/include/asm/arch-exynos/dwmmc.h b/arch/arm/include/asm/arch-exynos/dwmmc.h index a7ca12c..bd997ad 100644 --- a/arch/arm/include/asm/arch-exynos/dwmmc.h +++ b/arch/arm/include/asm/arch-exynos/dwmmc.h @@ -27,7 +27,5 @@ #define DWMCI_DIVRATIO_BIT 24 #define DWMCI_DIVRATIO_MASK 0x7
-#ifdef CONFIG_OF_CONTROL int exynos_dwmmc_init(const void *blob); -#endif int exynos_dwmci_add_port(int index, u32 regbase, int bus_width, u32 clksel); diff --git a/arch/arm/include/asm/arch-exynos/mipi_dsim.h b/arch/arm/include/asm/arch-exynos/mipi_dsim.h index 50e5c25..c9e8e06 100644 --- a/arch/arm/include/asm/arch-exynos/mipi_dsim.h +++ b/arch/arm/include/asm/arch-exynos/mipi_dsim.h @@ -374,7 +374,5 @@ void exynos_init_dsim_platform_data(vidinfo_t *vid); /* panel driver init based on mipi dsi interface */ void s6e8ax0_init(void);
-#ifdef CONFIG_OF_CONTROL extern int mipi_power(void); -#endif #endif /* _DSIM_H */ diff --git a/arch/arm/include/asm/arch-exynos/mmc.h b/arch/arm/include/asm/arch-exynos/mmc.h index 0fb6461..48b8c4d 100644 --- a/arch/arm/include/asm/arch-exynos/mmc.h +++ b/arch/arm/include/asm/arch-exynos/mmc.h @@ -65,8 +65,6 @@ static inline int s5p_mmc_init(int index, int bus_width) return s5p_sdhci_init(base, index, bus_width); }
-#ifdef CONFIG_OF_CONTROL int exynos_mmc_init(const void *blob); -#endif
#endif diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c index 24047b8..d37a31a 100644 --- a/arch/arm/mach-tegra/clock.c +++ b/arch/arm/mach-tegra/clock.c @@ -563,7 +563,7 @@ void clock_ll_start_uart(enum periph_id periph_id) reset_set_enable(periph_id, 0); }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) int clock_decode_periph_id(const void *blob, int node) { enum periph_id id; @@ -578,7 +578,7 @@ int clock_decode_periph_id(const void *blob, int node) assert(clock_periph_id_isvalid(id)); return id; } -#endif /* CONFIG_OF_CONTROL */ +#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
int clock_verify(void) { diff --git a/arch/arm/mach-tegra/tegra114/clock.c b/arch/arm/mach-tegra/tegra114/clock.c index d5194e1..0e1912b 100644 --- a/arch/arm/mach-tegra/tegra114/clock.c +++ b/arch/arm/mach-tegra/tegra114/clock.c @@ -561,7 +561,7 @@ void reset_set_enable(enum periph_id periph_id, int enable) writel(reg, reset); }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) /* * Convert a device tree clock ID to our peripheral ID. They are mostly * the same but we are very cautious so we check that a valid clock ID is @@ -597,7 +597,7 @@ enum periph_id clk_id_to_periph_id(int clk_id) return clk_id; } } -#endif /* CONFIG_OF_CONTROL */ +#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
void clock_early_init(void) { diff --git a/arch/arm/mach-tegra/tegra124/clock.c b/arch/arm/mach-tegra/tegra124/clock.c index b955848..63990ce 100644 --- a/arch/arm/mach-tegra/tegra124/clock.c +++ b/arch/arm/mach-tegra/tegra124/clock.c @@ -700,7 +700,7 @@ void reset_set_enable(enum periph_id periph_id, int enable) writel(reg, reset); }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) /* * Convert a device tree clock ID to our peripheral ID. They are mostly * the same but we are very cautious so we check that a valid clock ID is @@ -766,7 +766,7 @@ enum periph_id clk_id_to_periph_id(int clk_id) return clk_id; } } -#endif /* CONFIG_OF_CONTROL */ +#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
void clock_early_init(void) { diff --git a/arch/arm/mach-tegra/tegra20/clock.c b/arch/arm/mach-tegra/tegra20/clock.c index 7b9e10c..fcb2013 100644 --- a/arch/arm/mach-tegra/tegra20/clock.c +++ b/arch/arm/mach-tegra/tegra20/clock.c @@ -475,7 +475,7 @@ void reset_set_enable(enum periph_id periph_id, int enable) writel(reg, reset); }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) /* * Convert a device tree clock ID to our peripheral ID. They are mostly * the same but we are very cautious so we check that a valid clock ID is @@ -510,7 +510,7 @@ enum periph_id clk_id_to_periph_id(int clk_id) return clk_id; } } -#endif /* CONFIG_OF_CONTROL */ +#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
void clock_early_init(void) { diff --git a/arch/arm/mach-tegra/tegra30/clock.c b/arch/arm/mach-tegra/tegra30/clock.c index 0eb0f0a..e9d89a1 100644 --- a/arch/arm/mach-tegra/tegra30/clock.c +++ b/arch/arm/mach-tegra/tegra30/clock.c @@ -541,7 +541,7 @@ void reset_set_enable(enum periph_id periph_id, int enable) writel(reg, reset); }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) /* * Convert a device tree clock ID to our peripheral ID. They are mostly * the same but we are very cautious so we check that a valid clock ID is @@ -579,7 +579,7 @@ enum periph_id clk_id_to_periph_id(int clk_id) return clk_id; } } -#endif /* CONFIG_OF_CONTROL */ +#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
void clock_early_init(void) { diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c index 375cd0b..0c8bd7d 100644 --- a/board/xilinx/microblaze-generic/microblaze-generic.c +++ b/board/xilinx/microblaze-generic/microblaze-generic.c @@ -24,7 +24,7 @@ DECLARE_GLOBAL_DATA_PTR; static int reset_pin = -1; #endif
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) ulong ram_base;
void dram_init_banksize(void) diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 738c31c..237f2c2 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -154,7 +154,7 @@ int board_mmc_init(bd_t *bd)
int dram_init(void) { -#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) int node; fdt_addr_t addr; fdt_size_t size; diff --git a/common/cli.c b/common/cli.c index 075ae9d..b6ae80a 100644 --- a/common/cli.c +++ b/common/cli.c @@ -135,7 +135,7 @@ int do_run(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } #endif
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) bool cli_process_fdt(const char **cmdp) { /* Allow the fdt to override the boot command */ @@ -196,7 +196,7 @@ err: */ hang(); } -#endif /* CONFIG_OF_CONTROL */ +#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
void cli_loop(void) { diff --git a/common/spl/spl.c b/common/spl/spl.c index 45cf925..a5892d7 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -157,8 +157,7 @@ int spl_init(void) gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN; gd->malloc_ptr = 0; #endif - if (IS_ENABLED(CONFIG_OF_CONTROL) && - IS_ENABLED(CONFIG_SPL_OF_CONTROL)) { + if (CONFIG_IS_ENABLED(OF_CONTROL)) { ret = fdtdec_setup(); if (ret) { debug("fdtdec_setup() returned error %d\n", ret); diff --git a/drivers/core/Makefile b/drivers/core/Makefile index d7ffac0..04fdf19 100644 --- a/drivers/core/Makefile +++ b/drivers/core/Makefile @@ -7,9 +7,9 @@ obj-y += device.o lists.o root.o uclass.o util.o obj-$(CONFIG_DEVRES) += devres.o ifndef CONFIG_SPL_BUILD -obj-$(CONFIG_OF_CONTROL) += simple-bus.o +obj-$(CONFIG_$(SPL_)OF_CONTROL) += simple-bus.o endif obj-$(CONFIG_$(SPL_)DM_DEVICE_REMOVE) += device-remove.o obj-$(CONFIG_DM) += dump.o -obj-$(CONFIG_OF_CONTROL) += regmap.o -obj-$(CONFIG_OF_CONTROL) += syscon-uclass.o +obj-$(CONFIG_$(SPL_)OF_CONTROL) += regmap.o +obj-$(CONFIG_$(SPL_)OF_CONTROL) += syscon-uclass.o diff --git a/drivers/core/device.c b/drivers/core/device.c index 47ec9c0..cd9cc10 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -59,7 +59,7 @@ int device_bind(struct udevice *parent, const struct driver *drv,
dev->seq = -1; dev->req_seq = -1; - if (IS_ENABLED(CONFIG_OF_CONTROL) && IS_ENABLED(CONFIG_DM_SEQ_ALIAS)) { + if (CONFIG_IS_ENABLED(OF_CONTROL) && IS_ENABLED(CONFIG_DM_SEQ_ALIAS)) { /* * Some devices, such as a SPI bus, I2C bus and serial ports * are numbered using aliases. @@ -559,7 +559,7 @@ const char *dev_get_uclass_name(struct udevice *dev) return dev->uclass->uc_drv->name; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) fdt_addr_t dev_get_addr(struct udevice *dev) { return fdtdec_get_addr(gd->fdt_blob, dev->of_offset, "reg"); diff --git a/drivers/core/lists.c b/drivers/core/lists.c index 2e52500..a1c9478 100644 --- a/drivers/core/lists.c +++ b/drivers/core/lists.c @@ -99,7 +99,7 @@ int device_bind_driver_to_node(struct udevice *parent, const char *drv_name, return 0; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) /** * driver_check_compatible() - Check if a driver is compatible with this node * diff --git a/drivers/core/root.c b/drivers/core/root.c index 12d0460..78ab00c 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -114,7 +114,7 @@ int dm_init(void) ret = device_bind_by_name(NULL, false, &root_info, &DM_ROOT_NON_CONST); if (ret) return ret; -#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) DM_ROOT_NON_CONST->of_offset = 0; #endif ret = device_probe(DM_ROOT_NON_CONST); @@ -145,7 +145,7 @@ int dm_scan_platdata(bool pre_reloc_only) return ret; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) int dm_scan_fdt_node(struct udevice *parent, const void *blob, int offset, bool pre_reloc_only) { @@ -198,7 +198,7 @@ int dm_init_and_scan(bool pre_reloc_only) return ret; }
- if (OF_CONTROL) { + if (CONFIG_IS_ENABLED(OF_CONTROL)) { ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only); if (ret) { debug("dm_scan_fdt() failed: %d\n", ret); diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c index 2012f99..c6dd575 100644 --- a/drivers/gpio/mxc_gpio.c +++ b/drivers/gpio/mxc_gpio.c @@ -332,7 +332,7 @@ U_BOOT_DRIVER(gpio_mxc) = { .bind = mxc_gpio_bind, };
-#ifndef CONFIG_OF_CONTROL +#if !CONFIG_IS_ENABLED(OF_CONTROL) static const struct mxc_gpio_plat mxc_plat[] = { { 0, (struct gpio_regs *)GPIO1_BASE_ADDR }, { 1, (struct gpio_regs *)GPIO2_BASE_ADDR }, diff --git a/drivers/gpio/vybrid_gpio.c b/drivers/gpio/vybrid_gpio.c index 6eaf0a9..4d25f9a 100644 --- a/drivers/gpio/vybrid_gpio.c +++ b/drivers/gpio/vybrid_gpio.c @@ -135,7 +135,7 @@ static int vybrid_gpio_bind(struct udevice *dev) return 0; }
-#ifndef CONFIG_OF_CONTROL +#if !CONFIG_IS_ENABLED(OF_CONTROL) static const struct vybrid_gpio_platdata vybrid_gpio[] = { {0, GPIO0_BASE_ADDR, "GPIO0 "}, {1, GPIO1_BASE_ADDR, "GPIO1 "}, diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c index 9a04e48..02b0ae9 100644 --- a/drivers/i2c/s3c24x0_i2c.c +++ b/drivers/i2c/s3c24x0_i2c.c @@ -1002,7 +1002,7 @@ static int s3c24x0_i2c_write(struct i2c_adapter *adap, uchar chip, uint addr, } }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) static void process_nodes(const void *blob, int node_list[], int count, int is_highspeed) { @@ -1101,7 +1101,7 @@ int i2c_reset_port_fdt(const void *blob, int node)
return 0; } -#endif /* CONFIG_OF_CONTROL */ +#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
#ifdef CONFIG_EXYNOS5 static void exynos_i2c_init(struct i2c_adapter *adap, int speed, int slaveaddr) diff --git a/drivers/input/Makefile b/drivers/input/Makefile index a8e9be2..117da9a 100644 --- a/drivers/input/Makefile +++ b/drivers/input/Makefile @@ -13,4 +13,5 @@ obj-y += keyboard.o pc_keyb.o obj-$(CONFIG_PS2MULT) += ps2mult.o ps2ser.o endif obj-y += input.o -obj-$(CONFIG_OF_CONTROL) += key_matrix.o + +obj-$(CONFIG_$(SPL_)OF_CONTROL) += key_matrix.o diff --git a/drivers/input/tegra-kbc.c b/drivers/input/tegra-kbc.c index 0ef94f7..c9c9fac 100644 --- a/drivers/input/tegra-kbc.c +++ b/drivers/input/tegra-kbc.c @@ -295,7 +295,7 @@ static int init_tegra_keyboard(struct stdio_dev *dev) if (config.created) return 0;
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) int node;
node = fdtdec_next_compatible(gd->fdt_blob, 0, diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c index e083745..cde2ba7 100644 --- a/drivers/mmc/exynos_dw_mmc.c +++ b/drivers/mmc/exynos_dw_mmc.c @@ -158,7 +158,7 @@ int exynos_dwmci_add_port(int index, u32 regbase, int bus_width, u32 clksel) return exynos_dwmci_core_init(host, index); }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) static struct dwmci_host dwmci_host[DWMMC_MAX_CH_NUM];
static int do_dwmci_init(struct dwmci_host *host) diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c index 8e1968a..edaff79 100644 --- a/drivers/mmc/s5p_sdhci.c +++ b/drivers/mmc/s5p_sdhci.c @@ -96,7 +96,7 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width) return s5p_sdhci_core_init(host); }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) struct sdhci_host sdhci_host[SDHCI_MAX_HOSTS];
static int do_sdhci_init(struct sdhci_host *host) diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c index d555692..0601376 100644 --- a/drivers/mmc/tegra_mmc.c +++ b/drivers/mmc/tegra_mmc.c @@ -21,7 +21,7 @@ DECLARE_GLOBAL_DATA_PTR;
struct mmc_host mmc_host[CONFIG_SYS_MMC_MAX_DEVICE];
-#ifndef CONFIG_OF_CONTROL +#if !CONFIG_IS_ENABLED(OF_CONTROL) #error "Please enable device tree support to use this driver" #endif
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index 971acbb..c69f5d4 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -33,7 +33,7 @@ int zynq_sdhci_init(phys_addr_t regbase) return 0; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) int zynq_sdhci_of_init(const void *blob) { int offset = 0; diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index e0283dc..954376d 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -266,7 +266,7 @@ static int spi_flash_validate_params(struct spi_slave *spi, u8 *idcode, return 0; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash) { fdt_addr_t addr; @@ -292,7 +292,7 @@ int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash)
return 0; } -#endif /* CONFIG_OF_CONTROL */ +#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
/** * spi_flash_probe_slave() - Probe for a SPI flash device on a bus @@ -347,7 +347,7 @@ int spi_flash_probe_slave(struct spi_slave *spi, struct spi_flash *flash) } }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) if (spi_flash_decode_fdt(gd->fdt_blob, flash)) { debug("SF: FDT decode error\n"); ret = -EINVAL; diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index c9afa99..564205d 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -361,7 +361,7 @@ int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr, return 1; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) int xilinx_emaclite_of_init(const void *blob) { int offset = 0; diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index c723dbb..f672a74 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -541,7 +541,7 @@ int zynq_gem_initialize(bd_t *bis, phys_addr_t base_addr, return 1; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) int zynq_gem_of_init(const void *blob) { int offset = 0; diff --git a/drivers/power/exynos-tmu.c b/drivers/power/exynos-tmu.c index 9a093a5..b9968c2 100644 --- a/drivers/power/exynos-tmu.c +++ b/drivers/power/exynos-tmu.c @@ -180,7 +180,7 @@ enum tmu_status_t tmu_monitor(int *temp) */ static int get_tmu_fdt_values(struct tmu_info *info, const void *blob) { -#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) fdt_addr_t addr; int node; int error = 0; diff --git a/drivers/power/pmic/pmic_max77686.c b/drivers/power/pmic/pmic_max77686.c index 1ad810a..93c8d2b 100644 --- a/drivers/power/pmic/pmic_max77686.c +++ b/drivers/power/pmic/pmic_max77686.c @@ -256,7 +256,7 @@ int pmic_init(unsigned char bus) { static const char name[] = "MAX77686_PMIC"; struct pmic *p = pmic_alloc(); -#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) const void *blob = gd->fdt_blob; int node, parent, tmp; #endif @@ -266,7 +266,7 @@ int pmic_init(unsigned char bus) return -ENOMEM; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) node = fdtdec_next_compatible(blob, 0, COMPAT_MAXIM_MAX77686_PMIC); if (node < 0) { debug("PMIC: No node for PMIC Chip in device tree\n"); diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index c8a77e2..2b6d1e4 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -357,7 +357,7 @@ int ns16550_serial_probe(struct udevice *dev) return 0; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) int ns16550_serial_ofdata_to_platdata(struct udevice *dev) { struct ns16550_platdata *plat = dev->platdata; diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 815fec3..71bb903 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -32,7 +32,7 @@ static void serial_find_console_or_panic(void) struct udevice *dev; int node;
- if (OF_CONTROL && gd->fdt_blob) { + if (CONFIG_IS_ENABLED(OF_CONTROL) && gd->fdt_blob) { /* Check for a chosen console */ node = fdtdec_get_chosen_node(gd->fdt_blob, "stdout-path"); if (node < 0) @@ -55,7 +55,7 @@ static void serial_find_console_or_panic(void) } } } - if (!SPL_BUILD || !OF_CONTROL || !gd->fdt_blob) { + if (!SPL_BUILD || !CONFIG_IS_ENABLED(OF_CONTROL) || !gd->fdt_blob) { /* * Try to use CONFIG_CONS_INDEX if available (it is numbered * from 1!). diff --git a/drivers/serial/serial_omap.c b/drivers/serial/serial_omap.c index 265fe00..36c8faf 100644 --- a/drivers/serial/serial_omap.c +++ b/drivers/serial/serial_omap.c @@ -12,7 +12,7 @@
DECLARE_GLOBAL_DATA_PTR;
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) static const struct udevice_id omap_serial_ids[] = { { .compatible = "ti,omap3-uart" }, { } diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c index ad503af..917b603 100644 --- a/drivers/serial/serial_pl01x.c +++ b/drivers/serial/serial_pl01x.c @@ -353,7 +353,7 @@ static const struct dm_serial_ops pl01x_serial_ops = { .setbrg = pl01x_serial_setbrg, };
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) static const struct udevice_id pl01x_serial_id[] ={ {.compatible = "arm,pl011", .data = TYPE_PL011}, {.compatible = "arm,pl010", .data = TYPE_PL010}, diff --git a/drivers/serial/serial_tegra.c b/drivers/serial/serial_tegra.c index b9227f0..0c84f0b 100644 --- a/drivers/serial/serial_tegra.c +++ b/drivers/serial/serial_tegra.c @@ -9,7 +9,7 @@ #include <ns16550.h> #include <serial.h>
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) static const struct udevice_id tegra_serial_ids[] = { { .compatible = "nvidia,tegra20-uart" }, { } @@ -42,7 +42,7 @@ U_BOOT_DEVICE(ns16550_serial) = { U_BOOT_DRIVER(serial_ns16550) = { .name = "serial_tegra20", .id = UCLASS_SERIAL, -#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) .of_match = tegra_serial_ids, .ofdata_to_platdata = tegra_serial_ofdata_to_platdata, .platdata_auto_alloc_size = sizeof(struct ns16550_platdata), diff --git a/drivers/serial/serial_uniphier.c b/drivers/serial/serial_uniphier.c index f210986..abf362a 100644 --- a/drivers/serial/serial_uniphier.c +++ b/drivers/serial/serial_uniphier.c @@ -113,7 +113,7 @@ static int uniphier_serial_remove(struct udevice *dev) return 0; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) static const struct udevice_id uniphier_uart_of_match[] = { { .compatible = "socionext,uniphier-uart" }, { /* sentinel */ } diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c index 9278763..9d84290 100644 --- a/drivers/serial/serial_zynq.c +++ b/drivers/serial/serial_zynq.c @@ -175,7 +175,7 @@ DECLARE_PSSERIAL_FUNCTIONS(1); static struct serial_device uart_zynq_serial1_device = INIT_PSSERIAL_STRUCTURE(1, "ttyPS1");
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) __weak struct serial_device *default_serial_console(void) { const void *blob = gd->fdt_blob; diff --git a/drivers/sound/max98095.c b/drivers/sound/max98095.c index febf419..35829f8 100644 --- a/drivers/sound/max98095.c +++ b/drivers/sound/max98095.c @@ -520,7 +520,7 @@ static int get_max98095_codec_values(struct sound_codec_info *pcodec_info, const void *blob) { int error = 0; -#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) enum fdt_compat_id compat; int node; int parent; diff --git a/drivers/sound/wm8994.c b/drivers/sound/wm8994.c index f8e9a6e..d378442 100644 --- a/drivers/sound/wm8994.c +++ b/drivers/sound/wm8994.c @@ -814,7 +814,7 @@ static int get_codec_values(struct sound_codec_info *pcodec_info, const void *blob) { int error = 0; -#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) enum fdt_compat_id compat; int node; int parent; diff --git a/drivers/tpm/tpm_tis_i2c.c b/drivers/tpm/tpm_tis_i2c.c index ee4dfea..cc740e9 100644 --- a/drivers/tpm/tpm_tis_i2c.c +++ b/drivers/tpm/tpm_tis_i2c.c @@ -585,7 +585,7 @@ static struct tpm_vendor_specific tpm_tis_i2c = {
static enum i2c_chip_type tpm_vendor_chip_type(void) { -#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) const void *blob = gd->fdt_blob;
if (fdtdec_next_compatible(blob, 0, COMPAT_INFINEON_SLB9645_TPM) >= 0) diff --git a/drivers/video/exynos_dp.c b/drivers/video/exynos_dp.c index f60b060..60ba01c 100644 --- a/drivers/video/exynos_dp.c +++ b/drivers/video/exynos_dp.c @@ -851,7 +851,7 @@ static unsigned int exynos_dp_config_video(struct edp_device_info *edp_info) return ret; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) int exynos_dp_parse_dt(const void *blob, struct edp_device_info *edp_info) { unsigned int node = fdtdec_next_compatible(blob, 0, @@ -918,7 +918,7 @@ unsigned int exynos_init_dp(void) return -EFAULT; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) if (exynos_dp_parse_dt(gd->fdt_blob, edp_info)) debug("unable to parse DP DT node\n"); #else diff --git a/drivers/video/exynos_dp_lowlevel.c b/drivers/video/exynos_dp_lowlevel.c index bf0ea10..39783dc 100644 --- a/drivers/video/exynos_dp_lowlevel.c +++ b/drivers/video/exynos_dp_lowlevel.c @@ -22,7 +22,7 @@ struct exynos_dp *dp_regs;
void exynos_dp_set_base_addr(void) { -#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) unsigned int node = fdtdec_next_compatible(gd->fdt_blob, 0, COMPAT_SAMSUNG_EXYNOS5_DP); if (node <= 0) diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c index 8f3b826..69edc3a 100644 --- a/drivers/video/exynos_fb.c +++ b/drivers/video/exynos_fb.c @@ -28,7 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;
static unsigned int panel_width, panel_height;
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) vidinfo_t panel_info = { /* * Insert a value here so that we don't end up in the BSS @@ -126,7 +126,7 @@ static void lcd_panel_on(vidinfo_t *vid)
exynos_backlight_on(1);
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) node = fdtdec_next_compatible(gd->fdt_blob, 0, COMPAT_SAMSUNG_EXYNOS_FIMD); if (node <= 0) { @@ -150,7 +150,7 @@ static void lcd_panel_on(vidinfo_t *vid) exynos_mipi_dsi_init(); }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) int exynos_lcd_early_init(const void *blob) { unsigned int node; @@ -295,7 +295,7 @@ void lcd_ctrl_init(void *lcdbase) set_system_display_ctrl(); set_lcd_clk();
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) #ifdef CONFIG_EXYNOS_MIPI_DSIM exynos_init_dsim_platform_data(&panel_info); #endif diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c index f67fa81..ac001a8 100644 --- a/drivers/video/exynos_fimd.c +++ b/drivers/video/exynos_fimd.c @@ -251,7 +251,7 @@ void exynos_fimd_window_off(unsigned int win_id) writel(cfg, &fimd_ctrl->winshmap); }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) /* * The reset value for FIMD SYSMMU register MMU_CTRL is 3 * on Exynos5420 and newer versions. @@ -295,7 +295,7 @@ void exynos_fimd_lcd_init(vidinfo_t *vid) { unsigned int cfg = 0, rgb_mode; unsigned int offset; -#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) unsigned int node;
node = fdtdec_next_compatible(gd->fdt_blob, diff --git a/drivers/video/exynos_mipi_dsi.c b/drivers/video/exynos_mipi_dsi.c index c68ebd6..b597acc 100644 --- a/drivers/video/exynos_mipi_dsi.c +++ b/drivers/video/exynos_mipi_dsi.c @@ -28,7 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;
static struct exynos_platform_mipi_dsim *dsim_pd; -#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) static struct mipi_dsim_config dsim_config_dt; static struct exynos_platform_mipi_dsim dsim_platform_data_dt; static struct mipi_dsim_lcd_device mipi_lcd_device_dt; @@ -249,7 +249,7 @@ void exynos_set_dsim_platform_data(struct exynos_platform_mipi_dsim *pd) dsim_pd = pd; }
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) int exynos_dsim_config_parse_dt(const void *blob) { int node; diff --git a/drivers/video/tegra.c b/drivers/video/tegra.c index b8f3431..e829aa8 100644 --- a/drivers/video/tegra.c +++ b/drivers/video/tegra.c @@ -49,7 +49,7 @@ vidinfo_t panel_info = { .vl_col = -1, };
-#ifndef CONFIG_OF_CONTROL +#if !CONFIG_IS_ENABLED(OF_CONTROL) #error "You must enable CONFIG_OF_CONTROL to get Tegra LCD support" #endif
diff --git a/include/cli.h b/include/cli.h index 6da7a4a..4c39b9e 100644 --- a/include/cli.h +++ b/include/cli.h @@ -108,7 +108,7 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer, */ int cli_simple_parse_line(char *line, char *argv[]);
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) /** * cli_process_fdt() - process the boot command from the FDT * diff --git a/include/config_uncmd_spl.h b/include/config_uncmd_spl.h index 2741fc8..6e299f6 100644 --- a/include/config_uncmd_spl.h +++ b/include/config_uncmd_spl.h @@ -20,9 +20,6 @@ #undef CONFIG_CMD_SNTP #undef CONFIG_CMD_TFTPPUT #undef CONFIG_CMD_TFTPSRV -#ifndef CONFIG_SPL_OF_CONTROL -#undef CONFIG_OF_CONTROL -#endif
#ifndef CONFIG_SPL_DM #undef CONFIG_DM_SERIAL diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h index e16965c..f98a357 100644 --- a/include/configs/microblaze-generic.h +++ b/include/configs/microblaze-generic.h @@ -106,7 +106,8 @@ # define CONFIG_XILINX_TB_WATCHDOG #endif
-#ifndef CONFIG_OF_CONTROL +#if !defined(CONFIG_OF_CONTROL) || \ + (defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_OF_CONTROL)) /* ddr sdram - main memory */ # define CONFIG_SYS_SDRAM_BASE XILINX_RAM_START # define CONFIG_SYS_SDRAM_SIZE XILINX_RAM_SIZE diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h index 4c3366a..0f0286b 100644 --- a/include/configs/socfpga_common.h +++ b/include/configs/socfpga_common.h @@ -198,7 +198,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void); #define CONFIG_CMD_SF #endif
-#ifdef CONFIG_OF_CONTROL /* DW SPI is controlled via DT */ +#if CONFIG_IS_ENABLED(OF_CONTROL) /* DW SPI is controlled via DT */ #define CONFIG_DESIGNWARE_SPI #define CONFIG_CMD_SPI #endif diff --git a/include/dm/device.h b/include/dm/device.h index 38e23f8..4e04b04 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -122,11 +122,11 @@ struct udevice_id { ulong data; };
-#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) #define of_match_ptr(_ptr) (_ptr) #else #define of_match_ptr(_ptr) NULL -#endif /* CONFIG_OF_CONTROL */ +#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
/** * struct driver - A driver for a feature or peripheral diff --git a/include/fdtdec.h b/include/fdtdec.h index 8e03000..73890ac 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -47,16 +47,6 @@ struct fdt_memory { #define SPL_BUILD 0 #endif
-#ifdef CONFIG_OF_CONTROL -# if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_OF_CONTROL) -# define OF_CONTROL 0 -# else -# define OF_CONTROL 1 -# endif -#else -# define OF_CONTROL 0 -#endif - /* * Information about a resource. start is the first address of the resource * and end is the last address (inclusive). The length of the resource will diff --git a/lib/Makefile b/lib/Makefile index c6576d8..4af4776 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -25,8 +25,8 @@ obj-y += crc8.o obj-y += crc16.o obj-$(CONFIG_ERRNO_STR) += errno_str.o obj-$(CONFIG_FIT) += fdtdec_common.o -obj-$(CONFIG_OF_CONTROL) += fdtdec_common.o -obj-$(CONFIG_OF_CONTROL) += fdtdec.o +obj-$(CONFIG_$(SPL_)OF_CONTROL) += fdtdec_common.o +obj-$(CONFIG_$(SPL_)OF_CONTROL) += fdtdec.o obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o obj-$(CONFIG_GZIP) += gunzip.o obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o @@ -50,15 +50,12 @@ endif
ifndef CONFIG_SPL_BUILD obj-$(CONFIG_OF_LIBFDT) += libfdt/ -obj-$(CONFIG_OF_CONTROL) += fdtdec_common.o -obj-$(CONFIG_OF_CONTROL) += fdtdec.o endif - ifdef CONFIG_SPL_OF_CONTROL obj-$(CONFIG_OF_LIBFDT) += libfdt/ -obj-$(CONFIG_OF_CONTROL) += fdtdec_common.o -obj-$(CONFIG_OF_CONTROL) += fdtdec.o endif +obj-$(CONFIG_$(SPL_)OF_CONTROL) += fdtdec_common.o +obj-$(CONFIG_$(SPL_)OF_CONTROL) += fdtdec.o
ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16.o diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 232ca74..b43ec9c 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1138,7 +1138,7 @@ int fdtdec_decode_display_timing(const void *blob, int parent, int index,
int fdtdec_setup(void) { -#ifdef CONFIG_OF_CONTROL +#if CONFIG_IS_ENABLED(OF_CONTROL) # ifdef CONFIG_OF_EMBED /* Get a pointer to the FDT */ gd->fdt_blob = __dtb_dt_begin; @@ -1149,7 +1149,7 @@ int fdtdec_setup(void) # else /* FDT is at end of image */ gd->fdt_blob = (ulong *)&_end; -#endif +# endif # elif defined(CONFIG_OF_HOSTFILE) if (sandbox_read_fdt_from_file()) { puts("Failed to read control FDT\n"); diff --git a/scripts/Makefile.uncmd_spl b/scripts/Makefile.uncmd_spl index b90fcb8..4003546 100644 --- a/scripts/Makefile.uncmd_spl +++ b/scripts/Makefile.uncmd_spl @@ -3,9 +3,6 @@ # TODO: Invent a better way
ifdef CONFIG_SPL_BUILD -ifndef CONFIG_SPL_OF_CONTROL -CONFIG_OF_CONTROL= -endif
ifndef CONFIG_SPL_DM CONFIG_DM_SERIAL=

Hi!
We have flipped CONFIG_SPL_DISABLE_OF_CONTROL. We have cleansing devices, $(SPL_) and CONFIG_IS_ENABLED(), so we are ready to clear away the ugly logic in include/fdtdec.h:
#ifdef CONFIG_OF_CONTROL # if defined(CONFIG_SPL_BUILD) && !defined(SPL_OF_CONTROL) # define OF_CONTROL 0 # else # define OF_CONTROL 1 # endif #else # define OF_CONTROL 0 #endif
Now CONFIG_IS_ENABLED(OF_CONTROL) is the substitute. It refers to CONFIG_OF_CONTROL for U-boot proper and CONFIG_SPL_OF_CONTROL for SPL.
CONFIG_IS_ENABLED() is a bit too verbose. Could we get something shorter, like ENABLED()? Pavel

On Sunday, July 26, 2015 at 08:38:46 PM, Pavel Machek wrote:
Hi!
We have flipped CONFIG_SPL_DISABLE_OF_CONTROL. We have cleansing devices, $(SPL_) and CONFIG_IS_ENABLED(), so we are ready to clear
away the ugly logic in include/fdtdec.h: #ifdef CONFIG_OF_CONTROL # if defined(CONFIG_SPL_BUILD) && !defined(SPL_OF_CONTROL) # define OF_CONTROL 0 # else # define OF_CONTROL 1 # endif #else # define OF_CONTROL 0 #endif
Now CONFIG_IS_ENABLED(OF_CONTROL) is the substitute. It refers to CONFIG_OF_CONTROL for U-boot proper and CONFIG_SPL_OF_CONTROL for SPL.
CONFIG_IS_ENABLED() is a bit too verbose. Could we get something shorter, like ENABLED()? Pavel
Linux has an IS_ENABLED() macro to my knowledge.
Best regards, Marek Vasut

Hi Pavel,
2015-07-27 3:38 GMT+09:00 Pavel Machek pavel@denx.de:
Hi!
We have flipped CONFIG_SPL_DISABLE_OF_CONTROL. We have cleansing devices, $(SPL_) and CONFIG_IS_ENABLED(), so we are ready to clear away the ugly logic in include/fdtdec.h:
#ifdef CONFIG_OF_CONTROL # if defined(CONFIG_SPL_BUILD) && !defined(SPL_OF_CONTROL) # define OF_CONTROL 0 # else # define OF_CONTROL 1 # endif #else # define OF_CONTROL 0 #endif
Now CONFIG_IS_ENABLED(OF_CONTROL) is the substitute. It refers to CONFIG_OF_CONTROL for U-boot proper and CONFIG_SPL_OF_CONTROL for SPL.
CONFIG_IS_ENABLED() is a bit too verbose. Could we get something shorter, like ENABLED()? Pavel
The prefix "CONFIG_" is important because this must be searched by scripts/basic/fixdep.c
We are familiar with IS_ENABLED() which originates in Linux, so a new build-context-depending macro, CONFIG_IS_ENABLED() is reasonable naming, I believe.
Besides,
IS_ENABLED(CONFIG_OF_CONTROL) - before CONFIG_IS_ENABLED(OF_CONTROL) - after
Same length. Not too verbose.

On Mon 2015-07-27 10:33:51, Masahiro Yamada wrote:
Hi Pavel,
2015-07-27 3:38 GMT+09:00 Pavel Machek pavel@denx.de:
Hi!
We have flipped CONFIG_SPL_DISABLE_OF_CONTROL. We have cleansing devices, $(SPL_) and CONFIG_IS_ENABLED(), so we are ready to clear away the ugly logic in include/fdtdec.h:
#ifdef CONFIG_OF_CONTROL # if defined(CONFIG_SPL_BUILD) && !defined(SPL_OF_CONTROL) # define OF_CONTROL 0 # else # define OF_CONTROL 1 # endif #else # define OF_CONTROL 0 #endif
Now CONFIG_IS_ENABLED(OF_CONTROL) is the substitute. It refers to CONFIG_OF_CONTROL for U-boot proper and CONFIG_SPL_OF_CONTROL for SPL.
CONFIG_IS_ENABLED() is a bit too verbose. Could we get something shorter, like ENABLED()?
The prefix "CONFIG_" is important because this must be searched by scripts/basic/fixdep.c
We are familiar with IS_ENABLED() which originates in Linux, so a new build-context-depending macro, CONFIG_IS_ENABLED() is reasonable naming, I believe.
Besides,
IS_ENABLED(CONFIG_OF_CONTROL) - before CONFIG_IS_ENABLED(OF_CONTROL) - after
What about CONFIG_EN(OF_CONTROL), then? I don't think confusion is possible... Pavel

On Monday, July 27, 2015 at 09:05:03 AM, Pavel Machek wrote:
On Mon 2015-07-27 10:33:51, Masahiro Yamada wrote:
Hi Pavel,
2015-07-27 3:38 GMT+09:00 Pavel Machek pavel@denx.de:
Hi!
We have flipped CONFIG_SPL_DISABLE_OF_CONTROL. We have cleansing devices, $(SPL_) and CONFIG_IS_ENABLED(), so we are ready to clear
away the ugly logic in include/fdtdec.h: #ifdef CONFIG_OF_CONTROL # if defined(CONFIG_SPL_BUILD) && !defined(SPL_OF_CONTROL) # define OF_CONTROL 0 # else # define OF_CONTROL 1 # endif #else # define OF_CONTROL 0 #endif
Now CONFIG_IS_ENABLED(OF_CONTROL) is the substitute. It refers to CONFIG_OF_CONTROL for U-boot proper and CONFIG_SPL_OF_CONTROL for SPL.
CONFIG_IS_ENABLED() is a bit too verbose. Could we get something shorter, like ENABLED()?
The prefix "CONFIG_" is important because this must be searched by scripts/basic/fixdep.c
We are familiar with IS_ENABLED() which originates in Linux, so a new build-context-depending macro, CONFIG_IS_ENABLED() is reasonable naming, I believe.
Besides,
IS_ENABLED(CONFIG_OF_CONTROL) - before CONFIG_IS_ENABLED(OF_CONTROL) - after
What about CONFIG_EN(OF_CONTROL), then? I don't think confusion is possible...
I don't like CONFIG_EN(), sorry. It looks like shortening something just for the sake of shortening it, which is only confusing.
Best regards, Marek Vasut

2015-07-27 19:52 GMT+09:00 Marek Vasut marex@denx.de:
On Monday, July 27, 2015 at 09:05:03 AM, Pavel Machek wrote:
On Mon 2015-07-27 10:33:51, Masahiro Yamada wrote:
Hi Pavel,
2015-07-27 3:38 GMT+09:00 Pavel Machek pavel@denx.de:
Hi!
We have flipped CONFIG_SPL_DISABLE_OF_CONTROL. We have cleansing devices, $(SPL_) and CONFIG_IS_ENABLED(), so we are ready to clear
away the ugly logic in include/fdtdec.h: #ifdef CONFIG_OF_CONTROL # if defined(CONFIG_SPL_BUILD) && !defined(SPL_OF_CONTROL) # define OF_CONTROL 0 # else # define OF_CONTROL 1 # endif #else # define OF_CONTROL 0 #endif
Now CONFIG_IS_ENABLED(OF_CONTROL) is the substitute. It refers to CONFIG_OF_CONTROL for U-boot proper and CONFIG_SPL_OF_CONTROL for SPL.
CONFIG_IS_ENABLED() is a bit too verbose. Could we get something shorter, like ENABLED()?
The prefix "CONFIG_" is important because this must be searched by scripts/basic/fixdep.c
We are familiar with IS_ENABLED() which originates in Linux, so a new build-context-depending macro, CONFIG_IS_ENABLED() is reasonable naming, I believe.
Besides,
IS_ENABLED(CONFIG_OF_CONTROL) - before CONFIG_IS_ENABLED(OF_CONTROL) - after
What about CONFIG_EN(OF_CONTROL), then? I don't think confusion is possible...
I don't like CONFIG_EN(), sorry. It looks like shortening something just for the sake of shortening it, which is only confusing.
Me neither.

On Sun, 2015-07-26 at 17:26 +0900, Masahiro Yamada wrote:
Refer to Simon's question, too: http://lists.denx.de/pipermail/u-boot/2015-July/219598.html
Since U-boot introduced SPL (not since Kconfig), enabling features for U-boot and SPL independently is always a PITA.
- decide if each feature should be supported for SPL or not
- Add CONFIG_SPL_FRED_SUPPORT into Makefile.spl
- Add #undef include/config_uncmd_spl.h to disable features we do not want to support on SPL
- Add "ifdef CONFIG_SPL_BUILD ... endif" here and there to adjust things
- Add "#ifdef CONFIG_SPL_BUILD ... #endif" here and there to fix things up
Things are getting more and more crappy.
When U-boot switched to Kconfig, first I introduced separate .config (.config, spl/.config, tpl/.config) to clean up them. But it turned out to be a pain.
So, I believe the current single .config is much better. But I also admit we need something systematic to subdue our PITA.
We had something systematic -- separate .configs, which could have been used to get rid of the CONFIG_SPL_FRED_SUPPORT stuff -- that you reverted (which was the only reason the uncmd stuff ever existed).
Yet somehow this is "much better". :-(
One possibility is to support "spl-y" in makefiles. (This idea is cribbed from barebox.)
obj-$(CONFIG_FOO) += foo.o spl-$(CONFIG_SPL_FOO) += foo.o
is cleaner than
ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_FOO) += foo.o else obj-$(CONFIG_FOO) += foo.o endif
It is a nice improvement in makefile side. But we still need to do something with C files.
Another option is something like CONFIG_FOO=yyn (yes for U-boot, yes for SPL, no for TPL)
To achieve this, I think a big operation is needed in Kconfig core. I cannot do that. (Of course, Patches are welcome if someone else can do that.)
So, I was thinking of something different.
My idea was inspired by IS_ENABLED() macro in include/linux/kconfig.h.
Linux defines different macros for built-in and module, and it is possible to write #if IS_ENABLED(CONFIG_FOO) ... #endif
instead of
#if defined(CONFIG_FOO) || defined(CONFIG_FOO_MODULE) ... #endif
So, I'd like to propose new macros to write code like
#if CONFIG_IS_ENABLED(FOO) ... #endif
instead of
#if (!defined(CONFIG_SPL_BUILD) && defined(CONFIG_FOO)) || \ (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_FOO)) ... #endif
With separate .config this is just:
#ifdef CONFIG_FOO ... #endif
-Scott
participants (5)
-
Marek Vasut
-
Masahiro Yamada
-
Pavel Machek
-
Scott Wood
-
Simon Glass