Commit 257184d7 authored by Andy Fleming's avatar Andy Fleming Committed by David S. Miller

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: default avatarAndy Fleming <afleming@gmail.com>
Signed-off-by: default avatarShaohui Xie <Shaohui.Xie@freescale.com>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 124059fd
...@@ -62,9 +62,6 @@ static struct phy_driver genphy_driver[GENPHY_DRV_MAX]; ...@@ -62,9 +62,6 @@ static struct phy_driver genphy_driver[GENPHY_DRV_MAX];
static LIST_HEAD(phy_fixup_list); static LIST_HEAD(phy_fixup_list);
static DEFINE_MUTEX(phy_fixup_lock); static DEFINE_MUTEX(phy_fixup_lock);
static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
u32 flags, phy_interface_t interface);
/** /**
* phy_register_fixup - creates a new phy_fixup and adds it to the list * phy_register_fixup - creates a new phy_fixup and adds it to the list
* @bus_id: A string which matches phydev->dev.bus_id (or PHY_ANY_ID) * @bus_id: A string which matches phydev->dev.bus_id (or PHY_ANY_ID)
...@@ -567,12 +564,12 @@ EXPORT_SYMBOL(phy_init_hw); ...@@ -567,12 +564,12 @@ EXPORT_SYMBOL(phy_init_hw);
* *
* Description: Called by drivers to attach to a particular PHY * Description: Called by drivers to attach to a particular PHY
* device. The phy_device is found, and properly hooked up * device. The phy_device is found, and properly hooked up
* to the phy_driver. If no driver is attached, then the * to the phy_driver. If no driver is attached, then a
* genphy_driver is used. The phy_device is given a ptr to * generic driver is used. The phy_device is given a ptr to
* the attaching device, and given a callback for link status * the attaching device, and given a callback for link status
* change. The phy_device is returned to the attaching driver. * change. The phy_device is returned to the attaching driver.
*/ */
static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
u32 flags, phy_interface_t interface) u32 flags, phy_interface_t interface)
{ {
struct device *d = &phydev->dev; struct device *d = &phydev->dev;
...@@ -582,11 +579,9 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, ...@@ -582,11 +579,9 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
* exist, and we should use the genphy driver. * exist, and we should use the genphy driver.
*/ */
if (NULL == d->driver) { if (NULL == d->driver) {
if (phydev->is_c45) { if (phydev->is_c45)
pr_err("No driver for phy %x\n", phydev->phy_id); d->driver = &genphy_driver[GENPHY_DRV_10G].driver;
return -ENODEV; else
}
d->driver = &genphy_driver[GENPHY_DRV_1G].driver; d->driver = &genphy_driver[GENPHY_DRV_1G].driver;
err = d->driver->probe(d); err = d->driver->probe(d);
...@@ -623,6 +618,7 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, ...@@ -623,6 +618,7 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
return err; return err;
} }
EXPORT_SYMBOL(phy_attach_direct);
/** /**
* phy_attach - attach a network device to a particular PHY device * phy_attach - attach a network device to a particular PHY device
......
...@@ -588,6 +588,8 @@ int phy_resume(struct phy_device *phydev); ...@@ -588,6 +588,8 @@ int phy_resume(struct phy_device *phydev);
struct phy_device *phy_attach(struct net_device *dev, const char *bus_id, struct phy_device *phy_attach(struct net_device *dev, const char *bus_id,
phy_interface_t interface); phy_interface_t interface);
struct phy_device *phy_find_first(struct mii_bus *bus); struct phy_device *phy_find_first(struct mii_bus *bus);
int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
u32 flags, phy_interface_t interface);
int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
void (*handler)(struct net_device *), void (*handler)(struct net_device *),
phy_interface_t interface); phy_interface_t interface);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment