Skip to contentSkip to conversation

Add macros to ease our life with independent CONFIGs between U-Boot and SPL

PATCH New Masahiro Yamada 4 participants 41 messages Aug 11, 2015 – Aug 21, 2015

Subsystems (18)
lore
Share & tools
lore
#0 lore raw

v3 cover 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.

The result of buildman:

Summary of 16 commits for 1113 boards (8 threads, 1 job per thread) 01: arm: socfpga: misc: Add support for printing FPGA type

     avr32:  +   atngw100mkii grasshopper atstk1002 atngw100
        sh:  +   sh7753evb sh7785lcr_32bit sh7785lcr
     nios2:  +   nios2-generic
       arm:  +   openrd_base axm openrd_ultimate zynq_zc70x openrd_client taurus
   powerpc:  +   ebony taihu ocotea TQM834x taishan katmai alpr

02: kbuild: fixdep: optimize code slightly
03: kbuild: add a makefile macro useful with per-image config options 04: linux/kconfig.h: add CPP macros useful for per-image config options 05: spl: move SPL driver entries to driver/Makefile
06: dm: unify obj-$(CONFIG_DM) and obj-$(CONFIG_SPL_DM) entries 07: clk: rename CONFIG_SPL_CLK_SUPPORT to CONFIG_SPL_CLK
08: clk: unify obj-$(CONFIG_CLK) and obj-$(CONFIG_SPL_CLK) entries 09: ram: rename CONFIG_SPL_RAM_SUPPORT to CONFIG_SPL_RAM
10: ram: unify obj-$(CONFIG_RAM) and obj-$(CONFIG_SPL_RAM) entries 11: led: rename CONFIG_SPL_LED_SUPPORT to CONFIG_SPL_LED
12: led: unify obj-$(CONFIG_LED) and obj-$(CONFIG_SPL_LED) entries 13: dm: drop CONFIG_DM_DEVICE_REMOVE from uncmd list
14: fdtdec: fix OF_CONTROL switch
15: of: flip CONFIG_SPL_DISABLE_OF_CONTROL into CONFIG_SPL_OF_CONTROL 16: of: clean up OF_CONTROL ifdef conditionals

Changes in v3:
- Rebase on commit bd48c0617b5c721

Changes in v2:
- Do not delete vpac270 board.
Instead, change board/vpac270/u-boot-spl.lds
- Rebase on commit cc35734358540a1

Masahiro Yamada (15):
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                                   |  3 --
 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/Kconfig                        |  1 -
 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/u-boot-spl.lds                       |  2 +-
 .../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_arria5_defconfig                   |  1 +
 configs/socfpga_cyclone5_defconfig                 |  1 +
 configs/socfpga_socrates_defconfig                 |  1 +
 configs/trats2_defconfig                           |  1 -
 configs/trats_defconfig                            |  1 -
 drivers/Makefile                                   | 42 +++++++++++++++++--
 drivers/clk/Kconfig                                |  2 +-
 drivers/core/Makefile                              |  4 +-
 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                             |  2 +-
 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_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/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                                       |  2 +-
 scripts/Kbuild.include                             |  6 +++
 scripts/Makefile.spl                               | 31 +-------------
 scripts/Makefile.uncmd_spl                         |  5 ---
 scripts/basic/fixdep.c                             | 33 +++++++++++++--
 86 files changed, 225 insertions(+), 182 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/15 kbuild: fixdep: optimize code slightly

If the target string matches "CONFIG_", move the pointer p forward. This saves several 7-chars adjustments.

---

Changes in v3: None
Changes in v2: None

 scripts/basic/fixdep.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
scripts/basic/fixdep.c +4 -3
index b304068..46cc1b3 100644
@@ -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);
 	}
 }
 
Signature · 1 line
1.9.1
#2 lore raw

PATCH v3 1/15 kbuild: fixdep: optimize code slightly

Quoted 6 lines · Masahiro Yamada

If the target string matches "CONFIG_", move the pointer p forward. This saves several 7-chars adjustments.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/be946aa0/attachment.sig>
#3 lore raw

PATCH v3 2/15 kbuild: add a makefile macro useful with per-image config options

In reply to Masahiro Yamada

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.

---

Changes in v3: None
Changes in v2: None

 scripts/Kbuild.include | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/Kbuild.include +6 -0
index f02eb37..98e09ce 100644
@@ -309,3 +309,9 @@ why =                                                                        \
 
 echo-why = $(call escsq, $(strip $(why)))
 endif
+
+ifdef CONFIG_SPL_BUILD
+SPL_ := SPL_
+else
+SPL_ :=
+endif
Signature · 1 line
1.9.1
#4 lore raw

PATCH v3 2/15 kbuild: add a makefile macro useful with per-image config options

Quoted 60 lines · Masahiro Yamada

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/
     ...
Quoted 5 lines

Eventually, SPL-specialized entries in Makefile.spl would go away.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/ab5bc5c6/attachment.sig>
#5 lore raw

PATCH v3 3/15 linux/kconfig.h: add CPP macros useful for per-image config options

In reply to Masahiro Yamada

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.

---

Changes in v3: None
Changes in v2: None

 include/linux/kconfig.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 scripts/basic/fixdep.c  | 26 ++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)
include/linux/kconfig.h +48 -0
index be342b9..486fb94 100644
@@ -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 */
scripts/basic/fixdep.c +26 -0
index 46cc1b3..20fed03 100644
@@ -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();
 
Signature · 1 line
1.9.1
#6 lore raw

PATCH v3 3/15 linux/kconfig.h: add CPP macros useful for per-image config options

Quoted 55 lines · Masahiro Yamada

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

