1 --- a/drivers/net/arm/ixp4xx_eth.c
2 +++ b/drivers/net/arm/ixp4xx_eth.c
3 @@ -396,6 +396,53 @@ static void ixp4xx_adjust_link(struct ne
4 dev->name, port->speed, port->duplex ? "full" : "half");
7 +static int ixp4xx_phy_connect(struct net_device *dev)
9 + struct port *port = netdev_priv(dev);
10 + struct eth_plat_info *plat = port->plat;
11 + char phy_id[MII_BUS_ID_SIZE + 3];
13 + snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, "0", plat->phy);
14 + port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
15 + PHY_INTERFACE_MODE_MII);
16 + if (IS_ERR(port->phydev)) {
17 + printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
18 + return PTR_ERR(port->phydev);
21 + /* mask with MAC supported features */
22 + port->phydev->supported &= PHY_BASIC_FEATURES;
23 + port->phydev->advertising = port->phydev->supported;
25 + port->phydev->irq = PHY_POLL;
27 + printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy,
28 + npe_name(port->npe));
33 +static void ixp4xx_phy_disconnect(struct net_device *dev)
35 + struct port *port = netdev_priv(dev);
37 + phy_disconnect(port->phydev);
40 +static void ixp4xx_phy_start(struct net_device *dev)
42 + struct port *port = netdev_priv(dev);
44 + port->speed = 0; /* force "link up" message */
45 + phy_start(port->phydev);
48 +static void ixp4xx_phy_stop(struct net_device *dev)
50 + struct port *port = netdev_priv(dev);
52 + phy_stop(port->phydev);
55 static inline void debug_pkt(struct net_device *dev, const char *func,
57 @@ -1005,8 +1052,7 @@ static int eth_open(struct net_device *d
61 - port->speed = 0; /* force "link up" message */
62 - phy_start(port->phydev);
63 + ixp4xx_phy_start(dev);
65 for (i = 0; i < ETH_ALEN; i++)
66 __raw_writel(dev->dev_addr[i], &port->regs->hw_addr[i]);
67 @@ -1127,7 +1173,7 @@ static int eth_close(struct net_device *
68 printk(KERN_CRIT "%s: unable to disable loopback\n",
71 - phy_stop(port->phydev);
72 + ixp4xx_phy_stop(dev);
75 qmgr_disable_irq(TXDONE_QUEUE);
76 @@ -1153,7 +1199,6 @@ static int __devinit eth_init_one(struct
77 struct net_device *dev;
78 struct eth_plat_info *plat = pdev->dev.platform_data;
80 - char phy_id[MII_BUS_ID_SIZE + 3];
83 if (!(dev = alloc_etherdev(sizeof(struct port))))
84 @@ -1211,18 +1256,10 @@ static int __devinit eth_init_one(struct
85 __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control);
88 - snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, "0", plat->phy);
89 - port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
90 - PHY_INTERFACE_MODE_MII);
91 - if ((err = IS_ERR(port->phydev)))
92 + err = ixp4xx_phy_connect(dev);
96 - /* mask with MAC supported features */
97 - port->phydev->supported &= PHY_BASIC_FEATURES;
98 - port->phydev->advertising = port->phydev->supported;
100 - port->phydev->irq = PHY_POLL;
102 if ((err = register_netdev(dev)))
105 @@ -1249,7 +1286,7 @@ static int __devexit eth_remove_one(stru
106 struct net_device *dev = platform_get_drvdata(pdev);
107 struct port *port = netdev_priv(dev);
109 - phy_disconnect(port->phydev);
110 + ixp4xx_phy_disconnect(dev);
111 unregister_netdev(dev);
112 phy_disconnect(port->phydev);
113 npe_port_tab[NPE_ID(port->id)] = NULL;