diff options
author | Andy Fleming <afleming@gmail.com> | 2014-01-10 01:27:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-13 17:29:49 -0500 |
commit | 257184d7cc03519e1ea37b421879767b4194ce8c (patch) | |
tree | 2d9d523b12f6a35788d60377f9c532cdb87db27c /drivers/net/phy | |
parent | 124059fd53af0ce62220473f144cf03352dc08f1 (diff) |
phylib: Support attaching to generic 10g driver
phy_attach_direct() may now attach to a generic 10G driver. It can
also be used exactly as phy_connect_direct(), which will be useful
when using of_mdio, as phy_connect (and therefore of_phy_connect)
start the PHY state machine, which is currently irrelevant for 10G
PHYs.
Signed-off-by: Andy Fleming <afleming@gmail.com>
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/phy_device.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 18714fe0f074..39794c4d7b21 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -62,9 +62,6 @@ static struct phy_driver genphy_driver[GENPHY_DRV_MAX]; | |||
62 | static LIST_HEAD(phy_fixup_list); | 62 | static LIST_HEAD(phy_fixup_list); |
63 | static DEFINE_MUTEX(phy_fixup_lock); | 63 | static DEFINE_MUTEX(phy_fixup_lock); |
64 | 64 | ||
65 | static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | ||
66 | u32 flags, phy_interface_t interface); | ||
67 | |||
68 | /** | 65 | /** |
69 | * phy_register_fixup - creates a new phy_fixup and adds it to the list | 66 | * phy_register_fixup - creates a new phy_fixup and adds it to the list |
70 | * @bus_id: A string which matches phydev->dev.bus_id (or PHY_ANY_ID) | 67 | * @bus_id: A string which matches phydev->dev.bus_id (or PHY_ANY_ID) |
@@ -567,13 +564,13 @@ EXPORT_SYMBOL(phy_init_hw); | |||
567 | * | 564 | * |
568 | * Description: Called by drivers to attach to a particular PHY | 565 | * Description: Called by drivers to attach to a particular PHY |
569 | * device. The phy_device is found, and properly hooked up | 566 | * device. The phy_device is found, and properly hooked up |
570 | * to the phy_driver. If no driver is attached, then the | 567 | * to the phy_driver. If no driver is attached, then a |
571 | * genphy_driver is used. The phy_device is given a ptr to | 568 | * generic driver is used. The phy_device is given a ptr to |
572 | * the attaching device, and given a callback for link status | 569 | * the attaching device, and given a callback for link status |
573 | * change. The phy_device is returned to the attaching driver. | 570 | * change. The phy_device is returned to the attaching driver. |
574 | */ | 571 | */ |
575 | static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | 572 | int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, |
576 | u32 flags, phy_interface_t interface) | 573 | u32 flags, phy_interface_t interface) |
577 | { | 574 | { |
578 | struct device *d = &phydev->dev; | 575 | struct device *d = &phydev->dev; |
579 | int err; | 576 | int err; |
@@ -582,12 +579,10 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
582 | * exist, and we should use the genphy driver. | 579 | * exist, and we should use the genphy driver. |
583 | */ | 580 | */ |
584 | if (NULL == d->driver) { | 581 | if (NULL == d->driver) { |
585 | if (phydev->is_c45) { | 582 | if (phydev->is_c45) |
586 | pr_err("No driver for phy %x\n", phydev->phy_id); | 583 | d->driver = &genphy_driver[GENPHY_DRV_10G].driver; |
587 | return -ENODEV; | 584 | else |
588 | } | 585 | d->driver = &genphy_driver[GENPHY_DRV_1G].driver; |
589 | |||
590 | d->driver = &genphy_driver[GENPHY_DRV_1G].driver; | ||
591 | 586 | ||
592 | err = d->driver->probe(d); | 587 | err = d->driver->probe(d); |
593 | if (err >= 0) | 588 | if (err >= 0) |
@@ -623,6 +618,7 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
623 | 618 | ||
624 | return err; | 619 | return err; |
625 | } | 620 | } |
621 | EXPORT_SYMBOL(phy_attach_direct); | ||
626 | 622 | ||
627 | /** | 623 | /** |
628 | * phy_attach - attach a network device to a particular PHY device | 624 | * phy_attach - attach a network device to a particular PHY device |