Quoted 8 lines
    $(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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/04961367/attachment.sig>
#7 lore raw

PATCH v3 4/15 spl: move SPL driver entries to driver/Makefile

In reply to Masahiro Yamada

Just preparing for upcoming cleaning.

The board-specific linker script board/vpac270/u-boot-spl.lds has been touched to avoid build error. It does not change the size of spl/u-boot-spl.bin for this board, so it should be OK.

---

Changes in v3: None
Changes in v2:
- Do not delete vpac270 board.
Instead, change board/vpac270/u-boot-spl.lds

 board/vpac270/u-boot-spl.lds |  2 +-
 drivers/Makefile             | 37 +++++++++++++++++++++++++++++++++++++
 scripts/Makefile.spl         | 31 +------------------------------
 3 files changed, 39 insertions(+), 31 deletions(-)
board/vpac270/u-boot-spl.lds +1 -1
index a10ea71..954afb9 100644
@@ -23,7 +23,7 @@ SECTIONS
 		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*)
+		drivers/built-in.o			(.text*)
 	}
 
 
drivers/Makefile +37 -0
index 5a35148..a24c5f5 100644
@@ -1,3 +1,38 @@
+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_ALTERA_SDRAM) += ddr/altera/
+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 +62,5 @@ obj-y += input/
 # SOC specific infrastructure drivers.
 obj-y += soc/
 obj-y += thermal/
+
+endif
scripts/Makefile.spl +1 -30
index 239ee48..58442f1 100644
@@ -54,40 +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_ALTERA_SDRAM) += drivers/ddr/altera/
-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))
Signature · 1 line
1.9.1
#8 lore raw

PATCH v3 4/15 spl: move SPL driver entries to driver/Makefile

Quoted 10 lines · Masahiro Yamada

Just preparing for upcoming cleaning.

The board-specific linker script board/vpac270/u-boot-spl.lds has been touched to avoid build error. It does not change the size of spl/u-boot-spl.bin for this board, so it should be OK.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/33b5c7a3/attachment.sig>
#9 lore raw

PATCH v3 5/15 dm: unify obj-$(CONFIG_DM) and obj-$(CONFIG_SPL_DM) entries

In reply to Masahiro Yamada

---

Changes in v3: None
Changes in v2: None

 drivers/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/Makefile +2 -2
index a24c5f5..ee8e418 100644
@@ -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/
@@ -34,7 +35,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/
Signature · 1 line
1.9.1
#10 lore raw

PATCH v3 5/15 dm: unify obj-$(CONFIG_DM) and obj-$(CONFIG_SPL_DM) entries

Quoted 3 lines · Masahiro Yamada

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/ebefc182/attachment.sig>
#11 lore raw

PATCH v3 6/15 clk: rename CONFIG_SPL_CLK_SUPPORT to CONFIG_SPL_CLK

In reply to Masahiro Yamada

---

Changes in v3: None
Changes in v2: None

 drivers/Makefile    | 2 +-
 drivers/clk/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/Makefile +1 -1
index ee8e418..2e17d02 100644
@@ -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/
drivers/clk/Kconfig +1 -1
index 07eb54c..890f22f 100644
@@ -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
Signature · 1 line
1.9.1
#12 lore raw

PATCH v3 6/15 clk: rename CONFIG_SPL_CLK_SUPPORT to CONFIG_SPL_CLK

Quoted 4 lines · Masahiro Yamada

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/74785636/attachment.sig>
#13 lore raw

PATCH v3 7/15 clk: unify obj-$(CONFIG_CLK) and obj-$(CONFIG_SPL_CLK) entries

In reply to Masahiro Yamada

---

Changes in v3: None
Changes in v2: None

 drivers/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/Makefile +1 -2
index 2e17d02..8630a58 100644
@@ -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/
@@ -34,7 +34,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/
Signature · 1 line
1.9.1
#14 lore raw

PATCH v3 7/15 clk: unify obj-$(CONFIG_CLK) and obj-$(CONFIG_SPL_CLK) entries

Quoted 4 lines · Masahiro Yamada

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/096baba9/attachment.sig>
#15 lore raw

PATCH v3 8/15 ram: rename CONFIG_SPL_RAM_SUPPORT to CONFIG_SPL_RAM

In reply to Masahiro Yamada

---

Changes in v3: None
Changes in v2: None

 drivers/Makefile    | 2 +-
 drivers/ram/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/Makefile +1 -1
index 8630a58..3b38861 100644
@@ -24,7 +24,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/
drivers/ram/Kconfig +1 -1
index 642a2d8..ff09f22 100644
@@ -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
Signature · 1 line
1.9.1
#16 lore raw

PATCH v3 8/15 ram: rename CONFIG_SPL_RAM_SUPPORT to CONFIG_SPL_RAM

Quoted 3 lines · Masahiro Yamada

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/ab846021/attachment.sig>
#17 lore raw

PATCH v3 9/15 ram: unify obj-$(CONFIG_RAM) and obj-$(CONFIG_SPL_RAM) entries

In reply to Masahiro Yamada

---

Changes in v3: None
Changes in v2: None

 drivers/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/Makefile +1 -2
index 3b38861..aff0d05 100644
@@ -1,5 +1,6 @@
 obj-$(CONFIG_$(SPL_)DM)		+= core/
 obj-$(CONFIG_$(SPL_)CLK)	+= clk/
+obj-$(CONFIG_$(SPL_)RAM)	+= ram/
 
 ifdef CONFIG_SPL_BUILD
 
@@ -24,7 +25,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/
@@ -46,7 +46,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/
Signature · 1 line
1.9.1
#18 lore raw

PATCH v3 9/15 ram: unify obj-$(CONFIG_RAM) and obj-$(CONFIG_SPL_RAM) entries

Quoted 3 lines · Masahiro Yamada

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/747d27bb/attachment.sig>
#19 lore raw

PATCH v3 10/15 led: rename CONFIG_SPL_LED_SUPPORT to CONFIG_SPL_LED

In reply to Masahiro Yamada

---

Changes in v3: None
Changes in v2: None

 drivers/Makefile    | 2 +-
 drivers/led/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/Makefile +1 -1
