Lines Matching refs:port
16 * The hardware does not support VLAN filter on the port, but on the
20 * rule and the CPU port is also added to all bridges. This makes it possible
23 * each switch port which is used when the port is used without an
168 #define GSWIP_PCE_PMAP1 0x453 /* Monitoring port map */
169 #define GSWIP_PCE_PMAP2 0x454 /* Default Multicast port map */
170 #define GSWIP_PCE_PMAP3 0x455 /* Default Unknown Unicast port map */
412 int port)
414 /* There's no MII_CFG register for the CPU port */
415 if (!dsa_is_cpu_port(priv->ds, port))
416 gswip_mii_mask(priv, clear, set, GSWIP_MII_CFGp(port));
420 int port)
422 switch (port) {
605 /* Add the LAN port into a bridge with the CPU port by
610 static int gswip_add_single_port_br(struct gswip_priv *priv, int port, bool add)
618 if (port >= max_ports) {
619 dev_err(priv->dev, "single port for %i supported\n", port);
623 vlan_active.index = port + 1;
626 vlan_active.val[0] = port + 1 /* fid */;
637 vlan_mapping.index = port + 1;
640 vlan_mapping.val[1] = BIT(port) | BIT(cpu_port);
651 static int gswip_port_enable(struct dsa_switch *ds, int port,
657 if (!dsa_is_user_port(ds, port))
660 if (!dsa_is_cpu_port(ds, port)) {
661 err = gswip_add_single_port_br(priv, port, true);
666 /* RMON Counter Enable for port */
667 gswip_switch_w(priv, GSWIP_BM_PCFG_CNTEN, GSWIP_BM_PCFGp(port));
669 /* enable port fetch/store dma & VLAN Modification */
672 GSWIP_FDMA_PCTRLp(port));
674 GSWIP_SDMA_PCTRLp(port));
676 if (!dsa_is_cpu_port(ds, port)) {
683 GSWIP_MDIO_PHYp(port));
689 static void gswip_port_disable(struct dsa_switch *ds, int port)
693 if (!dsa_is_user_port(ds, port))
697 GSWIP_FDMA_PCTRLp(port));
699 GSWIP_SDMA_PCTRLp(port));
739 static int gswip_port_vlan_filtering(struct dsa_switch *ds, int port,
747 struct net_device *bridge = dsa_to_port(ds, port)->bridge_dev;
752 if (!!(priv->port_vlan_filter & BIT(port)) != vlan_filtering)
759 /* Use port based VLAN tag */
764 GSWIP_PCE_VCTRL(port));
766 GSWIP_PCE_PCTRL_0p(port));
768 /* Use port based VLAN tag */
773 GSWIP_PCE_VCTRL(port));
775 GSWIP_PCE_PCTRL_0p(port));
792 /* disable port fetch/store dma on all ports */
814 /* Default unknown Broadcast/Multicast/Unicast port maps */
826 * to the switch port being completely dead (RX and TX are both not
828 * Also with various other PHY / port combinations (PHY11G GPHY, PHY22F
846 /* enable special tag insertion on cpu port */
879 int port,
945 struct net_device *bridge, int port)
990 vlan_mapping.val[1] |= BIT(port);
1000 gswip_switch_w(priv, 0, GSWIP_PCE_DEFPVID(port));
1005 struct net_device *bridge, int port,
1060 vlan_mapping.val[1] |= BIT(port);
1062 vlan_mapping.val[2] &= ~BIT(port);
1064 vlan_mapping.val[2] |= BIT(port);
1075 gswip_switch_w(priv, idx, GSWIP_PCE_DEFPVID(port));
1081 struct net_device *bridge, int port,
1113 vlan_mapping.val[1] &= ~BIT(port);
1114 vlan_mapping.val[2] &= ~BIT(port);
1133 gswip_switch_w(priv, 0, GSWIP_PCE_DEFPVID(port));
1138 static int gswip_port_bridge_join(struct dsa_switch *ds, int port,
1148 err = gswip_vlan_add_unaware(priv, bridge, port);
1151 priv->port_vlan_filter &= ~BIT(port);
1153 priv->port_vlan_filter |= BIT(port);
1155 return gswip_add_single_port_br(priv, port, false);
1158 static void gswip_port_bridge_leave(struct dsa_switch *ds, int port,
1163 gswip_add_single_port_br(priv, port, true);
1169 gswip_vlan_remove(priv, bridge, port, 0, true, false);
1172 static int gswip_port_vlan_prepare(struct dsa_switch *ds, int port,
1176 struct net_device *bridge = dsa_to_port(ds, port)->bridge_dev;
1183 if (!dsa_is_cpu_port(ds, port) && !bridge)
1220 static void gswip_port_vlan_add(struct dsa_switch *ds, int port,
1224 struct net_device *bridge = dsa_to_port(ds, port)->bridge_dev;
1229 /* We have to receive all packets on the CPU port and should not
1234 if (dsa_is_cpu_port(ds, port))
1238 gswip_vlan_add_aware(priv, bridge, port, vid, untagged, pvid);
1241 static int gswip_port_vlan_del(struct dsa_switch *ds, int port,
1245 struct net_device *bridge = dsa_to_port(ds, port)->bridge_dev;
1250 /* We have to receive all packets on the CPU port and should not
1255 if (dsa_is_cpu_port(ds, port))
1259 err = gswip_vlan_remove(priv, bridge, port, vid, pvid, true);
1267 static void gswip_port_fast_age(struct dsa_switch *ds, int port)
1291 if (((mac_bridge.val[0] & GENMASK(7, 4)) >> 4) != port)
1304 static void gswip_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
1312 GSWIP_SDMA_PCTRLp(port));
1330 GSWIP_SDMA_PCTRLp(port));
1332 GSWIP_PCE_PCTRL_0p(port));
1335 static int gswip_port_fdb(struct dsa_switch *ds, int port,
1339 struct net_device *bridge = dsa_to_port(ds, port)->bridge_dev;
1367 mac_bridge.val[0] = add ? BIT(port) : 0; /* port map */
1378 static int gswip_port_fdb_add(struct dsa_switch *ds, int port,
1381 return gswip_port_fdb(ds, port, addr, vid, true);
1384 static int gswip_port_fdb_del(struct dsa_switch *ds, int port,
1387 return gswip_port_fdb(ds, port, addr, vid, false);
1390 static int gswip_port_fdb_dump(struct dsa_switch *ds, int port,
1420 if (mac_bridge.val[0] & BIT(port)) {
1426 if (((mac_bridge.val[0] & GENMASK(7, 4)) >> 4) == port) {
1436 static void gswip_phylink_validate(struct dsa_switch *ds, int port,
1442 switch (port) {
1464 dev_err(ds->dev, "Unsupported port: %i\n", port);
1497 dev_err(ds->dev, "Unsupported interface '%s' for port %d\n",
1498 phy_modes(state->interface), port);
1502 static void gswip_port_set_link(struct gswip_priv *priv, int port, bool link)
1512 GSWIP_MDIO_PHYp(port));
1515 static void gswip_port_set_speed(struct gswip_priv *priv, int port, int speed,
1553 GSWIP_MDIO_PHYp(port));
1554 gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_RATE_MASK, mii_cfg, port);
1556 GSWIP_MAC_CTRL_0p(port));
1559 static void gswip_port_set_duplex(struct gswip_priv *priv, int port, int duplex)
1572 GSWIP_MAC_CTRL_0p(port));
1574 GSWIP_MDIO_PHYp(port));
1577 static void gswip_port_set_pause(struct gswip_priv *priv, int port,
1601 mac_ctrl_0, GSWIP_MAC_CTRL_0p(port));
1605 mdio_phy, GSWIP_MDIO_PHYp(port));
1608 static void gswip_phylink_mac_config(struct dsa_switch *ds, int port,
1643 miicfg, port);
1648 GSWIP_MII_PCDU_RXDLY_MASK, 0, port);
1651 gswip_mii_mask_pcdu(priv, GSWIP_MII_PCDU_RXDLY_MASK, 0, port);
1654 gswip_mii_mask_pcdu(priv, GSWIP_MII_PCDU_TXDLY_MASK, 0, port);
1661 static void gswip_phylink_mac_link_down(struct dsa_switch *ds, int port,
1667 gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, port);
1669 if (!dsa_is_cpu_port(ds, port))
1670 gswip_port_set_link(priv, port, false);
1673 static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port,
1682 if (!dsa_is_cpu_port(ds, port)) {
1683 gswip_port_set_link(priv, port, true);
1684 gswip_port_set_speed(priv, port, speed, interface);
1685 gswip_port_set_duplex(priv, port, duplex);
1686 gswip_port_set_pause(priv, port, tx_pause, rx_pause);
1689 gswip_mii_mask_cfg(priv, 0, GSWIP_MII_CFG_EN, port);
1692 static void gswip_get_strings(struct dsa_switch *ds, int port, u32 stringset,
1731 static void gswip_get_ethtool_stats(struct dsa_switch *ds, int port,
1742 data[i] = gswip_bcm_ram_entry_read(priv, port,
1745 high = gswip_bcm_ram_entry_read(priv, port,
1752 static int gswip_get_sset_count(struct dsa_switch *ds, int port, int sset)
2071 dev_err(dev, "wrong CPU port defined, HW only supports port: %i",