Lines Matching full: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()
41 for (port = 0; port < ds->num_ports; port++) { 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()
227 b53_brcm_hdr_setup(ds, port); in bcm_sf2_port_setup()
239 bcm_sf2_gphy_enable_set(ds, true); in bcm_sf2_port_setup()
272 return b53_enable_port(ds, port, phy); in bcm_sf2_port_setup()
275 static void bcm_sf2_port_disable(struct dsa_switch *ds, int port) in bcm_sf2_port_disable() argument
277 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_port_disable()
292 bcm_sf2_gphy_enable_set(ds, false); in bcm_sf2_port_disable()
294 b53_disable_port(ds, port); in bcm_sf2_port_disable()
303 bcm_sf2_recalc_clock(ds); in bcm_sf2_port_disable()
368 struct dsa_switch *ds = dev_id; in bcm_sf2_switch_0_isr() local
369 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_switch_0_isr()
380 struct dsa_switch *ds = dev_id; in bcm_sf2_switch_1_isr() local
381 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_switch_1_isr()
389 dsa_port_phylink_mac_change(ds, 7, true); in bcm_sf2_switch_1_isr()
393 dsa_port_phylink_mac_change(ds, 7, false); in bcm_sf2_switch_1_isr()
487 static int bcm_sf2_mdio_register(struct dsa_switch *ds) in bcm_sf2_mdio_register() argument
489 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_mdio_register()
507 priv->slave_mii_bus = devm_mdiobus_alloc(ds->dev); in bcm_sf2_mdio_register()
536 ds->phys_mii_mask = priv->indir_phy_mask; in bcm_sf2_mdio_register()
537 ds->slave_mii_bus = priv->slave_mii_bus; in bcm_sf2_mdio_register()
538 priv->slave_mii_bus->parent = ds->dev->parent; in bcm_sf2_mdio_register()
579 static u32 bcm_sf2_sw_get_phy_flags(struct dsa_switch *ds, int port) in bcm_sf2_sw_get_phy_flags() argument
581 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_get_phy_flags()
593 static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port, in bcm_sf2_sw_validate() argument
597 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_validate()
608 dev_err(ds->dev, in bcm_sf2_sw_validate()
640 static void bcm_sf2_sw_mac_config(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_config() argument
644 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_config()
683 static void bcm_sf2_sw_mac_link_set(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_link_set() argument
686 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_link_set()
703 static void bcm_sf2_sw_mac_link_down(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_link_down() argument
707 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_link_down()
724 bcm_sf2_sw_mac_link_set(ds, port, interface, false); in bcm_sf2_sw_mac_link_down()
727 static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_link_up() argument
734 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_link_up()
738 bcm_sf2_sw_mac_link_set(ds, port, interface, true); in bcm_sf2_sw_mac_link_up()
783 p->eee_enabled = b53_eee_init(ds, port, phydev); in bcm_sf2_sw_mac_link_up()
786 static void bcm_sf2_sw_fixed_state(struct dsa_switch *ds, int port, in bcm_sf2_sw_fixed_state() argument
789 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_fixed_state()
809 netif_carrier_off(dsa_to_port(ds, port)->slave); in bcm_sf2_sw_fixed_state()
816 static void bcm_sf2_enable_acb(struct dsa_switch *ds) in bcm_sf2_enable_acb() argument
818 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_enable_acb()
830 static int bcm_sf2_sw_suspend(struct dsa_switch *ds) in bcm_sf2_sw_suspend() argument
832 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_suspend()
841 for (port = 0; port < ds->num_ports; port++) { in bcm_sf2_sw_suspend()
842 if (dsa_is_user_port(ds, port) || dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_suspend()
843 bcm_sf2_port_disable(ds, port); in bcm_sf2_sw_suspend()
852 static int bcm_sf2_sw_resume(struct dsa_switch *ds) in bcm_sf2_sw_resume() argument
854 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_resume()
866 ret = bcm_sf2_cfp_resume(ds); in bcm_sf2_sw_resume()
871 bcm_sf2_gphy_enable_set(ds, true); in bcm_sf2_sw_resume()
873 ds->ops->setup(ds); in bcm_sf2_sw_resume()
878 static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_wol() argument
881 struct net_device *p = dsa_to_port(ds, port)->cpu_dp->master; in bcm_sf2_sw_get_wol()
882 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_get_wol()
902 static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port, in bcm_sf2_sw_set_wol() argument
905 struct net_device *p = dsa_to_port(ds, port)->cpu_dp->master; in bcm_sf2_sw_set_wol()
906 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_set_wol()
907 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in bcm_sf2_sw_set_wol()
932 static int bcm_sf2_sw_setup(struct dsa_switch *ds) in bcm_sf2_sw_setup() argument
934 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_setup()
940 if (dsa_is_user_port(ds, port)) in bcm_sf2_sw_setup()
941 bcm_sf2_port_setup(ds, port, NULL); in bcm_sf2_sw_setup()
942 else if (dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_setup()
943 bcm_sf2_imp_setup(ds, port); in bcm_sf2_sw_setup()
945 bcm_sf2_port_disable(ds, port); in bcm_sf2_sw_setup()
948 b53_configure_vlan(ds); in bcm_sf2_sw_setup()
949 bcm_sf2_enable_acb(ds); in bcm_sf2_sw_setup()
951 return b53_setup_devlink_resources(ds); in bcm_sf2_sw_setup()
954 static void bcm_sf2_sw_teardown(struct dsa_switch *ds) in bcm_sf2_sw_teardown() argument
956 dsa_devlink_resources_unregister(ds); in bcm_sf2_sw_teardown()
1058 static void bcm_sf2_sw_get_strings(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_strings() argument
1061 int cnt = b53_get_sset_count(ds, port, stringset); in bcm_sf2_sw_get_strings()
1063 b53_get_strings(ds, port, stringset, data); in bcm_sf2_sw_get_strings()
1064 bcm_sf2_cfp_get_strings(ds, port, stringset, in bcm_sf2_sw_get_strings()
1068 static void bcm_sf2_sw_get_ethtool_stats(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_ethtool_stats() argument
1071 int cnt = b53_get_sset_count(ds, port, ETH_SS_STATS); in bcm_sf2_sw_get_ethtool_stats()
1073 b53_get_ethtool_stats(ds, port, data); in bcm_sf2_sw_get_ethtool_stats()
1074 bcm_sf2_cfp_get_ethtool_stats(ds, port, data + cnt); in bcm_sf2_sw_get_ethtool_stats()
1077 static int bcm_sf2_sw_get_sset_count(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_sset_count() argument
1080 int cnt = b53_get_sset_count(ds, port, sset); in bcm_sf2_sw_get_sset_count()
1085 cnt += bcm_sf2_cfp_get_sset_count(ds, port, sset); in bcm_sf2_sw_get_sset_count()
1211 struct dsa_switch *ds; in bcm_sf2_sw_probe() local
1258 ds = dev->ds; in bcm_sf2_sw_probe()
1259 ds->ops = &bcm_sf2_ops; in bcm_sf2_sw_probe()
1262 ds->num_tx_queues = SF2_NUM_EGRESS_QUEUES; in bcm_sf2_sw_probe()
1317 bcm_sf2_gphy_enable_set(priv->dev->ds, true); in bcm_sf2_sw_probe()
1319 ret = bcm_sf2_mdio_register(ds); in bcm_sf2_sw_probe()
1325 bcm_sf2_gphy_enable_set(priv->dev->ds, false); in bcm_sf2_sw_probe()
1337 "switch_0", ds); in bcm_sf2_sw_probe()
1344 "switch_1", ds); in bcm_sf2_sw_probe()
1403 dsa_unregister_switch(priv->dev->ds); in bcm_sf2_sw_remove()
1404 bcm_sf2_cfp_exit(priv->dev->ds); in bcm_sf2_sw_remove()
1425 bcm_sf2_gphy_enable_set(priv->dev->ds, true); in bcm_sf2_sw_shutdown()
1433 return dsa_switch_suspend(priv->dev->ds); in bcm_sf2_suspend()
1440 return dsa_switch_resume(priv->dev->ds); in bcm_sf2_resume()