Lines Matching refs:ds
284 dev_dbg(dev->ds->dev, "VID: %d, members: 0x%04x, untag: 0x%04x\n", in b53_set_vlan_entry()
499 void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port) in b53_imp_vlan_setup() argument
501 struct b53_device *dev = ds->priv; in b53_imp_vlan_setup()
517 int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy) in b53_enable_port() argument
519 struct b53_device *dev = ds->priv; in b53_enable_port()
524 if (!dsa_is_user_port(ds, port)) in b53_enable_port()
527 cpu_port = ds->ports[port].cpu_dp->index; in b53_enable_port()
547 b53_imp_vlan_setup(ds, cpu_port); in b53_enable_port()
551 b53_eee_enable_set(ds, port, true); in b53_enable_port()
557 void b53_disable_port(struct dsa_switch *ds, int port) in b53_disable_port() argument
559 struct b53_device *dev = ds->priv; in b53_disable_port()
572 void b53_brcm_hdr_setup(struct dsa_switch *ds, int port) in b53_brcm_hdr_setup() argument
574 bool tag_en = !(ds->ops->get_tag_protocol(ds, port) == in b53_brcm_hdr_setup()
576 struct b53_device *dev = ds->priv; in b53_brcm_hdr_setup()
643 b53_brcm_hdr_setup(dev->ds, port); in b53_enable_cpu_port()
663 int b53_configure_vlan(struct dsa_switch *ds) in b53_configure_vlan() argument
665 struct b53_device *dev = ds->priv; in b53_configure_vlan()
679 b53_enable_vlan(dev, false, ds->vlan_filtering); in b53_configure_vlan()
765 static int b53_phy_read16(struct dsa_switch *ds, int addr, int reg) in b53_phy_read16() argument
767 struct b53_device *priv = ds->priv; in b53_phy_read16()
780 static int b53_phy_write16(struct dsa_switch *ds, int addr, int reg, u16 val) in b53_phy_write16() argument
782 struct b53_device *priv = ds->priv; in b53_phy_write16()
808 b53_configure_vlan(priv->ds); in b53_apply_config()
852 static struct phy_device *b53_get_phy_device(struct dsa_switch *ds, int port) in b53_get_phy_device() argument
862 return mdiobus_get_phy(ds->slave_mii_bus, port); in b53_get_phy_device()
865 void b53_get_strings(struct dsa_switch *ds, int port, u32 stringset, in b53_get_strings() argument
868 struct b53_device *dev = ds->priv; in b53_get_strings()
879 phydev = b53_get_phy_device(ds, port); in b53_get_strings()
888 void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data) in b53_get_ethtool_stats() argument
890 struct b53_device *dev = ds->priv; in b53_get_ethtool_stats()
921 void b53_get_ethtool_phy_stats(struct dsa_switch *ds, int port, uint64_t *data) in b53_get_ethtool_phy_stats() argument
925 phydev = b53_get_phy_device(ds, port); in b53_get_ethtool_phy_stats()
933 int b53_get_sset_count(struct dsa_switch *ds, int port, int sset) in b53_get_sset_count() argument
935 struct b53_device *dev = ds->priv; in b53_get_sset_count()
941 phydev = b53_get_phy_device(ds, port); in b53_get_sset_count()
952 static int b53_setup(struct dsa_switch *ds) in b53_setup() argument
954 struct b53_device *dev = ds->priv; in b53_setup()
960 dev_err(ds->dev, "failed to reset switch\n"); in b53_setup()
968 dev_err(ds->dev, "failed to apply configuration\n"); in b53_setup()
974 if (dsa_is_cpu_port(ds, port)) in b53_setup()
977 b53_disable_port(ds, port); in b53_setup()
985 ds->vlan_filtering_is_global = true; in b53_setup()
1059 static void b53_adjust_link(struct dsa_switch *ds, int port, in b53_adjust_link() argument
1062 struct b53_device *dev = ds->priv; in b53_adjust_link()
1117 dev_info(ds->dev, "Configured port %d for %s\n", port, in b53_adjust_link()
1134 dev_err(ds->dev, in b53_adjust_link()
1148 p->eee_enabled = b53_eee_init(ds, port, phydev); in b53_adjust_link()
1151 void b53_port_event(struct dsa_switch *ds, int port) in b53_port_event() argument
1153 struct b53_device *dev = ds->priv; in b53_port_event()
1159 dsa_port_phylink_mac_change(ds, port, link); in b53_port_event()
1163 void b53_phylink_validate(struct dsa_switch *ds, int port, in b53_phylink_validate() argument
1167 struct b53_device *dev = ds->priv; in b53_phylink_validate()
1206 int b53_phylink_mac_link_state(struct dsa_switch *ds, int port, in b53_phylink_mac_link_state() argument
1209 struct b53_device *dev = ds->priv; in b53_phylink_mac_link_state()
1221 void b53_phylink_mac_config(struct dsa_switch *ds, int port, in b53_phylink_mac_config() argument
1225 struct b53_device *dev = ds->priv; in b53_phylink_mac_config()
1243 void b53_phylink_mac_an_restart(struct dsa_switch *ds, int port) in b53_phylink_mac_an_restart() argument
1245 struct b53_device *dev = ds->priv; in b53_phylink_mac_an_restart()
1252 void b53_phylink_mac_link_down(struct dsa_switch *ds, int port, in b53_phylink_mac_link_down() argument
1256 struct b53_device *dev = ds->priv; in b53_phylink_mac_link_down()
1272 void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, in b53_phylink_mac_link_up() argument
1277 struct b53_device *dev = ds->priv; in b53_phylink_mac_link_up()
1293 int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering) in b53_vlan_filtering() argument
1295 struct b53_device *dev = ds->priv; in b53_vlan_filtering()
1321 int b53_vlan_prepare(struct dsa_switch *ds, int port, in b53_vlan_prepare() argument
1324 struct b53_device *dev = ds->priv; in b53_vlan_prepare()
1332 b53_enable_vlan(dev, true, ds->vlan_filtering); in b53_vlan_prepare()
1338 void b53_vlan_add(struct dsa_switch *ds, int port, in b53_vlan_add() argument
1341 struct b53_device *dev = ds->priv; in b53_vlan_add()
1353 if (untagged && !dsa_is_cpu_port(ds, port)) in b53_vlan_add()
1362 if (pvid && !dsa_is_cpu_port(ds, port)) { in b53_vlan_add()
1370 int b53_vlan_del(struct dsa_switch *ds, int port, in b53_vlan_del() argument
1373 struct b53_device *dev = ds->priv; in b53_vlan_del()
1391 if (untagged && !dsa_is_cpu_port(ds, port)) in b53_vlan_del()
1522 int b53_fdb_add(struct dsa_switch *ds, int port, in b53_fdb_add() argument
1525 struct b53_device *priv = ds->priv; in b53_fdb_add()
1537 int b53_fdb_del(struct dsa_switch *ds, int port, in b53_fdb_del() argument
1540 struct b53_device *priv = ds->priv; in b53_fdb_del()
1590 int b53_fdb_dump(struct dsa_switch *ds, int port, in b53_fdb_dump() argument
1593 struct b53_device *priv = ds->priv; in b53_fdb_dump()
1629 int b53_br_join(struct dsa_switch *ds, int port, struct net_device *br) in b53_br_join() argument
1631 struct b53_device *dev = ds->priv; in b53_br_join()
1632 s8 cpu_port = ds->ports[port].cpu_dp->index; in b53_br_join()
1650 if (dsa_to_port(ds, i)->bridge_dev != br) in b53_br_join()
1674 void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br) in b53_br_leave() argument
1676 struct b53_device *dev = ds->priv; in b53_br_leave()
1678 s8 cpu_port = ds->ports[port].cpu_dp->index; in b53_br_leave()
1686 if (dsa_to_port(ds, i)->bridge_dev != br) in b53_br_leave()
1720 void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state) in b53_br_set_stp_state() argument
1722 struct b53_device *dev = ds->priv; in b53_br_set_stp_state()
1743 dev_err(ds->dev, "invalid STP state: %d\n", state); in b53_br_set_stp_state()
1754 void b53_br_fast_age(struct dsa_switch *ds, int port) in b53_br_fast_age() argument
1756 struct b53_device *dev = ds->priv; in b53_br_fast_age()
1759 dev_err(ds->dev, "fast ageing failed\n"); in b53_br_fast_age()
1763 int b53_br_egress_floods(struct dsa_switch *ds, int port, in b53_br_egress_floods() argument
1766 struct b53_device *dev = ds->priv; in b53_br_egress_floods()
1788 static bool b53_possible_cpu_port(struct dsa_switch *ds, int port) in b53_possible_cpu_port() argument
1803 static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port) in b53_can_enable_brcm_tags() argument
1805 bool ret = b53_possible_cpu_port(ds, port); in b53_can_enable_brcm_tags()
1808 dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n", in b53_can_enable_brcm_tags()
1813 enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port) in b53_get_tag_protocol() argument
1815 struct b53_device *dev = ds->priv; in b53_get_tag_protocol()
1823 !b53_can_enable_brcm_tags(ds, port)) in b53_get_tag_protocol()
1836 int b53_mirror_add(struct dsa_switch *ds, int port, in b53_mirror_add() argument
1839 struct b53_device *dev = ds->priv; in b53_mirror_add()
1861 void b53_mirror_del(struct dsa_switch *ds, int port, in b53_mirror_del() argument
1864 struct b53_device *dev = ds->priv; in b53_mirror_del()
1900 void b53_eee_enable_set(struct dsa_switch *ds, int port, bool enable) in b53_eee_enable_set() argument
1902 struct b53_device *dev = ds->priv; in b53_eee_enable_set()
1917 int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy) in b53_eee_init() argument
1925 b53_eee_enable_set(ds, port, true); in b53_eee_init()
1931 int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e) in b53_get_mac_eee() argument
1933 struct b53_device *dev = ds->priv; in b53_get_mac_eee()
1948 int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e) in b53_set_mac_eee() argument
1950 struct b53_device *dev = ds->priv; in b53_set_mac_eee()
1957 b53_eee_enable_set(ds, port, e->eee_enabled); in b53_set_mac_eee()
2308 if (!(dev->ds->phys_mii_mask & BIT(i)) && in b53_switch_init()
2309 !b53_possible_cpu_port(dev->ds, i)) in b53_switch_init()
2310 dev->ds->phys_mii_mask |= BIT(i); in b53_switch_init()
2341 struct dsa_switch *ds; in b53_switch_alloc() local
2344 ds = dsa_switch_alloc(base, DSA_MAX_PORTS); in b53_switch_alloc()
2345 if (!ds) in b53_switch_alloc()
2352 ds->priv = dev; in b53_switch_alloc()
2355 dev->ds = ds; in b53_switch_alloc()
2358 ds->ops = &b53_switch_ops; in b53_switch_alloc()
2450 return dsa_register_switch(dev->ds); in b53_switch_register()