Merge branch 'master' of git://www.denx.de/git/u-boot-arm
[oweals/u-boot.git] / board / bf537-stamp / bf537-stamp.c
index 47f7c9edf6f666a405280577ba834b1bdad19467..d279817bbab79b90429c020fe6d53c5549010b8d 100644 (file)
 #include <command.h>
 #include <asm/blackfin.h>
 #include <asm/io.h>
+#include <net.h>
 #include "ether_bf537.h"
+#include <asm/mach-common/bits/bootrom.h>
+
+/**
+ * is_valid_ether_addr - Determine if the given Ethernet address is valid
+ * @addr: Pointer to a six-byte array containing the Ethernet address
+ *
+ * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not
+ * a multicast address, and is not FF:FF:FF:FF:FF:FF.
+ *
+ * Return true if the address is valid.
+ */
+static inline int is_valid_ether_addr(const u8 * addr)
+{
+       /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
+        * explicitly check for it here. */
+       return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
+}
+
+DECLARE_GLOBAL_DATA_PTR;
 
 #define POST_WORD_ADDR 0xFF903FFC
 
@@ -98,7 +118,7 @@ int checkboard(void)
 void cf_outb(unsigned char val, volatile unsigned char *addr)
 {
        *(addr) = val;
-       sync();
+       SSYNC();
 }
 
 unsigned char cf_inb(volatile unsigned char *addr)
@@ -106,7 +126,7 @@ unsigned char cf_inb(volatile unsigned char *addr)
        volatile unsigned char c;
 
        c = *(addr);
-       sync();
+       SSYNC();
 
        return c;
 }
@@ -117,7 +137,7 @@ void cf_insw(unsigned short *sect_buf, unsigned short *addr, int words)
 
        for (i = 0; i < words; i++)
                *(sect_buf + i) = *(addr);
-       sync();
+       SSYNC();
 }
 
 void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words)
@@ -126,13 +146,12 @@ void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words)
 
        for (i = 0; i < words; i++)
                *(addr) = *(sect_buf + i);
-       sync();
+       SSYNC();
 }
 #endif                         /* CONFIG_BFIN_IDE */
 
 long int initdram(int board_type)
 {
-       DECLARE_GLOBAL_DATA_PTR;
 #ifdef DEBUG
        int brate;
        char *tmp = getenv("baudrate");
@@ -159,7 +178,7 @@ int misc_init_r(void)
        unsigned char *pMACaddr = (unsigned char *)0x203F0000;
        u8 SrcAddr[6] = { 0x02, 0x80, 0xAD, 0x20, 0x31, 0xB8 };
 
-#if (CONFIG_COMMANDS & CFG_CMD_NET)
+#if defined(CONFIG_CMD_NET)
        /* The 0xFF check here is to make sure we don't use the address
         * in flash if it's simply been erased (aka all 0xFF values) */
        if (getenv("ethaddr") == NULL && is_valid_ether_addr(pMACaddr)) {
@@ -171,7 +190,7 @@ int misc_init_r(void)
        if (getenv("ethaddr")) {
                SetupMacAddr(SrcAddr);
        }
-#endif                         /* CONFIG_COMMANDS & CFG_CMD_NET */
+#endif
 #endif                         /* BFIN_BOOT_MODE == BF537_BYPASS_BOOT */
 
 #if defined(CONFIG_BFIN_IDE)