Lines Matching refs:ds

282 	dev_dbg(dev->ds->dev, "VID: %d, members: 0x%04x, untag: 0x%04x\n",
498 void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
500 struct b53_device *dev = ds->priv;
562 static void b53_eee_enable_set(struct dsa_switch *ds, int port, bool enable)
564 struct b53_device *dev = ds->priv;
575 int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy)
577 struct b53_device *dev = ds->priv;
582 if (!dsa_is_user_port(ds, port))
585 cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
609 b53_imp_vlan_setup(ds, cpu_port);
613 b53_eee_enable_set(ds, port, true);
619 void b53_disable_port(struct dsa_switch *ds, int port)
621 struct b53_device *dev = ds->priv;
634 void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
636 struct b53_device *dev = ds->priv;
720 b53_brcm_hdr_setup(dev->ds, port);
744 static bool b53_vlan_port_needs_forced_tagged(struct dsa_switch *ds, int port)
746 struct b53_device *dev = ds->priv;
748 return dev->tag_protocol == DSA_TAG_PROTO_NONE && dsa_is_cpu_port(ds, port);
751 int b53_configure_vlan(struct dsa_switch *ds)
753 struct b53_device *dev = ds->priv;
769 b53_enable_vlan(dev, -1, dev->vlan_enabled, ds->vlan_filtering);
780 if (!b53_vlan_port_needs_forced_tagged(ds, i))
879 static int b53_phy_read16(struct dsa_switch *ds, int addr, int reg)
881 struct b53_device *priv = ds->priv;
894 static int b53_phy_write16(struct dsa_switch *ds, int addr, int reg, u16 val)
896 struct b53_device *priv = ds->priv;
920 b53_configure_vlan(priv->ds);
964 static struct phy_device *b53_get_phy_device(struct dsa_switch *ds, int port)
974 return mdiobus_get_phy(ds->user_mii_bus, port);
977 void b53_get_strings(struct dsa_switch *ds, int port, u32 stringset,
980 struct b53_device *dev = ds->priv;
991 phydev = b53_get_phy_device(ds, port);
1000 void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data)
1002 struct b53_device *dev = ds->priv;
1033 void b53_get_ethtool_phy_stats(struct dsa_switch *ds, int port, uint64_t *data)
1037 phydev = b53_get_phy_device(ds, port);
1045 int b53_get_sset_count(struct dsa_switch *ds, int port, int sset)
1047 struct b53_device *dev = ds->priv;
1053 phydev = b53_get_phy_device(ds, port);
1084 int b53_setup_devlink_resources(struct dsa_switch *ds)
1087 struct b53_device *dev = ds->priv;
1094 err = dsa_devlink_resource_register(ds, "VLAN", dev->num_vlans,
1101 dsa_devlink_resource_occ_get_register(ds,
1107 dsa_devlink_resources_unregister(ds);
1112 static int b53_setup(struct dsa_switch *ds)
1114 struct b53_device *dev = ds->priv;
1121 ds->untag_bridge_pvid = dev->tag_protocol == DSA_TAG_PROTO_NONE;
1125 dev_err(ds->dev, "failed to reset switch\n");
1133 dev_err(ds->dev, "failed to apply configuration\n");
1141 if (dsa_is_cpu_port(ds, port))
1144 b53_disable_port(ds, port);
1147 return b53_setup_devlink_resources(ds);
1150 static void b53_teardown(struct dsa_switch *ds)
1152 dsa_devlink_resources_unregister(ds);
1225 static void b53_adjust_63xx_rgmii(struct dsa_switch *ds, int port,
1228 struct b53_device *dev = ds->priv;
1265 dev_dbg(ds->dev, "Configured port %d for %s\n", port,
1269 static void b53_adjust_531x5_rgmii(struct dsa_switch *ds, int port,
1272 struct b53_device *dev = ds->priv;
1308 dev_info(ds->dev, "Configured port %d for %s\n", port,
1312 static void b53_adjust_5325_mii(struct dsa_switch *ds, int port)
1314 struct b53_device *dev = ds->priv;
1328 dev_err(ds->dev,
1335 void b53_port_event(struct dsa_switch *ds, int port)
1337 struct b53_device *dev = ds->priv;
1343 dsa_port_phylink_mac_change(ds, port, link);
1347 static void b53_phylink_get_caps(struct dsa_switch *ds, int port,
1350 struct b53_device *dev = ds->priv;
1390 struct b53_device *dev = dp->ds->priv;
1404 struct dsa_switch *ds = dp->ds;
1405 struct b53_device *dev = ds->priv;
1409 b53_adjust_63xx_rgmii(ds, port, interface);
1413 b53_adjust_531x5_rgmii(ds, port, interface);
1417 b53_adjust_5325_mii(ds, port);
1426 struct b53_device *dev = dp->ds->priv;
1450 struct dsa_switch *ds = dp->ds;
1451 struct b53_device *dev = ds->priv;
1457 p->eee_enabled = b53_eee_init(ds, port, phydev);
1463 if (is5301x(dev) && dsa_is_cpu_port(ds, port))
1477 int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
1480 struct b53_device *dev = ds->priv;
1488 static int b53_vlan_prepare(struct dsa_switch *ds, int port,
1491 struct b53_device *dev = ds->priv;
1507 b53_enable_vlan(dev, port, true, ds->vlan_filtering);
1512 int b53_vlan_add(struct dsa_switch *ds, int port,
1516 struct b53_device *dev = ds->priv;
1522 err = b53_vlan_prepare(ds, port, vlan);
1534 if (untagged && !b53_vlan_port_needs_forced_tagged(ds, port))
1542 if (pvid && !dsa_is_cpu_port(ds, port)) {
1552 int b53_vlan_del(struct dsa_switch *ds, int port,
1555 struct b53_device *dev = ds->priv;
1571 if (untagged && !b53_vlan_port_needs_forced_tagged(ds, port))
1741 int b53_fdb_add(struct dsa_switch *ds, int port,
1745 struct b53_device *priv = ds->priv;
1762 int b53_fdb_del(struct dsa_switch *ds, int port,
1766 struct b53_device *priv = ds->priv;
1821 int b53_fdb_dump(struct dsa_switch *ds, int port,
1824 struct b53_device *priv = ds->priv;
1864 int b53_mdb_add(struct dsa_switch *ds, int port,
1868 struct b53_device *priv = ds->priv;
1885 int b53_mdb_del(struct dsa_switch *ds, int port,
1889 struct b53_device *priv = ds->priv;
1896 dev_err(ds->dev, "failed to delete MDB entry\n");
1902 int b53_br_join(struct dsa_switch *ds, int port, struct dsa_bridge bridge,
1905 struct b53_device *dev = ds->priv;
1906 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
1930 if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge))
1954 void b53_br_leave(struct dsa_switch *ds, int port, struct dsa_bridge bridge)
1956 struct b53_device *dev = ds->priv;
1958 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
1966 if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge))
2000 void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state)
2002 struct b53_device *dev = ds->priv;
2023 dev_err(ds->dev, "invalid STP state: %d\n", state);
2034 void b53_br_fast_age(struct dsa_switch *ds, int port)
2036 struct b53_device *dev = ds->priv;
2039 dev_err(ds->dev, "fast ageing failed\n");
2043 int b53_br_flags_pre(struct dsa_switch *ds, int port,
2054 int b53_br_flags(struct dsa_switch *ds, int port,
2059 b53_port_set_ucast_flood(ds->priv, port,
2062 b53_port_set_mcast_flood(ds->priv, port,
2065 b53_port_set_learning(ds->priv, port,
2072 static bool b53_possible_cpu_port(struct dsa_switch *ds, int port)
2087 static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port,
2090 bool ret = b53_possible_cpu_port(ds, port);
2093 dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n",
2101 dev_warn(ds->dev,
2113 enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
2116 struct b53_device *dev = ds->priv;
2118 if (!b53_can_enable_brcm_tags(ds, port, mprot)) {
2143 int b53_mirror_add(struct dsa_switch *ds, int port,
2147 struct b53_device *dev = ds->priv;
2169 void b53_mirror_del(struct dsa_switch *ds, int port,
2172 struct b53_device *dev = ds->priv;
2210 int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy)
2218 b53_eee_enable_set(ds, port, true);
2224 int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e)
2226 struct b53_device *dev = ds->priv;
2235 int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e)
2237 struct b53_device *dev = ds->priv;
2244 b53_eee_enable_set(ds, port, e->eee_enabled);
2250 static int b53_change_mtu(struct dsa_switch *ds, int port, int mtu)
2252 struct b53_device *dev = ds->priv;
2265 static int b53_get_max_mtu(struct dsa_switch *ds, int port)
2672 dev->ds->num_ports = min_t(unsigned int, dev->num_ports, DSA_MAX_PORTS);
2677 if (!(dev->ds->phys_mii_mask & BIT(i)) &&
2678 !b53_possible_cpu_port(dev->ds, i))
2679 dev->ds->phys_mii_mask |= BIT(i);
2710 struct dsa_switch *ds;
2713 ds = devm_kzalloc(base, sizeof(*ds), GFP_KERNEL);
2714 if (!ds)
2717 ds->dev = base;
2723 ds->priv = dev;
2726 dev->ds = ds;
2729 ds->ops = &b53_switch_ops;
2730 ds->phylink_mac_ops = &b53_phylink_mac_ops;
2737 ds->vlan_filtering_is_global = true;
2834 return dsa_register_switch(dev->ds);