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[BUS_ID_SIZE];
13 + snprintf(phy_id, BUS_ID_SIZE, 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 @@ -1003,8 +1050,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 @@ -1125,7 +1171,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 @@ -1149,7 +1195,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[BUS_ID_SIZE];
83 if (!(dev = alloc_etherdev(sizeof(struct port))))
84 @@ -1212,22 +1257,9 @@ static int __devinit eth_init_one(struct
85 __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control);
88 - snprintf(phy_id, BUS_ID_SIZE, 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 (IS_ERR(port->phydev)) {
92 - printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
93 - return PTR_ERR(port->phydev);
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 - printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy,
103 - npe_name(port->npe));
104 + err = ixp4xx_phy_connect(dev);
110 @@ -1245,7 +1277,7 @@ static int __devexit eth_remove_one(stru
111 struct net_device *dev = platform_get_drvdata(pdev);
112 struct port *port = netdev_priv(dev);
114 - phy_disconnect(port->phydev);
115 + ixp4xx_phy_disconnect(dev);
116 unregister_netdev(dev);
117 npe_port_tab[NPE_ID(port->id)] = NULL;
118 platform_set_drvdata(pdev, NULL);