index aff0d05..ddb4215 100644
@@ -14,7 +14,7 @@ obj-$(CONFIG_ALTERA_SDRAM) += ddr/altera/
 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/
drivers/led/Kconfig +1 -1
index de5feea..781c410 100644
@@ -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
Signature · 1 line
1.9.1
#20 lore raw

PATCH v3 10/15 led: rename CONFIG_SPL_LED_SUPPORT to CONFIG_SPL_LED

Quoted 3 lines · Masahiro Yamada

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/00e295d5/attachment.sig>
#21 lore raw

PATCH v3 11/15 led: unify obj-$(CONFIG_LED) and obj-$(CONFIG_SPL_LED) entries

In reply to Masahiro Yamada

---

Changes in v3: None
Changes in v2: None

 drivers/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/Makefile +1 -2
index ddb4215..a721ec8 100644
@@ -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
@@ -14,7 +15,6 @@ obj-$(CONFIG_ALTERA_SDRAM) += ddr/altera/
 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/
@@ -42,7 +42,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/
Signature · 1 line
1.9.1
#22 lore raw

PATCH v3 11/15 led: unify obj-$(CONFIG_LED) and obj-$(CONFIG_SPL_LED) entries

Quoted 4 lines · Masahiro Yamada

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/1aeb3f76/attachment.sig>
#23 lore raw

PATCH v3 12/15 dm: drop CONFIG_DM_DEVICE_REMOVE from uncmd list

In reply to Masahiro Yamada

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.

---

Changes in v3: None
Changes in v2: None

 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(-)
drivers/core/Makefile +1 -1
index ccc2fd4..1dd25a3 100644
@@ -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_REGMAP)	+= regmap.o
 obj-$(CONFIG_SYSCON)	+= syscon-uclass.o
drivers/core/device.c +3 -3
index bbe7a94..56b9081 100644
@@ -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);
drivers/core/uclass.c +2 -2
index 5c4a66d..f63ff59 100644
@@ -435,7 +435,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;
@@ -515,7 +515,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;
include/config_uncmd_spl.h +0 -1
index c191f56..86cc0c3 100644
@@ -32,7 +32,6 @@
 #endif
 
 #undef CONFIG_DM_WARN
-#undef CONFIG_DM_DEVICE_REMOVE
 #undef CONFIG_DM_SEQ_ALIAS
 #undef CONFIG_DM_STDIO
 
include/dm/device-internal.h +5 -5
index 2cd2fe9..04884f1 100644
@@ -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) {}
include/dm/uclass-internal.h +2 -2
index 9b68508..b51e1da 100644
@@ -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; }
scripts/Makefile.uncmd_spl +0 -2
index 4f05652..a0630d1 100644
@@ -15,6 +15,4 @@ CONFIG_DM_SPI=
 CONFIG_DM_SPI_FLASH=
 endif
 
-CONFIG_DM_DEVICE_REMOVE=
-
 endif
Signature · 1 line
1.9.1
#24 lore raw

PATCH v3 12/15 dm: drop CONFIG_DM_DEVICE_REMOVE from uncmd list

Quoted 4 lines · Masahiro Yamada

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.

Quoted 8 lines

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/c6b8763f/attachment.sig>
#25 lore raw

PATCH v3 13/15 fdtdec: fix OF_CONTROL switch

In reply to Masahiro Yamada

There is no case where defined(SPL_DISABLE_OF_CONTROL) is true.

---

Changes in v3: None
Changes in v2: None

 include/fdtdec.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/fdtdec.h +1 -1
index eac679e..0070e54 100644
@@ -46,7 +46,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
Signature · 1 line
1.9.1
#26 lore raw

PATCH v3 13/15 fdtdec: fix OF_CONTROL switch

Quoted 5 lines · Masahiro Yamada

There is no case where defined(SPL_DISABLE_OF_CONTROL) is true.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/9385e53f/attachment.sig>
#27 lore raw

PATCH v3 14/15 of: flip CONFIG_SPL_DISABLE_OF_CONTROL into CONFIG_SPL_OF_CONTROL

In reply to Masahiro Yamada

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 three boards enabling OF_CONTROL on SPL:
- socfpga_arria5_defconfig
- socfpga_cyclone5_defconfig
- socfpga_socrates_defconfig

This commit adds CONFIG_SPL_OF_CONTROL for them and deletes CONFIG_SPL_DISABLE_OF_CONTROL from the other boards to invert the logic.

---

Changes in v3:
- Rebase on commit bd48c0617b5c721

Changes in v2:
- Rebase on commit cc35734358540a1

 arch/arm/Kconfig                         | 3 ---
 arch/arm/cpu/armv7/exynos/Kconfig        | 8 --------
 arch/arm/cpu/armv7/s5pc1xx/Kconfig       | 2 --
 arch/arm/mach-tegra/Kconfig              | 1 -
 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_arria5_defconfig         | 1 +
 configs/socfpga_cyclone5_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 +-
 23 files changed, 17 insertions(+), 32 deletions(-)
arch/arm/Kconfig +0 -3
index 8b8269f..1707572 100644
@@ -650,7 +650,6 @@ config ARCH_SUNXI
 	select DM_USB
 	select OF_CONTROL
 	select OF_SEPARATE
-	select SPL_DISABLE_OF_CONTROL
 	select USB
 	select USB_STORAGE
 	select USB_KEYBOARD
@@ -676,7 +675,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
@@ -806,7 +804,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)
arch/arm/cpu/armv7/exynos/Kconfig +0 -8
index 37b89b0..a6a7597 100644
@@ -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,19 +35,16 @@ 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_SPRING
 	bool "Spring board"
@@ -61,19 +56,16 @@ 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
 
arch/arm/cpu/armv7/s5pc1xx/Kconfig +0 -2
index 792ef59..04acdaa 100644
@@ -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
 
