All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH 1/2] Makefile: Add environment variable DEVICE_TREE to header
Date: Wed, 26 Feb 2020 07:33:15 -0800	[thread overview]
Message-ID: <CAPnjgZ1+QtRb2MgNH5-FGH5vCQukiSR05D10JbQFDB9=HxGQ1g@mail.gmail.com> (raw)
In-Reply-To: <65fe3fb4b7f682b4a292b261f0140b1f89f4610e.1582041753.git.michal.simek@xilinx.com>

Hi Michal,

On Tue, 18 Feb 2020 at 09:02, Michal Simek <michal.simek@xilinx.com> wrote:
>
> Users have option to overwrite default device tree
> (CONFIG_DEFAULT_DEVICE_TREE) via environment variable DEVICE_TREE.
>
> Feature has been added long time ago by commit 74de8c9a1672
> ("dts/Makefile: Build the user specified dts") for a little bit different
> reason.
>
> But this variable can be also used for different purpose like choosing
> proper configuration from FIT image in SPL.
> And this is the functionality I would like to use on Xilinx Zynq devices
> that current u-boot.img can be composed in the same way based on OF_LIST
> and different configuration is taken based on platform specific SPL.
> SPL requires low level ps7_init_gpl configuration that's why different
> boards require different SPL with fixed board_fit_config_name_match().
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> I have done it in this way but maybe there is any smarter way how this can
> be done. Also macro name can change if you want.

Can you please add a bit of documentation to doc/README.fdt-control ?

> ---
>  Makefile                 | 14 +++++++++++++-
>  arch/arm/mach-zynq/spl.c |  8 ++++++--
>  2 files changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 0af89e0a7881..15f7cce445f6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -483,6 +483,7 @@ endif
>  version_h := include/generated/version_autogenerated.h
>  timestamp_h := include/generated/timestamp_autogenerated.h
>  defaultenv_h := include/generated/defaultenv_autogenerated.h
> +dt_h := include/generated/dt.h
>
>  no-dot-config-targets := clean clobber mrproper distclean \
>                          help %docs check% coccicheck \
> @@ -1768,7 +1769,7 @@ endif
>  # prepare2 creates a makefile if using a separate output directory
>  prepare2: prepare3 outputmakefile cfg
>
> -prepare1: prepare2 $(version_h) $(timestamp_h) \
> +prepare1: prepare2 $(version_h) $(timestamp_h) $(dt_h) \
>                     include/config/auto.conf
>  ifeq ($(wildcard $(LDSCRIPT)),)
>         @echo >&2 "  Could not find linker script."
> @@ -1834,12 +1835,23 @@ define filechk_defaultenv.h
>          xxd -i ; echo ", 0x00" ; )
>  endef
>
> +define filechk_dt.h
> +       (if test -n "$${DEVICE_TREE}"; then \

I think this can be:

ifneq($(DEVICE_TREE),)

> +               echo \#define DEVICE_TREE \"$(DEVICE_TREE)\"; \
> +       else \
> +               echo \#define DEVICE_TREE CONFIG_DEFAULT_DEVICE_TREE; \
> +       fi)
> +endef
> +
>  $(version_h): include/config/uboot.release FORCE
>         $(call filechk,version.h)
>
>  $(timestamp_h): $(srctree)/Makefile FORCE
>         $(call filechk,timestamp.h)
>
> +$(dt_h): $(srctree)/Makefile FORCE
> +       $(call filechk,dt.h)
> +
>  $(defaultenv_h): $(CONFIG_DEFAULT_ENV_FILE:"%"=%) FORCE
>         $(call filechk,defaultenv.h)
>
> diff --git a/arch/arm/mach-zynq/spl.c b/arch/arm/mach-zynq/spl.c
> index 96ba90fb7a76..e89e46c1038d 100644
> --- a/arch/arm/mach-zynq/spl.c
> +++ b/arch/arm/mach-zynq/spl.c
> @@ -6,6 +6,7 @@
>  #include <debug_uart.h>
>  #include <hang.h>
>  #include <spl.h>
> +#include <generated/dt.h>
>
>  #include <asm/io.h>
>  #include <asm/spl.h>
> @@ -89,8 +90,11 @@ void spl_board_prepare_for_boot(void)
>  int board_fit_config_name_match(const char *name)
>  {
>         /* Just empty function now - can't decide what to choose */
> -       debug("%s: %s\n", __func__, name);
> +       debug("%s: Check %s, default %s\n", __func__, name, DEVICE_TREE);
>
> -       return 0;
> +       if (!strcmp(name, DEVICE_TREE))
> +               return 0;
> +
> +       return -1;
>  }
>  #endif
> --
> 2.25.0
>

Regards,
Simon

  parent reply	other threads:[~2020-02-26 15:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 16:02 [PATCH 0/2] ARM: zynq: Start to use unified configurations Michal Simek
2020-02-18 16:02 ` [PATCH 1/2] Makefile: Add environment variable DEVICE_TREE to header Michal Simek
2020-02-24 13:56   ` Tom Rini
2020-02-26 15:33   ` Simon Glass [this message]
2020-02-28 11:03     ` Michal Simek
2020-03-02 19:47       ` Simon Glass
2020-03-03  6:52         ` Michal Simek
2020-03-04  2:47           ` Simon Glass
2020-03-04  6:44             ` Michal Simek
2020-03-04 17:51               ` Simon Glass
2020-02-18 16:02 ` [PATCH 2/2] ARM: zynq: Switch to single zynq configurations Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPnjgZ1+QtRb2MgNH5-FGH5vCQukiSR05D10JbQFDB9=HxGQ1g@mail.gmail.com' \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.