[U-Boot] [PATCH] add support for EMK TOP7000 CPU module (modified files)

Reinhard Meyer (-VC) reinhard.meyer at emk-elektronik.de
Fri Jun 4 14:10:32 CEST 2010


This Patch adds support for the EMK TOP7000 CPU Module
Part 2: modified files

Signed-off-by: Reinhard Meyer reinhard.meyer at emk-elektronik.de


---
 MAINTAINERS               |    6 ++++-
 Makefile                  |    3 ++
 board/emk/common/vpd.c    |   57 
++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 59 insertions(+), 7 deletions(-)
 mode change 100755 => 100644 include/configs/top7000.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 7a13d28..9d5540a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -311,7 +311,7 @@ Andrea "llandre" Marson <andrea.marson at dave-tech.it>
 
     PPChameleonEVB    PPC405EP
 
-Reinhard Meyer <r.meyer at emk-elektronik.de>
+Reinhard Meyer <reinhard.meyer at emk-elektronik.de>
 
     TOP860        MPC860T
     TOP5200        MPC5200
@@ -928,6 +928,10 @@ Haavard Skinnemoen <haavard.skinnemoen at atmel.com>
     ATSTK1006    AT32AP7000
     ATNGW100    AT32AP7000
 
+Reinhard Meyer <reinhard.meyer at emk-elektronik.de>
+
+    TOP7000        AT32AP7000
+
 #########################################################################
 # SuperH Systems:                            #
 #                                    #
diff --git a/Makefile b/Makefile
index c26e491..e57a4ca 100644
--- a/Makefile
+++ b/Makefile
@@ -3549,6 +3549,9 @@ hammerhead_config    :    unconfig
 mimc200_config        :    unconfig
     @$(MKCONFIG) $(@:_config=) avr32 at32ap mimc200 mimc at32ap700x
 
+top7000_config    :    unconfig
+    @$(MKCONFIG) $(@:_config=) avr32 at32ap top7000 emk at32ap700x
+
 #========================================================================
 # SH3 (SuperH)
 #========================================================================
diff --git a/board/emk/common/vpd.c b/board/emk/common/vpd.c
index c2af219..50776bd 100644
--- a/board/emk/common/vpd.c
+++ b/board/emk/common/vpd.c
@@ -1,6 +1,6 @@
 /*
- * (C) Copyright 2003
- * Reinhard Meyer, EMK Elektronik GmbH, r.meyer at emk-elektronik.de
+ * (C) Copyright 2003-2010
+ * Reinhard Meyer, EMK Elektronik
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -22,6 +22,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 
 /*****************************************************************************
  * read "factory" part of EEPROM and set some environment variables
@@ -68,12 +69,56 @@ void read_factory_r (void)
         addr += p - buf;
         /*printf ("%s\n", buf); */
         /* search for our specific entry */
-        if (!strncmp ((char *) buf, "[RLA/lan/Ethernet] ", 19)) {
+        if (!strncmp ((char *) buf, "[RLA/lan/Ethernet] ", 19))
             setenv ("ethaddr", (char *)(buf + 19));
-        } else if (!strncmp ((char *) buf, "[BOARD/SERIAL] ", 15)) {
+#if defined(CONFIG_TOP7000)
+        /* boards that have 2 LAN interfaces */
+        else if (!strncmp ((char *) buf, "[RLA/lan2/Ethernet] ", 20))
+            setenv ("eth1addr", (char *)(buf + 20));
+#endif
+        else if (!strncmp ((char *) buf, "[BOARD/SERIAL] ", 15))
             setenv ("serial#", (char *)(buf + 15));
-        } else if (!strncmp ((char *) buf, "[BOARD/TYPE] ", 13)) {
+        else if (!strncmp ((char *) buf, "[BOARD/TYPE] ", 13))
             setenv ("board_id", (char *)(buf + 13));
-        }
     }
 }
+
+#if defined(CONFIG_TOP7000)
+int do_vpd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+    uchar buf[512];
+    uchar *p;
+    int i;
+    u_int addr;
+    
+    if (argc != 3)
+        return 1;
+
+    p = buf+2;
+    i = simple_strtoul(argv[1], NULL, 10);
+    if (i<1 || i>32766)
+        return 1;
+        
+    addr=(i-1)*2;
+    
+    p+=sprintf((char*)p, "[RLA/lan/Ethernet] 00:80:d9:0d:%02x:%02x\n",
+        addr/256, addr%256);
+    addr++;
+    p+=sprintf((char*)p, "[RLA/lan2/Ethernet] 00:80:d9:0d:%02x:%02x\n",
+        addr/256, addr%256);
+    p+=sprintf((char*)p, "[BOARD/SERIAL] %05d\n", i);
+    p+=sprintf((char*)p, "[BOARD/TYPE] %s\n", argv[2]);
+    
+    i = p-buf-2;
+    buf[0]=i;
+    buf[1]=i>>8;
+    if (eeprom_write (CONFIG_SYS_I2C_FACT_ADDR, CONFIG_SYS_FACT_OFFSET, 
buf, i+2)) {
+        printf ("cannot write factory configuration\n");
+        return 1;
+    }
+    
+    return 0;
+}
+
+U_BOOT_CMD(vpd,    3,    0,    do_vpd, "enter vital product data", 
"serialnumer type");
+#endif
diff --git a/include/configs/top7000.h b/include/configs/top7000.h
old mode 100755
new mode 100644
-- 
1.5.6.5




More information about the U-Boot mailing list