diff options
author | Ulf Carlsson <md1ulfc@mdstud.chalmers.se> | 2000-06-14 03:47:57 +0000 |
---|---|---|
committer | Ulf Carlsson <md1ulfc@mdstud.chalmers.se> | 2000-06-14 03:47:57 +0000 |
commit | 4873bd66f2e888c267340c1cdb273e455b26c292 (patch) | |
tree | f36f29a2473041bedf1835f586056dfc7ef0db9f | |
parent | 6c9bc059cf73540f65fa2524c876ea96fc68edac (diff) |
The nic search command may fail because of the battery in
the iButton. If we fail: wait for a while and issue the
nic search again.
-rw-r--r-- | drivers/net/ioc3-eth.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 7bac36277..63b0182b7 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c @@ -249,7 +249,7 @@ nic_find(struct ioc3 *ioc3, int *last) b = nic_read_bit(ioc3); if (a && b) { - printk("NIC search failed.\n"); + printk("NIC search failed (not fatal).\n"); *last = 0; return 0; } @@ -279,7 +279,7 @@ nic_find(struct ioc3 *ioc3, int *last) return address; } -static void nic_init(struct ioc3 *ioc3) +static int nic_init(struct ioc3 *ioc3) { const char *type; u8 crc; @@ -298,8 +298,8 @@ static void nic_init(struct ioc3 *ioc3) break; default: if (save == 0) { - printk("No NIC connected.\n"); - return; + /* Let the caller try again. */ + return -1; } continue; } @@ -326,6 +326,8 @@ static void nic_init(struct ioc3 *ioc3) serial[3], serial[4], serial[5], crc); } printk(".\n"); + + return 0; } /* @@ -335,10 +337,20 @@ static void ioc3_get_eaddr(struct net_device *dev, struct ioc3 *ioc3) { u8 nic[14]; int i; + int tries = 2; /* There may be some problem with the battery? */ ioc3_w(gpcr_s, (1 << 21)); - nic_init(ioc3); + while (tries--) { + if (!nic_init(ioc3)) + break; + udelay(500); + } + + if (tries < 0) { + printk("Failed to read MAC address\n"); + return; + } /* Read Memory. */ nic_write_byte(ioc3, 0xf0); |