X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fnet%2Fsh_eth.c;h=86cc324e96e716301e242d0a086a9ebd4469e82a;hb=be44f75887f27400e3abcf69886c8a3663f23bac;hp=ebe858894c275e17363342e08ddc7aa45bf79ef2;hpb=bd3980cc095af1728b994cdd8bf1ac430b6289e6;p=u-boot diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index ebe858894c..86cc324e96 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -514,6 +514,7 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd) int port = eth->port, ret = 0; u32 val, phy_status; struct sh_eth_info *port_info = ð->port_info[port]; + struct eth_device *dev = port_info->dev; /* Configure e-dmac registers */ outl((inl(EDMR(port)) & ~EMDR_DESC_R) | EDMR_EL, EDMR(port)); @@ -529,11 +530,11 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd) outl(0, ECSIPR(port)); /* Set Mac address */ - val = bd->bi_enetaddr[0] << 24 | bd->bi_enetaddr[1] << 16 | - bd->bi_enetaddr[2] << 8 | bd->bi_enetaddr[3]; + val = dev->enetaddr[0] << 24 | dev->enetaddr[1] << 16 | + dev->enetaddr[2] << 8 | dev->enetaddr[3]; outl(val, MAHR(port)); - val = bd->bi_enetaddr[4] << 8 | bd->bi_enetaddr[5]; + val = dev->enetaddr[4] << 8 | dev->enetaddr[5]; outl(val, MALR(port)); outl(RFLR_RFL_MIN, RFLR(port)); @@ -545,7 +546,7 @@ static int sh_eth_config(struct sh_eth_dev *eth, bd_t *bd) /* Configure phy */ ret = sh_eth_phy_config(eth); if (ret) { - printf(SHETHER_NAME ":i phy config timeout\n"); + printf(SHETHER_NAME ": phy config timeout\n"); goto err_phy_cfg; } /* Read phy status to finish configuring the e-mac */ @@ -589,24 +590,6 @@ static void sh_eth_stop(struct sh_eth_dev *eth) outl(~EDRRR_R, EDRRR(eth->port)); } -static int sh_eth_get_mac(bd_t *bd) -{ - char *s, *e; - - s = getenv("ethaddr"); - if (s != NULL) { - int i; - for (i = 0; i < 6; ++i) { - bd->bi_enetaddr[i] = s ? simple_strtoul(s, &e, 16) : 0; - if (s) - s = (*e) ? e + 1 : e; - } - } else { - puts("Please set MAC address\n"); - } - return 0; -} - int sh_eth_init(struct eth_device *dev, bd_t *bd) { int ret = 0; @@ -639,8 +622,6 @@ err: void sh_eth_halt(struct eth_device *dev) { struct sh_eth_dev *eth = dev->priv; - - sh_eth_reset(eth); sh_eth_stop(eth); } @@ -682,7 +663,8 @@ int sh_eth_initialize(bd_t *bd) /* Register Device to EtherNet subsystem */ eth_register(dev); - sh_eth_get_mac(bd); + if (!eth_getenv_enetaddr("ethaddr", dev->enetaddr)) + puts("Please set MAC address\n"); return ret;