diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2014-08-27 20:04:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-28 01:59:40 -0400 |
commit | ce31b31c68e7e39f29b1257581fbd08ce3ca5589 (patch) | |
tree | 504543fb702e6d4d0b716d7d2eaf763191d07627 /net/dsa | |
parent | ec9436baedb689668c409cfc8b69eb9573b0d661 (diff) |
net: dsa: allow updating fixed PHY link information
Allow switch drivers to hook a PHY link update callback to perform
port-specific link work.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/slave.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 398d0663d3dd..18ff53836fe3 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -358,6 +358,18 @@ static void dsa_slave_adjust_link(struct net_device *dev) | |||
358 | phy_print_status(p->phy); | 358 | phy_print_status(p->phy); |
359 | } | 359 | } |
360 | 360 | ||
361 | static int dsa_slave_fixed_link_update(struct net_device *dev, | ||
362 | struct fixed_phy_status *status) | ||
363 | { | ||
364 | struct dsa_slave_priv *p = netdev_priv(dev); | ||
365 | struct dsa_switch *ds = p->parent; | ||
366 | |||
367 | if (ds->drv->fixed_link_update) | ||
368 | ds->drv->fixed_link_update(ds, p->port, status); | ||
369 | |||
370 | return 0; | ||
371 | } | ||
372 | |||
361 | /* slave device setup *******************************************************/ | 373 | /* slave device setup *******************************************************/ |
362 | static void dsa_slave_phy_setup(struct dsa_slave_priv *p, | 374 | static void dsa_slave_phy_setup(struct dsa_slave_priv *p, |
363 | struct net_device *slave_dev) | 375 | struct net_device *slave_dev) |
@@ -365,6 +377,7 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
365 | struct dsa_switch *ds = p->parent; | 377 | struct dsa_switch *ds = p->parent; |
366 | struct dsa_chip_data *cd = ds->pd; | 378 | struct dsa_chip_data *cd = ds->pd; |
367 | struct device_node *phy_dn, *port_dn; | 379 | struct device_node *phy_dn, *port_dn; |
380 | bool phy_is_fixed = false; | ||
368 | int ret; | 381 | int ret; |
369 | 382 | ||
370 | port_dn = cd->port_dn[p->port]; | 383 | port_dn = cd->port_dn[p->port]; |
@@ -380,6 +393,7 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
380 | pr_err("failed to register fixed PHY\n"); | 393 | pr_err("failed to register fixed PHY\n"); |
381 | return; | 394 | return; |
382 | } | 395 | } |
396 | phy_is_fixed = true; | ||
383 | phy_dn = port_dn; | 397 | phy_dn = port_dn; |
384 | } | 398 | } |
385 | 399 | ||
@@ -388,6 +402,9 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
388 | dsa_slave_adjust_link, 0, | 402 | dsa_slave_adjust_link, 0, |
389 | p->phy_interface); | 403 | p->phy_interface); |
390 | 404 | ||
405 | if (p->phy && phy_is_fixed) | ||
406 | fixed_phy_set_link_update(p->phy, dsa_slave_fixed_link_update); | ||
407 | |||
391 | /* We could not connect to a designated PHY, so use the switch internal | 408 | /* We could not connect to a designated PHY, so use the switch internal |
392 | * MDIO bus instead | 409 | * MDIO bus instead |
393 | */ | 410 | */ |