arch/arm/mach-tegra/Kconfig +0 -1
index ba0b865..a5b7e0d 100644
@@ -5,7 +5,6 @@ config TEGRA_ARMV7_COMMON
 	select SUPPORT_SPL
 	select SPL
 	select OF_CONTROL
-	select SPL_DISABLE_OF_CONTROL
 	select CPU_V7
 	select DM
 	select DM_SPI_FLASH
common/spl/spl.c +1 -1
index 94b01da..45cf925 100644
@@ -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);
configs/am335x_boneblack_vboot_defconfig +0 -1
index b141255..b52ddfd 100644
@@ -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
configs/arches_defconfig +0 -1
index f979a64..9084a3a 100644
@@ -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
configs/canyonlands_defconfig +0 -1
index 09172b1..44d4fbd 100644
@@ -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
configs/galileo_defconfig +0 -1
index 3f80483..6ef1090 100644
@@ -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
configs/microblaze-generic_defconfig +0 -1
index 8355c67..060a697 100644
@@ -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
configs/odroid_defconfig +0 -1
index 3104f88..0fb01e7 100644
@@ -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
configs/origen_defconfig +0 -1
index 6961978..7e5a37c 100644
@@ -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
configs/s5pc210_universal_defconfig +0 -1
index 21a4708..999da4c 100644
@@ -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
configs/socfpga_arria5_defconfig +1 -0
index 4d1cd21..f406db7 100644
@@ -6,6 +6,7 @@ CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_MMC_SUPPORT=y
configs/socfpga_cyclone5_defconfig +1 -0
index ae3a1de..75207bf 100644
@@ -6,6 +6,7 @@ CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
 CONFIG_SPI_FLASH=y
 CONFIG_DM_ETH=y
 CONFIG_NETDEVICES=y
configs/socfpga_socrates_defconfig +1 -0
index 71d4711..c38f1ab 100644
@@ -6,6 +6,7 @@ CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
 CONFIG_SPI_FLASH=y
 CONFIG_DM_ETH=y
 CONFIG_NETDEVICES=y
configs/trats2_defconfig +0 -1
index f3cbe6d..f2452dc 100644
@@ -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
configs/trats_defconfig +0 -1
index 6553edb..f0ce56a 100644
@@ -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
dts/Kconfig +3 -3
index 09cfefb..d72a909 100644
@@ -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
include/config_uncmd_spl.h +1 -1
index 86cc0c3..2741fc8 100644
@@ -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
 
include/fdtdec.h +1 -1
index 0070e54..372baec 100644
@@ -46,7 +46,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
lib/Makefile +7 -1
index db7d980..3b6a74b 100644
@@ -49,7 +49,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
scripts/Makefile.uncmd_spl +1 -1
index a0630d1..b90fcb8 100644
@@ -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
 
Signature · 1 line
1.9.1
#28 lore raw

PATCH v3 14/15 of: flip CONFIG_SPL_DISABLE_OF_CONTROL into CONFIG_SPL_OF_CONTROL

On Wednesday, August 12, 2015 at 12:31:54 AM, Masahiro Yamada wrote:

Hi!

Quoted 9 lines

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 three boards enabling OF_CONTROL on SPL:
- socfpga_arria5_defconfig
- socfpga_cyclone5_defconfig
- socfpga_socrates_defconfig

Quoted 7 lines

This commit adds CONFIG_SPL_OF_CONTROL for them and deletes CONFIG_SPL_DISABLE_OF_CONTROL from the other boards to invert the logic.

Wouldn't it make more sense for the SOCFPGA stuff to simply select CONFIG_OF_CONTROL and CONFIG_SPL_OF_CONTROL in arch/arm/mach-socfpga/Kconfig by default instead of adding it into each boards' config file ?

Best regards,
Marek Vasut

#29 lore raw

PATCH v3 14/15 of: flip CONFIG_SPL_DISABLE_OF_CONTROL into CONFIG_SPL_OF_CONTROL

Hi Marek,

2015-08-12 7:47 GMT+09:00 Marek Vasut <[email protected]>:

Quoted 17 lines · Masahiro Yamada

Hi!

Quoted 13 lines

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 three boards enabling OF_CONTROL on SPL:
- socfpga_arria5_defconfig
- socfpga_cyclone5_defconfig
- socfpga_socrates_defconfig

This commit adds CONFIG_SPL_OF_CONTROL for them and deletes CONFIG_SPL_DISABLE_OF_CONTROL from the other boards to invert the logic.

Quoted 8 lines
Quoted 3 lines

Wouldn't it make more sense for the SOCFPGA stuff to simply select CONFIG_OF_CONTROL and CONFIG_SPL_OF_CONTROL in arch/arm/mach-socfpga/Kconfig by default instead of adding it into each boards' config file ?

It will make sense if SOCFPGA only works with CONFIG_OF_CONTROL and CONFIG_SPL_OF_CONTROL enabled.

It was not clear if they were forcible or not
because CONFIG_OF_CONTROL was defined in the defconfig, so I am following it.

Signature · 2 lines
Best Regards
Masahiro Yamada
#30 lore raw

PATCH v3 14/15 of: flip CONFIG_SPL_DISABLE_OF_CONTROL into CONFIG_SPL_OF_CONTROL

Quoted 1 line · Masahiro Yamada

Hi Marek,

Hi Masahiro!

Quoted 22 lines

2015-08-12 7:47 GMT+09:00 Marek Vasut <[email protected]>:

Quoted 21 lines · Masahiro Yamada

Hi!

Quoted 16 lines

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 three boards enabling OF_CONTROL on SPL:
- socfpga_arria5_defconfig
- socfpga_cyclone5_defconfig
- socfpga_socrates_defconfig

This commit adds CONFIG_SPL_OF_CONTROL for them and deletes CONFIG_SPL_DISABLE_OF_CONTROL from the other boards to invert the logic.

