]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
Blackfin: bfin_mac: force boards to setup the MAC themselves
authorMike Frysinger <vapier@gentoo.org>
Mon, 13 Oct 2008 19:06:25 +0000 (15:06 -0400)
committerWolfgang Denk <wd@denx.de>
Fri, 20 Mar 2009 21:39:09 +0000 (22:39 +0100)
Since the on-chip MAC does not have an eeprom or similar interface, force
all Blackfin boards that use this driver to setup the board data with a
proper MAC.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
CC: Ben Warren <biggerbadderben@gmail.com>
drivers/net/bfin_mac.c
drivers/net/bfin_mac.h
lib_blackfin/board.c

index 23f934aeeb0f5c5249914b64fc94dbf1a27fba5a..12d98c2df551e887d861bc0bb41d577cb7d4a4ca 100644 (file)
@@ -315,7 +315,7 @@ static int bfin_EMAC_init(struct eth_device *dev, bd_t *bd)
                return -1;
 
        /* Initialize EMAC address */
-       bfin_EMAC_setup_addr(bd);
+       bfin_EMAC_setup_addr(dev->enetaddr);
 
        /* Initialize TX and RX buffer */
        for (i = 0; i < PKTBUFSRX; i++) {
@@ -373,16 +373,16 @@ static void bfin_EMAC_halt(struct eth_device *dev)
 
 }
 
-void bfin_EMAC_setup_addr(bd_t *bd)
+void bfin_EMAC_setup_addr(uchar *enetaddr)
 {
        *pEMAC_ADDRLO =
-               bd->bi_enetaddr[0] |
-               bd->bi_enetaddr[1] << 8 |
-               bd->bi_enetaddr[2] << 16 |
-               bd->bi_enetaddr[3] << 24;
+               enetaddr[0] |
+               enetaddr[1] << 8 |
+               enetaddr[2] << 16 |
+               enetaddr[3] << 24;
        *pEMAC_ADDRHI =
-               bd->bi_enetaddr[4] |
-               bd->bi_enetaddr[5] << 8;
+               enetaddr[4] |
+               enetaddr[5] << 8;
 }
 
 ADI_ETHER_BUFFER *SetupRxBuffer(int no)
index 084f53334880c6cd1985a2bdc6f7f335e4c1d319..8f467a309e12d33ab3229a9c2681e01cd190379f 100644 (file)
@@ -61,6 +61,6 @@ static void bfin_EMAC_halt(struct eth_device *dev);
 static int bfin_EMAC_send(struct eth_device *dev, volatile void *packet, int length);
 static int bfin_EMAC_recv(struct eth_device *dev);
 
-static void bfin_EMAC_setup_addr(bd_t *bd);
+void bfin_EMAC_setup_addr(uchar *enetaddr);
 
 #endif
index c22371197fb9fdf7579140b47660610538081bee..537f69abaa97299d174e6eb47e024f7722657eb0 100644 (file)
@@ -106,10 +106,6 @@ static void display_global_data(void)
        printf(" \\-bd: %x\n", gd->bd);
        printf("   |-bi_baudrate: %x\n", bd->bi_baudrate);
        printf("   |-bi_ip_addr: %x\n", bd->bi_ip_addr);
-       printf("   |-bi_enetaddr: %x %x %x %x %x %x\n",
-              bd->bi_enetaddr[0], bd->bi_enetaddr[1],
-              bd->bi_enetaddr[2], bd->bi_enetaddr[3],
-              bd->bi_enetaddr[4], bd->bi_enetaddr[5]);
        printf("   |-bi_boot_params: %x\n", bd->bi_boot_params);
        printf("   |-bi_memstart: %x\n", bd->bi_memstart);
        printf("   |-bi_memsize: %x\n", bd->bi_memsize);
@@ -338,35 +334,6 @@ void board_init_r(gd_t * id, ulong dest_addr)
        /* relocate environment function pointers etc. */
        env_relocate();
 
-#ifdef CONFIG_CMD_NET
-       /* board MAC address */
-       s = getenv("ethaddr");
-       if (s == NULL) {
-# ifndef CONFIG_ETHADDR
-#  if 0
-               if (!board_get_enetaddr(bd->bi_enetaddr)) {
-                       char nid[20];
-                       sprintf(nid, "%02X:%02X:%02X:%02X:%02X:%02X",
-                               bd->bi_enetaddr[0], bd->bi_enetaddr[1],
-                               bd->bi_enetaddr[2], bd->bi_enetaddr[3],
-                               bd->bi_enetaddr[4], bd->bi_enetaddr[5]);
-                       setenv("ethaddr", nid);
-               }
-#  endif
-# endif
-       } else {
-               int i;
-               char *e;
-               for (i = 0; i < 6; ++i) {
-                       bd->bi_enetaddr[i] = simple_strtoul(s, &e, 16);
-                       s = (*e) ? e + 1 : e;
-               }
-       }
-
-       /* IP Address */
-       bd->bi_ip_addr = getenv_IPaddr("ipaddr");
-#endif
-
        /* Initialize devices */
        devices_init();
        jumptable_init();
@@ -393,21 +360,10 @@ void board_init_r(gd_t * id, ulong dest_addr)
 #endif
 
 #ifdef CONFIG_CMD_NET
+       /* IP Address */
+       bd->bi_ip_addr = getenv_IPaddr("ipaddr");
        printf("Net:   ");
        eth_initialize(gd->bd);
-       if ((s = getenv("ethaddr"))) {
-# ifndef CONFIG_NET_MULTI
-               size_t i;
-               char *e;
-               for (i = 0; i < 6; ++i) {
-                       bd->bi_enetaddr[i] = simple_strtoul(s, &e, 16);
-                       s = (*e) ? e + 1 : e;
-               }
-# endif
-               printf("MAC:   %02X:%02X:%02X:%02X:%02X:%02X\n",
-                       bd->bi_enetaddr[0], bd->bi_enetaddr[1], bd->bi_enetaddr[2],
-                       bd->bi_enetaddr[3], bd->bi_enetaddr[4], bd->bi_enetaddr[5]);
-       }
 #endif
 
        display_global_data();