diff options
| author | David S. Miller <davem@davemloft.net> | 2016-01-07 14:31:28 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-01-07 14:31:28 -0500 |
| commit | 123581775336e91538e45cc00606692e1c410a66 (patch) | |
| tree | e152e8b038e05908c7fb1271f751dfa8462d6034 /net | |
| parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (diff) | |
| parent | mdio: Abstract device_remove() and device_free() (diff) | |
| download | linux-123581775336e91538e45cc00606692e1c410a66.tar.gz linux-123581775336e91538e45cc00606692e1c410a66.zip | |
Merge branch 'mdio-devices'
Andrew Lunn says:
====================
Support MDIO devices
The discussions about changing the way DSA probes switches resulted in
the wish to have switches attached to an MDIO bus to be represented as
an MDIO device. However the current code only supports PHYs on MDIO
busses. This patchset remedies this problem. It consists of a number
of cleanups, abstraction for accessing structure members, and
refactoring, as well as adding the concept of a generic MDIO device
and MDIO driver.
v2:
Added Reviewed-by from Florian
Made phydev_name() an inline function
Added phy_attached_info/phy_attached_print() for information about
the attached phy.
Removed now redundant irq setup from of_mdio.c
Dropped hunks from PHYMII ioctl which prevented access to any address
DSA carrier off before phy setup
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
| -rw-r--r-- | net/dsa/dsa.c | 2 | ||||
| -rw-r--r-- | net/dsa/slave.c | 22 |
2 files changed, 12 insertions, 12 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 208d1b257194..fa4daba8db55 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -439,7 +439,7 @@ static void dsa_switch_destroy(struct dsa_switch *ds) if (of_phy_is_fixed_link(port_dn)) { phydev = of_phy_find_device(port_dn); if (phydev) { - int addr = phydev->addr; + int addr = phydev->mdio.addr; phy_device_free(phydev); of_node_put(port_dn); diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 1e9e9424a33d..40b9ca72aae3 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -15,6 +15,7 @@ #include <linux/phy_fixed.h> #include <linux/of_net.h> #include <linux/of_mdio.h> +#include <linux/mdio.h> #include <net/rtnetlink.h> #include <net/switchdev.h> #include <linux/if_bridge.h> @@ -997,7 +998,7 @@ static int dsa_slave_phy_connect(struct dsa_slave_priv *p, { struct dsa_switch *ds = p->parent; - p->phy = ds->slave_mii_bus->phy_map[addr]; + p->phy = mdiobus_get_phy(ds->slave_mii_bus, addr); if (!p->phy) { netdev_err(slave_dev, "no phy at %d\n", addr); return -ENODEV; @@ -1080,11 +1081,10 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p, netdev_err(slave_dev, "failed to connect to port %d: %d\n", p->port, ret); return ret; } - } else { - netdev_info(slave_dev, "attached PHY at address %d [%s]\n", - p->phy->addr, p->phy->drv->name); } + phy_attached_info(p->phy); + return 0; } @@ -1189,13 +1189,6 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent, p->old_link = -1; p->old_duplex = -1; - ret = dsa_slave_phy_setup(p, slave_dev); - if (ret) { - netdev_err(master, "error %d setting up slave phy\n", ret); - free_netdev(slave_dev); - return ret; - } - ds->ports[port] = slave_dev; ret = register_netdev(slave_dev); if (ret) { @@ -1209,6 +1202,13 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent, netif_carrier_off(slave_dev); + ret = dsa_slave_phy_setup(p, slave_dev); + if (ret) { + netdev_err(master, "error %d setting up slave phy\n", ret); + free_netdev(slave_dev); + return ret; + } + return 0; } |
