summaryrefslogtreecommitdiff
path: root/cleopatre/u-boot-1.1.6/common
diff options
context:
space:
mode:
authordraskovic2009-08-11 16:08:59 +0000
committerdraskovic2009-08-11 16:08:59 +0000
commitd0b0f3ce390f3d70d6bf4d1d3b76b6a30c0c52fb (patch)
treeecae89d95df6378ba1c634f490b789f6ef39201c /cleopatre/u-boot-1.1.6/common
parent0a956bbcd4bf08343be75406eee54947334c426a (diff)
[CLEO][U-BOOT]Tested and corrected image detection for image 0
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@5215 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cleopatre/u-boot-1.1.6/common')
-rw-r--r--cleopatre/u-boot-1.1.6/common/cmd_spidboot.c57
1 files changed, 40 insertions, 17 deletions
diff --git a/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c b/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c
index 65db1df627..9a6c709c74 100644
--- a/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c
+++ b/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c
@@ -315,7 +315,7 @@ static void update_origin_index(spidcom_image_desc_t *desc, char *addr, ulong in
flash_write( (char *)desc, (ulong)addr, sizeof(spidcom_image_desc_t) );
}
-static int select_image(int img_nb)
+static int select_image(int found_nb)
{
int sel_img = -1; /* will hold the index of selected image */
spidcom_image_desc_t *desc;
@@ -323,7 +323,7 @@ static int select_image(int img_nb)
ulong max_index = 0;
int i;
- for (i=0; i<img_nb; i++)
+ for (i=0; i<found_nb; i++)
{
desc = &img_desc[i];
load_header(desc, (char *)img_addr[i]);
@@ -332,7 +332,7 @@ static int select_image(int img_nb)
switch(img_state[i])
{
case IMAGE_OK:
- printf("IMG_%d is OK.\n", i);
+ printf("IMG at address %#x is OK.\n", img_addr[i]);
if (desc->index >= max_index)
{
max_index = desc->index;
@@ -341,40 +341,40 @@ static int select_image(int img_nb)
break;
case IMAGE_OK_ORIGIN:
- printf("IMG_%d is OK.\n", i);
+ printf("IMG at address %#x is OK.\n", img_addr[i]);
break;
case BAD_MAGIC_NUMBER:
- printf("IMG_%d is not OK (bad magic number).\n", i);
+ printf("IMG at address %#x is not OK (bad magic number).\n", img_addr[i]);
break;
case WRONG_IMAGE_ARCH:
- printf("IMG_%d is not OK (architecture error).\n", i);
+ printf("IMG at address %#x is not OK (architecture error).\n", img_addr[i]);
break;
case WRONG_IMAGE_TYPE:
- printf("IMG_%d is not OK (type error).\n", i);
+ printf("IMG at address %#x is not OK (type error).\n", img_addr[i]);
break;
case UPD_NOT_FINISHED:
- printf("IMG_%d is not OK (update error).\n", i);
+ printf("IMG at address %#x is not OK (update error).\n", img_addr[i]);
break;
case INDEX_NOT_VALID:
- printf("IMG_%d is not OK (index error).\n", i);
+ printf("IMG at address %#x is not OK (index error).\n", img_addr[i]);
break;
case IMAGE_NOT_SUCCESS:
- printf("IMG_%d is not OK (image error).\n", i);
+ printf("IMG at address %#x is not OK (image error).\n", img_addr[i]);
break;
default: /* IMAGE_NOT_VALID */
- printf("IMG_%d is not OK (valid error).\n", i);
+ printf("IMG at address %#x is not OK (valid error).\n", img_addr[i]);
}
}
/* Check a JTAG image, cause it will be better to boot it */
- for (i=0; i<img_nb; i++)
+ for (i=0; i<found_nb; i++)
{
if(img_state[i] == IMAGE_OK_ORIGIN)
{
@@ -407,10 +407,23 @@ find_images(int img_nb)
nvram = (spc300_nvram_t *)(gd->bd->bi_nvram_addr);
+ /* we know addr of IMG_0, even if it has bad magic word */
+ img_addr[0] = PHYS_FLASH_SPI_1 + nvram->img_0_offset;
+#if defined(CONFIG_ARCH_ARIZONA) && !defined(CONFIG_EXEC_FROM_SPI)
+ img_addr[0] -= 0x78000000; /* FCM3 fix when executed from Flash NOR -- remove later!!! */
+#endif /* CONFIG_EXEC_FROM_SPI */
+ i++;
+
+ /* if there is only one img_nb address is set to img_0_addr and we can return */
+ if(img_nb == 1)
+ {
+ return 1;
+ }
+
/* search for the "SPIDIMG\0" string on the beginning of the each sector */
for (sect=0; sect < flinfo->sector_count; ++sect)
{
- if (flinfo->start[sect] < nvram->img_0_offset)
+ if (flinfo->start[sect] <= PHYS_FLASH_SPI_1 + nvram->img_0_offset)
continue;
/* read beginning of the sector in local array variable */
@@ -457,6 +470,7 @@ int do_spidboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
char *img_load_addr = NULL;
bd_t *bd = gd->bd;
int img_nb = 0;
+ int found_nb = 0;
int sel_img = -1; /* image selected for boot after all the checks */
#ifdef CONFIG_CMDLINE_TAG
@@ -482,16 +496,25 @@ int do_spidboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
/* give a chance of 1sec timeout for user to initiate the update */
do_spidupd();
- find_images(img_nb);
- sel_img = select_image(img_nb);
- if(ctrlc())
+ printf("Scanning for present Linux images... ");
+ found_nb = find_images(img_nb);
+ printf("Found %d Linux images.\n", found_nb);
+ if ( found_nb == 0 )
+ {
+ continue;
+ }
+
+ sel_img = select_image(found_nb);
+ if ( ctrlc() )
+ {
return -1;
+ }
}
addr = img_addr[sel_img];
hdr = &img_desc[sel_img];
- printf("Selecting IMG_%d.\n", sel_img);
+ printf("Selecting IMG at address %#x.\n", addr);
}
else
{