++static void
++ifxmips_adjust_link(struct net_device *dev)
++{
++ struct ifxmips_mii_priv *priv = netdev_priv(dev);
++ struct phy_device *phydev = priv->phydev;
++ int new_state = 0;
++
++ /* Did anything change? */
++ if (priv->oldlink != phydev->link ||
++ priv->oldduplex != phydev->duplex ||
++ priv->oldspeed != phydev->speed) {
++ /* Yes, so update status and mark as changed */
++ new_state = 1;
++ priv->oldduplex = phydev->duplex;
++ priv->oldspeed = phydev->speed;
++ priv->oldlink = phydev->link;
++ }
++
++ /* If link status changed, show new status */
++ if (new_state)
++ phy_print_status(phydev);
++}
++
++static int mii_probe(struct net_device *dev)
++{
++ struct ifxmips_mii_priv *priv = netdev_priv(dev);
++ struct phy_device *phydev = NULL;
++ int phy_addr;
++
++ priv->oldlink = 0;
++ priv->oldspeed = 0;
++ priv->oldduplex = -1;
++
++ /* find the first (lowest address) PHY on the current MAC's MII bus */
++ for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
++ if (priv->mii_bus->phy_map[phy_addr]) {
++ phydev = priv->mii_bus->phy_map[phy_addr];
++ break; /* break out with first one found */
++ }
++ }
++
++ if (!phydev) {
++ printk (KERN_ERR "%s: no PHY found\n", dev->name);
++ return -ENODEV;
++ }
++
++ /* now we are supposed to have a proper phydev, to attach to... */
++ BUG_ON(!phydev);
++ BUG_ON(phydev->attached_dev);
++
++ phydev = phy_connect(dev, dev_name(&phydev->dev), &ifxmips_adjust_link,
++ 0, PHY_INTERFACE_MODE_MII);
++
++ if (IS_ERR(phydev)) {
++ printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
++ return PTR_ERR(phydev);
++ }
++
++ /* mask with MAC supported features */
++ phydev->supported &= (SUPPORTED_10baseT_Half
++ | SUPPORTED_10baseT_Full
++ | SUPPORTED_100baseT_Half
++ | SUPPORTED_100baseT_Full
++ | SUPPORTED_Autoneg
++ /* | SUPPORTED_Pause | SUPPORTED_Asym_Pause */
++ | SUPPORTED_MII
++ | SUPPORTED_TP);
++
++ phydev->advertising = phydev->supported;
++
++ priv->phydev = phydev;
++
++ printk(KERN_INFO "%s: attached PHY driver [%s] "
++ "(mii_bus:phy_addr=%s, irq=%d)\n",
++ dev->name, phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
++
++ return 0;
++}
++
++