Lines Matching full: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 static void b53_phylink_get_caps(struct dsa_switch *ds, int port, in b53_phylink_get_caps() argument
1315 struct b53_device *dev = ds->priv; in b53_phylink_get_caps()
1357 static struct phylink_pcs *b53_phylink_mac_select_pcs(struct dsa_switch *ds, in b53_phylink_mac_select_pcs() argument
1361 struct b53_device *dev = ds->priv; in b53_phylink_mac_select_pcs()
1369 void b53_phylink_mac_config(struct dsa_switch *ds, int port, in b53_phylink_mac_config() argument
1376 void b53_phylink_mac_link_down(struct dsa_switch *ds, int port, in b53_phylink_mac_link_down() argument
1380 struct b53_device *dev = ds->priv; in b53_phylink_mac_link_down()
1396 void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, in b53_phylink_mac_link_up() argument
1403 struct b53_device *dev = ds->priv; in b53_phylink_mac_link_up()
1421 int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, in b53_vlan_filtering() argument
1424 struct b53_device *dev = ds->priv; in b53_vlan_filtering()
1432 static int b53_vlan_prepare(struct dsa_switch *ds, int port, in b53_vlan_prepare() argument
1435 struct b53_device *dev = ds->priv; in b53_vlan_prepare()
1451 b53_enable_vlan(dev, port, true, ds->vlan_filtering); in b53_vlan_prepare()
1456 int b53_vlan_add(struct dsa_switch *ds, int port, in b53_vlan_add() argument
1460 struct b53_device *dev = ds->priv; in b53_vlan_add()
1466 err = b53_vlan_prepare(ds, port, vlan); in b53_vlan_add()
1478 if (untagged && !b53_vlan_port_needs_forced_tagged(ds, port)) in b53_vlan_add()
1486 if (pvid && !dsa_is_cpu_port(ds, port)) { in b53_vlan_add()
1496 int b53_vlan_del(struct dsa_switch *ds, int port, in b53_vlan_del() argument
1499 struct b53_device *dev = ds->priv; in b53_vlan_del()
1515 if (untagged && !b53_vlan_port_needs_forced_tagged(ds, port)) in b53_vlan_del()
1685 int b53_fdb_add(struct dsa_switch *ds, int port, in b53_fdb_add() argument
1689 struct b53_device *priv = ds->priv; in b53_fdb_add()
1706 int b53_fdb_del(struct dsa_switch *ds, int port, in b53_fdb_del() argument
1710 struct b53_device *priv = ds->priv; in b53_fdb_del()
1765 int b53_fdb_dump(struct dsa_switch *ds, int port, in b53_fdb_dump() argument
1768 struct b53_device *priv = ds->priv; in b53_fdb_dump()
1808 int b53_mdb_add(struct dsa_switch *ds, int port, in b53_mdb_add() argument
1812 struct b53_device *priv = ds->priv; in b53_mdb_add()
1829 int b53_mdb_del(struct dsa_switch *ds, int port, in b53_mdb_del() argument
1833 struct b53_device *priv = ds->priv; in b53_mdb_del()
1840 dev_err(ds->dev, "failed to delete MDB entry\n"); in b53_mdb_del()
1846 int b53_br_join(struct dsa_switch *ds, int port, struct dsa_bridge bridge, in b53_br_join() argument
1849 struct b53_device *dev = ds->priv; in b53_br_join()
1850 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_br_join()
1874 if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) in b53_br_join()
1898 void b53_br_leave(struct dsa_switch *ds, int port, struct dsa_bridge bridge) in b53_br_leave() argument
1900 struct b53_device *dev = ds->priv; in b53_br_leave()
1902 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_br_leave()
1910 if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) in b53_br_leave()
1944 void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state) in b53_br_set_stp_state() argument
1946 struct b53_device *dev = ds->priv; in b53_br_set_stp_state()
1967 dev_err(ds->dev, "invalid STP state: %d\n", state); in b53_br_set_stp_state()
1978 void b53_br_fast_age(struct dsa_switch *ds, int port) in b53_br_fast_age() argument
1980 struct b53_device *dev = ds->priv; in b53_br_fast_age()
1983 dev_err(ds->dev, "fast ageing failed\n"); in b53_br_fast_age()
1987 int b53_br_flags_pre(struct dsa_switch *ds, int port, in b53_br_flags_pre() argument
1998 int b53_br_flags(struct dsa_switch *ds, int port, in b53_br_flags() argument
2003 b53_port_set_ucast_flood(ds->priv, port, in b53_br_flags()
2006 b53_port_set_mcast_flood(ds->priv, port, in b53_br_flags()
2009 b53_port_set_learning(ds->priv, port, in b53_br_flags()
2016 static bool b53_possible_cpu_port(struct dsa_switch *ds, int port) in b53_possible_cpu_port() argument
2031 static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port, in b53_can_enable_brcm_tags() argument
2034 bool ret = b53_possible_cpu_port(ds, port); in b53_can_enable_brcm_tags()
2037 dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n", in b53_can_enable_brcm_tags()
2045 dev_warn(ds->dev, in b53_can_enable_brcm_tags()
2057 enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port, in b53_get_tag_protocol() argument
2060 struct b53_device *dev = ds->priv; in b53_get_tag_protocol()
2062 if (!b53_can_enable_brcm_tags(ds, port, mprot)) { in b53_get_tag_protocol()
2087 int b53_mirror_add(struct dsa_switch *ds, int port, in b53_mirror_add() argument
2091 struct b53_device *dev = ds->priv; in b53_mirror_add()
2113 void b53_mirror_del(struct dsa_switch *ds, int port, in b53_mirror_del() argument
2116 struct b53_device *dev = ds->priv; in b53_mirror_del()
2152 void b53_eee_enable_set(struct dsa_switch *ds, int port, bool enable) in b53_eee_enable_set() argument
2154 struct b53_device *dev = ds->priv; in b53_eee_enable_set()
2169 int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy) in b53_eee_init() argument
2177 b53_eee_enable_set(ds, port, true); in b53_eee_init()
2183 int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e) in b53_get_mac_eee() argument
2185 struct b53_device *dev = ds->priv; in b53_get_mac_eee()
2200 int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e) in b53_set_mac_eee() argument
2202 struct b53_device *dev = ds->priv; in b53_set_mac_eee()
2209 b53_eee_enable_set(ds, port, e->eee_enabled); in b53_set_mac_eee()
2215 static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu) in b53_change_mtu() argument
2217 struct b53_device *dev = ds->priv; in b53_change_mtu()
2230 static int b53_get_max_mtu(struct dsa_switch *ds, int port) in b53_get_max_mtu() argument
2608 dev->ds->num_ports = min_t(unsigned int, dev->num_ports, DSA_MAX_PORTS); in b53_switch_init()
2613 if (!(dev->ds->phys_mii_mask & BIT(i)) && in b53_switch_init()
2614 !b53_possible_cpu_port(dev->ds, i)) in b53_switch_init()
2615 dev->ds->phys_mii_mask |= BIT(i); in b53_switch_init()
2646 struct dsa_switch *ds; in b53_switch_alloc() local
2649 ds = devm_kzalloc(base, sizeof(*ds), GFP_KERNEL); in b53_switch_alloc()
2650 if (!ds) in b53_switch_alloc()
2653 ds->dev = base; in b53_switch_alloc()
2659 ds->priv = dev; in b53_switch_alloc()
2662 dev->ds = ds; in b53_switch_alloc()
2665 ds->ops = &b53_switch_ops; in b53_switch_alloc()
2672 ds->vlan_filtering_is_global = true; in b53_switch_alloc()
2768 return dsa_register_switch(dev->ds); in b53_switch_register()