]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/mcsdk-tools.git/blobdiff - post/src/post.c
Add NAND/NOR writer support and update POST for C6670
[keystone-rtos/mcsdk-tools.git] / post / src / post.c
index c6d91140906b310e78c2fc232d76634c3c1e568a..f69e87c886f9b218902d4159fb4a5f7595da610d 100644 (file)
@@ -277,6 +277,35 @@ post_test_nor
     return test_passed;
 }
 
+void
+post_hex_to_string
+(
+    uint32_t    hex,
+    uint32_t    nibbles,
+    char        *msg
+)
+{
+    int32_t     i;
+    uint8_t     nibble;
+
+    for (i = (nibbles-1); i >= 0; i--)
+    {
+        nibble = hex & 0xf;
+        if (nibble <= 0x9)
+        {
+            nibble += '0';
+        }
+        else
+        {
+            nibble += ('A' - 0xa);
+        }
+
+        msg[i] = nibble;
+        hex = hex >> 4;
+    }
+    msg[nibbles] = 0;
+}
+
 /******************************************************************************
  * Function:    main function for POST
  ******************************************************************************/
@@ -294,15 +323,12 @@ main
     int32_t                 i;
     char                    msg[9];
     uint8_t                 mac_addr[6];
+    platform_info           info;
 
     /* Turn on all the platform initialize flags */
     memset(&init_config, 0, sizeof(platform_init_config));
     memset(&init_flags, 0x01, sizeof(platform_init_flags));
 
-#ifdef _EVMC6670L_
-    init_flags.phy = 0;
-#endif
-
     /* Initialize the platform */
     if (platform_init(&init_flags, &init_config) != Platform_EOK)
     {
@@ -328,41 +354,42 @@ main
     platform_uart_set_baudrate(POST_UART_BAUDRATE);
     if (test_id != POST_TEST_PLL_INIT)
     {
-        if (post_write_uart(POST_DEVICE) != TRUE)
+        if (post_write_uart("\r\n\r\n") != TRUE)
         {
             post_display_led_error(POST_TEST_UART);   /* Never return from this function */
         }
+
+        platform_get_info(&info);
+
+        /* Display the board name */
+        post_write_uart(info.board_name);
+
+        /* Display the POST version */
         post_write_uart(POST_EVM_VERSION_MSG);
         post_write_uart(post_version);
 
+        post_hex_to_string(info.board_rev, 4, msg);
+        post_write_uart("\r\n\r\nFPGA Version: ");
+        post_write_uart(msg);
+
         /*post_write_uart("\r\n\r\nPOST booting from I2C 0x50 ... ");*/
 
+        /* Display the EFUSE MAC address */
         platform_get_macaddr(PLATFORM_MAC_TYPE_EFUSE, mac_addr);
-        msg[2] = ' ';
-        msg[3] = 0;
         post_write_uart("\r\n\r\nEFUSE MAC ID is: ");
         for (i = 0; i < 6; i++)
         {
-            msg[0] = (char)(mac_addr[i]>>4);
-            if (msg[0] < 0xa)
-            {
-                msg[0] += '0';
-            }
-            else
-            {
-                msg[0] = msg[0] - 0xa + 'A';
-            }
-            msg[1] = (char)(mac_addr[i]&0xf);
-            if (msg[1] < 0xa)
-            {
-                msg[1] += '0';
-            }
-            else
-            {
-                msg[1] = msg[1] - 0xa + 'A';
-            }
+            post_hex_to_string(info.emac.efuse_mac_address[i], 2, msg);
+            msg[2] = ' ';
+            msg[3] = 0;
             post_write_uart(msg);
         }
+
+        /* Read the PLL Reset Type Status register and display on UART */
+        reset_type = PLL_CTRL_REG_RSTYPE;
+        post_hex_to_string(reset_type, 8, msg);
+        post_write_uart("\r\n\r\nPLL Reset Type Status Register: 0x");
+        post_write_uart(msg);
     }
 
     /* Display test in progress UART/LED status or init error */
@@ -381,16 +408,5 @@ main
     post_display_status(POST_TEST_NAND, test_passed);
 
     post_display_status(POST_TEST_COMPLETE, TRUE);
-
-    /* Read the PLL Reset Type Status register and display on UART */
-    reset_type = PLL_CTRL_REG_RSTYPE;
-    for (i = 7; i >= 0; i--)
-    {
-        msg[i] = (char)(reset_type & 0xf) + '0';
-        reset_type = reset_type >> 4;
-    }
-    msg[8] = 0;
-    post_write_uart("\r\n\r\nPLL Reset Type Status Register: 0x");
-    post_write_uart(msg);
 }