Message ID | 65fe3fb4b7f682b4a292b261f0140b1f89f4610e.1582041753.git.michal.simek@xilinx.com |
---|---|
State | Deferred |
Delegated to: | Michal Simek |
Headers | show |
Series | ARM: zynq: Start to use unified configurations | expand |
On Tue, Feb 18, 2020 at 05:02:36PM +0100, Michal Simek 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> Reviewed-by: Tom Rini <trini@konsulko.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
On 26. 02. 20 16:33, Simon Glass wrote: > 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 ? This feature is cover by documentation in this file already. What exactly do you think that should be added? Thanks, Michal 169 Build: 170 171 After board configuration is done, fdt supported u-boot can be build in two ways: 172 1) build the default dts which is defined from CONFIG_DEFAULT_DEVICE_TREE 173 $ make 174 2) build the user specified dts file 175 $ make DEVICE_TREE=<dts-file-name> 176 177
Hi Michal, On Fri, 28 Feb 2020 at 04:03, Michal Simek <michal.simek@xilinx.com> wrote: > > On 26. 02. 20 16:33, Simon Glass wrote: > > 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 ? > > This feature is cover by documentation in this file already. What > exactly do you think that should be added? > Then I suppose I am confused as to what this patch does. I thought it was allowing U-Boot to pass the DT to Linux, which wasn't previously supported? Regards, Simon > Thanks, > Michal > > 169 Build: > 170 > 171 After board configuration is done, fdt supported u-boot can be build > in two ways: > 172 1) build the default dts which is defined from > CONFIG_DEFAULT_DEVICE_TREE > 173 $ make > 174 2) build the user specified dts file > 175 $ make DEVICE_TREE=<dts-file-name> > 176 > 177 >
On 02. 03. 20 20:47, Simon Glass wrote: > Hi Michal, > > On Fri, 28 Feb 2020 at 04:03, Michal Simek <michal.simek@xilinx.com> wrote: >> >> On 26. 02. 20 16:33, Simon Glass wrote: >>> 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 ? >> >> This feature is cover by documentation in this file already. What >> exactly do you think that should be added? >> > > Then I suppose I am confused as to what this patch does. I thought it > was allowing U-Boot to pass the DT to Linux, which wasn't previously > supported? Just a note this is also not supported and would be good to have support for it. The patch is putting device tree name as macro to header and I am using this value just in zynq SPL to choose proper dtb file from u-boot.img. On ZynqMP generic platform I am using mkimage_fit_atf.sh script to automatically fill default configuration. https://gitlab.denx.de/u-boot/u-boot/blob/master/arch/arm/mach-zynqmp/mkimage_fit_atf.sh#L94 And I didn't want to create different u-boot.img/itb for Zynq that's why SPL has device tree built it directly in SPL. As I said maybe there is smarter way how to do it but this was the one I used. In our case SPL another way could be to put filename from ps7_init_* files and save it as variable and use it. Thanks, Michal
Hi Michal, On Mon, 2 Mar 2020 at 23:52, Michal Simek <michal.simek@xilinx.com> wrote: > > On 02. 03. 20 20:47, Simon Glass wrote: > > Hi Michal, > > > > On Fri, 28 Feb 2020 at 04:03, Michal Simek <michal.simek@xilinx.com> wrote: > >> > >> On 26. 02. 20 16:33, Simon Glass wrote: > >>> 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 ? > >> > >> This feature is cover by documentation in this file already. What > >> exactly do you think that should be added? > >> > > > > Then I suppose I am confused as to what this patch does. I thought it > > was allowing U-Boot to pass the DT to Linux, which wasn't previously > > supported? > > Just a note this is also not supported and would be good to have support > for it. > > The patch is putting device tree name as macro to header and I am using > this value just in zynq SPL to choose proper dtb file from u-boot.img. > > On ZynqMP generic platform I am using mkimage_fit_atf.sh script to > automatically fill default configuration. > https://gitlab.denx.de/u-boot/u-boot/blob/master/arch/arm/mach-zynqmp/mkimage_fit_atf.sh#L94 > And I didn't want to create different u-boot.img/itb for Zynq that's why > SPL has device tree built it directly in SPL. > > As I said maybe there is smarter way how to do it but this was the one I > used. > In our case SPL another way could be to put filename from ps7_init_* > files and save it as variable and use it. OK I see. So are you using OF_CONTROL for SPL? Regards, Simon
On 04. 03. 20 3:47, Simon Glass wrote: > Hi Michal, > > On Mon, 2 Mar 2020 at 23:52, Michal Simek <michal.simek@xilinx.com> wrote: >> >> On 02. 03. 20 20:47, Simon Glass wrote: >>> Hi Michal, >>> >>> On Fri, 28 Feb 2020 at 04:03, Michal Simek <michal.simek@xilinx.com> wrote: >>>> >>>> On 26. 02. 20 16:33, Simon Glass wrote: >>>>> 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 ? >>>> >>>> This feature is cover by documentation in this file already. What >>>> exactly do you think that should be added? >>>> >>> >>> Then I suppose I am confused as to what this patch does. I thought it >>> was allowing U-Boot to pass the DT to Linux, which wasn't previously >>> supported? >> >> Just a note this is also not supported and would be good to have support >> for it. >> >> The patch is putting device tree name as macro to header and I am using >> this value just in zynq SPL to choose proper dtb file from u-boot.img. >> >> On ZynqMP generic platform I am using mkimage_fit_atf.sh script to >> automatically fill default configuration. >> https://gitlab.denx.de/u-boot/u-boot/blob/master/arch/arm/mach-zynqmp/mkimage_fit_atf.sh#L94 >> And I didn't want to create different u-boot.img/itb for Zynq that's why >> SPL has device tree built it directly in SPL. >> >> As I said maybe there is smarter way how to do it but this was the one I >> used. >> In our case SPL another way could be to put filename from ps7_init_* >> files and save it as variable and use it. > > OK I see. So are you using OF_CONTROL for SPL? Yes. M
Hi Michal, On Tue, 3 Mar 2020 at 23:44, Michal Simek <michal.simek@xilinx.com> wrote: > > On 04. 03. 20 3:47, Simon Glass wrote: > > Hi Michal, > > > > On Mon, 2 Mar 2020 at 23:52, Michal Simek <michal.simek@xilinx.com> wrote: > >> > >> On 02. 03. 20 20:47, Simon Glass wrote: > >>> Hi Michal, > >>> > >>> On Fri, 28 Feb 2020 at 04:03, Michal Simek <michal.simek@xilinx.com> wrote: > >>>> > >>>> On 26. 02. 20 16:33, Simon Glass wrote: > >>>>> 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 ? > >>>> > >>>> This feature is cover by documentation in this file already. What > >>>> exactly do you think that should be added? > >>>> > >>> > >>> Then I suppose I am confused as to what this patch does. I thought it > >>> was allowing U-Boot to pass the DT to Linux, which wasn't previously > >>> supported? > >> > >> Just a note this is also not supported and would be good to have support > >> for it. > >> > >> The patch is putting device tree name as macro to header and I am using > >> this value just in zynq SPL to choose proper dtb file from u-boot.img. > >> > >> On ZynqMP generic platform I am using mkimage_fit_atf.sh script to > >> automatically fill default configuration. > >> https://gitlab.denx.de/u-boot/u-boot/blob/master/arch/arm/mach-zynqmp/mkimage_fit_atf.sh#L94 > >> And I didn't want to create different u-boot.img/itb for Zynq that's why > >> SPL has device tree built it directly in SPL. > >> > >> As I said maybe there is smarter way how to do it but this was the one I > >> used. > >> In our case SPL another way could be to put filename from ps7_init_* > >> files and save it as variable and use it. > > > > OK I see. So are you using OF_CONTROL for SPL? > > Yes. OK ta. Reviewed-by: Simon Glass <sjg@chromium.org> Regards, Simon
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 \ + 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
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. --- Makefile | 14 +++++++++++++- arch/arm/mach-zynq/spl.c | 8 ++++++-- 2 files changed, 19 insertions(+), 3 deletions(-)