Skip to content
Snippets Groups Projects
Commit b904725a authored by Michal Simek's avatar Michal Simek
Browse files

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: default avatarMichal Simek <michal.simek@xilinx.com>
Reviewed-by: default avatarJagan Teki <jteki@openedev.com>
parent 3cbbc257
No related branches found
No related tags found
No related merge requests found
...@@ -241,7 +241,7 @@ static u32 phywrite(struct eth_device *dev, u32 phy_addr, u32 regnum, u16 data) ...@@ -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); 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; int i;
u16 phyreg; u16 phyreg;
...@@ -254,7 +254,7 @@ static void phy_detection(struct eth_device *dev) ...@@ -254,7 +254,7 @@ static void phy_detection(struct eth_device *dev)
/* Found a valid PHY address */ /* Found a valid PHY address */
debug("Default phy address %d is valid\n", debug("Default phy address %d is valid\n",
priv->phyaddr); priv->phyaddr);
return; return 0;
} else { } else {
debug("PHY address is not setup correctly %d\n", debug("PHY address is not setup correctly %d\n",
priv->phyaddr); priv->phyaddr);
...@@ -272,11 +272,12 @@ static void phy_detection(struct eth_device *dev) ...@@ -272,11 +272,12 @@ static void phy_detection(struct eth_device *dev)
/* Found a valid PHY address */ /* Found a valid PHY address */
priv->phyaddr = i; priv->phyaddr = i;
debug("Found valid phy address, %d\n", i); debug("Found valid phy address, %d\n", i);
return; return 0;
} }
} }
} }
printf("PHY is not detected\n"); printf("PHY is not detected\n");
return -1;
} }
static int zynq_gem_setup_mac(struct eth_device *dev) static int zynq_gem_setup_mac(struct eth_device *dev)
...@@ -310,6 +311,7 @@ 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) static int zynq_gem_init(struct eth_device *dev, bd_t * bis)
{ {
u32 i; u32 i;
int ret;
unsigned long clk_rate = 0; unsigned long clk_rate = 0;
struct phy_device *phydev; struct phy_device *phydev;
struct zynq_gem_regs *regs = (struct zynq_gem_regs *)dev->iobase; 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) ...@@ -384,7 +386,11 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis)
priv->init++; priv->init++;
} }
phy_detection(dev); ret = phy_detection(dev);
if (ret) {
printf("GEM PHY init failed\n");
return ret;
}
/* interface - look at tsec */ /* interface - look at tsec */
phydev = phy_connect(priv->bus, priv->phyaddr, dev, phydev = phy_connect(priv->bus, priv->phyaddr, dev,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment