net: gem: Check if phy was correctly detected
authorMichal Simek <michal.simek@xilinx.com>
Tue, 12 Nov 2013 13:25:29 +0000 (14:25 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 21 Jan 2014 15:07:10 +0000 (16:07 +0100)
As tsec and fm drivers checking phydev->link
ensure that u-boot don't try access device if link is not ready.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/net/zynq_gem.c

index 6a017a8102736d95286f2659d424ff4270306a99..381bca459e161f0d72b926bc2bbc08b712b142d3 100644 (file)
@@ -339,6 +339,11 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis)
        phy_config(phydev);
        phy_startup(phydev);
 
+       if (!phydev->link) {
+               printf("%s: No link.\n", phydev->dev->name);
+               return -1;
+       }
+
        switch (phydev->speed) {
        case SPEED_1000:
                writel(ZYNQ_GEM_NWCFG_INIT | ZYNQ_GEM_NWCFG_SPEED1000,