]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
[PCS440EP] - Show on the DIAG LEDs, if the SHA1 check failed
authorHeiko Schocher <hs@pollux.denx.de>
Wed, 11 Jul 2007 16:39:11 +0000 (18:39 +0200)
committerHeiko Schocher <hs@pollux.denx.de>
Wed, 11 Jul 2007 16:39:11 +0000 (18:39 +0200)
            - now the Flash ST M29W040B is supported (not tested)
            - fix the "led" command
            - fix compile error, if BUILD_DIR is used

Signed-off-by: Heiko Schocher <hs@denx.de>
Makefile
board/pcs440ep/flash.c
board/pcs440ep/pcs440ep.c
doc/README.sha1 [new file with mode: 0644]
include/configs/pcs440ep.h

index 47e4e670abdcee14d4f92be10bb4bacf086fc381..c45700e08d6664f0066934b7b4cd0650d9db07de 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -268,7 +268,7 @@ $(obj)u-boot.img:   $(obj)u-boot.bin
                -d $< $@
 
 $(obj)u-boot.sha1:     $(obj)u-boot.bin
-               ./tools/ubsha1 $(obj)u-boot.bin
+               $(obj)./tools/ubsha1 $(obj)u-boot.bin
 
 $(obj)u-boot.dis:      $(obj)u-boot
                $(OBJDUMP) -d $< > $@
index 70014407c6ef632134c339d2015c52452ea22438..c5a62e25436cf165c19182ac1ae2ccfa7066847f 100644 (file)
@@ -82,6 +82,7 @@ void flash_print_info(flash_info_t *info)
        case FLASH_MAN_AMD:     printf ("AMD ");                break;
        case FLASH_MAN_FUJ:     printf ("FUJITSU ");            break;
        case FLASH_MAN_SST:     printf ("SST ");                break;
+       case FLASH_MAN_STM:     printf ("ST Micro");            break;
        case FLASH_MAN_EXCEL:   printf ("Excel Semiconductor "); break;
        case FLASH_MAN_MX:      printf ("MXIC "); break;
        default:                printf ("Unknown Vendor ");     break;
@@ -118,6 +119,8 @@ void flash_print_info(flash_info_t *info)
                break;
        case FLASH_SST040:      printf ("SST39LF/VF040 (4 Mbit, uniform sector size)\n");
                break;
+       case STM_ID_M29W040B:   printf ("ST Micro M29W040B (4 Mbit, uniform sector size)\n");
+               break;
        default:                printf ("Unknown Chip Type\n");
                break;
        }
@@ -193,6 +196,9 @@ static ulong flash_get_size(vu_long *addr, flash_info_t *info)
        case (CFG_FLASH_WORD_SIZE)SST_MANUFACT:
                info->flash_id = FLASH_MAN_SST;
                break;
+       case (CFG_FLASH_WORD_SIZE)STM_MANUFACT:
+               info->flash_id = FLASH_MAN_STM;
+               break;
        case (CFG_FLASH_WORD_SIZE)EXCEL_MANUFACT:
                info->flash_id = FLASH_MAN_EXCEL;
                break;
@@ -226,6 +232,11 @@ static ulong flash_get_size(vu_long *addr, flash_info_t *info)
                info->sector_count = 8;
                info->size = 0x0080000;         /* => 0.5 MB    */
                break;
+       case (CFG_FLASH_WORD_SIZE)STM_ID_M29W040B:
+               info->flash_id += FLASH_AM040;
+               info->sector_count = 8;
+               info->size = 0x0080000; /* => 0,5 MB */
+               break;
 
        case (CFG_FLASH_WORD_SIZE)AMD_ID_LV800T:
                info->flash_id += FLASH_AM800T;
index ada6b82c92715b2052d755897febc12076ec5ff4..0e34a76cb9f5335f67d9fee0ece4704d8469a636 100644 (file)
@@ -85,8 +85,9 @@ static void status_led_blink (void)
 
        /* set all LED which are on, to state BLINKING */
        for (i = 0; i < 4; i++) {
-               if (val & 0x08) status_led_set (i, STATUS_LED_BLINKING);
-               val = val << 1;
+               if (val & 0x01) status_led_set (3 - i, STATUS_LED_BLINKING);
+               else status_led_set (3 - i, STATUS_LED_OFF);
+               val = val >> 1;
        }
 }
 
@@ -113,12 +114,14 @@ void show_boot_progress (int val)
                        status_led_set (1, STATUS_LED_ON);
                        status_led_set (2, STATUS_LED_ON);
                        break;
+#if 0
                case 64:
                        /* starting Ethernet configuration */
                        status_led_set (0, STATUS_LED_OFF);
                        status_led_set (1, STATUS_LED_OFF);
                        status_led_set (2, STATUS_LED_ON);
                        break;
+#endif
                case 80:
                        /* loading Image */
                        status_led_set (0, STATUS_LED_ON);
@@ -404,6 +407,9 @@ static void pcs440ep_checksha1 (void)
        int     ret;
        char    *cs_test;
 
+       status_led_set (0, STATUS_LED_OFF);
+       status_led_set (1, STATUS_LED_OFF);
+       status_led_set (2, STATUS_LED_ON);
        ret = pcs440ep_sha1 (1);
        if (ret == 0) return;
 
@@ -751,28 +757,41 @@ void hw_watchdog_reset(void)
  ************************************************************************/
 int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
-       int     rcode = 0;
+       int     rcode = 0, i;
        ulong   pattern = 0;
 
