diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2014-09-19 16:07:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-19 16:27:07 -0400 |
commit | 6819563e646a7f3692836daefd12cd86c697759f (patch) | |
tree | 2769e45763a0e1da6c4550d33259ae2635efc16c /net/dsa | |
parent | 487320c541430a7a45eda668a26423e06eb32ad5 (diff) |
net: dsa: allow switch drivers to specify phy_device::dev_flags
Some switch drivers (e.g: bcm_sf2) may have to communicate specific
workarounds or flags towards the PHY device driver. Allow switches
driver to be delegated that task by introducing a get_phy_flags()
callback which will do just that.
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 | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 90c9689ed362..a7997265019a 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -371,6 +371,7 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
371 | struct dsa_chip_data *cd = ds->pd; | 371 | struct dsa_chip_data *cd = ds->pd; |
372 | struct device_node *phy_dn, *port_dn; | 372 | struct device_node *phy_dn, *port_dn; |
373 | bool phy_is_fixed = false; | 373 | bool phy_is_fixed = false; |
374 | u32 phy_flags = 0; | ||
374 | int ret; | 375 | int ret; |
375 | 376 | ||
376 | port_dn = cd->port_dn[p->port]; | 377 | port_dn = cd->port_dn[p->port]; |
@@ -390,9 +391,12 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
390 | phy_dn = port_dn; | 391 | phy_dn = port_dn; |
391 | } | 392 | } |
392 | 393 | ||
394 | if (ds->drv->get_phy_flags) | ||
395 | phy_flags = ds->drv->get_phy_flags(ds, p->port); | ||
396 | |||
393 | if (phy_dn) | 397 | if (phy_dn) |
394 | p->phy = of_phy_connect(slave_dev, phy_dn, | 398 | p->phy = of_phy_connect(slave_dev, phy_dn, |
395 | dsa_slave_adjust_link, 0, | 399 | dsa_slave_adjust_link, phy_flags, |
396 | p->phy_interface); | 400 | p->phy_interface); |
397 | 401 | ||
398 | if (p->phy && phy_is_fixed) | 402 | if (p->phy && phy_is_fixed) |
@@ -480,6 +484,9 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent, | |||
480 | netif_carrier_off(slave_dev); | 484 | netif_carrier_off(slave_dev); |
481 | 485 | ||
482 | if (p->phy != NULL) { | 486 | if (p->phy != NULL) { |
487 | if (ds->drv->get_phy_flags(ds, port)) | ||
488 | p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port); | ||
489 | |||
483 | phy_attach(slave_dev, dev_name(&p->phy->dev), | 490 | phy_attach(slave_dev, dev_name(&p->phy->dev), |
484 | PHY_INTERFACE_MODE_GMII); | 491 | PHY_INTERFACE_MODE_GMII); |
485 | 492 | ||