mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-29 08:01:08 +00:00
net: designware: Adjust dw_adjust_link() to return an error
This function can fail, so return the error if there is one. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Romain Perier <romain.perier@collabora.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
b9e08d0e80
commit
0ea38db90c
1 changed files with 8 additions and 4 deletions
|
@ -230,14 +230,14 @@ static int _dw_write_hwaddr(struct dw_eth_dev *priv, u8 *mac_id)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dw_adjust_link(struct eth_mac_regs *mac_p,
|
static int dw_adjust_link(struct dw_eth_dev *priv, struct eth_mac_regs *mac_p,
|
||||||
struct phy_device *phydev)
|
struct phy_device *phydev)
|
||||||
{
|
{
|
||||||
u32 conf = readl(&mac_p->conf) | FRAMEBURSTENABLE | DISABLERXOWN;
|
u32 conf = readl(&mac_p->conf) | FRAMEBURSTENABLE | DISABLERXOWN;
|
||||||
|
|
||||||
if (!phydev->link) {
|
if (!phydev->link) {
|
||||||
printf("%s: No link.\n", phydev->dev->name);
|
printf("%s: No link.\n", phydev->dev->name);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (phydev->speed != 1000)
|
if (phydev->speed != 1000)
|
||||||
|
@ -256,6 +256,8 @@ static void dw_adjust_link(struct eth_mac_regs *mac_p,
|
||||||
printf("Speed: %d, %s duplex%s\n", phydev->speed,
|
printf("Speed: %d, %s duplex%s\n", phydev->speed,
|
||||||
(phydev->duplex) ? "full" : "half",
|
(phydev->duplex) ? "full" : "half",
|
||||||
(phydev->port == PORT_FIBRE) ? ", fiber mode" : "");
|
(phydev->port == PORT_FIBRE) ? ", fiber mode" : "");
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _dw_eth_halt(struct dw_eth_dev *priv)
|
static void _dw_eth_halt(struct dw_eth_dev *priv)
|
||||||
|
@ -321,7 +323,9 @@ static int _dw_eth_init(struct dw_eth_dev *priv, u8 *enetaddr)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
dw_adjust_link(mac_p, priv->phydev);
|
ret = dw_adjust_link(priv, mac_p, priv->phydev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (!priv->phydev->link)
|
if (!priv->phydev->link)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
Loading…
Reference in a new issue