Re: [U-Boot] [PATCH 3/3] imx8: output SECO-FW, ATF and imx-mkimage commit IDs

2019-10-22 Thread Anatolij Gustschin
Hi Peng,

On Tue, 22 Oct 2019 02:49:53 +
Peng Fan peng@nxp.com wrote:
...
> > +   /* Get SECO FW build and commit id */
> > +   sc_misc_seco_build_info(-1, _build, _commit);  
> 
> Use sc_seco_build_info.

OK, will do in v2.

...
> > +   if (strlen(mkimage_commit) == 0) {
> > +   debug("IMX-MKIMAGE does not support build info\n");
> > +   mkimage_commit = "0"; /* Display 0 */
> > +   }
> 
> We no need imx-mkimage, use mkimage in U-Boot no need this piece code.

will drop it in v2 patch.

--
Anatolij
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] imx8: output SECO-FW, ATF and imx-mkimage commit IDs

2019-10-21 Thread Peng Fan
Hi Anatolij,

> Subject: [PATCH 3/3] imx8: output SECO-FW, ATF and imx-mkimage commit
> IDs
> 
> Borrow ID reading code from Ye Li (NXP U-Boot, commit ID 5b443e3e2617)
> and add the commit IDs to the environment.
> 
> Signed-off-by: Anatolij Gustschin 
> ---
>  arch/arm/mach-imx/imx8/misc.c | 61
> ++-
>  1 file changed, 60 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-imx/imx8/misc.c
> b/arch/arm/mach-imx/imx8/misc.c index fe73e29eee..b0693358e7 100644
> --- a/arch/arm/mach-imx/imx8/misc.c
> +++ b/arch/arm/mach-imx/imx8/misc.c
> @@ -1,6 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0+
>  #include 
>  #include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> 
>  int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate)
> { @@ -25,9 +28,28 @@ int sc_pm_setup_uart(sc_rsrc_t uart_rsrc,
> sc_pm_clock_rate_t clk_rate)
>   return 0;
>  }
> 
> +#define FSL_SIP_BUILDINFO0xC203
> +#define FSL_SIP_BUILDINFO_GET_COMMITHASH 0x00
> +extern uint32_t _end_ofs;
> +
> +static void set_buildinfo_to_env(uint32_t scfw, uint32_t secofw,
> +  char *mkimage, char *atf)
> +{
> + if (!mkimage || !atf)
> + return;
> +
> + env_set("commit_mkimage", mkimage);
> + env_set("commit_atf", atf);
> + env_set_hex("commit_scfw", (ulong)scfw);
> + env_set_hex("commit_secofw", (ulong)secofw); }
> +
>  void build_info(void)
>  {
> + u32 seco_build = 0, seco_commit = 0;
>   u32 sc_build = 0, sc_commit = 0;
> + ulong atf_commit = 0;
> + char *mkimage_commit, *temp;
> 
>   /* Get SCFW build and commit id */
>   sc_misc_build_info(-1, _build, _commit); @@ -35,5 +57,42 @@
> void build_info(void)
>   printf("SCFW does not support build info\n");
>   sc_commit = 0; /* Display 0 if build info not supported */
>   }
> - printf("Build: SCFW %x\n", sc_commit);
> +
> + /* Get SECO FW build and commit id */
> + sc_misc_seco_build_info(-1, _build, _commit);

Use sc_seco_build_info.

> + if (!seco_build) {
> + debug("SECO FW does not support build info\n");
> + /* Display 0 when the build info is not supported */
> + seco_commit = 0;
> + }
> +
> + /*
> +  * Get imx-mkimage commit id.
> +  * The imx-mkimage puts the commit hash behind the end of u-boot.bin
> +  */
> + mkimage_commit = (char *)(ulong)(CONFIG_SYS_TEXT_BASE + _end_ofs
> +
> +  fdt_totalsize(gd->fdt_blob));
> + temp = mkimage_commit + 8;
> + *temp = '\0';
> +
> + if (strlen(mkimage_commit) == 0) {
> + debug("IMX-MKIMAGE does not support build info\n");
> + mkimage_commit = "0"; /* Display 0 */
> + }


We no need imx-mkimage, use mkimage in U-Boot no need this piece code.

Regards,
Peng.

> +
> + /* Get ARM Trusted Firmware commit id */
> + atf_commit = call_imx_sip(FSL_SIP_BUILDINFO,
> +   FSL_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0);
> + if (atf_commit == 0x) {
> + debug("ATF does not support build info\n");
> + atf_commit = 0x30; /* Display 0 */
> + }
> +
> + printf("Build: SCFW %08x, SECO-FW %08x\n"
> +"   IMX-MKIMAGE %s, ATF %s\n",
> +sc_commit, seco_commit, mkimage_commit, (char
> *)_commit);
> +
> + /* Set all to env */
> + set_buildinfo_to_env(sc_commit, seco_commit, mkimage_commit,
> +  (char *)_commit);
>  }
> --
> 2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot