Lines Matching +full:speed +full:- +full:bins
4 * Copyright (C) 2011-2013 Jonas Gorski <jogo@openwrt.org>
228 #define B53_MAX_MTU_25 (1536 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN)
229 #define B53_MAX_MTU (9720 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN)
235 b53_write8(dev, B53_ARLIO_PAGE, dev->vta_regs[0], VTA_START_CMD | op); in b53_do_vlan_op()
240 b53_read8(dev, B53_ARLIO_PAGE, dev->vta_regs[0], &vta); in b53_do_vlan_op()
247 return -EIO; in b53_do_vlan_op()
256 if (vlan->members) { in b53_set_vlan_entry()
257 entry = ((vlan->untag & VA_UNTAG_MASK_25) << in b53_set_vlan_entry()
258 VA_UNTAG_S_25) | vlan->members; in b53_set_vlan_entry()
259 if (dev->core_rev >= 3) in b53_set_vlan_entry()
271 if (vlan->members) in b53_set_vlan_entry()
272 entry = ((vlan->untag & VA_UNTAG_MASK_65) << in b53_set_vlan_entry()
273 VA_UNTAG_S_65) | vlan->members | VA_VALID_65; in b53_set_vlan_entry()
279 b53_write16(dev, B53_ARLIO_PAGE, dev->vta_regs[1], vid); in b53_set_vlan_entry()
280 b53_write32(dev, B53_ARLIO_PAGE, dev->vta_regs[2], in b53_set_vlan_entry()
281 (vlan->untag << VTE_UNTAG_S) | vlan->members); in b53_set_vlan_entry()
286 dev_dbg(dev->ds->dev, "VID: %d, members: 0x%04x, untag: 0x%04x\n", in b53_set_vlan_entry()
287 vid, vlan->members, vlan->untag); in b53_set_vlan_entry()
300 if (dev->core_rev >= 3) in b53_get_vlan_entry()
301 vlan->valid = !!(entry & VA_VALID_25_R4); in b53_get_vlan_entry()
303 vlan->valid = !!(entry & VA_VALID_25); in b53_get_vlan_entry()
304 vlan->members = entry & VA_MEMBER_MASK; in b53_get_vlan_entry()
305 vlan->untag = (entry >> VA_UNTAG_S_25) & VA_UNTAG_MASK_25; in b53_get_vlan_entry()
314 vlan->valid = !!(entry & VA_VALID_65); in b53_get_vlan_entry()
315 vlan->members = entry & VA_MEMBER_MASK; in b53_get_vlan_entry()
316 vlan->untag = (entry >> VA_UNTAG_S_65) & VA_UNTAG_MASK_65; in b53_get_vlan_entry()
320 b53_write16(dev, B53_ARLIO_PAGE, dev->vta_regs[1], vid); in b53_get_vlan_entry()
322 b53_read32(dev, B53_ARLIO_PAGE, dev->vta_regs[2], &entry); in b53_get_vlan_entry()
323 vlan->members = entry & VTE_MEMBERS; in b53_get_vlan_entry()
324 vlan->untag = (entry >> VTE_UNTAG_S) & VTE_MEMBERS; in b53_get_vlan_entry()
325 vlan->valid = true; in b53_get_vlan_entry()
333 if (is5325(dev) || is5365(dev) || dev->chip_id == BCM5389_DEVICE_ID) in b53_set_eap_mode()
459 dev->vlan_enabled = enable; in b53_enable_vlan()
461 dev_dbg(dev->dev, "Port %d VLAN enabled: %d, filtering: %d\n", in b53_enable_vlan()
471 return -EINVAL; in b53_set_jumbo()
474 port_mask = dev->enabled_ports; in b53_set_jumbo()
480 b53_write32(dev, B53_JUMBO_PAGE, dev->jumbo_pm_reg, port_mask); in b53_set_jumbo()
481 return b53_write16(dev, B53_JUMBO_PAGE, dev->jumbo_size_reg, max_size); in b53_set_jumbo()
503 return -ETIMEDOUT; in b53_flush_arl()
526 struct b53_device *dev = ds->priv; in b53_imp_vlan_setup()
531 * on a per-port basis such that we only have Port i and IMP in in b53_imp_vlan_setup()
590 struct b53_device *dev = ds->priv; in b53_eee_enable_set()
603 struct b53_device *dev = ds->priv; in b53_setup_port()
622 struct b53_device *dev = ds->priv; in b53_enable_port()
630 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_enable_port()
632 if (dev->ops->irq_enable) in b53_enable_port()
633 ret = dev->ops->irq_enable(dev, port); in b53_enable_port()
647 pvlan |= dev->ports[port].vlan_ctl_mask; in b53_enable_port()
653 if (dev->ports[port].eee.eee_enabled) in b53_enable_port()
662 struct b53_device *dev = ds->priv; in b53_disable_port()
670 if (dev->ops->irq_disable) in b53_disable_port()
671 dev->ops->irq_disable(dev, port); in b53_disable_port()
677 struct b53_device *dev = ds->priv; in b53_brcm_hdr_setup()
678 bool tag_en = !(dev->tag_protocol == DSA_TAG_PROTO_NONE); in b53_brcm_hdr_setup()
737 * allow delivering frames to the per-port net_devices in b53_brcm_hdr_setup()
761 b53_brcm_hdr_setup(dev->ds, port); in b53_enable_cpu_port()
792 struct b53_device *dev = ds->priv; in b53_vlan_port_needs_forced_tagged()
794 return dev->tag_protocol == DSA_TAG_PROTO_NONE && dsa_is_cpu_port(ds, port); in b53_vlan_port_needs_forced_tagged()
799 struct b53_device *dev = ds->priv; in b53_vlan_port_may_join_untagged()
802 if (!dev->vlan_filtering) in b53_vlan_port_may_join_untagged()
810 return dp->bridge == NULL; in b53_vlan_port_may_join_untagged()
815 struct b53_device *dev = ds->priv; in b53_configure_vlan()
825 for (i = def_vid; i < dev->num_vlans; i++) in b53_configure_vlan()
831 b53_enable_vlan(dev, -1, dev->vlan_enabled, dev->vlan_filtering); in b53_configure_vlan()
839 v = &dev->vlans[def_vid]; in b53_configure_vlan()
852 if (dev->vlan_filtering) { in b53_configure_vlan()
853 /* Upon initial call we have not set-up any VLANs, but upon in b53_configure_vlan()
856 for (vid = def_vid + 1; vid < dev->num_vlans; vid++) { in b53_configure_vlan()
857 v = &dev->vlans[vid]; in b53_configure_vlan()
859 if (!v->members) in b53_configure_vlan()
870 dev->ports[i].pvid); in b53_configure_vlan()
880 int gpio = dev->reset_gpio; in b53_switch_reset_gpio()
885 /* Reset sequence: RESET low(50ms)->high(20ms) in b53_switch_reset_gpio()
893 dev->current_page = 0xff; in b53_switch_reset_gpio()
913 if (dev->chip_id == BCM58XX_DEVICE_ID || in b53_switch_reset()
914 dev->chip_id == BCM583XX_DEVICE_ID) { in b53_switch_reset()
925 } while (timeout-- > 0); in b53_switch_reset()
928 dev_err(dev->dev, in b53_switch_reset()
930 return -ETIMEDOUT; in b53_switch_reset()
944 dev_err(dev->dev, "Failed to enable switch!\n"); in b53_switch_reset()
945 return -EINVAL; in b53_switch_reset()
957 struct b53_device *priv = ds->priv; in b53_phy_read16()
961 if (priv->ops->phy_read16) in b53_phy_read16()
962 ret = priv->ops->phy_read16(priv, addr, reg, &value); in b53_phy_read16()
972 struct b53_device *priv = ds->priv; in b53_phy_write16()
974 if (priv->ops->phy_write16) in b53_phy_write16()
975 return priv->ops->phy_write16(priv, addr, reg, val); in b53_phy_write16()
983 memset(priv->vlans, 0, sizeof(*priv->vlans) * priv->num_vlans); in b53_reset_switch()
984 memset(priv->ports, 0, sizeof(*priv->ports) * priv->num_ports); in b53_reset_switch()
986 priv->serdes_lane = B53_INVALID_LANE; in b53_reset_switch()
996 b53_configure_vlan(priv->ds); in b53_apply_config()
1042 /* These ports typically do not have built-in PHYs */ in b53_get_phy_device()
1050 return mdiobus_get_phy(ds->user_mii_bus, port); in b53_get_phy_device()
1056 struct b53_device *dev = ds->priv; in b53_get_strings()
1077 struct b53_device *dev = ds->priv; in b53_get_ethtool_stats()
1087 mutex_lock(&dev->stats_mutex); in b53_get_ethtool_stats()
1092 if (s->size == 8) { in b53_get_ethtool_stats()
1093 b53_read64(dev, B53_MIB_PAGE(port), s->offset, &val); in b53_get_ethtool_stats()
1097 b53_read32(dev, B53_MIB_PAGE(port), s->offset, in b53_get_ethtool_stats()
1104 mutex_unlock(&dev->stats_mutex); in b53_get_ethtool_stats()
1122 struct b53_device *dev = ds->priv; in b53_get_sset_count()
1150 for (i = 0; i < dev->num_vlans; i++) { in b53_devlink_vlan_table_get()
1151 vl = &dev->vlans[i]; in b53_devlink_vlan_table_get()
1152 if (vl->members) in b53_devlink_vlan_table_get()
1162 struct b53_device *dev = ds->priv; in b53_setup_devlink_resources()
1165 devlink_resource_size_params_init(&size_params, dev->num_vlans, in b53_setup_devlink_resources()
1166 dev->num_vlans, in b53_setup_devlink_resources()
1169 err = dsa_devlink_resource_register(ds, "VLAN", dev->num_vlans, in b53_setup_devlink_resources()
1189 struct b53_device *dev = ds->priv; in b53_setup()
1198 ds->untag_bridge_pvid = dev->tag_protocol == DSA_TAG_PROTO_NONE; in b53_setup()
1203 ds->untag_vlan_aware_bridge_pvid = true; in b53_setup()
1207 dev_err(ds->dev, "failed to reset switch\n"); in b53_setup()
1213 vl = &dev->vlans[pvid]; in b53_setup()
1215 vl->members |= BIT(port); in b53_setup()
1217 vl->untag |= BIT(port); in b53_setup()
1224 dev_err(ds->dev, "failed to apply configuration\n"); in b53_setup()
1231 for (port = 0; port < dev->num_ports; port++) { in b53_setup()
1251 if (port == dev->imp_port) { in b53_force_link()
1269 int speed, int duplex, in b53_force_port_config() argument
1275 if (port == dev->imp_port) { in b53_force_port_config()
1290 switch (speed) { in b53_force_port_config()
1304 dev_err(dev->dev, "unknown speed: %d\n", speed); in b53_force_port_config()
1319 struct b53_device *dev = ds->priv; in b53_adjust_63xx_rgmii()
1322 if (port == dev->imp_port) in b53_adjust_63xx_rgmii()
1347 if (port != dev->imp_port) { in b53_adjust_63xx_rgmii()
1356 dev_dbg(ds->dev, "Configured port %d for %s\n", port, in b53_adjust_63xx_rgmii()
1363 struct b53_device *dev = ds->priv; in b53_adjust_531x5_rgmii()
1366 if (port == dev->imp_port) in b53_adjust_531x5_rgmii()
1399 dev_info(ds->dev, "Configured port %d for %s\n", port, in b53_adjust_531x5_rgmii()
1405 struct b53_device *dev = ds->priv; in b53_adjust_5325_mii()
1419 dev_err(ds->dev, in b53_adjust_5325_mii()
1428 struct b53_device *dev = ds->priv; in b53_port_event()
1441 struct b53_device *dev = ds->priv; in b53_phylink_get_caps()
1444 __set_bit(PHY_INTERFACE_MODE_GMII, config->supported_interfaces); in b53_phylink_get_caps()
1457 __set_bit(PHY_INTERFACE_MODE_MII, config->supported_interfaces); in b53_phylink_get_caps()
1458 __set_bit(PHY_INTERFACE_MODE_REVMII, config->supported_interfaces); in b53_phylink_get_caps()
1460 config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | in b53_phylink_get_caps()
1470 config->mac_capabilities |= MAC_1000; in b53_phylink_get_caps()
1473 if (dev->ops->phylink_get_caps) in b53_phylink_get_caps()
1474 dev->ops->phylink_get_caps(dev, port, config); in b53_phylink_get_caps()
1481 struct b53_device *dev = dp->ds->priv; in b53_phylink_mac_select_pcs()
1483 if (!dev->ops->phylink_mac_select_pcs) in b53_phylink_mac_select_pcs()
1486 return dev->ops->phylink_mac_select_pcs(dev, dp->index, interface); in b53_phylink_mac_select_pcs()
1494 phy_interface_t interface = state->interface; in b53_phylink_mac_config()
1495 struct dsa_switch *ds = dp->ds; in b53_phylink_mac_config()
1496 struct b53_device *dev = ds->priv; in b53_phylink_mac_config()
1497 int port = dp->index; in b53_phylink_mac_config()
1517 struct b53_device *dev = dp->ds->priv; in b53_phylink_mac_link_down()
1518 int port = dp->index; in b53_phylink_mac_link_down()
1529 dev->ops->serdes_link_set) in b53_phylink_mac_link_down()
1530 dev->ops->serdes_link_set(dev, port, mode, interface, false); in b53_phylink_mac_link_down()
1537 int speed, int duplex, in b53_phylink_mac_link_up() argument
1541 struct dsa_switch *ds = dp->ds; in b53_phylink_mac_link_up()
1542 struct b53_device *dev = ds->priv; in b53_phylink_mac_link_up()
1543 struct ethtool_keee *p = &dev->ports[dp->index].eee; in b53_phylink_mac_link_up()
1544 int port = dp->index; in b53_phylink_mac_link_up()
1547 /* Re-negotiate EEE if it was enabled already */ in b53_phylink_mac_link_up()
1548 p->eee_enabled = b53_eee_init(ds, port, phydev); in b53_phylink_mac_link_up()
1557 b53_force_port_config(dev, port, speed, duplex, in b53_phylink_mac_link_up()
1564 dev->ops->serdes_link_set) in b53_phylink_mac_link_up()
1565 dev->ops->serdes_link_set(dev, port, mode, interface, true); in b53_phylink_mac_link_up()
1571 struct b53_device *dev = ds->priv; in b53_vlan_filtering()
1573 if (dev->vlan_filtering != vlan_filtering) { in b53_vlan_filtering()
1574 dev->vlan_filtering = vlan_filtering; in b53_vlan_filtering()
1585 struct b53_device *dev = ds->priv; in b53_vlan_prepare()
1587 if ((is5325(dev) || is5365(dev)) && vlan->vid == 0) in b53_vlan_prepare()
1588 return -EOPNOTSUPP; in b53_vlan_prepare()
1594 if (dev->chip_id == BCM7278_DEVICE_ID && port == 7 && in b53_vlan_prepare()
1595 !(vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED)) in b53_vlan_prepare()
1596 return -EINVAL; in b53_vlan_prepare()
1598 if (vlan->vid >= dev->num_vlans) in b53_vlan_prepare()
1599 return -ERANGE; in b53_vlan_prepare()
1601 b53_enable_vlan(dev, port, true, dev->vlan_filtering); in b53_vlan_prepare()
1610 struct b53_device *dev = ds->priv; in b53_vlan_add()
1611 bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; in b53_vlan_add()
1612 bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID; in b53_vlan_add()
1621 if (vlan->vid == 0) in b53_vlan_add()
1624 old_pvid = dev->ports[port].pvid; in b53_vlan_add()
1626 new_pvid = vlan->vid; in b53_vlan_add()
1627 else if (!pvid && vlan->vid == old_pvid) in b53_vlan_add()
1631 dev->ports[port].pvid = new_pvid; in b53_vlan_add()
1633 vl = &dev->vlans[vlan->vid]; in b53_vlan_add()
1638 vl->members |= BIT(port); in b53_vlan_add()
1640 vl->untag |= BIT(port); in b53_vlan_add()
1642 vl->untag &= ~BIT(port); in b53_vlan_add()
1644 if (!dev->vlan_filtering) in b53_vlan_add()
1647 b53_set_vlan_entry(dev, vlan->vid, vl); in b53_vlan_add()
1648 b53_fast_age_vlan(dev, vlan->vid); in b53_vlan_add()
1663 struct b53_device *dev = ds->priv; in b53_vlan_del()
1664 bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; in b53_vlan_del()
1668 if (vlan->vid == 0) in b53_vlan_del()
1671 pvid = dev->ports[port].pvid; in b53_vlan_del()
1673 vl = &dev->vlans[vlan->vid]; in b53_vlan_del()
1675 vl->members &= ~BIT(port); in b53_vlan_del()
1677 if (pvid == vlan->vid) in b53_vlan_del()
1679 dev->ports[port].pvid = pvid; in b53_vlan_del()
1682 vl->untag &= ~(BIT(port)); in b53_vlan_del()
1684 if (!dev->vlan_filtering) in b53_vlan_del()
1687 b53_set_vlan_entry(dev, vlan->vid, vl); in b53_vlan_del()
1688 b53_fast_age_vlan(dev, vlan->vid); in b53_vlan_del()
1697 /* Address Resolution Logic routines. Caller must hold &dev->arl_mutex. */
1709 } while (timeout--); in b53_arl_op_wait()
1711 dev_warn(dev->dev, "timeout waiting for ARL to finish: 0x%02x\n", reg); in b53_arl_op_wait()
1713 return -ETIMEDOUT; in b53_arl_op_wait()
1721 return -EINVAL; in b53_arl_rw_op()
1729 if (dev->vlan_enabled) in b53_arl_rw_op()
1749 bitmap_zero(free_bins, dev->num_arl_bins); in b53_arl_read()
1751 /* Read the bins */ in b53_arl_read()
1752 for (i = 0; i < dev->num_arl_bins; i++) { in b53_arl_read()
1768 if (dev->vlan_enabled && in b53_arl_read()
1775 *idx = find_first_bit(free_bins, dev->num_arl_bins); in b53_arl_read()
1776 return *idx >= dev->num_arl_bins ? -ENOSPC : -ENOENT; in b53_arl_read()
1788 /* Convert the array into a 64-bit MAC */ in b53_arl_op()
1807 case -ETIMEDOUT: in b53_arl_op()
1809 case -ENOSPC: in b53_arl_op()
1810 dev_dbg(dev->dev, "{%pM,%.4d} no space left in ARL\n", in b53_arl_op()
1813 case -ENOENT: in b53_arl_op()
1815 dev_dbg(dev->dev, "{%pM,%.4d} not found, using idx: %d\n", in b53_arl_op()
1820 dev_dbg(dev->dev, "{%pM,%.4d} found, using idx: %d\n", in b53_arl_op()
1858 struct b53_device *priv = ds->priv; in b53_fdb_add()
1865 return -EOPNOTSUPP; in b53_fdb_add()
1867 mutex_lock(&priv->arl_mutex); in b53_fdb_add()
1869 mutex_unlock(&priv->arl_mutex); in b53_fdb_add()
1879 struct b53_device *priv = ds->priv; in b53_fdb_del()
1882 mutex_lock(&priv->arl_mutex); in b53_fdb_del()
1884 mutex_unlock(&priv->arl_mutex); in b53_fdb_del()
1904 } while (timeout--); in b53_arl_search_wait()
1906 return -ETIMEDOUT; in b53_arl_search_wait()
1925 if (!ent->is_valid) in b53_fdb_copy()
1928 if (port != ent->port) in b53_fdb_copy()
1931 return cb(ent->mac, ent->vid, ent->is_static, data); in b53_fdb_copy()
1937 struct b53_device *priv = ds->priv; in b53_fdb_dump()
1943 mutex_lock(&priv->arl_mutex); in b53_fdb_dump()
1959 if (priv->num_arl_bins > 2) { in b53_fdb_dump()
1971 mutex_unlock(&priv->arl_mutex); in b53_fdb_dump()
1981 struct b53_device *priv = ds->priv; in b53_mdb_add()
1988 return -EOPNOTSUPP; in b53_mdb_add()
1990 mutex_lock(&priv->arl_mutex); in b53_mdb_add()
1991 ret = b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, true); in b53_mdb_add()
1992 mutex_unlock(&priv->arl_mutex); in b53_mdb_add()
2002 struct b53_device *priv = ds->priv; in b53_mdb_del()
2005 mutex_lock(&priv->arl_mutex); in b53_mdb_del()
2006 ret = b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, false); in b53_mdb_del()
2007 mutex_unlock(&priv->arl_mutex); in b53_mdb_del()
2009 dev_err(ds->dev, "failed to delete MDB entry\n"); in b53_mdb_del()
2018 struct b53_device *dev = ds->priv; in b53_br_join()
2020 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_br_join()
2027 if (dev->chip_id == BCM7278_DEVICE_ID && port == 7) in b53_br_join()
2028 return -EINVAL; in b53_br_join()
2031 vl = &dev->vlans[pvid]; in b53_br_join()
2033 if (dev->vlan_filtering) { in b53_br_join()
2048 vl->members &= ~BIT(port); in b53_br_join()
2049 if (vl->members == BIT(cpu_port)) in b53_br_join()
2050 vl->members &= ~BIT(cpu_port); in b53_br_join()
2051 vl->untag = vl->members; in b53_br_join()
2067 dev->ports[i].vlan_ctl_mask = reg; in b53_br_join()
2079 dev->ports[port].vlan_ctl_mask = pvlan; in b53_br_join()
2087 struct b53_device *dev = ds->priv; in b53_br_leave()
2089 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_br_leave()
2103 dev->ports[port].vlan_ctl_mask = reg; in b53_br_leave()
2114 dev->ports[port].vlan_ctl_mask = pvlan; in b53_br_leave()
2117 vl = &dev->vlans[pvid]; in b53_br_leave()
2119 if (dev->vlan_filtering) { in b53_br_leave()
2130 vl->members |= BIT(port) | BIT(cpu_port); in b53_br_leave()
2131 vl->untag |= BIT(port) | BIT(cpu_port); in b53_br_leave()
2139 struct b53_device *dev = ds->priv; in b53_br_set_stp_state()
2160 dev_err(ds->dev, "invalid STP state: %d\n", state); in b53_br_set_stp_state()
2173 struct b53_device *dev = ds->priv; in b53_br_fast_age()
2176 dev_err(ds->dev, "fast ageing failed\n"); in b53_br_fast_age()
2185 return -EINVAL; in b53_br_flags_pre()
2196 b53_port_set_ucast_flood(ds->priv, port, in b53_br_flags()
2199 b53_port_set_mcast_flood(ds->priv, port, in b53_br_flags()
2202 b53_port_set_learning(ds->priv, port, in b53_br_flags()
2230 dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n", in b53_can_enable_brcm_tags()
2238 dev_warn(ds->dev, in b53_can_enable_brcm_tags()
2253 struct b53_device *dev = ds->priv; in b53_get_tag_protocol()
2256 dev->tag_protocol = DSA_TAG_PROTO_NONE; in b53_get_tag_protocol()
2262 dev->tag_protocol = DSA_TAG_PROTO_BRCM_LEGACY; in b53_get_tag_protocol()
2269 if (dev->chip_id == BCM58XX_DEVICE_ID && port == B53_CPU_PORT) { in b53_get_tag_protocol()
2270 dev->tag_protocol = DSA_TAG_PROTO_BRCM_PREPEND; in b53_get_tag_protocol()
2274 dev->tag_protocol = DSA_TAG_PROTO_BRCM; in b53_get_tag_protocol()
2276 return dev->tag_protocol; in b53_get_tag_protocol()
2284 struct b53_device *dev = ds->priv; in b53_mirror_add()
2298 reg |= mirror->to_local_port; in b53_mirror_add()
2309 struct b53_device *dev = ds->priv; in b53_mirror_del()
2313 if (mirror->ingress) in b53_mirror_del()
2328 if (mirror->ingress) in b53_mirror_del()
2339 reg &= ~mirror->to_local_port; in b53_mirror_del()
2363 struct b53_device *dev = ds->priv; in b53_support_eee()
2371 struct b53_device *dev = ds->priv; in b53_set_mac_eee()
2372 struct ethtool_keee *p = &dev->ports[port].eee; in b53_set_mac_eee()
2374 p->eee_enabled = e->eee_enabled; in b53_set_mac_eee()
2375 b53_eee_enable_set(ds, port, e->eee_enabled); in b53_set_mac_eee()
2383 struct b53_device *dev = ds->priv; in b53_change_mtu()
2401 struct b53_device *dev = ds->priv; in b53_get_max_mtu()
2780 if (chip->chip_id == dev->chip_id) { in b53_switch_init()
2781 if (!dev->enabled_ports) in b53_switch_init()
2782 dev->enabled_ports = chip->enabled_ports; in b53_switch_init()
2783 dev->name = chip->dev_name; in b53_switch_init()
2784 dev->duplex_reg = chip->duplex_reg; in b53_switch_init()
2785 dev->vta_regs[0] = chip->vta_regs[0]; in b53_switch_init()
2786 dev->vta_regs[1] = chip->vta_regs[1]; in b53_switch_init()
2787 dev->vta_regs[2] = chip->vta_regs[2]; in b53_switch_init()
2788 dev->jumbo_pm_reg = chip->jumbo_pm_reg; in b53_switch_init()
2789 dev->imp_port = chip->imp_port; in b53_switch_init()
2790 dev->num_vlans = chip->vlans; in b53_switch_init()
2791 dev->num_arl_bins = chip->arl_bins; in b53_switch_init()
2792 dev->num_arl_buckets = chip->arl_buckets; in b53_switch_init()
2809 /* BCM5325F - do not use port 4 */ in b53_switch_init()
2810 dev->enabled_ports &= ~BIT(4); in b53_switch_init()
2816 return -EINVAL; in b53_switch_init()
2823 dev->num_ports = fls(dev->enabled_ports); in b53_switch_init()
2825 dev->ds->num_ports = min_t(unsigned int, dev->num_ports, DSA_MAX_PORTS); in b53_switch_init()
2827 /* Include non standard CPU port built-in PHYs to be probed */ in b53_switch_init()
2829 for (i = 0; i < dev->num_ports; i++) { in b53_switch_init()
2830 if (!(dev->ds->phys_mii_mask & BIT(i)) && in b53_switch_init()
2831 !b53_possible_cpu_port(dev->ds, i)) in b53_switch_init()
2832 dev->ds->phys_mii_mask |= BIT(i); in b53_switch_init()
2836 dev->ports = devm_kcalloc(dev->dev, in b53_switch_init()
2837 dev->num_ports, sizeof(struct b53_port), in b53_switch_init()
2839 if (!dev->ports) in b53_switch_init()
2840 return -ENOMEM; in b53_switch_init()
2842 dev->vlans = devm_kcalloc(dev->dev, in b53_switch_init()
2843 dev->num_vlans, sizeof(struct b53_vlan), in b53_switch_init()
2845 if (!dev->vlans) in b53_switch_init()
2846 return -ENOMEM; in b53_switch_init()
2848 dev->reset_gpio = b53_switch_get_reset_gpio(dev); in b53_switch_init()
2849 if (dev->reset_gpio >= 0) { in b53_switch_init()
2850 ret = devm_gpio_request_one(dev->dev, dev->reset_gpio, in b53_switch_init()
2870 ds->dev = base; in b53_switch_alloc()
2876 ds->priv = dev; in b53_switch_alloc()
2877 dev->dev = base; in b53_switch_alloc()
2879 dev->ds = ds; in b53_switch_alloc()
2880 dev->priv = priv; in b53_switch_alloc()
2881 dev->ops = ops; in b53_switch_alloc()
2882 ds->ops = &b53_switch_ops; in b53_switch_alloc()
2883 ds->phylink_mac_ops = &b53_phylink_mac_ops; in b53_switch_alloc()
2884 dev->vlan_enabled = true; in b53_switch_alloc()
2885 dev->vlan_filtering = false; in b53_switch_alloc()
2891 ds->vlan_filtering_is_global = true; in b53_switch_alloc()
2893 mutex_init(&dev->reg_mutex); in b53_switch_alloc()
2894 mutex_init(&dev->stats_mutex); in b53_switch_alloc()
2895 mutex_init(&dev->arl_mutex); in b53_switch_alloc()
2925 dev->chip_id = BCM5325_DEVICE_ID; in b53_switch_detect()
2927 dev->chip_id = BCM5365_DEVICE_ID; in b53_switch_detect()
2933 dev->chip_id = id8; in b53_switch_detect()
2951 dev->chip_id = id32; in b53_switch_detect()
2954 dev_err(dev->dev, in b53_switch_detect()
2957 return -ENODEV; in b53_switch_detect()
2961 if (dev->chip_id == BCM5325_DEVICE_ID) in b53_switch_detect()
2963 &dev->core_rev); in b53_switch_detect()
2966 &dev->core_rev); in b53_switch_detect()
2974 if (dev->pdata) { in b53_switch_register()
2975 dev->chip_id = dev->pdata->chip_id; in b53_switch_register()
2976 dev->enabled_ports = dev->pdata->enabled_ports; in b53_switch_register()
2979 if (!dev->chip_id && b53_switch_detect(dev)) in b53_switch_register()
2980 return -EINVAL; in b53_switch_register()
2986 dev_info(dev->dev, "found switch: %s, rev %i\n", in b53_switch_register()
2987 dev->name, dev->core_rev); in b53_switch_register()
2989 return dsa_register_switch(dev->ds); in b53_switch_register()