-       pattern = simple_strtoul (argv[1], NULL, 10);
-       if (pattern > 200) {
+       pattern = simple_strtoul (argv[1], NULL, 16);
+       if (pattern > 0x400) {
+               int     val = GET_LEDS;
+               printf ("led: %x\n", val);
+               return rcode;
+       }
+       if (pattern > 0x200) {
                status_led_blink ();
                hang ();
                return rcode;
        }
-       if (pattern > 100) {
+       if (pattern > 0x100) {
                status_led_blink ();
                return rcode;
        }
        pattern &= 0x0f;
-       set_leds (pattern);
+       for (i = 0; i < 4; i++) {
+               if (pattern & 0x01) status_led_set (i, STATUS_LED_ON);
+               else status_led_set (i, STATUS_LED_OFF);
+               pattern = pattern >> 1;
+       }
        return rcode;
 }
 
 U_BOOT_CMD(
        led,    2,      1,      do_led,
-       "led    - set the led\n",
-       NULL
+       "led [bitmask]   - set the DIAG-LED\n",
+       "[bitmask] 0x01 = DIAG 1 on\n"
+       "              0x02 = DIAG 2 on\n"
+       "              0x04 = DIAG 3 on\n"
+       "              0x08 = DIAG 4 on\n"
+       "              > 0x100 set the LED, who are on, to state blinking\n"
 );
 
 #if defined(CONFIG_SHA1_CHECK_UB_IMG)
diff --git a/doc/README.sha1 b/doc/README.sha1
new file mode 100644 (file)
index 0000000..92dc8ff
--- /dev/null
@@ -0,0 +1,57 @@
+SHA1 usage:
+-----------
+
+In the U-Boot Image for the pcs440ep board is a SHA1 checksum integrated.
+This SHA1 sum is used, to check, if the U-Boot Image in Flash is not
+corrupted.
+
+The following command is available:
+
+=> help sha1
+sha1 address len [addr]  calculate the SHA1 sum [save at addr]
+     -p calculate the SHA1 sum from the U-Boot image in flash and print
+     -c check the U-Boot image in flash
+
+"sha1 -p"
+       calculates and prints the SHA1 sum, from the Image stored in Flash
+
+"sha1 -c"
+       check, if the SHA1 sum from the Image stored in Flash is correct
+
+
+It is possible to calculate a SHA1 checksum from a memoryrange with:
+
+"sha1 address len"
+
+If you want to store a new Image in Flash for the pcs440ep board,
+which has no SHA1 sum, you can do the following:
+
+a) cp the new Image on a position in RAM (here 0x300000)
+   (for this example we use the Image from Flash, stored at 0xfffa0000 and
+    0x60000 Bytes long)
+
+"cp.b fffa0000 300000 60000"
+
+b) Initialize the SHA1 sum in the Image with 0x00
+   The SHA1 sum is stored in Flash at:
+                           CFG_MONITOR_BASE + CFG_MONITOR_LEN + SHA1_SUM_POS
+   for the pcs440ep Flash:       0xfffa0000 +         0x60000 +        -0x20
+                            = 0xffffffe0
+   for the example in RAM:         0x300000 +         0x60000 +        -0x20
+                            = 0x35ffe0
+
+   note: a SHA1 checksum is 20 bytes long.
+
+"mw.b 35ffe0 0 14"
+
+c) now calculate the SHA1 sum from the memoryrange and write
+   the calculated checksum at the right place:
+
+"sha1 300000 60000 35ffe0"
+
+Now you have a U-Boot-Image for the pcs440ep board with the correct SHA1 sum.
+
+If you do a "./MAKEALL pcs440ep" or a "make all" to get the U-Boot image,
+the correct SHA1 sum will be automagically included in the U-Boot image.
+
+Heiko Schocher, 11 Jul 2007
index 69d97d66ea1528bc7ceb191ebf624f8e9778fe8b..5ee97c12794edf9f47ba8577e635ab1a92f3b93a 100644 (file)
 #define CONFIG_STATUS_LED      1       /* Status LED enabled           */
 #define CONFIG_BOARD_SPECIFIC_LED      1
 
-#define STATUS_LED_BIT         0x08                    /* LED 1 is on GPIO_PPC_1 */
+#define STATUS_LED_BIT         0x08                    /* DIAG1 is on GPIO_PPC_1 */
 #define STATUS_LED_PERIOD      ((CFG_HZ / 2) / 5)      /* blink at 5 Hz */
 #define STATUS_LED_STATE       STATUS_LED_OFF
-#define STATUS_LED_BIT1                0x04                    /* LED 2 is on GPIO_PPC_2 */
+#define STATUS_LED_BIT1                0x04                    /* DIAG2 is on GPIO_PPC_2 */
 #define STATUS_LED_PERIOD1     ((CFG_HZ / 2) / 5)      /* blink at 5 Hz */
 #define STATUS_LED_STATE1      STATUS_LED_ON
-#define STATUS_LED_BIT2                0x02                    /* LED 3 is on GPIO_PPC_3 */
+#define STATUS_LED_BIT2                0x02                    /* DIAG3 is on GPIO_PPC_3 */
 #define STATUS_LED_PERIOD2     ((CFG_HZ / 2) / 5)      /* blink at 5 Hz */
 #define STATUS_LED_STATE2      STATUS_LED_OFF
-#define STATUS_LED_BIT3                0x01                    /* LED 4 is on GPIO_PPC_4 */
+#define STATUS_LED_BIT3                0x01                    /* DIAG4 is on GPIO_PPC_4 */
 #define STATUS_LED_PERIOD3     ((CFG_HZ / 2) / 5)      /* blink at 5 Hz */
 #define STATUS_LED_STATE3      STATUS_LED_OFF