diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/phy/phy_device.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r-- | drivers/net/phy/phy_device.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index b10fedd82143..db1794546c56 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -177,6 +177,7 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) | |||
177 | dev->state = PHY_DOWN; | 177 | dev->state = PHY_DOWN; |
178 | 178 | ||
179 | mutex_init(&dev->lock); | 179 | mutex_init(&dev->lock); |
180 | INIT_DELAYED_WORK(&dev->state_queue, phy_state_machine); | ||
180 | 181 | ||
181 | return dev; | 182 | return dev; |
182 | } | 183 | } |
@@ -276,6 +277,22 @@ int phy_device_register(struct phy_device *phydev) | |||
276 | EXPORT_SYMBOL(phy_device_register); | 277 | EXPORT_SYMBOL(phy_device_register); |
277 | 278 | ||
278 | /** | 279 | /** |
280 | * phy_find_first - finds the first PHY device on the bus | ||
281 | * @bus: the target MII bus | ||
282 | */ | ||
283 | struct phy_device *phy_find_first(struct mii_bus *bus) | ||
284 | { | ||
285 | int addr; | ||
286 | |||
287 | for (addr = 0; addr < PHY_MAX_ADDR; addr++) { | ||
288 | if (bus->phy_map[addr]) | ||
289 | return bus->phy_map[addr]; | ||
290 | } | ||
291 | return NULL; | ||
292 | } | ||
293 | EXPORT_SYMBOL(phy_find_first); | ||
294 | |||
295 | /** | ||
279 | * phy_prepare_link - prepares the PHY layer to monitor link status | 296 | * phy_prepare_link - prepares the PHY layer to monitor link status |
280 | * @phydev: target phy_device struct | 297 | * @phydev: target phy_device struct |
281 | * @handler: callback function for link status change notifications | 298 | * @handler: callback function for link status change notifications |
@@ -378,6 +395,20 @@ void phy_disconnect(struct phy_device *phydev) | |||
378 | } | 395 | } |
379 | EXPORT_SYMBOL(phy_disconnect); | 396 | EXPORT_SYMBOL(phy_disconnect); |
380 | 397 | ||
398 | int phy_init_hw(struct phy_device *phydev) | ||
399 | { | ||
400 | int ret; | ||
401 | |||
402 | if (!phydev->drv || !phydev->drv->config_init) | ||
403 | return 0; | ||
404 | |||
405 | ret = phy_scan_fixups(phydev); | ||
406 | if (ret < 0) | ||
407 | return ret; | ||
408 | |||
409 | return phydev->drv->config_init(phydev); | ||
410 | } | ||
411 | |||
381 | /** | 412 | /** |
382 | * phy_attach_direct - attach a network device to a given PHY device pointer | 413 | * phy_attach_direct - attach a network device to a given PHY device pointer |
383 | * @dev: network device to attach | 414 | * @dev: network device to attach |
@@ -425,21 +456,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
425 | /* Do initial configuration here, now that | 456 | /* Do initial configuration here, now that |
426 | * we have certain key parameters | 457 | * we have certain key parameters |
427 | * (dev_flags and interface) */ | 458 | * (dev_flags and interface) */ |
428 | if (phydev->drv->config_init) { | 459 | return phy_init_hw(phydev); |
429 | int err; | ||
430 | |||
431 | err = phy_scan_fixups(phydev); | ||
432 | |||
433 | if (err < 0) | ||
434 | return err; | ||
435 | |||
436 | err = phydev->drv->config_init(phydev); | ||
437 | |||
438 | if (err < 0) | ||
439 | return err; | ||
440 | } | ||
441 | |||
442 | return 0; | ||
443 | } | 460 | } |
444 | EXPORT_SYMBOL(phy_attach_direct); | 461 | EXPORT_SYMBOL(phy_attach_direct); |
445 | 462 | ||