• Home
  • Raw
  • Download

Lines Matching refs:ds

34 			if (dp->ds->index != sw_index)  in dsa_switch_find()
37 return dp->ds; in dsa_switch_find()
148 struct dsa_switch *ds = dp->ds; in dsa_link_touch() local
152 dst = ds->dst; in dsa_link_touch()
173 struct dsa_switch *ds = dp->ds; in dsa_port_setup_routing_table() local
174 struct dsa_switch_tree *dst = ds->dst; in dsa_port_setup_routing_table()
315 struct dsa_switch_tree *dst = dp->ds->dst; in dsa_port_devlink_setup()
317 struct devlink *dl = dp->ds->devlink; in dsa_port_devlink_setup()
399 struct dsa_switch *ds = dsa_devlink_to_ds(dl); in dsa_devlink_info_get() local
401 if (ds->ops->devlink_info_get) in dsa_devlink_info_get()
402 return ds->ops->devlink_info_get(ds, req, extack); in dsa_devlink_info_get()
411 static int dsa_switch_setup(struct dsa_switch *ds) in dsa_switch_setup() argument
417 if (ds->setup) in dsa_switch_setup()
425 ds->phys_mii_mask |= dsa_user_ports(ds); in dsa_switch_setup()
430 ds->devlink = devlink_alloc(&dsa_devlink_ops, sizeof(*dl_priv)); in dsa_switch_setup()
431 if (!ds->devlink) in dsa_switch_setup()
433 dl_priv = devlink_priv(ds->devlink); in dsa_switch_setup()
434 dl_priv->ds = ds; in dsa_switch_setup()
436 err = devlink_register(ds->devlink, ds->dev); in dsa_switch_setup()
443 list_for_each_entry(dp, &ds->dst->ports, list) { in dsa_switch_setup()
444 if (dp->ds == ds) { in dsa_switch_setup()
451 err = dsa_switch_register_notifier(ds); in dsa_switch_setup()
455 err = ds->ops->setup(ds); in dsa_switch_setup()
459 devlink_params_publish(ds->devlink); in dsa_switch_setup()
461 if (!ds->slave_mii_bus && ds->ops->phy_read) { in dsa_switch_setup()
462 ds->slave_mii_bus = mdiobus_alloc(); in dsa_switch_setup()
463 if (!ds->slave_mii_bus) { in dsa_switch_setup()
468 dsa_slave_mii_bus_init(ds); in dsa_switch_setup()
470 err = mdiobus_register(ds->slave_mii_bus); in dsa_switch_setup()
475 ds->setup = true; in dsa_switch_setup()
480 if (ds->slave_mii_bus && ds->ops->phy_read) in dsa_switch_setup()
481 mdiobus_free(ds->slave_mii_bus); in dsa_switch_setup()
483 if (ds->ops->teardown) in dsa_switch_setup()
484 ds->ops->teardown(ds); in dsa_switch_setup()
486 dsa_switch_unregister_notifier(ds); in dsa_switch_setup()
488 list_for_each_entry(dp, &ds->dst->ports, list) in dsa_switch_setup()
489 if (dp->ds == ds) in dsa_switch_setup()
491 devlink_unregister(ds->devlink); in dsa_switch_setup()
493 devlink_free(ds->devlink); in dsa_switch_setup()
494 ds->devlink = NULL; in dsa_switch_setup()
499 static void dsa_switch_teardown(struct dsa_switch *ds) in dsa_switch_teardown() argument
503 if (!ds->setup) in dsa_switch_teardown()
506 if (ds->slave_mii_bus && ds->ops->phy_read) { in dsa_switch_teardown()
507 mdiobus_unregister(ds->slave_mii_bus); in dsa_switch_teardown()
508 mdiobus_free(ds->slave_mii_bus); in dsa_switch_teardown()
509 ds->slave_mii_bus = NULL; in dsa_switch_teardown()
512 dsa_switch_unregister_notifier(ds); in dsa_switch_teardown()
514 if (ds->ops->teardown) in dsa_switch_teardown()
515 ds->ops->teardown(ds); in dsa_switch_teardown()
517 if (ds->devlink) { in dsa_switch_teardown()
518 list_for_each_entry(dp, &ds->dst->ports, list) in dsa_switch_teardown()
519 if (dp->ds == ds) in dsa_switch_teardown()
521 devlink_unregister(ds->devlink); in dsa_switch_teardown()
522 devlink_free(ds->devlink); in dsa_switch_teardown()
523 ds->devlink = NULL; in dsa_switch_teardown()
526 ds->setup = false; in dsa_switch_teardown()
535 err = dsa_switch_setup(dp->ds); in dsa_tree_setup_switches()
559 dsa_switch_teardown(dp->ds); in dsa_tree_setup_switches()
572 dsa_switch_teardown(dp->ds); in dsa_tree_teardown_switches()
664 static struct dsa_port *dsa_port_touch(struct dsa_switch *ds, int index) in dsa_port_touch() argument
666 struct dsa_switch_tree *dst = ds->dst; in dsa_port_touch()
670 if (dp->ds == ds && dp->index == index) in dsa_port_touch()
677 dp->ds = ds; in dsa_port_touch()
708 struct dsa_switch *mds, *ds = dp->ds; in dsa_get_tag_protocol() local
718 mds = mdp->ds; in dsa_get_tag_protocol()
727 return ds->ops->get_tag_protocol(ds, dp->index, tag_protocol); in dsa_get_tag_protocol()
732 struct dsa_switch *ds = dp->ds; in dsa_port_parse_cpu() local
733 struct dsa_switch_tree *dst = ds->dst; in dsa_port_parse_cpu()
742 dev_warn(ds->dev, "No tagger for this switch\n"); in dsa_port_parse_cpu()
782 static int dsa_switch_parse_ports_of(struct dsa_switch *ds, in dsa_switch_parse_ports_of() argument
795 dev_err(ds->dev, "no ports child node found\n"); in dsa_switch_parse_ports_of()
805 if (reg >= ds->num_ports) { in dsa_switch_parse_ports_of()
810 dp = dsa_to_port(ds, reg); in dsa_switch_parse_ports_of()
822 static int dsa_switch_parse_member_of(struct dsa_switch *ds, in dsa_switch_parse_member_of() argument
833 ds->index = m[1]; in dsa_switch_parse_member_of()
835 ds->dst = dsa_tree_touch(m[0]); in dsa_switch_parse_member_of()
836 if (!ds->dst) in dsa_switch_parse_member_of()
842 static int dsa_switch_touch_ports(struct dsa_switch *ds) in dsa_switch_touch_ports() argument
847 for (port = 0; port < ds->num_ports; port++) { in dsa_switch_touch_ports()
848 dp = dsa_port_touch(ds, port); in dsa_switch_touch_ports()
856 static int dsa_switch_parse_of(struct dsa_switch *ds, struct device_node *dn) in dsa_switch_parse_of() argument
860 err = dsa_switch_parse_member_of(ds, dn); in dsa_switch_parse_of()
864 err = dsa_switch_touch_ports(ds); in dsa_switch_parse_of()
868 return dsa_switch_parse_ports_of(ds, dn); in dsa_switch_parse_of()
892 static int dsa_switch_parse_ports(struct dsa_switch *ds, in dsa_switch_parse_ports() argument
905 dp = dsa_to_port(ds, i); in dsa_switch_parse_ports()
923 static int dsa_switch_parse(struct dsa_switch *ds, struct dsa_chip_data *cd) in dsa_switch_parse() argument
927 ds->cd = cd; in dsa_switch_parse()
932 ds->index = 0; in dsa_switch_parse()
933 ds->dst = dsa_tree_touch(0); in dsa_switch_parse()
934 if (!ds->dst) in dsa_switch_parse()
937 err = dsa_switch_touch_ports(ds); in dsa_switch_parse()
941 return dsa_switch_parse_ports(ds, cd); in dsa_switch_parse()
944 static void dsa_switch_release_ports(struct dsa_switch *ds) in dsa_switch_release_ports() argument
946 struct dsa_switch_tree *dst = ds->dst; in dsa_switch_release_ports()
950 if (dp->ds != ds) in dsa_switch_release_ports()
957 static int dsa_switch_probe(struct dsa_switch *ds) in dsa_switch_probe() argument
964 if (!ds->dev) in dsa_switch_probe()
967 pdata = ds->dev->platform_data; in dsa_switch_probe()
968 np = ds->dev->of_node; in dsa_switch_probe()
970 if (!ds->num_ports) in dsa_switch_probe()
974 err = dsa_switch_parse_of(ds, np); in dsa_switch_probe()
976 dsa_switch_release_ports(ds); in dsa_switch_probe()
978 err = dsa_switch_parse(ds, pdata); in dsa_switch_probe()
980 dsa_switch_release_ports(ds); in dsa_switch_probe()
988 dst = ds->dst; in dsa_switch_probe()
992 dsa_switch_release_ports(ds); in dsa_switch_probe()
999 int dsa_register_switch(struct dsa_switch *ds) in dsa_register_switch() argument
1004 err = dsa_switch_probe(ds); in dsa_register_switch()
1005 dsa_tree_put(ds->dst); in dsa_register_switch()
1012 static void dsa_switch_remove(struct dsa_switch *ds) in dsa_switch_remove() argument
1014 struct dsa_switch_tree *dst = ds->dst; in dsa_switch_remove()
1017 dsa_switch_release_ports(ds); in dsa_switch_remove()
1021 void dsa_unregister_switch(struct dsa_switch *ds) in dsa_unregister_switch() argument
1024 dsa_switch_remove(ds); in dsa_unregister_switch()