Hi Alison,

On Thu, 18 Sep 2014 13:47:14 +0800, Alison Wang <b18...@freescale.com>
wrote:

> For LS102xA, the initialized next_pbl_cmd should be the sum of
> 0x81000000, the lower 24 bits of CONFIG_SPL_TEXT_BASE and
> CONFIG_SPL_MAX_SIZE(0x1a000). The sum is different from PowerPC.
> The PBI CRC command is different from PowerPC too.
> In pblimage tool, add the support for the above two issues.
> 
> Signed-off-by: Alison Wang <alison.w...@freescale.com>
> ---
>  tools/pblimage.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/pblimage.c b/tools/pblimage.c
> index 6e6e801..152678b 100644
> --- a/tools/pblimage.c
> +++ b/tools/pblimage.c
> @@ -12,6 +12,10 @@
>   * Initialize to an invalid value.
>   */
>  static uint32_t next_pbl_cmd = 0x82000000;
> +static uint32_t pbl_cmd_initaddr = 0x82000000;
> +static uint32_t pbi_crc_cmd1 = 0x13;
> +static uint32_t pbi_crc_cmd2 = 0x80;
> +
>  /*
>   * need to store all bytes in memory for calculating crc32, then write the
>   * bytes to image file for PBL boot.
> @@ -49,7 +53,7 @@ static void init_next_pbl_cmd(FILE *fp_uboot)
>               exit(EXIT_FAILURE);
>       }
>  
> -     next_pbl_cmd = 0x82000000 - st.st_size;
> +     next_pbl_cmd = pbl_cmd_initaddr - st.st_size;
>  }
>  
>  static void generate_pbl_cmd(void)
> @@ -81,7 +85,7 @@ static void pbl_fget(size_t size, FILE *stream)
>  static void load_uboot(FILE *fp_uboot)
>  {
>       init_next_pbl_cmd(fp_uboot);
> -     while (next_pbl_cmd < 0x82000000) {
> +     while (next_pbl_cmd < pbl_cmd_initaddr) {
>               generate_pbl_cmd();
>               pbl_fget(64, fp_uboot);
>       }
> @@ -111,6 +115,14 @@ static void pbl_parser(char *name)
>       size_t len = 0;
>  
>       fname = name;
> +
> +     if (strstr(fname, "ls102xa")) {
> +             next_pbl_cmd = 0x8101a000;
> +             pbl_cmd_initaddr = 0x8101a000;
> +             pbi_crc_cmd1 = 0x61;
> +             pbi_crc_cmd2 = 0;
> +     }

Basing the tool's behaviour on the file name is not a good approach
IMO. Can't we add some command line option to the tool to select the
right set of values?

>       fd = fopen(name, "r");
>       if (fd == NULL) {
>               printf("Error:%s - Can't open\n", fname);
> @@ -172,8 +184,8 @@ static void add_end_cmd(void)
>  
>       /* Add PBI CRC command. */
>       *pmem_buf++ = 0x08;
> -     *pmem_buf++ = 0x13;
> -     *pmem_buf++ = 0x80;
> +     *pmem_buf++ = pbi_crc_cmd1;
> +     *pmem_buf++ = pbi_crc_cmd2;
>       *pmem_buf++ = 0x40;
>       pbl_size += 4;
>  


Amicalement,
-- 
Albert.
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to