From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Thu, 18 Sep 2014 11:57:10 +0200 Subject: [U-Boot] [PATCH 2/7] ls102xa: pblimage: Add pblimage tool support for LS102xA In-Reply-To: <1411019239-12360-3-git-send-email-b18965@freescale.com> References: <1411019239-12360-1-git-send-email-b18965@freescale.com> <1411019239-12360-3-git-send-email-b18965@freescale.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Alison, On Thu, 18 Sep 2014 13:47:14 +0800, Alison Wang 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 > --- > 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.