Quoted 7 lines
Quoted 4 lines

Wouldn't it make more sense for the SOCFPGA stuff to simply select CONFIG_OF_CONTROL and CONFIG_SPL_OF_CONTROL in arch/arm/mach-socfpga/Kconfig by default instead of adding it into each boards' config file ?

It will make sense if SOCFPGA only works with CONFIG_OF_CONTROL and CONFIG_SPL_OF_CONTROL enabled.

It does, non-DT and non-DM operation is prohibited and forbidden on SoCFPGA. Thanks for confirming it's possible to enable those in Kconfig by default instead. I can send a patch to convert the socfpga this way later :)

Quoted 3 lines

It was not clear if they were forcible or not
because CONFIG_OF_CONTROL was defined in the defconfig, so I am following it.

Yeah, all SoCFPGA boards use DT and DM support in both U-Boot and SPL. It's really the state-of-the-art implementation :b

Best regards,
Marek Vasut

#31 lore raw

PATCH v3 14/15 of: flip CONFIG_SPL_DISABLE_OF_CONTROL into CONFIG_SPL_OF_CONTROL

In reply to Masahiro Yamada
Quoted 9 lines · Masahiro Yamada

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 three boards enabling OF_CONTROL on SPL:
- socfpga_arria5_defconfig
- socfpga_cyclone5_defconfig
- socfpga_socrates_defconfig

Quoted 7 lines

This commit adds CONFIG_SPL_OF_CONTROL for them and deletes CONFIG_SPL_DISABLE_OF_CONTROL from the other boards to invert the logic.

(With a slight change due to samsun PR, but applied cleanly after rename)
Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/d6b92eda/attachment.sig>
#32 lore raw

PATCH v3 15/15 of: clean up OF_CONTROL ifdef conditionals

In reply to Masahiro Yamada

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.

---

Changes in v3:
- Rebase on commit bd48c0617b5c721

Changes in v2: None

 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                                |  2 +-
 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                               |  2 +-
 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_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                                         |  2 +-
 scripts/Makefile.uncmd_spl                           |  3 ---
 56 files changed, 75 insertions(+), 100 deletions(-)
arch/arm/cpu/armv7/am33xx/board.c +1 -1
index 377c611..3224f93 100644
@@ -61,7 +61,7 @@ U_BOOT_DEVICES(am33xx_gpios) = {
 #endif
 };
 
-# ifndef CONFIG_OF_CONTROL
+# if !CONFIG_IS_ENABLED(OF_CONTROL)
 /*
  * TODO(sjg at 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.
arch/arm/cpu/armv7/exynos/pinmux.c +1 -1
index e97cb37..179b294 100644
@@ -874,7 +874,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;
arch/arm/include/asm/arch-exynos/dwmmc.h +0 -2
index a7ca12c..bd997ad 100644
@@ -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);
arch/arm/include/asm/arch-exynos/mipi_dsim.h +0 -2
index 50e5c25..c9e8e06 100644
@@ -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 */
arch/arm/include/asm/arch-exynos/mmc.h +0 -2
index 0fb6461..48b8c4d 100644
@@ -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
arch/arm/mach-tegra/clock.c +2 -2
index 3b2b4ff..83fa837 100644
@@ -564,7 +564,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;
@@ -579,7 +579,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)
 {
arch/arm/mach-tegra/tegra114/clock.c +2 -2
index f1831d3..5e805a7 100644
@@ -582,7 +582,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
@@ -618,7 +618,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)
 {
arch/arm/mach-tegra/tegra124/clock.c +2 -2
index 9126218..cca11d4 100644
@@ -730,7 +730,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
@@ -796,7 +796,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)
 {
arch/arm/mach-tegra/tegra20/clock.c +2 -2
index dea459b..cd9fb9a 100644
@@ -507,7 +507,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
@@ -542,7 +542,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)
 {
arch/arm/mach-tegra/tegra30/clock.c +2 -2
index 3ce508b..1f104f2 100644
@@ -562,7 +562,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
@@ -600,7 +600,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)
 {
board/xilinx/microblaze-generic/microblaze-generic.c +1 -1
index 375cd0b..0c8bd7d 100644
@@ -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)
board/xilinx/zynq/board.c +1 -1
index 738c31c..237f2c2 100644
@@ -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;
common/cli.c +2 -2
index 075ae9d..b6ae80a 100644
@@ -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)
 {
common/spl/spl.c +1 -2
index 45cf925..a5892d7 100644
@@ -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);
drivers/core/Makefile +1 -1
index 1dd25a3..11e0276 100644
@@ -7,7 +7,7 @@
 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
drivers/core/device.c +2 -2
index 56b9081..e23a872 100644
@@ -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.
@@ -561,7 +561,7 @@ const char *dev_get_uclass_name(struct udevice *dev)
 
 fdt_addr_t dev_get_addr(struct udevice *dev)
 {
-#ifdef CONFIG_OF_CONTROL
+#if CONFIG_IS_ENABLED(OF_CONTROL)
 	fdt_addr_t addr;
 
 	addr = fdtdec_get_addr(gd->fdt_blob, dev->of_offset, "reg");
drivers/core/lists.c +1 -1
index 2e52500..a1c9478 100644
@@ -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
  *
drivers/core/root.c +3 -3
index 12d0460..78ab00c 100644
@@ -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);
drivers/gpio/mxc_gpio.c +1 -1
index 57a650f..0c48320 100644
@@ -336,7 +336,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 },
drivers/gpio/vybrid_gpio.c +1 -1
index 6eaf0a9..4d25f9a 100644
@@ -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 "},
drivers/i2c/s3c24x0_i2c.c +2 -2
index c11a6be..ae6f436 100644
@@ -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)
drivers/input/Makefile +1 -1
index a8e9be2..b804236 100644
@@ -13,4 +13,4 @@ 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
drivers/input/tegra-kbc.c +1 -1
index 0ef94f7..c9c9fac 100644
@@ -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,
drivers/mmc/exynos_dw_mmc.c +1 -1
index e083745..cde2ba7 100644
@@ -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)
drivers/mmc/s5p_sdhci.c +1 -1
index 522eab9..4db51d6 100644
@@ -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)
drivers/mmc/tegra_mmc.c +1 -1
index 6f8b4d0..1584865 100644
@@ -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
 
