summaryrefslogtreecommitdiff
path: root/cleopatre/u-boot-1.1.6/common
diff options
context:
space:
mode:
authorOlivier Dufour2013-01-30 15:01:31 +0100
committerCyril Jourdan2013-02-11 13:33:26 +0100
commit1005ac0db5e56e80c9fc7c90085d1490e3e99c05 (patch)
treea2ec59b0f90d02a3de6df2dbf963461274e098fa /cleopatre/u-boot-1.1.6/common
parent8e10b3c3426479982f5bb1932d1533340dcb3df2 (diff)
cleo/uboot/cmd_spidboot: force image selection during autoswitch, closes #3693
Diffstat (limited to 'cleopatre/u-boot-1.1.6/common')
-rw-r--r--cleopatre/u-boot-1.1.6/common/cmd_spidboot.c21
1 files changed, 21 insertions, 0 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 28bf69f27c..f2d2721f95 100644
--- a/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c
+++ b/cleopatre/u-boot-1.1.6/common/cmd_spidboot.c
@@ -34,6 +34,7 @@
#include <asm/arch/wdt.h>
#include <asm/arch/ips/uart.h>
#if defined (CONFIG_CHIP_MSE500)
+#include <asm/arch/sram-mapping.h>
#include <asm/arch/ips/hardware/msepll.h>
#include <asm/arch/ips/hardware/mseafe.h>
#include <asm/arch/ips/hardware/iomux.h>
@@ -522,6 +523,26 @@ static int select_image(int img_nb)
uint version_len;
spidcom_image_desc_image_type_t prev_img_type = SPIDCOM_IMG_DESC_IMAGE_TYPE_UNKNOWN;
int i;
+#if defined (CONFIG_CHIP_MSE500)
+ volatile sram_autoswitch_data_t *autoswitch_data = (volatile sram_autoswitch_data_t *) SRAM_DATA_PA_PTR (autoswitch);
+
+ if (!strncmp ((const char *)autoswitch_data->magic, MSE500_AUTOSWITCH_MAGIC,
+ MSE500_AUTOSWITCH_MAGIC_SIZE)
+ && ((autoswitch_data->slot <= 1) && (autoswitch_data->slot >= 0)))
+ {
+ if (load_header (&img_desc[autoswitch_data->slot],
+ (char *)img_addr[autoswitch_data->slot]) >= 0)
+ {
+ int state = check_img (&img_desc[autoswitch_data->slot],
+ (char *)img_addr[autoswitch_data->slot]);
+ if (state == IMAGE_OK || state == IMAGE_OK_ORIGIN)
+ {
+ autoswitch_en = 1;
+ return autoswitch_data->slot;
+ }
+ }
+ }
+#endif
for (i=0; i<img_nb; i++)
{