1 --- a/drivers/net/arm/ixp4xx_eth.c
2 +++ b/drivers/net/arm/ixp4xx_eth.c
3 @@ -572,6 +572,50 @@ 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;
30 +static void ixp4xx_phy_disconnect(struct net_device *dev)
32 + struct port *port = netdev_priv(dev);
34 + phy_disconnect(port->phydev);
37 +static void ixp4xx_phy_start(struct net_device *dev)
39 + struct port *port = netdev_priv(dev);
41 + port->speed = 0; /* force "link up" message */
42 + phy_start(port->phydev);
45 +static void ixp4xx_phy_stop(struct net_device *dev)
47 + struct port *port = netdev_priv(dev);
49 + phy_stop(port->phydev);
52 static inline void debug_pkt(struct net_device *dev, const char *func,
54 @@ -1204,8 +1248,7 @@ static int eth_open(struct net_device *d
58 - port->speed = 0; /* force "link up" message */
59 - phy_start(port->phydev);
60 + ixp4xx_phy_start(dev);
62 for (i = 0; i < ETH_ALEN; i++)
63 __raw_writel(dev->dev_addr[i], &port->regs->hw_addr[i]);
64 @@ -1326,7 +1369,7 @@ static int eth_close(struct net_device *
65 printk(KERN_CRIT "%s: unable to disable loopback\n",
68 - phy_stop(port->phydev);
69 + ixp4xx_phy_stop(dev);
72 qmgr_disable_irq(TXDONE_QUEUE);
73 @@ -1352,7 +1395,6 @@ static int __devinit eth_init_one(struct
74 struct net_device *dev;
75 struct eth_plat_info *plat = pdev->dev.platform_data;
77 - char phy_id[MII_BUS_ID_SIZE + 3];
80 if (ptp_filter_init(ptp_filter, ARRAY_SIZE(ptp_filter))) {
81 @@ -1415,19 +1457,9 @@ static int __devinit eth_init_one(struct
82 __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control);
85 - snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, "0", plat->phy);
86 - port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
87 - PHY_INTERFACE_MODE_MII);
88 - if (IS_ERR(port->phydev)) {
89 - err = PTR_ERR(port->phydev);
90 + err = ixp4xx_phy_connect(dev);
95 - /* mask with MAC supported features */
96 - port->phydev->supported &= PHY_BASIC_FEATURES;
97 - port->phydev->advertising = port->phydev->supported;
99 - port->phydev->irq = PHY_POLL;
101 if ((err = register_netdev(dev)))
103 @@ -1438,7 +1470,7 @@ static int __devinit eth_init_one(struct
107 - phy_disconnect(port->phydev);
108 + ixp4xx_phy_disconnect(dev);
110 npe_port_tab[NPE_ID(port->id)] = NULL;
111 platform_set_drvdata(pdev, NULL);
112 @@ -1456,7 +1488,7 @@ static int __devexit eth_remove_one(stru
113 struct port *port = netdev_priv(dev);
115 unregister_netdev(dev);
116 - phy_disconnect(port->phydev);
117 + ixp4xx_phy_disconnect(dev);
118 npe_port_tab[NPE_ID(port->id)] = NULL;
119 platform_set_drvdata(pdev, NULL);
120 npe_release(port->npe);