drivers/mmc/zynq_sdhci.c +1 -1
index 971acbb..c69f5d4 100644
@@ -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;
drivers/mtd/spi/sf_probe.c +3 -3
index e0283dc..954376d 100644
@@ -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;
drivers/net/xilinx_emaclite.c +1 -1
index c9afa99..564205d 100644
@@ -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;
drivers/net/zynq_gem.c +1 -1
index b2006df..9175d2c 100644
@@ -553,7 +553,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;
drivers/power/exynos-tmu.c +1 -1
index 9a093a5..b9968c2 100644
@@ -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;
drivers/power/pmic/pmic_max77686.c +2 -2
index 1ad810a..93c8d2b 100644
@@ -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");
drivers/serial/ns16550.c +1 -1
index c8a77e2..2b6d1e4 100644
@@ -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;
drivers/serial/serial-uclass.c +2 -2
index bbc366b..bca296c 100644
@@ -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!).
drivers/serial/serial_omap.c +1 -1
index 265fe00..36c8faf 100644
@@ -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" },
 	{ }
drivers/serial/serial_pl01x.c +1 -1
index ad503af..917b603 100644
@@ -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},
drivers/serial/serial_tegra.c +2 -2
index b9227f0..0c84f0b 100644
@@ -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),
drivers/serial/serial_uniphier.c +1 -1
index f210986..abf362a 100644
@@ -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 */ }
drivers/serial/serial_zynq.c +1 -1
index 9278763..9d84290 100644
@@ -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;
drivers/sound/max98095.c +1 -1
index febf419..35829f8 100644
@@ -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;
drivers/sound/wm8994.c +1 -1
index f8e9a6e..d378442 100644
@@ -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;
drivers/tpm/tpm_tis_i2c.c +1 -1
index ee4dfea..cc740e9 100644
@@ -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)
drivers/video/exynos_dp_lowlevel.c +1 -1
index 05118f8..e9b461a 100644
@@ -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)
drivers/video/exynos_fb.c +4 -4
index 8f3b826..69edc3a 100644
@@ -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
drivers/video/exynos_fimd.c +2 -2
index f67fa81..ac001a8 100644
@@ -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,
drivers/video/exynos_mipi_dsi.c +2 -2
index c68ebd6..b597acc 100644
@@ -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;
drivers/video/tegra.c +1 -1
index 33c6103..8e81346 100644
@@ -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
 
include/cli.h +1 -1
index 6da7a4a..4c39b9e 100644
@@ -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
  *
include/config_uncmd_spl.h +0 -3
index 2741fc8..6e299f6 100644
@@ -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
include/configs/microblaze-generic.h +2 -1
index e16965c..f98a357 100644
@@ -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
include/configs/socfpga_common.h +1 -1
index 5ca45a9..c64c7ed 100644
@@ -214,7 +214,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
 #define CONFIG_SPI_FLASH_BAR
 #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
include/dm/device.h +2 -2
index 1f78963..a239be6 100644
@@ -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
include/fdtdec.h +0 -10
index 372baec..f34b923 100644
@@ -45,16 +45,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
lib/Makefile +4 -7
index 3b6a74b..96f832e 100644
@@ -26,8 +26,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
@@ -51,15 +51,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
lib/fdtdec.c +1 -1
index b201787..5a93cc2 100644
@@ -1154,7 +1154,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;
scripts/Makefile.uncmd_spl +0 -3
index b90fcb8..4003546 100644
@@ -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=
Signature · 1 line
1.9.1
#33 lore raw

PATCH v3 15/15 of: clean up OF_CONTROL ifdef conditionals

2015-08-12 7:31 GMT+09:00 Masahiro Yamada <[email protected]>:

Quoted 18 lines

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.

Quoted 6 lines

Also, we no longer have to cancel CONFIG_OF_CONTROL in include/config_uncmd_spl.h and scripts/Makefile.spl.

Linus replied to v2 which had been superseded.

So, moving his Acked-by over here.

Tom,

This patch does not apply to the current u-boot/master again.

Please let me know when you need v4.

Signature · 2 lines
Best Regards
Masahiro Yamada
#34 lore raw

PATCH v3 15/15 of: clean up OF_CONTROL ifdef conditionals

In reply to Masahiro Yamada
Quoted 18 lines · Masahiro Yamada

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.

Quoted 7 lines

Also, we no longer have to cancel CONFIG_OF_CONTROL in include/config_uncmd_spl.h and scripts/Makefile.spl.

(With a slight change due to samsun PR, but applied cleanly after rename)
Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150818/f0eaf6b7/attachment.sig>
#35 lore raw

PATCH v3 15/15 of: clean up OF_CONTROL ifdef conditionals

Quoted 22 lines · Tom Rini
Quoted 21 lines · Masahiro Yamada

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.

Quoted 8 lines
Quoted 4 lines

(With a slight change due to samsun PR, but applied cleanly after rename)
Applied to u-boot/master, thanks!

And this just broke just about every SoCFPGA platform (try ie. socfpga_cyclone5) ;-) I poked into this a bit and noticed that adding #include <linux/kconfig.h> into include/configs/socfpga_common.h fixes the issue, but I'd like to check with you if this is the correct way of fixing it.

Best regards,
Marek Vasut

#36 lore raw

PATCH v3 15/15 of: clean up OF_CONTROL ifdef conditionals

Quoted 28 lines · Marek Vasut
Quoted 27 lines · Tom Rini
Quoted 25 lines · Masahiro Yamada

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.

