Lines Matching refs:ds

34 static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)  in bcm_sf2_imp_setup()  argument
36 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_imp_setup()
61 b53_brcm_hdr_setup(ds, port); in bcm_sf2_imp_setup()
86 static void bcm_sf2_gphy_enable_set(struct dsa_switch *ds, bool enable) in bcm_sf2_gphy_enable_set() argument
88 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_gphy_enable_set()
159 static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, in bcm_sf2_port_setup() argument
162 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_port_setup()
166 if (!dsa_is_user_port(ds, port)) in bcm_sf2_port_setup()
181 b53_brcm_hdr_setup(ds, port); in bcm_sf2_port_setup()
193 bcm_sf2_gphy_enable_set(ds, true); in bcm_sf2_port_setup()
226 return b53_enable_port(ds, port, phy); in bcm_sf2_port_setup()
229 static void bcm_sf2_port_disable(struct dsa_switch *ds, int port) in bcm_sf2_port_disable() argument
231 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_port_disable()
246 bcm_sf2_gphy_enable_set(ds, false); in bcm_sf2_port_disable()
248 b53_disable_port(ds, port); in bcm_sf2_port_disable()
318 struct dsa_switch *ds = dev_id; in bcm_sf2_switch_0_isr() local
319 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_switch_0_isr()
330 struct dsa_switch *ds = dev_id; in bcm_sf2_switch_1_isr() local
331 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_switch_1_isr()
339 dsa_port_phylink_mac_change(ds, 7, true); in bcm_sf2_switch_1_isr()
343 dsa_port_phylink_mac_change(ds, 7, false); in bcm_sf2_switch_1_isr()
413 static int bcm_sf2_mdio_register(struct dsa_switch *ds) in bcm_sf2_mdio_register() argument
415 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_mdio_register()
429 priv->slave_mii_bus = devm_mdiobus_alloc(ds->dev); in bcm_sf2_mdio_register()
456 ds->phys_mii_mask = priv->indir_phy_mask; in bcm_sf2_mdio_register()
457 ds->slave_mii_bus = priv->slave_mii_bus; in bcm_sf2_mdio_register()
458 priv->slave_mii_bus->parent = ds->dev->parent; in bcm_sf2_mdio_register()
474 static u32 bcm_sf2_sw_get_phy_flags(struct dsa_switch *ds, int port) in bcm_sf2_sw_get_phy_flags() argument
476 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_get_phy_flags()
486 static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port, in bcm_sf2_sw_validate() argument
490 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_validate()
501 dev_err(ds->dev, in bcm_sf2_sw_validate()
533 static void bcm_sf2_sw_mac_config(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_config() argument
537 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_config()
607 static void bcm_sf2_sw_mac_link_set(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_link_set() argument
610 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_link_set()
627 static void bcm_sf2_sw_mac_link_down(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_link_down() argument
631 bcm_sf2_sw_mac_link_set(ds, port, interface, false); in bcm_sf2_sw_mac_link_down()
634 static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, in bcm_sf2_sw_mac_link_up() argument
639 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_mac_link_up()
642 bcm_sf2_sw_mac_link_set(ds, port, interface, true); in bcm_sf2_sw_mac_link_up()
645 p->eee_enabled = b53_eee_init(ds, port, phydev); in bcm_sf2_sw_mac_link_up()
648 static void bcm_sf2_sw_fixed_state(struct dsa_switch *ds, int port, in bcm_sf2_sw_fixed_state() argument
651 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_fixed_state()
671 netif_carrier_off(ds->ports[port].slave); in bcm_sf2_sw_fixed_state()
678 static void bcm_sf2_enable_acb(struct dsa_switch *ds) in bcm_sf2_enable_acb() argument
680 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_enable_acb()
692 static int bcm_sf2_sw_suspend(struct dsa_switch *ds) in bcm_sf2_sw_suspend() argument
694 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_suspend()
703 for (port = 0; port < ds->num_ports; port++) { in bcm_sf2_sw_suspend()
704 if (dsa_is_user_port(ds, port) || dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_suspend()
705 bcm_sf2_port_disable(ds, port); in bcm_sf2_sw_suspend()
711 static int bcm_sf2_sw_resume(struct dsa_switch *ds) in bcm_sf2_sw_resume() argument
713 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_resume()
722 ret = bcm_sf2_cfp_resume(ds); in bcm_sf2_sw_resume()
727 bcm_sf2_gphy_enable_set(ds, true); in bcm_sf2_sw_resume()
729 ds->ops->setup(ds); in bcm_sf2_sw_resume()
734 static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_wol() argument
737 struct net_device *p = ds->ports[port].cpu_dp->master; in bcm_sf2_sw_get_wol()
738 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_get_wol()
758 static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port, in bcm_sf2_sw_set_wol() argument
761 struct net_device *p = ds->ports[port].cpu_dp->master; in bcm_sf2_sw_set_wol()
762 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_set_wol()
763 s8 cpu_port = ds->ports[port].cpu_dp->index; in bcm_sf2_sw_set_wol()
788 static int bcm_sf2_sw_setup(struct dsa_switch *ds) in bcm_sf2_sw_setup() argument
790 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); in bcm_sf2_sw_setup()
796 if (dsa_is_user_port(ds, port)) in bcm_sf2_sw_setup()
797 bcm_sf2_port_setup(ds, port, NULL); in bcm_sf2_sw_setup()
798 else if (dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_setup()
799 bcm_sf2_imp_setup(ds, port); in bcm_sf2_sw_setup()
801 bcm_sf2_port_disable(ds, port); in bcm_sf2_sw_setup()
804 b53_configure_vlan(ds); in bcm_sf2_sw_setup()
805 bcm_sf2_enable_acb(ds); in bcm_sf2_sw_setup()
909 static void bcm_sf2_sw_get_strings(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_strings() argument
912 int cnt = b53_get_sset_count(ds, port, stringset); in bcm_sf2_sw_get_strings()
914 b53_get_strings(ds, port, stringset, data); in bcm_sf2_sw_get_strings()
915 bcm_sf2_cfp_get_strings(ds, port, stringset, in bcm_sf2_sw_get_strings()
919 static void bcm_sf2_sw_get_ethtool_stats(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_ethtool_stats() argument
922 int cnt = b53_get_sset_count(ds, port, ETH_SS_STATS); in bcm_sf2_sw_get_ethtool_stats()
924 b53_get_ethtool_stats(ds, port, data); in bcm_sf2_sw_get_ethtool_stats()
925 bcm_sf2_cfp_get_ethtool_stats(ds, port, data + cnt); in bcm_sf2_sw_get_ethtool_stats()
928 static int bcm_sf2_sw_get_sset_count(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_sset_count() argument
931 int cnt = b53_get_sset_count(ds, port, sset); in bcm_sf2_sw_get_sset_count()
936 cnt += bcm_sf2_cfp_get_sset_count(ds, port, sset); in bcm_sf2_sw_get_sset_count()
1057 struct dsa_switch *ds; in bcm_sf2_sw_probe() local
1099 ds = dev->ds; in bcm_sf2_sw_probe()
1100 ds->ops = &bcm_sf2_ops; in bcm_sf2_sw_probe()
1103 ds->num_tx_queues = SF2_NUM_EGRESS_QUEUES; in bcm_sf2_sw_probe()
1138 bcm_sf2_gphy_enable_set(priv->dev->ds, true); in bcm_sf2_sw_probe()
1140 ret = bcm_sf2_mdio_register(ds); in bcm_sf2_sw_probe()
1146 bcm_sf2_gphy_enable_set(priv->dev->ds, false); in bcm_sf2_sw_probe()
1158 "switch_0", ds); in bcm_sf2_sw_probe()
1165 "switch_1", ds); in bcm_sf2_sw_probe()
1220 dsa_unregister_switch(priv->dev->ds); in bcm_sf2_sw_remove()
1221 bcm_sf2_cfp_exit(priv->dev->ds); in bcm_sf2_sw_remove()
1238 bcm_sf2_gphy_enable_set(priv->dev->ds, true); in bcm_sf2_sw_shutdown()
1246 return dsa_switch_suspend(priv->dev->ds); in bcm_sf2_suspend()
1253 return dsa_switch_resume(priv->dev->ds); in bcm_sf2_resume()