public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/7] ls102xa: pblimage: Add pblimage tool support for LS102xA
Date: Thu, 18 Sep 2014 11:57:10 +0200	[thread overview]
Message-ID: <E1XUYSd-0002TN-F0@janus> (raw)
In-Reply-To: <1411019239-12360-3-git-send-email-b18965@freescale.com>

Hi Alison,

On Thu, 18 Sep 2014 13:47:14 +0800, Alison Wang <b18965@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.wang@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.

  reply	other threads:[~2014-09-18  9:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-18  5:47 [U-Boot] [PATCH 0/7] Add SD boot support for LS1021AQDS/TWR board Alison Wang
2014-09-18  5:47 ` [U-Boot] [PATCH 1/7] spl: pbl: Add new SPL image for pblimage tool Alison Wang
2014-09-18  9:37   ` Albert ARIBAUD
2014-09-19  5:07     ` Huan Wang
2014-09-20  7:47       ` Albert ARIBAUD
2014-09-22  6:17         ` Huan Wang
2014-09-22 15:49           ` York Sun
2014-09-23  2:43             ` Huan Wang
2014-09-23  3:40               ` York Sun
2014-09-25  6:33                 ` Huan Wang
2014-09-18  5:47 ` [U-Boot] [PATCH 2/7] ls102xa: pblimage: Add pblimage tool support for LS102xA Alison Wang
2014-09-18  9:57   ` Albert ARIBAUD [this message]
2014-09-22  6:22     ` Huan Wang
2014-09-24  7:55       ` [U-Boot] [OT] " Albert ARIBAUD
2014-09-24  8:00         ` Huan Wang
2014-09-18  5:47 ` [U-Boot] [PATCH 3/7] spl: Use u-boot.img instead of u-boot.bin when CONFIG_SPL_PBL_PAD is enabled Alison Wang
2014-09-18  5:47 ` [U-Boot] [PATCH 4/7] ls102xa: qixis: Add CONFIG_QIXIS_I2C_ACCESS macro Alison Wang
2014-09-18  5:47 ` [U-Boot] [PATCH 5/7] common: spl: Add interactive DDR debugger support for SPL Alison Wang
2014-09-18  5:47 ` [U-Boot] [PATCH 6/7] arm: ls102xa: Add SD boot support for LS1021AQDS board Alison Wang
2014-09-18 11:20   ` Albert ARIBAUD
2014-09-19  3:40     ` Alison Wang
2014-09-19  5:10     ` Huan Wang
     [not found]     ` <1411053355745.66856@freescale.com>
2014-09-19 15:56       ` Albert ARIBAUD
2014-09-22  6:46         ` Huan Wang
2014-09-22 11:01           ` Albert ARIBAUD
2014-09-25  6:45             ` Huan Wang
2014-10-01 18:08               ` Albert ARIBAUD
2014-10-08  9:53                 ` Huan Wang
2014-10-11 11:30                   ` Albert ARIBAUD
2014-10-15  6:56                     ` Huan Wang
2014-10-15 10:30                       ` Albert ARIBAUD
2014-09-18  5:47 ` [U-Boot] [PATCH 7/7] arm: ls102xa: Add SD boot support for LS1021ATWR board Alison Wang

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=E1XUYSd-0002TN-F0@janus \
    --to=albert.u.boot@aribaud.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox