Lines Matching refs:port
96 int port, uint8_t *data) in bcm_sf2_sw_get_strings() argument
106 int port, uint64_t *data) in bcm_sf2_sw_get_ethtool_stats() argument
121 offset = s->reg + CORE_P_MIB_OFFSET(port); in bcm_sf2_sw_get_ethtool_stats()
163 static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) in bcm_sf2_imp_setup() argument
170 reg &= ~P_TXQ_PSM_VDD(port); in bcm_sf2_imp_setup()
188 switch (port) { in bcm_sf2_imp_setup()
212 reg &= ~(1 << port); in bcm_sf2_imp_setup()
219 reg &= ~(1 << port); in bcm_sf2_imp_setup()
228 static void bcm_sf2_eee_enable_set(struct dsa_switch *ds, int port, bool enable) in bcm_sf2_eee_enable_set() argument
235 reg |= 1 << port; in bcm_sf2_eee_enable_set()
237 reg &= ~(1 << port); in bcm_sf2_eee_enable_set()
271 int port) in bcm_sf2_port_intr_enable() argument
275 switch (port) { in bcm_sf2_port_intr_enable()
284 off = P_IRQ_OFF(port); in bcm_sf2_port_intr_enable()
292 int port) in bcm_sf2_port_intr_disable() argument
296 switch (port) { in bcm_sf2_port_intr_disable()
306 off = P_IRQ_OFF(port); in bcm_sf2_port_intr_disable()
314 static int bcm_sf2_port_setup(struct dsa_switch *ds, int port, in bcm_sf2_port_setup() argument
323 reg &= ~P_TXQ_PSM_VDD(port); in bcm_sf2_port_setup()
327 core_writel(priv, 0, CORE_G_PCTL_PORT(port)); in bcm_sf2_port_setup()
330 if (priv->int_phy_mask & 1 << port && priv->hw_params.num_gphy == 1) { in bcm_sf2_port_setup()
348 if (port == priv->moca_port) in bcm_sf2_port_setup()
349 bcm_sf2_port_intr_enable(priv, port); in bcm_sf2_port_setup()
355 reg = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(port)); in bcm_sf2_port_setup()
357 reg |= (1 << port); in bcm_sf2_port_setup()
358 reg |= priv->port_sts[port].vlan_ctl_mask; in bcm_sf2_port_setup()
359 core_writel(priv, reg, CORE_PORT_VLAN_CTL_PORT(port)); in bcm_sf2_port_setup()
364 if (priv->port_sts[port].eee.eee_enabled) in bcm_sf2_port_setup()
365 bcm_sf2_eee_enable_set(ds, port, true); in bcm_sf2_port_setup()
370 static void bcm_sf2_port_disable(struct dsa_switch *ds, int port, in bcm_sf2_port_disable() argument
376 if (priv->wol_ports_mask & (1 << port)) in bcm_sf2_port_disable()
379 if (port == priv->moca_port) in bcm_sf2_port_disable()
380 bcm_sf2_port_intr_disable(priv, port); in bcm_sf2_port_disable()
382 if (priv->int_phy_mask & 1 << port && priv->hw_params.num_gphy == 1) in bcm_sf2_port_disable()
385 if (dsa_is_cpu_port(ds, port)) in bcm_sf2_port_disable()
388 off = CORE_G_PCTL_PORT(port); in bcm_sf2_port_disable()
396 reg |= P_TXQ_PSM_VDD(port); in bcm_sf2_port_disable()
402 static int bcm_sf2_eee_init(struct dsa_switch *ds, int port, in bcm_sf2_eee_init() argument
406 struct ethtool_eee *p = &priv->port_sts[port].eee; in bcm_sf2_eee_init()
415 bcm_sf2_eee_enable_set(ds, port, true); in bcm_sf2_eee_init()
420 static int bcm_sf2_sw_get_eee(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_eee() argument
424 struct ethtool_eee *p = &priv->port_sts[port].eee; in bcm_sf2_sw_get_eee()
429 e->eee_active = !!(reg & (1 << port)); in bcm_sf2_sw_get_eee()
434 static int bcm_sf2_sw_set_eee(struct dsa_switch *ds, int port, in bcm_sf2_sw_set_eee() argument
439 struct ethtool_eee *p = &priv->port_sts[port].eee; in bcm_sf2_sw_set_eee()
444 bcm_sf2_eee_enable_set(ds, port, false); in bcm_sf2_sw_set_eee()
446 p->eee_enabled = bcm_sf2_eee_init(ds, port, phydev); in bcm_sf2_sw_set_eee()
457 static int bcm_sf2_sw_fast_age_port(struct dsa_switch *ds, int port) in bcm_sf2_sw_fast_age_port() argument
463 core_writel(priv, port, CORE_FAST_AGE_PORT); in bcm_sf2_sw_fast_age_port()
485 static int bcm_sf2_sw_br_join(struct dsa_switch *ds, int port, in bcm_sf2_sw_br_join() argument
492 p_ctl = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(port)); in bcm_sf2_sw_br_join()
502 reg |= 1 << port; in bcm_sf2_sw_br_join()
512 core_writel(priv, p_ctl, CORE_PORT_VLAN_CTL_PORT(port)); in bcm_sf2_sw_br_join()
513 priv->port_sts[port].vlan_ctl_mask = p_ctl; in bcm_sf2_sw_br_join()
518 static int bcm_sf2_sw_br_leave(struct dsa_switch *ds, int port, in bcm_sf2_sw_br_leave() argument
525 p_ctl = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(port)); in bcm_sf2_sw_br_leave()
533 reg &= ~(1 << port); in bcm_sf2_sw_br_leave()
535 priv->port_sts[port].vlan_ctl_mask = reg; in bcm_sf2_sw_br_leave()
538 if (port != i) in bcm_sf2_sw_br_leave()
542 core_writel(priv, p_ctl, CORE_PORT_VLAN_CTL_PORT(port)); in bcm_sf2_sw_br_leave()
543 priv->port_sts[port].vlan_ctl_mask = p_ctl; in bcm_sf2_sw_br_leave()
548 static int bcm_sf2_sw_br_set_stp_state(struct dsa_switch *ds, int port, in bcm_sf2_sw_br_set_stp_state() argument
556 reg = core_readl(priv, CORE_G_PCTL_PORT(port)); in bcm_sf2_sw_br_set_stp_state()
587 ret = bcm_sf2_sw_fast_age_port(ds, port); in bcm_sf2_sw_br_set_stp_state()
595 reg = core_readl(priv, CORE_G_PCTL_PORT(port)); in bcm_sf2_sw_br_set_stp_state()
598 core_writel(priv, reg, CORE_G_PCTL_PORT(port)); in bcm_sf2_sw_br_set_stp_state()
672 static int bcm_sf2_arl_op(struct bcm_sf2_priv *priv, int op, int port, in bcm_sf2_arl_op() argument
705 ent.port = port; in bcm_sf2_arl_op()
723 static int bcm_sf2_sw_fdb_prepare(struct dsa_switch *ds, int port, in bcm_sf2_sw_fdb_prepare() argument
731 static int bcm_sf2_sw_fdb_add(struct dsa_switch *ds, int port, in bcm_sf2_sw_fdb_add() argument
737 return bcm_sf2_arl_op(priv, 0, port, fdb->addr, fdb->vid, true); in bcm_sf2_sw_fdb_add()
740 static int bcm_sf2_sw_fdb_del(struct dsa_switch *ds, int port, in bcm_sf2_sw_fdb_del() argument
745 return bcm_sf2_arl_op(priv, 0, port, fdb->addr, fdb->vid, false); in bcm_sf2_sw_fdb_del()
778 static int bcm_sf2_sw_fdb_copy(struct net_device *dev, int port, in bcm_sf2_sw_fdb_copy() argument
786 if (port != ent->port) in bcm_sf2_sw_fdb_copy()
796 static int bcm_sf2_sw_fdb_dump(struct dsa_switch *ds, int port, in bcm_sf2_sw_fdb_dump() argument
801 struct net_device *dev = ds->ports[port]; in bcm_sf2_sw_fdb_dump()
816 ret = bcm_sf2_sw_fdb_copy(dev, port, &results[0], fdb, cb); in bcm_sf2_sw_fdb_dump()
821 ret = bcm_sf2_sw_fdb_copy(dev, port, &results[1], fdb, cb); in bcm_sf2_sw_fdb_dump()
896 struct device_node *port; in bcm_sf2_identify_ports() local
904 for_each_available_child_of_node(dn, port) { in bcm_sf2_identify_ports()
905 if (of_property_read_u32(port, "reg", &port_num)) in bcm_sf2_identify_ports()
913 mode = of_get_phy_mode(port); in bcm_sf2_identify_ports()
915 ret = of_property_read_string(port, "phy-mode", in bcm_sf2_identify_ports()
935 unsigned int port; in bcm_sf2_sw_setup() local
1004 for (port = 0; port < priv->hw_params.num_ports; port++) { in bcm_sf2_sw_setup()
1006 if ((1 << port) & ds->phys_port_mask) in bcm_sf2_sw_setup()
1007 bcm_sf2_port_setup(ds, port, NULL); in bcm_sf2_sw_setup()
1008 else if (dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_setup()
1009 bcm_sf2_imp_setup(ds, port); in bcm_sf2_sw_setup()
1011 bcm_sf2_port_disable(ds, port, NULL); in bcm_sf2_sw_setup()
1062 static u32 bcm_sf2_sw_get_phy_flags(struct dsa_switch *ds, int port) in bcm_sf2_sw_get_phy_flags() argument
1136 static void bcm_sf2_sw_adjust_link(struct dsa_switch *ds, int port, in bcm_sf2_sw_adjust_link() argument
1168 reg = reg_readl(priv, REG_RGMII_CNTRL_P(port)); in bcm_sf2_sw_adjust_link()
1170 reg_writel(priv, reg, REG_RGMII_CNTRL_P(port)); in bcm_sf2_sw_adjust_link()
1177 reg = reg_readl(priv, REG_RGMII_CNTRL_P(port)); in bcm_sf2_sw_adjust_link()
1192 reg_writel(priv, reg, REG_RGMII_CNTRL_P(port)); in bcm_sf2_sw_adjust_link()
1194 pr_info("Port %d configured for %s\n", port, str); in bcm_sf2_sw_adjust_link()
1213 core_writel(priv, reg, CORE_STS_OVERRIDE_GMIIP_PORT(port)); in bcm_sf2_sw_adjust_link()
1216 static void bcm_sf2_sw_fixed_link_update(struct dsa_switch *ds, int port, in bcm_sf2_sw_fixed_link_update() argument
1236 if (port == priv->moca_port) { in bcm_sf2_sw_fixed_link_update()
1237 status->link = priv->port_sts[port].link; in bcm_sf2_sw_fixed_link_update()
1244 netif_carrier_off(ds->ports[port]); in bcm_sf2_sw_fixed_link_update()
1248 status->duplex = !!(duplex & (1 << port)); in bcm_sf2_sw_fixed_link_update()
1251 reg = core_readl(priv, CORE_STS_OVERRIDE_GMIIP_PORT(port)); in bcm_sf2_sw_fixed_link_update()
1257 core_writel(priv, reg, CORE_STS_OVERRIDE_GMIIP_PORT(port)); in bcm_sf2_sw_fixed_link_update()
1259 if ((pause & (1 << port)) && in bcm_sf2_sw_fixed_link_update()
1260 (pause & (1 << (port + PAUSESTS_TX_PAUSE_SHIFT)))) { in bcm_sf2_sw_fixed_link_update()
1265 if (pause & (1 << port)) in bcm_sf2_sw_fixed_link_update()
1272 unsigned int port; in bcm_sf2_sw_suspend() local
1280 for (port = 0; port < DSA_MAX_PORTS; port++) { in bcm_sf2_sw_suspend()
1281 if ((1 << port) & ds->phys_port_mask || in bcm_sf2_sw_suspend()
1282 dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_suspend()
1283 bcm_sf2_port_disable(ds, port, NULL); in bcm_sf2_sw_suspend()
1292 unsigned int port; in bcm_sf2_sw_resume() local
1304 for (port = 0; port < DSA_MAX_PORTS; port++) { in bcm_sf2_sw_resume()
1305 if ((1 << port) & ds->phys_port_mask) in bcm_sf2_sw_resume()
1306 bcm_sf2_port_setup(ds, port, NULL); in bcm_sf2_sw_resume()
1307 else if (dsa_is_cpu_port(ds, port)) in bcm_sf2_sw_resume()
1308 bcm_sf2_imp_setup(ds, port); in bcm_sf2_sw_resume()
1314 static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port, in bcm_sf2_sw_get_wol() argument
1331 if (priv->wol_ports_mask & (1 << port)) in bcm_sf2_sw_get_wol()
1337 static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port, in bcm_sf2_sw_set_wol() argument
1350 priv->wol_ports_mask |= (1 << port); in bcm_sf2_sw_set_wol()
1352 priv->wol_ports_mask &= ~(1 << port); in bcm_sf2_sw_set_wol()