Quoted 8 lines
Quoted 3 lines

(With a slight change due to samsun PR, but applied cleanly after rename)
Applied to u-boot/master, thanks!

And this just broke just about every SoCFPGA platform (try ie. socfpga_cyclone5) ;-) I poked into this a bit and noticed that adding #include <linux/kconfig.h> into include/configs/socfpga_common.h fixes the issue, but I'd like to check with you if this is the correct way of fixing it.

Broke it how?

$ ./tools/buildman/buildman socfpga_cyclone5
boards.cfg is up to date. Nothing to do.
Building current source for 1 boards (1 thread, 6 jobs per thread)
    1    0    0 /1      socfpga_cyclone5 
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150819/31598326/attachment.sig>
#37 lore raw

PATCH v3 15/15 of: clean up OF_CONTROL ifdef conditionals

Quoted 39 lines · Tom Rini
Quoted 32 lines · Marek Vasut
Quoted 22 lines · Tom Rini
Quoted 21 lines · Masahiro Yamada

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.

Quoted 8 lines
Quoted 4 lines

(With a slight change due to samsun PR, but applied cleanly after rename)
Applied to u-boot/master, thanks!

Quoted 5 lines

And this just broke just about every SoCFPGA platform (try ie. socfpga_cyclone5) ;-) I poked into this a bit and noticed that adding #include <linux/kconfig.h> into include/configs/socfpga_common.h fixes the issue, but I'd like to check with you if this is the correct way of fixing it.

Quoted 5 lines

Broke it how?

$ ./tools/buildman/buildman socfpga_cyclone5
boards.cfg is up to date. Nothing to do.
Building current source for 1 boards (1 thread, 6 jobs per thread)
    1    0    0 /1      socfpga_cyclone5

Looks like I wasn't really accurate and mainline actually managed to avoid this breakage. I only triggered it with a custom patch, which enables env in SPI NOR (see the spit below).

I suspect the problem is caused by tools/envcrc.c, which does include the board config file (which uses this CONFIG_IS_ENABLED()), but does not include a header file which defines it.

The question therefore is, shall we not used CONFIG_IS_ENABLED() in board config files or shall we include linux/kconfig.h in tools/envcrc.c ?

--->8---

In file included from include/configs/socfpga_sockit.h:195:0,

                 from include/config.h:5,
                 from tools/envcrc.c:19:
include/configs/socfpga_common.h:217:22: error: missing binary operator before 
token "("
 #if CONFIG_IS_ENABLED(OF_CONTROL) /* DW SPI is controlled via DT */
                      ^
make[1]: *** [tools/envcrc.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from include/configs/socfpga_sockit.h:195:0,
                 from include/config.h:5,
                 from ./tools/../common/env_embedded.c:12,
                 from tools/common/env_embedded.c:1:
include/configs/socfpga_common.h:217:22: error: missing binary operator before 
token "("
 #if CONFIG_IS_ENABLED(OF_CONTROL) /* DW SPI is controlled via DT */
                      ^
make[1]: *** [tools/common/env_embedded.o] Error 1
make: *** [tools] Error 2
In file included from include/configs/socfpga_sockit.h:195:0,
                 from include/config.h:5,
                 from tools/envcrc.c:19:
include/configs/socfpga_common.h:217:22: error: missing binary operator before 
token "("
 #if CONFIG_IS_ENABLED(OF_CONTROL) /* DW SPI is controlled via DT */
                      ^
make[1]: *** [tools/envcrc.o] Error 1
make: *** [tools] Error 2
In file included from include/configs/socfpga_sockit.h:195:0,
                 from include/config.h:5,
                 from tools/envcrc.c:19:                                                                                                          
include/configs/socfpga_common.h:217:22: error: missing binary operator before 
token "("                                                          
 #if CONFIG_IS_ENABLED(OF_CONTROL) /* DW SPI is controlled via DT */                                                                              
                      ^                                                                                                                           
make[1]: *** [tools/envcrc.o] Error 1                                                                                                             
make: *** [tools] Error 2                                                                                                                         
In file included from include/configs/socfpga_sockit.h:195:0,                                                                                     
                 from include/config.h:5,                                                                                                         
                 from tools/envcrc.c:19:
include/configs/socfpga_common.h:217:22: error: missing binary operator before 
token "("
 #if CONFIG_IS_ENABLED(OF_CONTROL) /* DW SPI is controlled via DT */
                      ^

make[1]: *** [tools/envcrc.o] Error 1
make: *** [tools] Error 2

Best regards,
Marek Vasut

#38 lore raw

PATCH v3 15/15 of: clean up OF_CONTROL ifdef conditionals

Hi Marek,

2015-08-20 6:15 GMT+09:00 Marek Vasut <[email protected]>:

Quoted 50 lines · Tom Rini
Quoted 39 lines · Marek Vasut
Quoted 32 lines · Tom Rini
Quoted 22 lines · Masahiro Yamada
Quoted 21 lines

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.

Quoted 8 lines
Quoted 4 lines

(With a slight change due to samsun PR, but applied cleanly after rename)
Applied to u-boot/master, thanks!

Quoted 5 lines

And this just broke just about every SoCFPGA platform (try ie. socfpga_cyclone5) ;-) I poked into this a bit and noticed that adding #include <linux/kconfig.h> into include/configs/socfpga_common.h fixes the issue, but I'd like to check with you if this is the correct way of fixing it.

Quoted 5 lines

Broke it how?

$ ./tools/buildman/buildman socfpga_cyclone5
boards.cfg is up to date. Nothing to do.
Building current source for 1 boards (1 thread, 6 jobs per thread)
    1    0    0 /1      socfpga_cyclone5

Looks like I wasn't really accurate and mainline actually managed to avoid this breakage. I only triggered it with a custom patch, which enables env in SPI NOR (see the spit below).

