Lines Matching refs:port
92 int port, uint8_t *data) in bcm_sf2_sw_get_strings() argument
102 int port, uint64_t *data) in bcm_sf2_sw_get_ethtool_stats() argument
117 offset = s->reg + CORE_P_MIB_OFFSET(port); in bcm_sf2_sw_get_ethtool_stats()
159 static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) in bcm_sf2_imp_setup() argument
166 reg &= ~P_TXQ_PSM_VDD(port); in bcm_sf2_imp_setup()
184 switch (port) { in bcm_sf2_imp_setup()
208 reg &= ~(1 << port); in bcm_sf2_imp_setup()
215 reg &= ~(1 << port); in bcm_sf2_imp_setup()
224 static void bcm_sf2_eee_enable_set(struct dsa_switch *ds, int port, bool enable) in bcm_sf2_eee_enable_set() argument
231 reg |= 1 << port; in bcm_sf2_eee_enable_set()
233 reg &= ~(1 << port); in bcm_sf2_eee_enable_set()
266 static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, in bcm_sf2_port_setup() argument
275 reg &= ~P_TXQ_PSM_VDD(port); in bcm_sf2_port_setup()
279 core_writel(priv, 0, CORE_G_PCTL_PORT(port)); in bcm_sf2_port_setup()
282 if (port == 0 && priv->hw_params.num_gphy == 1) { in bcm_sf2_port_setup()
300 if (port == 7) in bcm_sf2_port_setup()
307 reg = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(port)); in bcm_sf2_port_setup()
309 reg |= (1 << port); in bcm_sf2_port_setup()
310 reg |= priv->port_sts[port].vlan_ctl_mask; in bcm_sf2_port_setup()
311 core_writel(priv, reg, CORE_PORT_VLAN_CTL_PORT(port)); in bcm_sf2_port_setup()
316 if (priv->port_sts[port].eee.eee_enabled) in bcm_sf2_port_setup()
317 bcm_sf2_eee_enable_set(ds, port, true); in bcm_sf2_port_setup()
322 static void bcm_sf2_port_disable(struct dsa_switch *ds, int port, in bcm_sf2_port_disable() argument
328 if (priv->wol_ports_mask & (1 << port)) in bcm_sf2_port_disable()
331 if (port == 7) { in bcm_sf2_port_disable()
336 if (port == 0 && priv->hw_params.num_gphy == 1) in bcm_sf2_port_disable()
339 if (dsa_is_cpu_port(ds, port)) in bcm_sf2_port_disable()
342 off = CORE_G_PCTL_PORT(port); in bcm_sf2_port_disable()
350 reg |= P_TXQ_PSM_VDD(port); in bcm_sf2_port_disable()
356 static int bcm_sf2_eee_init(struct dsa_switch *ds, int port, in bcm_sf2_eee_init() argument
360 struct ethtool_eee *p = &priv->port_sts[port].eee; in bcm_sf2_eee_init()
369 bcm_sf2_eee_enable_set(ds, port, true); in bcm_sf2_eee_init()
374 static int bcm_sf2_sw_get_eee(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_eee() argument
378 struct ethtool_eee *p = &priv->port_sts[port].eee; in bcm_sf2_sw_get_eee()
383 e->eee_active = !!(reg & (1 << port)); in bcm_sf2_sw_get_eee()
388 static int bcm_sf2_sw_set_eee(struct dsa_switch *ds, int port, in bcm_sf2_sw_set_eee() argument
393 struct ethtool_eee *p = &priv->port_sts[port].eee; in bcm_sf2_sw_set_eee()
398 bcm_sf2_eee_enable_set(ds, port, false); in bcm_sf2_sw_set_eee()
400 p->eee_enabled = bcm_sf2_eee_init(ds, port, phydev); in bcm_sf2_sw_set_eee()
411 static int bcm_sf2_sw_fast_age_port(struct dsa_switch *ds, int port) in bcm_sf2_sw_fast_age_port() argument
417 core_writel(priv, port, CORE_FAST_AGE_PORT); in bcm_sf2_sw_fast_age_port()
439 static int bcm_sf2_sw_br_join(struct dsa_switch *ds, int port, in bcm_sf2_sw_br_join() argument
446 p_ctl = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(port)); in bcm_sf2_sw_br_join()
456 reg |= 1 << port; in bcm_sf2_sw_br_join()
466 core_writel(priv, p_ctl, CORE_PORT_VLAN_CTL_PORT(port)); in bcm_sf2_sw_br_join()
467 priv->port_sts[port].vlan_ctl_mask = p_ctl; in bcm_sf2_sw_br_join()
472 static int bcm_sf2_sw_br_leave(struct dsa_switch *ds, int port, in bcm_sf2_sw_br_leave() argument
479 p_ctl = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(port)); in bcm_sf2_sw_br_leave()
487 reg &= ~(1 << port); in bcm_sf2_sw_br_leave()
489 priv->port_sts[port].vlan_ctl_mask = reg; in bcm_sf2_sw_br_leave()
492 if (port != i) in bcm_sf2_sw_br_leave()
496 core_writel(priv, p_ctl, CORE_PORT_VLAN_CTL_PORT(port)); in bcm_sf2_sw_br_leave()
497 priv->port_sts[port].vlan_ctl_mask = p_ctl; in bcm_sf2_sw_br_leave()
502 static int bcm_sf2_sw_br_set_stp_state(struct dsa_switch *ds, int port, in bcm_sf2_sw_br_set_stp_state() argument
510 reg = core_readl(priv, CORE_G_PCTL_PORT(port)); in bcm_sf2_sw_br_set_stp_state()
541 ret = bcm_sf2_sw_fast_age_port(ds, port); in bcm_sf2_sw_br_set_stp_state()
549 reg = core_readl(priv, CORE_G_PCTL_PORT(port)); in bcm_sf2_sw_br_set_stp_state()
552 core_writel(priv, reg, CORE_G_PCTL_PORT(port)); in bcm_sf2_sw_br_set_stp_state()
623 unsigned int port; in bcm_sf2_sw_setup() local
691 for (port = 0; port < priv->hw_params.num_ports; port++) { in bcm_sf2_sw_setup()
693 if ((1 << port) & ds->phys_port_mask) in bcm_sf2_sw_setup()
694 bcm_sf2_port_setup(ds, port, NULL); in bcm_sf2_sw_setup()
695 else if (dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_setup()
696 bcm_sf2_imp_setup(ds, port); in bcm_sf2_sw_setup()
698 bcm_sf2_port_disable(ds, port, NULL); in bcm_sf2_sw_setup()
738 static u32 bcm_sf2_sw_get_phy_flags(struct dsa_switch *ds, int port) in bcm_sf2_sw_get_phy_flags() argument
812 static void bcm_sf2_sw_adjust_link(struct dsa_switch *ds, int port, in bcm_sf2_sw_adjust_link() argument
844 reg = reg_readl(priv, REG_RGMII_CNTRL_P(port)); in bcm_sf2_sw_adjust_link()
846 reg_writel(priv, reg, REG_RGMII_CNTRL_P(port)); in bcm_sf2_sw_adjust_link()
853 reg = reg_readl(priv, REG_RGMII_CNTRL_P(port)); in bcm_sf2_sw_adjust_link()
868 reg_writel(priv, reg, REG_RGMII_CNTRL_P(port)); in bcm_sf2_sw_adjust_link()
870 pr_info("Port %d configured for %s\n", port, str); in bcm_sf2_sw_adjust_link()
889 core_writel(priv, reg, CORE_STS_OVERRIDE_GMIIP_PORT(port)); in bcm_sf2_sw_adjust_link()
892 static void bcm_sf2_sw_fixed_link_update(struct dsa_switch *ds, int port, in bcm_sf2_sw_fixed_link_update() argument
912 if (port == 7) { in bcm_sf2_sw_fixed_link_update()
913 status->link = priv->port_sts[port].link; in bcm_sf2_sw_fixed_link_update()
917 status->duplex = !!(duplex & (1 << port)); in bcm_sf2_sw_fixed_link_update()
920 reg = core_readl(priv, CORE_STS_OVERRIDE_GMIIP_PORT(port)); in bcm_sf2_sw_fixed_link_update()
926 core_writel(priv, reg, CORE_STS_OVERRIDE_GMIIP_PORT(port)); in bcm_sf2_sw_fixed_link_update()
928 if ((pause & (1 << port)) && in bcm_sf2_sw_fixed_link_update()
929 (pause & (1 << (port + PAUSESTS_TX_PAUSE_SHIFT)))) { in bcm_sf2_sw_fixed_link_update()
934 if (pause & (1 << port)) in bcm_sf2_sw_fixed_link_update()
941 unsigned int port; in bcm_sf2_sw_suspend() local
949 for (port = 0; port < DSA_MAX_PORTS; port++) { in bcm_sf2_sw_suspend()
950 if ((1 << port) & ds->phys_port_mask || in bcm_sf2_sw_suspend()
951 dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_suspend()
952 bcm_sf2_port_disable(ds, port, NULL); in bcm_sf2_sw_suspend()
961 unsigned int port; in bcm_sf2_sw_resume() local
973 for (port = 0; port < DSA_MAX_PORTS; port++) { in bcm_sf2_sw_resume()
974 if ((1 << port) & ds->phys_port_mask) in bcm_sf2_sw_resume()
975 bcm_sf2_port_setup(ds, port, NULL); in bcm_sf2_sw_resume()
976 else if (dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_resume()
977 bcm_sf2_imp_setup(ds, port); 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
1000 if (priv->wol_ports_mask & (1 << port)) in bcm_sf2_sw_get_wol()
1006 static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port, in bcm_sf2_sw_set_wol() argument
1019 priv->wol_ports_mask |= (1 << port); in bcm_sf2_sw_set_wol()
1021 priv->wol_ports_mask &= ~(1 << port); in bcm_sf2_sw_set_wol()