Lines Matching refs:ds
36 static unsigned int bcm_sf2_num_active_ports(struct dsa_switch *ds) in bcm_sf2_num_active_ports() argument
38 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_num_active_ports()
42 if (dsa_is_cpu_port(ds, port)) in bcm_sf2_num_active_ports()
51 static void bcm_sf2_recalc_clock(struct dsa_switch *ds) in bcm_sf2_recalc_clock() argument
53 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_recalc_clock()
64 ports_active = bcm_sf2_num_active_ports(ds); in bcm_sf2_recalc_clock()
78 static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) in bcm_sf2_imp_setup() argument
80 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_imp_setup()
105 b53_brcm_hdr_setup(ds, port); in bcm_sf2_imp_setup()
133 static void bcm_sf2_gphy_enable_set(struct dsa_switch *ds, bool enable) in bcm_sf2_gphy_enable_set() argument
135 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_gphy_enable_set()
206 static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, in bcm_sf2_port_setup() argument
209 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_port_setup()
213 if (!dsa_is_user_port(ds, port)) in bcm_sf2_port_setup()
218 bcm_sf2_recalc_clock(ds); in bcm_sf2_port_setup()
232 b53_brcm_hdr_setup(ds, port); in bcm_sf2_port_setup()
252 bcm_sf2_gphy_enable_set(ds, true); in bcm_sf2_port_setup()
285 return b53_enable_port(ds, port, phy); in bcm_sf2_port_setup()
288 static void bcm_sf2_port_disable(struct dsa_switch *ds, int port) in bcm_sf2_port_disable() argument
290 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_port_disable()
305 bcm_sf2_gphy_enable_set(ds, false); in bcm_sf2_port_disable()
307 b53_disable_port(ds, port); in bcm_sf2_port_disable()
316 bcm_sf2_recalc_clock(ds); in bcm_sf2_port_disable()
381 struct dsa_switch *ds = dev_id; in bcm_sf2_switch_0_isr() local
382 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_switch_0_isr()
393 struct dsa_switch *ds = dev_id; in bcm_sf2_switch_1_isr() local
394 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_switch_1_isr()
402 dsa_port_phylink_mac_change(ds, 7, true); in bcm_sf2_switch_1_isr()
406 dsa_port_phylink_mac_change(ds, 7, false); in bcm_sf2_switch_1_isr()
500 static int bcm_sf2_mdio_register(struct dsa_switch *ds) in bcm_sf2_mdio_register() argument
502 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_mdio_register()
518 priv->slave_mii_bus = devm_mdiobus_alloc(ds->dev); in bcm_sf2_mdio_register()
545 ds->phys_mii_mask = priv->indir_phy_mask; in bcm_sf2_mdio_register()
546 ds->slave_mii_bus = priv->slave_mii_bus; in bcm_sf2_mdio_register()
547 priv->slave_mii_bus->parent = ds->dev->parent; in bcm_sf2_mdio_register()
588 static u32 bcm_sf2_sw_get_phy_flags(struct dsa_switch *ds, int port) in bcm_sf2_sw_get_phy_flags() argument
590 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_get_phy_flags()
600 static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port, in bcm_sf2_sw_validate() argument
604 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_validate()
615 dev_err(ds->dev, in bcm_sf2_sw_validate()
647 static void bcm_sf2_sw_mac_config(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_config() argument
651 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_config()
690 static void bcm_sf2_sw_mac_link_set(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_link_set() argument
693 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_link_set()
710 static void bcm_sf2_sw_mac_link_down(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_link_down() argument
714 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_link_down()
728 bcm_sf2_sw_mac_link_set(ds, port, interface, false); in bcm_sf2_sw_mac_link_down()
731 static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_link_up() argument
738 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_link_up()
742 bcm_sf2_sw_mac_link_set(ds, port, interface, true); in bcm_sf2_sw_mac_link_up()
782 p->eee_enabled = b53_eee_init(ds, port, phydev); in bcm_sf2_sw_mac_link_up()
785 static void bcm_sf2_sw_fixed_state(struct dsa_switch *ds, int port, in bcm_sf2_sw_fixed_state() argument
788 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_fixed_state()
808 netif_carrier_off(dsa_to_port(ds, port)->slave); in bcm_sf2_sw_fixed_state()
815 static void bcm_sf2_enable_acb(struct dsa_switch *ds) in bcm_sf2_enable_acb() argument
817 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_enable_acb()
829 static int bcm_sf2_sw_suspend(struct dsa_switch *ds) in bcm_sf2_sw_suspend() argument
831 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_suspend()
840 for (port = 0; port < ds->num_ports; port++) { in bcm_sf2_sw_suspend()
841 if (dsa_is_user_port(ds, port) || dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_suspend()
842 bcm_sf2_port_disable(ds, port); in bcm_sf2_sw_suspend()
851 static int bcm_sf2_sw_resume(struct dsa_switch *ds) in bcm_sf2_sw_resume() argument
853 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_resume()
865 ret = bcm_sf2_cfp_resume(ds); in bcm_sf2_sw_resume()
870 bcm_sf2_gphy_enable_set(ds, true); in bcm_sf2_sw_resume()
872 ds->ops->setup(ds); in bcm_sf2_sw_resume()
877 static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_wol() argument
880 struct net_device *p = dsa_to_port(ds, port)->cpu_dp->master; in bcm_sf2_sw_get_wol()
881 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_get_wol()
901 static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port, in bcm_sf2_sw_set_wol() argument
904 struct net_device *p = dsa_to_port(ds, port)->cpu_dp->master; in bcm_sf2_sw_set_wol()
905 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_set_wol()
906 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in bcm_sf2_sw_set_wol()
931 static int bcm_sf2_sw_setup(struct dsa_switch *ds) in bcm_sf2_sw_setup() argument
933 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_setup()
939 if (dsa_is_user_port(ds, port)) in bcm_sf2_sw_setup()
940 bcm_sf2_port_setup(ds, port, NULL); in bcm_sf2_sw_setup()
941 else if (dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_setup()
942 bcm_sf2_imp_setup(ds, port); in bcm_sf2_sw_setup()
944 bcm_sf2_port_disable(ds, port); in bcm_sf2_sw_setup()
947 b53_configure_vlan(ds); in bcm_sf2_sw_setup()
948 bcm_sf2_enable_acb(ds); in bcm_sf2_sw_setup()
950 return b53_setup_devlink_resources(ds); in bcm_sf2_sw_setup()
953 static void bcm_sf2_sw_teardown(struct dsa_switch *ds) in bcm_sf2_sw_teardown() argument
955 dsa_devlink_resources_unregister(ds); in bcm_sf2_sw_teardown()
1057 static void bcm_sf2_sw_get_strings(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_strings() argument
1060 int cnt = b53_get_sset_count(ds, port, stringset); in bcm_sf2_sw_get_strings()
1062 b53_get_strings(ds, port, stringset, data); in bcm_sf2_sw_get_strings()
1063 bcm_sf2_cfp_get_strings(ds, port, stringset, in bcm_sf2_sw_get_strings()
1067 static void bcm_sf2_sw_get_ethtool_stats(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_ethtool_stats() argument
1070 int cnt = b53_get_sset_count(ds, port, ETH_SS_STATS); in bcm_sf2_sw_get_ethtool_stats()
1072 b53_get_ethtool_stats(ds, port, data); in bcm_sf2_sw_get_ethtool_stats()
1073 bcm_sf2_cfp_get_ethtool_stats(ds, port, data + cnt); in bcm_sf2_sw_get_ethtool_stats()
1076 static int bcm_sf2_sw_get_sset_count(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_sset_count() argument
1079 int cnt = b53_get_sset_count(ds, port, sset); in bcm_sf2_sw_get_sset_count()
1084 cnt += bcm_sf2_cfp_get_sset_count(ds, port, sset); in bcm_sf2_sw_get_sset_count()
1210 struct dsa_switch *ds; in bcm_sf2_sw_probe() local
1257 ds = dev->ds; in bcm_sf2_sw_probe()
1258 ds->ops = &bcm_sf2_ops; in bcm_sf2_sw_probe()
1261 ds->num_tx_queues = SF2_NUM_EGRESS_QUEUES; in bcm_sf2_sw_probe()
1316 bcm_sf2_gphy_enable_set(priv->dev->ds, true); in bcm_sf2_sw_probe()
1318 ret = bcm_sf2_mdio_register(ds); in bcm_sf2_sw_probe()
1324 bcm_sf2_gphy_enable_set(priv->dev->ds, false); in bcm_sf2_sw_probe()
1336 "switch_0", ds); in bcm_sf2_sw_probe()
1343 "switch_1", ds); in bcm_sf2_sw_probe()
1402 dsa_unregister_switch(priv->dev->ds); in bcm_sf2_sw_remove()
1403 bcm_sf2_cfp_exit(priv->dev->ds); in bcm_sf2_sw_remove()
1424 bcm_sf2_gphy_enable_set(priv->dev->ds, true); in bcm_sf2_sw_shutdown()
1432 return dsa_switch_suspend(priv->dev->ds); in bcm_sf2_suspend()
1439 return dsa_switch_resume(priv->dev->ds); in bcm_sf2_resume()