From mboxrd@z Thu Jan 1 00:00:00 1970 From: richardretanubun Date: Mon, 18 Aug 2008 15:52:45 -0400 Subject: [U-Boot] [U-boot] [PATCH 2/2] NET: QE: UEC: Allow uec re-initialization based on netretry environment variable. Message-ID: <48A9D30D.5020008@ruggedcom.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Allow uec_init to run more than once, based on the netretry environment variable. This allows for manual (back and forth) switching between network interfaces. Signed-off-by: Richard Retanubun diff --git a/drivers/qe/uec.c b/drivers/qe/uec.c index 344c649..88402ca 100644 --- a/drivers/qe/uec.c +++ b/drivers/qe/uec.c @@ -1192,9 +1192,17 @@ static int uec_init(struct eth_device* dev, bd_t *bd) uec_private_t *uec; int err, i; struct phy_info *curphy; + char *netretry = NULL; uec = (uec_private_t *)dev->priv; + + /* Allow for net re-initialization based on netretry environment setting */ + netretry = getenv("netretry"); + if (netretry != NULL && (strcmp(netretry, "yes") == 0)) { + uec->the_first_run = 0; + } + if (uec->the_first_run == 0) { err = init_phy(dev); if (err) { @@ -1223,12 +1231,16 @@ static int uec_init(struct eth_device* dev, bd_t *bd) if (err || i <= 0) printf("warning: %s: timeout on PHY link\n", dev->name); - uec->the_first_run = 1; + /* If netretry is not set, or not set to yes, assume no retry */ + netretry = getenv("netretry"); + if (netretry == NULL || (strcmp(netretry, "yes") != 0)) { + uec->the_first_run = 1; + } } /* Set up the MAC address */ if (dev->enetaddr[0] & 0x01) { - printf("%s: MacAddress is multcast address\n", + printf("%s: MacAddress is multicast address\n", __FUNCTION__); return -1; }