1 --- a/drivers/net/arm/ixp4xx_eth.c
2 +++ b/drivers/net/arm/ixp4xx_eth.c
3 @@ -397,6 +397,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 @@ -1009,8 +1053,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 @@ -1131,7 +1174,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 @@ -1157,7 +1200,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 (!(dev = alloc_etherdev(sizeof(struct port))))
81 @@ -1215,18 +1257,10 @@ 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 ((err = IS_ERR(port->phydev)))
89 + err = ixp4xx_phy_connect(dev);
93 - /* mask with MAC supported features */
94 - port->phydev->supported &= PHY_BASIC_FEATURES;
95 - port->phydev->advertising = port->phydev->supported;
97 - port->phydev->irq = PHY_POLL;
99 if ((err = register_netdev(dev)))
102 @@ -1236,7 +1270,7 @@ static int __devinit eth_init_one(struct
106 - phy_disconnect(port->phydev);
107 + ixp4xx_phy_disconnect(dev);
109 npe_port_tab[NPE_ID(port->id)] = NULL;
110 platform_set_drvdata(pdev, NULL);
111 @@ -1254,7 +1288,7 @@ static int __devexit eth_remove_one(stru
112 struct port *port = netdev_priv(dev);
114 unregister_netdev(dev);
115 - phy_disconnect(port->phydev);
116 + ixp4xx_phy_disconnect(dev);
117 npe_port_tab[NPE_ID(port->id)] = NULL;
118 platform_set_drvdata(pdev, NULL);
119 npe_release(port->npe);