Quoted 7 lines

I suspect the problem is caused by tools/envcrc.c, which does include the board config file (which uses this CONFIG_IS_ENABLED()), but does not include a header file which defines it.

The question therefore is, shall we not used CONFIG_IS_ENABLED() in board config files or shall we include linux/kconfig.h in tools/envcrc.c ?

Our final goal is:
We should not use any CONFIG_* in host tools. Actually, some host tools in U-boot depend on the board
configuration, which is weird.
If we could rip off CONFIG_* from them, neither CONFIG_IS_ENABLED()
nor linux/kconfig.h
is needed for host tools. I believe this is the right thing to do.
Any volunteer?

What I can suggest now is:
Do not use CONFIG_IS_ENABLED() in board config headers.

include/config/microblaze-generic.h does this:

#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
#endif

This is indeed ugly, but works...

Signature · 2 lines
Best Regards
Masahiro Yamada
#39 lore raw

PATCH v3 15/15 of: clean up OF_CONTROL ifdef conditionals

Quoted 1 line · Masahiro Yamada

Hi Marek,

Hi Masahiro,

Quoted 69 lines

2015-08-20 6:15 GMT+09:00 Marek Vasut <[email protected]>:

Quoted 51 lines · Tom Rini
Quoted 39 lines · Marek Vasut
Quoted 32 lines · Tom Rini
Quoted 22 lines · Masahiro Yamada
Quoted 21 lines

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.

Quoted 8 lines
Quoted 4 lines

(With a slight change due to samsun PR, but applied cleanly after rename)
Applied to u-boot/master, thanks!

Quoted 5 lines

And this just broke just about every SoCFPGA platform (try ie. socfpga_cyclone5) ;-) I poked into this a bit and noticed that adding #include <linux/kconfig.h> into include/configs/socfpga_common.h fixes the issue, but I'd like to check with you if this is the correct way of fixing it.

Quoted 6 lines

Broke it how?

$ ./tools/buildman/buildman socfpga_cyclone5
boards.cfg is up to date. Nothing to do.
Building current source for 1 boards (1 thread, 6 jobs per thread)

1 0 0 /1 socfpga_cyclone5

Looks like I wasn't really accurate and mainline actually managed to avoid this breakage. I only triggered it with a custom patch, which enables env in SPI NOR (see the spit below).

Quoted 6 lines

I suspect the problem is caused by tools/envcrc.c, which does include the board config file (which uses this CONFIG_IS_ENABLED()), but does not include a header file which defines it.

The question therefore is, shall we not used CONFIG_IS_ENABLED() in board config files or shall we include linux/kconfig.h in tools/envcrc.c ?

Our final goal is:
We should not use any CONFIG_* in host tools. Actually, some host tools in U-boot depend on the board
configuration, which is weird.
If we could rip off CONFIG_* from them, neither CONFIG_IS_ENABLED()
nor linux/kconfig.h
is needed for host tools. I believe this is the right thing to do.
Any volunteer?

Quoted 2 lines

What I can suggest now is:
Do not use CONFIG_IS_ENABLED() in board config headers.

Yup, this is what I'll do :)

Quoted 11 lines

include/config/microblaze-generic.h does this:

#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
#endif

This is indeed ugly, but works...

I don't think I even need this :)

Best regards,
Marek Vasut

#40 lore raw

PATCH v3 15/15 of: clean up OF_CONTROL ifdef conditionals

Quoted 89 lines · Marek Vasut
Quoted 1 line · Masahiro Yamada

Hi Marek,

Hi Masahiro,

Quoted 69 lines

2015-08-20 6:15 GMT+09:00 Marek Vasut <[email protected]>:

Quoted 51 lines · Tom Rini
Quoted 39 lines · Marek Vasut
Quoted 32 lines · Tom Rini
Quoted 22 lines · Masahiro Yamada
Quoted 21 lines

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.

Quoted 8 lines
Quoted 4 lines

(With a slight change due to samsun PR, but applied cleanly after rename)
Applied to u-boot/master, thanks!

Quoted 5 lines

And this just broke just about every SoCFPGA platform (try ie. socfpga_cyclone5) ;-) I poked into this a bit and noticed that adding #include <linux/kconfig.h> into include/configs/socfpga_common.h fixes the issue, but I'd like to check with you if this is the correct way of fixing it.

Quoted 6 lines

Broke it how?

$ ./tools/buildman/buildman socfpga_cyclone5
boards.cfg is up to date. Nothing to do.
Building current source for 1 boards (1 thread, 6 jobs per thread)

1 0 0 /1 socfpga_cyclone5

Looks like I wasn't really accurate and mainline actually managed to avoid this breakage. I only triggered it with a custom patch, which enables env in SPI NOR (see the spit below).

Quoted 6 lines

I suspect the problem is caused by tools/envcrc.c, which does include the board config file (which uses this CONFIG_IS_ENABLED()), but does not include a header file which defines it.

The question therefore is, shall we not used CONFIG_IS_ENABLED() in board config files or shall we include linux/kconfig.h in tools/envcrc.c ?

Our final goal is:
We should not use any CONFIG_* in host tools. Actually, some host tools in U-boot depend on the board
configuration, which is weird.
If we could rip off CONFIG_* from them, neither CONFIG_IS_ENABLED()
nor linux/kconfig.h
is needed for host tools. I believe this is the right thing to do.
Any volunteer?

Quoted 2 lines

What I can suggest now is:
Do not use CONFIG_IS_ENABLED() in board config headers.

Yup, this is what I'll do :)

Quoted 10 lines

include/config/microblaze-generic.h does this:

#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
#endif
Quoted 3 lines
Quoted 1 line

This is indeed ugly, but works...

I don't think I even need this :)

I want to look at moving microblaze DM and just use OF_CONTROL and remove this ancient configuration method.

Thanks,
Michal

Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150821/739cd33e/attachment.sig>