X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fcpsw.c;h=39240d9662143e2c33a1e90f6309e9ab83e61666;hb=55aea84b1db277bd86edadb37d11b78d36db7608;hp=f1e9f720a77b1492f55edb3c291c6b4e11b809ef;hpb=454ac635257f78a369015bde7795ddf979d64e12;p=oweals%2Fu-boot.git diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c index f1e9f720a7..39240d9662 100644 --- a/drivers/net/cpsw.c +++ b/drivers/net/cpsw.c @@ -487,7 +487,7 @@ static inline void wait_for_idle(void) static int cpsw_mdio_read(struct mii_dev *bus, int phy_id, int dev_addr, int phy_reg) { - unsigned short data; + int data; u32 reg; if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK) @@ -568,9 +568,14 @@ static void cpsw_set_slave_mac(struct cpsw_slave *slave, static void cpsw_slave_update_link(struct cpsw_slave *slave, struct cpsw_priv *priv, int *link) { - struct phy_device *phy = priv->phydev; + struct phy_device *phy; u32 mac_control = 0; + phy = priv->phydev; + + if (!phy) + return; + phy_startup(phy); *link = phy->link; @@ -947,6 +952,9 @@ static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave) dev, slave->data->phy_if); + if (!phydev) + return -1; + phydev->supported &= supported; phydev->advertising = phydev->supported;