Lines Matching full:ds

116 static unsigned int bcm_sf2_num_active_ports(struct dsa_switch *ds)  in bcm_sf2_num_active_ports()  argument
118 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_num_active_ports()
121 for (port = 0; port < ds->num_ports; port++) { in bcm_sf2_num_active_ports()
122 if (dsa_is_cpu_port(ds, port)) in bcm_sf2_num_active_ports()
131 static void bcm_sf2_recalc_clock(struct dsa_switch *ds) in bcm_sf2_recalc_clock() argument
133 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_recalc_clock()
144 ports_active = bcm_sf2_num_active_ports(ds); in bcm_sf2_recalc_clock()
158 static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) in bcm_sf2_imp_setup() argument
160 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_imp_setup()
185 b53_brcm_hdr_setup(ds, port); in bcm_sf2_imp_setup()
202 static void bcm_sf2_gphy_enable_set(struct dsa_switch *ds, bool enable) in bcm_sf2_gphy_enable_set() argument
204 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_gphy_enable_set()
280 static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, in bcm_sf2_port_setup() argument
283 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_port_setup()
287 if (!dsa_is_user_port(ds, port)) in bcm_sf2_port_setup()
292 bcm_sf2_recalc_clock(ds); in bcm_sf2_port_setup()
301 b53_brcm_hdr_setup(ds, port); in bcm_sf2_port_setup()
313 bcm_sf2_gphy_enable_set(ds, true); in bcm_sf2_port_setup()
346 return b53_enable_port(ds, port, phy); in bcm_sf2_port_setup()
349 static void bcm_sf2_port_disable(struct dsa_switch *ds, int port) in bcm_sf2_port_disable() argument
351 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_port_disable()
366 bcm_sf2_gphy_enable_set(ds, false); in bcm_sf2_port_disable()
368 b53_disable_port(ds, port); in bcm_sf2_port_disable()
377 bcm_sf2_recalc_clock(ds); in bcm_sf2_port_disable()
442 struct dsa_switch *ds = dev_id; in bcm_sf2_switch_0_isr() local
443 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_switch_0_isr()
454 struct dsa_switch *ds = dev_id; in bcm_sf2_switch_1_isr() local
455 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_switch_1_isr()
463 dsa_port_phylink_mac_change(ds, 7, true); in bcm_sf2_switch_1_isr()
467 dsa_port_phylink_mac_change(ds, 7, false); in bcm_sf2_switch_1_isr()
510 struct device *dev = priv->dev->ds->dev; in bcm_sf2_crossbar_setup()
557 struct device *dev = priv->dev->ds->dev; in bcm_sf2_identify_ports()
607 static int bcm_sf2_mdio_register(struct dsa_switch *ds) in bcm_sf2_mdio_register() argument
609 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_mdio_register()
656 ds->phys_mii_mask = priv->indir_phy_mask; in bcm_sf2_mdio_register()
657 ds->slave_mii_bus = priv->slave_mii_bus; in bcm_sf2_mdio_register()
658 priv->slave_mii_bus->parent = ds->dev->parent; in bcm_sf2_mdio_register()
702 static u32 bcm_sf2_sw_get_phy_flags(struct dsa_switch *ds, int port) in bcm_sf2_sw_get_phy_flags() argument
704 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_get_phy_flags()
718 static void bcm_sf2_sw_get_caps(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_caps() argument
722 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_get_caps()
739 static void bcm_sf2_sw_mac_config(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_config() argument
743 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_config()
785 static void bcm_sf2_sw_mac_link_set(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_link_set() argument
788 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_link_set()
808 static void bcm_sf2_sw_mac_link_down(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_link_down() argument
812 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_link_down()
823 bcm_sf2_sw_mac_link_set(ds, port, interface, false); in bcm_sf2_sw_mac_link_down()
826 static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_link_up() argument
833 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_link_up()
838 bcm_sf2_sw_mac_link_set(ds, port, interface, true); in bcm_sf2_sw_mac_link_up()
886 p->eee_enabled = b53_eee_init(ds, port, phydev); in bcm_sf2_sw_mac_link_up()
889 static void bcm_sf2_sw_fixed_state(struct dsa_switch *ds, int port, in bcm_sf2_sw_fixed_state() argument
892 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_fixed_state()
912 netif_carrier_off(dsa_to_port(ds, port)->slave); in bcm_sf2_sw_fixed_state()
919 static void bcm_sf2_enable_acb(struct dsa_switch *ds) in bcm_sf2_enable_acb() argument
921 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_enable_acb()
933 static int bcm_sf2_sw_suspend(struct dsa_switch *ds) in bcm_sf2_sw_suspend() argument
935 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_suspend()
944 for (port = 0; port < ds->num_ports; port++) { in bcm_sf2_sw_suspend()
945 if (dsa_is_user_port(ds, port) || dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_suspend()
946 bcm_sf2_port_disable(ds, port); in bcm_sf2_sw_suspend()
955 static int bcm_sf2_sw_resume(struct dsa_switch *ds) in bcm_sf2_sw_resume() argument
957 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_resume()
971 ret = bcm_sf2_cfp_resume(ds); in bcm_sf2_sw_resume()
976 bcm_sf2_gphy_enable_set(ds, true); in bcm_sf2_sw_resume()
978 ds->ops->setup(ds); in bcm_sf2_sw_resume()
983 static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_wol() argument
986 struct net_device *p = dsa_port_to_master(dsa_to_port(ds, port)); in bcm_sf2_sw_get_wol()
987 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_get_wol()
1007 static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port, in bcm_sf2_sw_set_wol() argument
1010 struct net_device *p = dsa_port_to_master(dsa_to_port(ds, port)); in bcm_sf2_sw_set_wol()
1011 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_set_wol()
1012 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in bcm_sf2_sw_set_wol()
1037 static int bcm_sf2_sw_setup(struct dsa_switch *ds) in bcm_sf2_sw_setup() argument
1039 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_setup()
1045 if (dsa_is_user_port(ds, port)) in bcm_sf2_sw_setup()
1046 bcm_sf2_port_setup(ds, port, NULL); in bcm_sf2_sw_setup()
1047 else if (dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_setup()
1048 bcm_sf2_imp_setup(ds, port); in bcm_sf2_sw_setup()
1050 bcm_sf2_port_disable(ds, port); in bcm_sf2_sw_setup()
1053 b53_configure_vlan(ds); in bcm_sf2_sw_setup()
1054 bcm_sf2_enable_acb(ds); in bcm_sf2_sw_setup()
1056 return b53_setup_devlink_resources(ds); in bcm_sf2_sw_setup()
1059 static void bcm_sf2_sw_teardown(struct dsa_switch *ds) in bcm_sf2_sw_teardown() argument
1061 dsa_devlink_resources_unregister(ds); in bcm_sf2_sw_teardown()
1163 static void bcm_sf2_sw_get_strings(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_strings() argument
1166 int cnt = b53_get_sset_count(ds, port, stringset); in bcm_sf2_sw_get_strings()
1168 b53_get_strings(ds, port, stringset, data); in bcm_sf2_sw_get_strings()
1169 bcm_sf2_cfp_get_strings(ds, port, stringset, in bcm_sf2_sw_get_strings()
1173 static void bcm_sf2_sw_get_ethtool_stats(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_ethtool_stats() argument
1176 int cnt = b53_get_sset_count(ds, port, ETH_SS_STATS); in bcm_sf2_sw_get_ethtool_stats()
1178 b53_get_ethtool_stats(ds, port, data); in bcm_sf2_sw_get_ethtool_stats()
1179 bcm_sf2_cfp_get_ethtool_stats(ds, port, data + cnt); in bcm_sf2_sw_get_ethtool_stats()
1182 static int bcm_sf2_sw_get_sset_count(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_sset_count() argument
1185 int cnt = b53_get_sset_count(ds, port, sset); in bcm_sf2_sw_get_sset_count()
1190 cnt += bcm_sf2_cfp_get_sset_count(ds, port, sset); in bcm_sf2_sw_get_sset_count()
1348 struct dsa_switch *ds; in bcm_sf2_sw_probe() local
1396 ds = dev->ds; in bcm_sf2_sw_probe()
1397 ds->ops = &bcm_sf2_ops; in bcm_sf2_sw_probe()
1400 ds->num_tx_queues = SF2_NUM_EGRESS_QUEUES; in bcm_sf2_sw_probe()
1457 bcm_sf2_gphy_enable_set(priv->dev->ds, true); in bcm_sf2_sw_probe()
1459 ret = bcm_sf2_mdio_register(ds); in bcm_sf2_sw_probe()
1465 bcm_sf2_gphy_enable_set(priv->dev->ds, false); in bcm_sf2_sw_probe()
1477 "switch_0", ds); in bcm_sf2_sw_probe()
1484 "switch_1", ds); in bcm_sf2_sw_probe()
1546 dsa_unregister_switch(priv->dev->ds); in bcm_sf2_sw_remove()
1547 bcm_sf2_cfp_exit(priv->dev->ds); in bcm_sf2_sw_remove()
1571 bcm_sf2_gphy_enable_set(priv->dev->ds, true); in bcm_sf2_sw_shutdown()
1573 dsa_switch_shutdown(priv->dev->ds); in bcm_sf2_sw_shutdown()
1583 return dsa_switch_suspend(priv->dev->ds); in bcm_sf2_suspend()
1590 return dsa_switch_resume(priv->dev->ds); in bcm_sf2_resume()