diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/macb.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index fbc371fa19b5..7a5f89728a81 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -189,18 +189,11 @@ static void macb_handle_link_change(struct net_device *dev) | |||
189 | static int macb_mii_probe(struct net_device *dev) | 189 | static int macb_mii_probe(struct net_device *dev) |
190 | { | 190 | { |
191 | struct macb *bp = netdev_priv(dev); | 191 | struct macb *bp = netdev_priv(dev); |
192 | struct phy_device *phydev = NULL; | 192 | struct phy_device *phydev; |
193 | struct eth_platform_data *pdata; | 193 | struct eth_platform_data *pdata; |
194 | int phy_addr; | 194 | int ret; |
195 | |||
196 | /* find the first phy */ | ||
197 | for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { | ||
198 | if (bp->mii_bus->phy_map[phy_addr]) { | ||
199 | phydev = bp->mii_bus->phy_map[phy_addr]; | ||
200 | break; | ||
201 | } | ||
202 | } | ||
203 | 195 | ||
196 | phydev = phy_find_first(bp->mii_bus); | ||
204 | if (!phydev) { | 197 | if (!phydev) { |
205 | printk (KERN_ERR "%s: no PHY found\n", dev->name); | 198 | printk (KERN_ERR "%s: no PHY found\n", dev->name); |
206 | return -1; | 199 | return -1; |
@@ -210,17 +203,13 @@ static int macb_mii_probe(struct net_device *dev) | |||
210 | /* TODO : add pin_irq */ | 203 | /* TODO : add pin_irq */ |
211 | 204 | ||
212 | /* attach the mac to the phy */ | 205 | /* attach the mac to the phy */ |
213 | if (pdata && pdata->is_rmii) { | 206 | ret = phy_connect_direct(dev, phydev, &macb_handle_link_change, 0, |
214 | phydev = phy_connect(dev, dev_name(&phydev->dev), | 207 | pdata && pdata->is_rmii ? |
215 | &macb_handle_link_change, 0, PHY_INTERFACE_MODE_RMII); | 208 | PHY_INTERFACE_MODE_RMII : |
216 | } else { | 209 | PHY_INTERFACE_MODE_MII); |
217 | phydev = phy_connect(dev, dev_name(&phydev->dev), | 210 | if (ret) { |
218 | &macb_handle_link_change, 0, PHY_INTERFACE_MODE_MII); | ||
219 | } | ||
220 | |||
221 | if (IS_ERR(phydev)) { | ||
222 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | 211 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); |
223 | return PTR_ERR(phydev); | 212 | return ret; |
224 | } | 213 | } |
225 | 214 | ||
226 | /* mask with MAC supported features */ | 215 | /* mask with MAC supported features */ |