Lines Matching refs:ds

282 	dev_dbg(dev->ds->dev, "VID: %d, members: 0x%04x, untag: 0x%04x\n",  in b53_set_vlan_entry()
498 void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port) in b53_imp_vlan_setup() argument
500 struct b53_device *dev = ds->priv; in b53_imp_vlan_setup()
562 int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy) in b53_enable_port() argument
564 struct b53_device *dev = ds->priv; in b53_enable_port()
569 if (!dsa_is_user_port(ds, port)) in b53_enable_port()
572 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_enable_port()
596 b53_imp_vlan_setup(ds, cpu_port); in b53_enable_port()
600 b53_eee_enable_set(ds, port, true); in b53_enable_port()
606 void b53_disable_port(struct dsa_switch *ds, int port) in b53_disable_port() argument
608 struct b53_device *dev = ds->priv; in b53_disable_port()
621 void b53_brcm_hdr_setup(struct dsa_switch *ds, int port) in b53_brcm_hdr_setup() argument
623 struct b53_device *dev = ds->priv; in b53_brcm_hdr_setup()
707 b53_brcm_hdr_setup(dev->ds, port); in b53_enable_cpu_port()
731 static bool b53_vlan_port_needs_forced_tagged(struct dsa_switch *ds, int port) in b53_vlan_port_needs_forced_tagged() argument
733 struct b53_device *dev = ds->priv; in b53_vlan_port_needs_forced_tagged()
735 return dev->tag_protocol == DSA_TAG_PROTO_NONE && dsa_is_cpu_port(ds, port); in b53_vlan_port_needs_forced_tagged()
738 int b53_configure_vlan(struct dsa_switch *ds) in b53_configure_vlan() argument
740 struct b53_device *dev = ds->priv; in b53_configure_vlan()
756 b53_enable_vlan(dev, -1, dev->vlan_enabled, ds->vlan_filtering); in b53_configure_vlan()
767 if (!b53_vlan_port_needs_forced_tagged(ds, i)) in b53_configure_vlan()
866 static int b53_phy_read16(struct dsa_switch *ds, int addr, int reg) in b53_phy_read16() argument
868 struct b53_device *priv = ds->priv; in b53_phy_read16()
881 static int b53_phy_write16(struct dsa_switch *ds, int addr, int reg, u16 val) in b53_phy_write16() argument
883 struct b53_device *priv = ds->priv; in b53_phy_write16()
907 b53_configure_vlan(priv->ds); in b53_apply_config()
951 static struct phy_device *b53_get_phy_device(struct dsa_switch *ds, int port) in b53_get_phy_device() argument
961 return mdiobus_get_phy(ds->slave_mii_bus, port); in b53_get_phy_device()
964 void b53_get_strings(struct dsa_switch *ds, int port, u32 stringset, in b53_get_strings() argument
967 struct b53_device *dev = ds->priv; in b53_get_strings()
978 phydev = b53_get_phy_device(ds, port); in b53_get_strings()
987 void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data) in b53_get_ethtool_stats() argument
989 struct b53_device *dev = ds->priv; in b53_get_ethtool_stats()
1020 void b53_get_ethtool_phy_stats(struct dsa_switch *ds, int port, uint64_t *data) in b53_get_ethtool_phy_stats() argument
1024 phydev = b53_get_phy_device(ds, port); in b53_get_ethtool_phy_stats()
1032 int b53_get_sset_count(struct dsa_switch *ds, int port, int sset) in b53_get_sset_count() argument
1034 struct b53_device *dev = ds->priv; in b53_get_sset_count()
1040 phydev = b53_get_phy_device(ds, port); in b53_get_sset_count()
1071 int b53_setup_devlink_resources(struct dsa_switch *ds) in b53_setup_devlink_resources() argument
1074 struct b53_device *dev = ds->priv; in b53_setup_devlink_resources()
1081 err = dsa_devlink_resource_register(ds, "VLAN", dev->num_vlans, in b53_setup_devlink_resources()
1088 dsa_devlink_resource_occ_get_register(ds, in b53_setup_devlink_resources()
1094 dsa_devlink_resources_unregister(ds); in b53_setup_devlink_resources()
1099 static int b53_setup(struct dsa_switch *ds) in b53_setup() argument
1101 struct b53_device *dev = ds->priv; in b53_setup()
1108 ds->untag_bridge_pvid = dev->tag_protocol == DSA_TAG_PROTO_NONE; in b53_setup()
1112 dev_err(ds->dev, "failed to reset switch\n"); in b53_setup()
1120 dev_err(ds->dev, "failed to apply configuration\n"); in b53_setup()
1128 if (dsa_is_cpu_port(ds, port)) in b53_setup()
1131 b53_disable_port(ds, port); in b53_setup()
1134 return b53_setup_devlink_resources(ds); in b53_setup()
1137 static void b53_teardown(struct dsa_switch *ds) in b53_teardown() argument
1139 dsa_devlink_resources_unregister(ds); in b53_teardown()
1212 static void b53_adjust_link(struct dsa_switch *ds, int port, in b53_adjust_link() argument
1215 struct b53_device *dev = ds->priv; in b53_adjust_link()
1225 if (is5301x(dev) && dsa_is_cpu_port(ds, port)) in b53_adjust_link()
1272 dev_info(ds->dev, "Configured port %d for %s\n", port, in b53_adjust_link()
1289 dev_err(ds->dev, in b53_adjust_link()
1297 p->eee_enabled = b53_eee_init(ds, port, phydev); in b53_adjust_link()
1300 void b53_port_event(struct dsa_switch *ds, int port) in b53_port_event() argument
1302 struct b53_device *dev = ds->priv; in b53_port_event()
1308 dsa_port_phylink_mac_change(ds, port, link); in b53_port_event()
1312 void b53_phylink_validate(struct dsa_switch *ds, int port, in b53_phylink_validate() argument
1316 struct b53_device *dev = ds->priv; in b53_phylink_validate()
1353 int b53_phylink_mac_link_state(struct dsa_switch *ds, int port, in b53_phylink_mac_link_state() argument
1356 struct b53_device *dev = ds->priv; in b53_phylink_mac_link_state()
1368 void b53_phylink_mac_config(struct dsa_switch *ds, int port, in b53_phylink_mac_config() argument
1372 struct b53_device *dev = ds->priv; in b53_phylink_mac_config()
1384 void b53_phylink_mac_an_restart(struct dsa_switch *ds, int port) in b53_phylink_mac_an_restart() argument
1386 struct b53_device *dev = ds->priv; in b53_phylink_mac_an_restart()
1393 void b53_phylink_mac_link_down(struct dsa_switch *ds, int port, in b53_phylink_mac_link_down() argument
1397 struct b53_device *dev = ds->priv; in b53_phylink_mac_link_down()
1413 void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, in b53_phylink_mac_link_up() argument
1420 struct b53_device *dev = ds->priv; in b53_phylink_mac_link_up()
1438 int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, in b53_vlan_filtering() argument
1441 struct b53_device *dev = ds->priv; in b53_vlan_filtering()
1449 static int b53_vlan_prepare(struct dsa_switch *ds, int port, in b53_vlan_prepare() argument
1452 struct b53_device *dev = ds->priv; in b53_vlan_prepare()
1468 b53_enable_vlan(dev, port, true, ds->vlan_filtering); in b53_vlan_prepare()
1473 int b53_vlan_add(struct dsa_switch *ds, int port, in b53_vlan_add() argument
1477 struct b53_device *dev = ds->priv; in b53_vlan_add()
1483 err = b53_vlan_prepare(ds, port, vlan); in b53_vlan_add()
1495 if (untagged && !b53_vlan_port_needs_forced_tagged(ds, port)) in b53_vlan_add()
1503 if (pvid && !dsa_is_cpu_port(ds, port)) { in b53_vlan_add()
1513 int b53_vlan_del(struct dsa_switch *ds, int port, in b53_vlan_del() argument
1516 struct b53_device *dev = ds->priv; in b53_vlan_del()
1532 if (untagged && !b53_vlan_port_needs_forced_tagged(ds, port)) in b53_vlan_del()
1706 int b53_fdb_add(struct dsa_switch *ds, int port, in b53_fdb_add() argument
1709 struct b53_device *priv = ds->priv; in b53_fdb_add()
1726 int b53_fdb_del(struct dsa_switch *ds, int port, in b53_fdb_del() argument
1729 struct b53_device *priv = ds->priv; in b53_fdb_del()
1784 int b53_fdb_dump(struct dsa_switch *ds, int port, in b53_fdb_dump() argument
1787 struct b53_device *priv = ds->priv; in b53_fdb_dump()
1827 int b53_mdb_add(struct dsa_switch *ds, int port, in b53_mdb_add() argument
1830 struct b53_device *priv = ds->priv; in b53_mdb_add()
1847 int b53_mdb_del(struct dsa_switch *ds, int port, in b53_mdb_del() argument
1850 struct b53_device *priv = ds->priv; in b53_mdb_del()
1857 dev_err(ds->dev, "failed to delete MDB entry\n"); in b53_mdb_del()
1863 int b53_br_join(struct dsa_switch *ds, int port, struct net_device *br) in b53_br_join() argument
1865 struct b53_device *dev = ds->priv; in b53_br_join()
1866 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_br_join()
1890 if (dsa_to_port(ds, i)->bridge_dev != br) in b53_br_join()
1914 void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br) in b53_br_leave() argument
1916 struct b53_device *dev = ds->priv; in b53_br_leave()
1918 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_br_leave()
1926 if (dsa_to_port(ds, i)->bridge_dev != br) in b53_br_leave()
1960 void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state) in b53_br_set_stp_state() argument
1962 struct b53_device *dev = ds->priv; in b53_br_set_stp_state()
1983 dev_err(ds->dev, "invalid STP state: %d\n", state); in b53_br_set_stp_state()
1994 void b53_br_fast_age(struct dsa_switch *ds, int port) in b53_br_fast_age() argument
1996 struct b53_device *dev = ds->priv; in b53_br_fast_age()
1999 dev_err(ds->dev, "fast ageing failed\n"); in b53_br_fast_age()
2003 int b53_br_flags_pre(struct dsa_switch *ds, int port, in b53_br_flags_pre() argument
2014 int b53_br_flags(struct dsa_switch *ds, int port, in b53_br_flags() argument
2019 b53_port_set_ucast_flood(ds->priv, port, in b53_br_flags()
2022 b53_port_set_mcast_flood(ds->priv, port, in b53_br_flags()
2025 b53_port_set_learning(ds->priv, port, in b53_br_flags()
2032 static bool b53_possible_cpu_port(struct dsa_switch *ds, int port) in b53_possible_cpu_port() argument
2047 static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port, in b53_can_enable_brcm_tags() argument
2050 bool ret = b53_possible_cpu_port(ds, port); in b53_can_enable_brcm_tags()
2053 dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n", in b53_can_enable_brcm_tags()
2061 dev_warn(ds->dev, in b53_can_enable_brcm_tags()
2073 enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port, in b53_get_tag_protocol() argument
2076 struct b53_device *dev = ds->priv; in b53_get_tag_protocol()
2078 if (!b53_can_enable_brcm_tags(ds, port, mprot)) { in b53_get_tag_protocol()
2103 int b53_mirror_add(struct dsa_switch *ds, int port, in b53_mirror_add() argument
2106 struct b53_device *dev = ds->priv; in b53_mirror_add()
2128 void b53_mirror_del(struct dsa_switch *ds, int port, in b53_mirror_del() argument
2131 struct b53_device *dev = ds->priv; in b53_mirror_del()
2167 void b53_eee_enable_set(struct dsa_switch *ds, int port, bool enable) in b53_eee_enable_set() argument
2169 struct b53_device *dev = ds->priv; in b53_eee_enable_set()
2184 int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy) in b53_eee_init() argument
2192 b53_eee_enable_set(ds, port, true); in b53_eee_init()
2198 int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e) in b53_get_mac_eee() argument
2200 struct b53_device *dev = ds->priv; in b53_get_mac_eee()
2215 int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e) in b53_set_mac_eee() argument
2217 struct b53_device *dev = ds->priv; in b53_set_mac_eee()
2224 b53_eee_enable_set(ds, port, e->eee_enabled); in b53_set_mac_eee()
2230 static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu) in b53_change_mtu() argument
2232 struct b53_device *dev = ds->priv; in b53_change_mtu()
2245 static int b53_get_max_mtu(struct dsa_switch *ds, int port) in b53_get_max_mtu() argument
2624 dev->ds->num_ports = min_t(unsigned int, dev->num_ports, DSA_MAX_PORTS); in b53_switch_init()
2629 if (!(dev->ds->phys_mii_mask & BIT(i)) && in b53_switch_init()
2630 !b53_possible_cpu_port(dev->ds, i)) in b53_switch_init()
2631 dev->ds->phys_mii_mask |= BIT(i); in b53_switch_init()
2662 struct dsa_switch *ds; in b53_switch_alloc() local
2665 ds = devm_kzalloc(base, sizeof(*ds), GFP_KERNEL); in b53_switch_alloc()
2666 if (!ds) in b53_switch_alloc()
2669 ds->dev = base; in b53_switch_alloc()
2675 ds->priv = dev; in b53_switch_alloc()
2678 dev->ds = ds; in b53_switch_alloc()
2681 ds->ops = &b53_switch_ops; in b53_switch_alloc()
2688 ds->vlan_filtering_is_global = true; in b53_switch_alloc()
2784 return dsa_register_switch(dev->ds); in b53_switch_register()