summaryrefslogtreecommitdiffstats
path: root/drivers/net/zynq_gem.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2015-11-30 13:38:32 +0100
committerMichal Simek <michal.simek@xilinx.com>2015-12-07 09:59:04 +0100
commitb904725a112f7b7a1b5d657541d77dc8fa1a1615 (patch)
tree38ff2dc4a5785f499042f83b294de2a9bfcd73c4 /drivers/net/zynq_gem.c
parent3cbbc2574bd9440d4e2bda4addb8aae75cf72b2d (diff)
downloadtalos-obmc-uboot-b904725a112f7b7a1b5d657541d77dc8fa1a1615.tar.gz
talos-obmc-uboot-b904725a112f7b7a1b5d657541d77dc8fa1a1615.zip
net: gem: Do not continue if phy is not found
Add return value for phy detection algorithm to stop init function when phy is not found. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Jagan Teki <jteki@openedev.com>
Diffstat (limited to 'drivers/net/zynq_gem.c')
-rw-r--r--drivers/net/zynq_gem.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 858093f0d7..1a5a366c94 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -241,7 +241,7 @@ static u32 phywrite(struct eth_device *dev, u32 phy_addr, u32 regnum, u16 data)
ZYNQ_GEM_PHYMNTNC_OP_W_MASK, &data);
}
-static void phy_detection(struct eth_device *dev)
+static int phy_detection(struct eth_device *dev)
{
int i;
u16 phyreg;
@@ -254,7 +254,7 @@ static void phy_detection(struct eth_device *dev)
/* Found a valid PHY address */
debug("Default phy address %d is valid\n",
priv->phyaddr);
- return;
+ return 0;
} else {
debug("PHY address is not setup correctly %d\n",
priv->phyaddr);
@@ -272,11 +272,12 @@ static void phy_detection(struct eth_device *dev)
/* Found a valid PHY address */
priv->phyaddr = i;
debug("Found valid phy address, %d\n", i);
- return;
+ return 0;
}
}
}
printf("PHY is not detected\n");
+ return -1;
}
static int zynq_gem_setup_mac(struct eth_device *dev)
@@ -310,6 +311,7 @@ static int zynq_gem_setup_mac(struct eth_device *dev)
static int zynq_gem_init(struct eth_device *dev, bd_t * bis)
{
u32 i;
+ int ret;
unsigned long clk_rate = 0;
struct phy_device *phydev;
struct zynq_gem_regs *regs = (struct zynq_gem_regs *)dev->iobase;
@@ -384,7 +386,11 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis)
priv->init++;
}
- phy_detection(dev);
+ ret = phy_detection(dev);
+ if (ret) {
+ printf("GEM PHY init failed\n");
+ return ret;
+ }
/* interface - look at tsec */
phydev = phy_connect(priv->bus, priv->phyaddr, dev,
OpenPOWER on IntegriCloud