aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2015-08-08 11:09:14 -0400
committerDavid S. Miller <davem@davemloft.net>2015-08-10 17:25:02 -0400
commit6bc6d0a88179b732b9a5e40e05099dc219d1b3cb (patch)
tree06ca8d36ecf28a6319ce7bd9f1f6f57b14929c9f /net/dsa
parent966bce38e7fdb75eedaec90e40e4d22b9fbce79f (diff)
dsa: Support multiple MDIO busses
When using a cluster of switches, some topologies will have an MDIO bus per switch, not one for the whole cluster. Allow this to be represented in the device tree, by adding an optional mii-bus property at the switch level. The old platform_device method of instantiation supports this already, so only the device tree binding needs extending with an additional optional phandle. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-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/dsa.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index b445d492c115..78d4ac97aae3 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -574,7 +574,7 @@ static int dsa_of_probe(struct device *dev)
574{ 574{
575 struct device_node *np = dev->of_node; 575 struct device_node *np = dev->of_node;
576 struct device_node *child, *mdio, *ethernet, *port, *link; 576 struct device_node *child, *mdio, *ethernet, *port, *link;
577 struct mii_bus *mdio_bus; 577 struct mii_bus *mdio_bus, *mdio_bus_switch;
578 struct net_device *ethernet_dev; 578 struct net_device *ethernet_dev;
579 struct dsa_platform_data *pd; 579 struct dsa_platform_data *pd;
580 struct dsa_chip_data *cd; 580 struct dsa_chip_data *cd;
@@ -636,6 +636,16 @@ static int dsa_of_probe(struct device *dev)
636 if (!of_property_read_u32(child, "eeprom-length", &eeprom_len)) 636 if (!of_property_read_u32(child, "eeprom-length", &eeprom_len))
637 cd->eeprom_len = eeprom_len; 637 cd->eeprom_len = eeprom_len;
638 638
639 mdio = of_parse_phandle(child, "mii-bus", 0);
640 if (mdio) {
641 mdio_bus_switch = of_mdio_find_bus(mdio);
642 if (!mdio_bus_switch) {
643 ret = -EPROBE_DEFER;
644 goto out_free_chip;
645 }
646 cd->host_dev = &mdio_bus_switch->dev;
647 }
648
639 for_each_available_child_of_node(child, port) { 649 for_each_available_child_of_node(child, port) {
640 port_reg = of_get_property(port, "reg", NULL); 650 port_reg = of_get_property(port, "reg", NULL);
641 if (!port_reg) 651 if (!port_reg)