Lines Matching refs:ds

286 	dev_dbg(dev->ds->dev, "VID: %d, members: 0x%04x, untag: 0x%04x\n",  in b53_set_vlan_entry()
502 void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port) in b53_imp_vlan_setup() argument
504 struct b53_device *dev = ds->priv; in b53_imp_vlan_setup()
566 static void b53_eee_enable_set(struct dsa_switch *ds, int port, bool enable) in b53_eee_enable_set() argument
568 struct b53_device *dev = ds->priv; in b53_eee_enable_set()
579 int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy) in b53_enable_port() argument
581 struct b53_device *dev = ds->priv; in b53_enable_port()
586 if (!dsa_is_user_port(ds, port)) in b53_enable_port()
589 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_enable_port()
613 b53_imp_vlan_setup(ds, cpu_port); in b53_enable_port()
617 b53_eee_enable_set(ds, port, true); in b53_enable_port()
623 void b53_disable_port(struct dsa_switch *ds, int port) in b53_disable_port() argument
625 struct b53_device *dev = ds->priv; in b53_disable_port()
638 void b53_brcm_hdr_setup(struct dsa_switch *ds, int port) in b53_brcm_hdr_setup() argument
640 struct b53_device *dev = ds->priv; in b53_brcm_hdr_setup()
724 b53_brcm_hdr_setup(dev->ds, port); in b53_enable_cpu_port()
748 static bool b53_vlan_port_needs_forced_tagged(struct dsa_switch *ds, int port) in b53_vlan_port_needs_forced_tagged() argument
750 struct b53_device *dev = ds->priv; in b53_vlan_port_needs_forced_tagged()
752 return dev->tag_protocol == DSA_TAG_PROTO_NONE && dsa_is_cpu_port(ds, port); in b53_vlan_port_needs_forced_tagged()
755 int b53_configure_vlan(struct dsa_switch *ds) in b53_configure_vlan() argument
757 struct b53_device *dev = ds->priv; in b53_configure_vlan()
773 b53_enable_vlan(dev, -1, dev->vlan_enabled, ds->vlan_filtering); in b53_configure_vlan()
784 if (!b53_vlan_port_needs_forced_tagged(ds, i)) in b53_configure_vlan()
883 static int b53_phy_read16(struct dsa_switch *ds, int addr, int reg) in b53_phy_read16() argument
885 struct b53_device *priv = ds->priv; in b53_phy_read16()
898 static int b53_phy_write16(struct dsa_switch *ds, int addr, int reg, u16 val) in b53_phy_write16() argument
900 struct b53_device *priv = ds->priv; in b53_phy_write16()
924 b53_configure_vlan(priv->ds); in b53_apply_config()
968 static struct phy_device *b53_get_phy_device(struct dsa_switch *ds, int port) in b53_get_phy_device() argument
978 return mdiobus_get_phy(ds->user_mii_bus, port); in b53_get_phy_device()
981 void b53_get_strings(struct dsa_switch *ds, int port, u32 stringset, in b53_get_strings() argument
984 struct b53_device *dev = ds->priv; in b53_get_strings()
995 phydev = b53_get_phy_device(ds, port); in b53_get_strings()
1004 void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data) in b53_get_ethtool_stats() argument
1006 struct b53_device *dev = ds->priv; in b53_get_ethtool_stats()
1037 void b53_get_ethtool_phy_stats(struct dsa_switch *ds, int port, uint64_t *data) in b53_get_ethtool_phy_stats() argument
1041 phydev = b53_get_phy_device(ds, port); in b53_get_ethtool_phy_stats()
1049 int b53_get_sset_count(struct dsa_switch *ds, int port, int sset) in b53_get_sset_count() argument
1051 struct b53_device *dev = ds->priv; in b53_get_sset_count()
1057 phydev = b53_get_phy_device(ds, port); in b53_get_sset_count()
1088 int b53_setup_devlink_resources(struct dsa_switch *ds) in b53_setup_devlink_resources() argument
1091 struct b53_device *dev = ds->priv; in b53_setup_devlink_resources()
1098 err = dsa_devlink_resource_register(ds, "VLAN", dev->num_vlans, in b53_setup_devlink_resources()
1105 dsa_devlink_resource_occ_get_register(ds, in b53_setup_devlink_resources()
1111 dsa_devlink_resources_unregister(ds); in b53_setup_devlink_resources()
1116 static int b53_setup(struct dsa_switch *ds) in b53_setup() argument
1118 struct b53_device *dev = ds->priv; in b53_setup()
1125 ds->untag_bridge_pvid = dev->tag_protocol == DSA_TAG_PROTO_NONE; in b53_setup()
1129 dev_err(ds->dev, "failed to reset switch\n"); in b53_setup()
1137 dev_err(ds->dev, "failed to apply configuration\n"); in b53_setup()
1145 if (dsa_is_cpu_port(ds, port)) in b53_setup()
1148 b53_disable_port(ds, port); in b53_setup()
1151 return b53_setup_devlink_resources(ds); in b53_setup()
1154 static void b53_teardown(struct dsa_switch *ds) in b53_teardown() argument
1156 dsa_devlink_resources_unregister(ds); in b53_teardown()
1229 static void b53_adjust_63xx_rgmii(struct dsa_switch *ds, int port, in b53_adjust_63xx_rgmii() argument
1232 struct b53_device *dev = ds->priv; in b53_adjust_63xx_rgmii()
1269 dev_dbg(ds->dev, "Configured port %d for %s\n", port, in b53_adjust_63xx_rgmii()
1273 static void b53_adjust_531x5_rgmii(struct dsa_switch *ds, int port, in b53_adjust_531x5_rgmii() argument
1276 struct b53_device *dev = ds->priv; in b53_adjust_531x5_rgmii()
1312 dev_info(ds->dev, "Configured port %d for %s\n", port, in b53_adjust_531x5_rgmii()
1316 static void b53_adjust_5325_mii(struct dsa_switch *ds, int port) in b53_adjust_5325_mii() argument
1318 struct b53_device *dev = ds->priv; in b53_adjust_5325_mii()
1332 dev_err(ds->dev, in b53_adjust_5325_mii()
1339 void b53_port_event(struct dsa_switch *ds, int port) in b53_port_event() argument
1341 struct b53_device *dev = ds->priv; in b53_port_event()
1347 dsa_port_phylink_mac_change(ds, port, link); in b53_port_event()
1351 static void b53_phylink_get_caps(struct dsa_switch *ds, int port, in b53_phylink_get_caps() argument
1354 struct b53_device *dev = ds->priv; in b53_phylink_get_caps()
1394 struct b53_device *dev = dp->ds->priv; in b53_phylink_mac_select_pcs()
1408 struct dsa_switch *ds = dp->ds; in b53_phylink_mac_config() local
1409 struct b53_device *dev = ds->priv; in b53_phylink_mac_config()
1413 b53_adjust_63xx_rgmii(ds, port, interface); in b53_phylink_mac_config()
1417 b53_adjust_531x5_rgmii(ds, port, interface); in b53_phylink_mac_config()
1421 b53_adjust_5325_mii(ds, port); in b53_phylink_mac_config()
1430 struct b53_device *dev = dp->ds->priv; in b53_phylink_mac_link_down()
1454 struct dsa_switch *ds = dp->ds; in b53_phylink_mac_link_up() local
1455 struct b53_device *dev = ds->priv; in b53_phylink_mac_link_up()
1461 p->eee_enabled = b53_eee_init(ds, port, phydev); in b53_phylink_mac_link_up()
1467 if (is5301x(dev) && dsa_is_cpu_port(ds, port)) in b53_phylink_mac_link_up()
1481 int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, in b53_vlan_filtering() argument
1484 struct b53_device *dev = ds->priv; in b53_vlan_filtering()
1492 static int b53_vlan_prepare(struct dsa_switch *ds, int port, in b53_vlan_prepare() argument
1495 struct b53_device *dev = ds->priv; in b53_vlan_prepare()
1511 b53_enable_vlan(dev, port, true, ds->vlan_filtering); in b53_vlan_prepare()
1516 int b53_vlan_add(struct dsa_switch *ds, int port, in b53_vlan_add() argument
1520 struct b53_device *dev = ds->priv; in b53_vlan_add()
1526 err = b53_vlan_prepare(ds, port, vlan); in b53_vlan_add()
1538 if (untagged && !b53_vlan_port_needs_forced_tagged(ds, port)) in b53_vlan_add()
1546 if (pvid && !dsa_is_cpu_port(ds, port)) { in b53_vlan_add()
1556 int b53_vlan_del(struct dsa_switch *ds, int port, in b53_vlan_del() argument
1559 struct b53_device *dev = ds->priv; in b53_vlan_del()
1575 if (untagged && !b53_vlan_port_needs_forced_tagged(ds, port)) in b53_vlan_del()
1745 int b53_fdb_add(struct dsa_switch *ds, int port, in b53_fdb_add() argument
1749 struct b53_device *priv = ds->priv; in b53_fdb_add()
1766 int b53_fdb_del(struct dsa_switch *ds, int port, in b53_fdb_del() argument
1770 struct b53_device *priv = ds->priv; in b53_fdb_del()
1825 int b53_fdb_dump(struct dsa_switch *ds, int port, in b53_fdb_dump() argument
1828 struct b53_device *priv = ds->priv; in b53_fdb_dump()
1868 int b53_mdb_add(struct dsa_switch *ds, int port, in b53_mdb_add() argument
1872 struct b53_device *priv = ds->priv; in b53_mdb_add()
1889 int b53_mdb_del(struct dsa_switch *ds, int port, in b53_mdb_del() argument
1893 struct b53_device *priv = ds->priv; in b53_mdb_del()
1900 dev_err(ds->dev, "failed to delete MDB entry\n"); in b53_mdb_del()
1906 int b53_br_join(struct dsa_switch *ds, int port, struct dsa_bridge bridge, in b53_br_join() argument
1909 struct b53_device *dev = ds->priv; in b53_br_join()
1910 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_br_join()
1934 if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) in b53_br_join()
1958 void b53_br_leave(struct dsa_switch *ds, int port, struct dsa_bridge bridge) in b53_br_leave() argument
1960 struct b53_device *dev = ds->priv; in b53_br_leave()
1962 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_br_leave()
1970 if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge)) in b53_br_leave()
2004 void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state) in b53_br_set_stp_state() argument
2006 struct b53_device *dev = ds->priv; in b53_br_set_stp_state()
2027 dev_err(ds->dev, "invalid STP state: %d\n", state); in b53_br_set_stp_state()
2038 void b53_br_fast_age(struct dsa_switch *ds, int port) in b53_br_fast_age() argument
2040 struct b53_device *dev = ds->priv; in b53_br_fast_age()
2043 dev_err(ds->dev, "fast ageing failed\n"); in b53_br_fast_age()
2047 int b53_br_flags_pre(struct dsa_switch *ds, int port, in b53_br_flags_pre() argument
2058 int b53_br_flags(struct dsa_switch *ds, int port, in b53_br_flags() argument
2063 b53_port_set_ucast_flood(ds->priv, port, in b53_br_flags()
2066 b53_port_set_mcast_flood(ds->priv, port, in b53_br_flags()
2069 b53_port_set_learning(ds->priv, port, in b53_br_flags()
2076 static bool b53_possible_cpu_port(struct dsa_switch *ds, int port) in b53_possible_cpu_port() argument
2091 static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port, in b53_can_enable_brcm_tags() argument
2094 bool ret = b53_possible_cpu_port(ds, port); in b53_can_enable_brcm_tags()
2097 dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n", in b53_can_enable_brcm_tags()
2105 dev_warn(ds->dev, in b53_can_enable_brcm_tags()
2117 enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port, in b53_get_tag_protocol() argument
2120 struct b53_device *dev = ds->priv; in b53_get_tag_protocol()
2122 if (!b53_can_enable_brcm_tags(ds, port, mprot)) { in b53_get_tag_protocol()
2147 int b53_mirror_add(struct dsa_switch *ds, int port, in b53_mirror_add() argument
2151 struct b53_device *dev = ds->priv; in b53_mirror_add()
2173 void b53_mirror_del(struct dsa_switch *ds, int port, in b53_mirror_del() argument
2176 struct b53_device *dev = ds->priv; in b53_mirror_del()
2214 int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy) in b53_eee_init() argument
2222 b53_eee_enable_set(ds, port, true); in b53_eee_init()
2228 int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e) in b53_get_mac_eee() argument
2230 struct b53_device *dev = ds->priv; in b53_get_mac_eee()
2239 int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e) in b53_set_mac_eee() argument
2241 struct b53_device *dev = ds->priv; in b53_set_mac_eee()
2248 b53_eee_enable_set(ds, port, e->eee_enabled); in b53_set_mac_eee()
2254 static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu) in b53_change_mtu() argument
2256 struct b53_device *dev = ds->priv; in b53_change_mtu()
2263 if (!dsa_is_cpu_port(ds, port)) in b53_change_mtu()
2272 static int b53_get_max_mtu(struct dsa_switch *ds, int port) in b53_get_max_mtu() argument
2274 struct b53_device *dev = ds->priv; in b53_get_max_mtu()
2684 dev->ds->num_ports = min_t(unsigned int, dev->num_ports, DSA_MAX_PORTS); in b53_switch_init()
2689 if (!(dev->ds->phys_mii_mask & BIT(i)) && in b53_switch_init()
2690 !b53_possible_cpu_port(dev->ds, i)) in b53_switch_init()
2691 dev->ds->phys_mii_mask |= BIT(i); in b53_switch_init()
2722 struct dsa_switch *ds; in b53_switch_alloc() local
2725 ds = devm_kzalloc(base, sizeof(*ds), GFP_KERNEL); in b53_switch_alloc()
2726 if (!ds) in b53_switch_alloc()
2729 ds->dev = base; in b53_switch_alloc()
2735 ds->priv = dev; in b53_switch_alloc()
2738 dev->ds = ds; in b53_switch_alloc()
2741 ds->ops = &b53_switch_ops; in b53_switch_alloc()
2742 ds->phylink_mac_ops = &b53_phylink_mac_ops; in b53_switch_alloc()
2749 ds->vlan_filtering_is_global = true; in b53_switch_alloc()
2846 return dsa_register_switch(dev->ds); in b53_switch_register()