The IOC3 on Fuel's system board has no MAC PROM on its 1-wire bus, so
ioc3eth_get_mac_addr() cannot succeed there and the probe defers for
ever. Ask eth_platform_get_mac_address() before deferring; on IP35
machines it answers from the L1 system controller. Once deferred probing
gives up with neither source answering, use a random address.
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
drivers/net/ethernet/sgi/ioc3-eth.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c
index f86dd192a3d3..13102177ea88 100644
--- a/drivers/net/ethernet/sgi/ioc3-eth.c
+++ b/drivers/net/ethernet/sgi/ioc3-eth.c
@@ -850,6 +850,7 @@ static int ioc3eth_probe(struct platform_device *pdev)
struct ioc3_private *ip;
struct net_device *dev;
struct resource *regs;
+ bool random_mac = false;
u8 mac_addr[6];
int err;
@@ -858,9 +859,16 @@ static int ioc3eth_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Invalid resource\n");
return -EINVAL;
}
- /* get mac addr from one wire prom */
- if (ioc3eth_get_mac_addr(regs, mac_addr))
- return -EPROBE_DEFER; /* not available yet */
+ /* get mac addr from one wire prom, or from the platform */
+ if (ioc3eth_get_mac_addr(regs, mac_addr) &&
+ eth_platform_get_mac_address(&pdev->dev, mac_addr)) {
+ err = driver_deferred_probe_check_state(&pdev->dev);
+ if (err == -EPROBE_DEFER)
+ return err; /* not available yet */
+
+ dev_warn(&pdev->dev, "no MAC address, using a random one\n");
+ random_mac = true;
+ }
dev = alloc_etherdev(sizeof(struct ioc3_private));
if (!dev)@@ -939,7 +947,10 @@ static int ioc3eth_probe(struct platform_device *pdev)
ioc3_mii_start(ip);
ioc3_ssram_disc(ip);
- eth_hw_addr_set(dev, mac_addr);
+ if (random_mac)
+ eth_hw_addr_random(dev);
+ else
+ eth_hw_addr_set(dev, mac_addr);
/* The IOC3-specific entries in the device structure. */
dev->watchdog_timeo = 5 * HZ;
--
2.47.3