1 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
2 +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
3 @@ -573,6 +573,51 @@ 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,
14 + mdio_bus->id, plat->phy);
15 + port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
16 + PHY_INTERFACE_MODE_MII);
17 + if (IS_ERR(port->phydev)) {
18 + printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
19 + return PTR_ERR(port->phydev);
22 + /* mask with MAC supported features */
23 + port->phydev->supported &= PHY_BASIC_FEATURES;
24 + port->phydev->advertising = port->phydev->supported;
26 + port->phydev->irq = PHY_POLL;
31 +static void ixp4xx_phy_disconnect(struct net_device *dev)
33 + struct port *port = netdev_priv(dev);
35 + phy_disconnect(port->phydev);
38 +static void ixp4xx_phy_start(struct net_device *dev)
40 + struct port *port = netdev_priv(dev);
42 + port->speed = 0; /* force "link up" message */
43 + phy_start(port->phydev);
46 +static void ixp4xx_phy_stop(struct net_device *dev)
48 + struct port *port = netdev_priv(dev);
50 + phy_stop(port->phydev);
53 static inline void debug_pkt(struct net_device *dev, const char *func,
55 @@ -1205,8 +1250,7 @@ static int eth_open(struct net_device *d
59 - port->speed = 0; /* force "link up" message */
60 - phy_start(port->phydev);
61 + ixp4xx_phy_start(dev);
63 for (i = 0; i < ETH_ALEN; i++)
64 __raw_writel(dev->dev_addr[i], &port->regs->hw_addr[i]);
65 @@ -1327,7 +1371,7 @@ static int eth_close(struct net_device *
66 printk(KERN_CRIT "%s: unable to disable loopback\n",
69 - phy_stop(port->phydev);
70 + ixp4xx_phy_stop(dev);
73 qmgr_disable_irq(TXDONE_QUEUE);
74 @@ -1353,7 +1397,6 @@ static int __devinit eth_init_one(struct
75 struct net_device *dev;
76 struct eth_plat_info *plat = pdev->dev.platform_data;
78 - char phy_id[MII_BUS_ID_SIZE + 3];
81 if (ptp_filter_init(ptp_filter, ARRAY_SIZE(ptp_filter))) {
82 @@ -1416,20 +1459,9 @@ static int __devinit eth_init_one(struct
83 __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control);
86 - snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT,
87 - mdio_bus->id, plat->phy);
88 - port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
89 - PHY_INTERFACE_MODE_MII);
90 - if (IS_ERR(port->phydev)) {
91 - err = PTR_ERR(port->phydev);
92 + err = ixp4xx_phy_connect(dev);
97 - /* mask with MAC supported features */
98 - port->phydev->supported &= PHY_BASIC_FEATURES;
99 - port->phydev->advertising = port->phydev->supported;
101 - port->phydev->irq = PHY_POLL;
103 if ((err = register_netdev(dev)))
105 @@ -1440,7 +1472,7 @@ static int __devinit eth_init_one(struct
109 - phy_disconnect(port->phydev);
110 + ixp4xx_phy_disconnect(dev);
112 npe_port_tab[NPE_ID(port->id)] = NULL;
113 platform_set_drvdata(pdev, NULL);
114 @@ -1458,7 +1490,7 @@ static int __devexit eth_remove_one(stru
115 struct port *port = netdev_priv(dev);
117 unregister_netdev(dev);
118 - phy_disconnect(port->phydev);
119 + ixp4xx_phy_disconnect(dev);
120 npe_port_tab[NPE_ID(port->id)] = NULL;
121 platform_set_drvdata(pdev, NULL);
122 npe_release(port->npe);