Lines Matching +full:speed +full:- +full:bins

4  * Copyright (C) 2011-2013 Jonas Gorski <jogo@openwrt.org>
231 b53_write8(dev, B53_ARLIO_PAGE, dev->vta_regs[0], VTA_START_CMD | op); in b53_do_vlan_op()
236 b53_read8(dev, B53_ARLIO_PAGE, dev->vta_regs[0], &vta); in b53_do_vlan_op()
243 return -EIO; in b53_do_vlan_op()
252 if (vlan->members) { in b53_set_vlan_entry()
253 entry = ((vlan->untag & VA_UNTAG_MASK_25) << in b53_set_vlan_entry()
254 VA_UNTAG_S_25) | vlan->members; in b53_set_vlan_entry()
255 if (dev->core_rev >= 3) in b53_set_vlan_entry()
267 if (vlan->members) in b53_set_vlan_entry()
268 entry = ((vlan->untag & VA_UNTAG_MASK_65) << in b53_set_vlan_entry()
269 VA_UNTAG_S_65) | vlan->members | VA_VALID_65; in b53_set_vlan_entry()
275 b53_write16(dev, B53_ARLIO_PAGE, dev->vta_regs[1], vid); in b53_set_vlan_entry()
276 b53_write32(dev, B53_ARLIO_PAGE, dev->vta_regs[2], in b53_set_vlan_entry()
277 (vlan->untag << VTE_UNTAG_S) | vlan->members); in b53_set_vlan_entry()
282 dev_dbg(dev->ds->dev, "VID: %d, members: 0x%04x, untag: 0x%04x\n", in b53_set_vlan_entry()
283 vid, vlan->members, vlan->untag); in b53_set_vlan_entry()
296 if (dev->core_rev >= 3) in b53_get_vlan_entry()
297 vlan->valid = !!(entry & VA_VALID_25_R4); in b53_get_vlan_entry()
299 vlan->valid = !!(entry & VA_VALID_25); in b53_get_vlan_entry()
300 vlan->members = entry & VA_MEMBER_MASK; in b53_get_vlan_entry()
301 vlan->untag = (entry >> VA_UNTAG_S_25) & VA_UNTAG_MASK_25; in b53_get_vlan_entry()
310 vlan->valid = !!(entry & VA_VALID_65); in b53_get_vlan_entry()
311 vlan->members = entry & VA_MEMBER_MASK; in b53_get_vlan_entry()
312 vlan->untag = (entry >> VA_UNTAG_S_65) & VA_UNTAG_MASK_65; in b53_get_vlan_entry()
316 b53_write16(dev, B53_ARLIO_PAGE, dev->vta_regs[1], vid); in b53_get_vlan_entry()
318 b53_read32(dev, B53_ARLIO_PAGE, dev->vta_regs[2], &entry); in b53_get_vlan_entry()
319 vlan->members = entry & VTE_MEMBERS; in b53_get_vlan_entry()
320 vlan->untag = (entry >> VTE_UNTAG_S) & VTE_MEMBERS; in b53_get_vlan_entry()
321 vlan->valid = true; in b53_get_vlan_entry()
433 dev->vlan_enabled = enable; in b53_enable_vlan()
435 dev_dbg(dev->dev, "Port %d VLAN enabled: %d, filtering: %d\n", in b53_enable_vlan()
445 return -EINVAL; in b53_set_jumbo()
448 port_mask = dev->enabled_ports; in b53_set_jumbo()
454 b53_write32(dev, B53_JUMBO_PAGE, dev->jumbo_pm_reg, port_mask); in b53_set_jumbo()
455 return b53_write16(dev, B53_JUMBO_PAGE, dev->jumbo_size_reg, max_size); in b53_set_jumbo()
477 return -ETIMEDOUT; in b53_flush_arl()
500 struct b53_device *dev = ds->priv; in b53_imp_vlan_setup()
505 * on a per-port basis such that we only have Port i and IMP in in b53_imp_vlan_setup()
564 struct b53_device *dev = ds->priv; in b53_enable_port()
572 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_enable_port()
578 if (dev->ops->irq_enable) in b53_enable_port()
579 ret = dev->ops->irq_enable(dev, port); in b53_enable_port()
593 pvlan |= dev->ports[port].vlan_ctl_mask; in b53_enable_port()
599 if (dev->ports[port].eee.eee_enabled) in b53_enable_port()
608 struct b53_device *dev = ds->priv; in b53_disable_port()
616 if (dev->ops->irq_disable) in b53_disable_port()
617 dev->ops->irq_disable(dev, port); in b53_disable_port()
623 struct b53_device *dev = ds->priv; in b53_brcm_hdr_setup()
624 bool tag_en = !(dev->tag_protocol == DSA_TAG_PROTO_NONE); in b53_brcm_hdr_setup()
683 * allow delivering frames to the per-port net_devices in b53_brcm_hdr_setup()
707 b53_brcm_hdr_setup(dev->ds, port); in b53_enable_cpu_port()
733 struct b53_device *dev = ds->priv; in b53_vlan_port_needs_forced_tagged()
735 return dev->tag_protocol == DSA_TAG_PROTO_NONE && dsa_is_cpu_port(ds, port); in b53_vlan_port_needs_forced_tagged()
740 struct b53_device *dev = ds->priv; in b53_configure_vlan()
750 for (i = def_vid; i < dev->num_vlans; i++) in b53_configure_vlan()
756 b53_enable_vlan(dev, -1, dev->vlan_enabled, ds->vlan_filtering); in b53_configure_vlan()
765 v = &dev->vlans[def_vid]; in b53_configure_vlan()
766 v->members |= BIT(i); in b53_configure_vlan()
768 v->untag = v->members; in b53_configure_vlan()
773 /* Upon initial call we have not set-up any VLANs, but upon in b53_configure_vlan()
776 for (vid = def_vid; vid < dev->num_vlans; vid++) { in b53_configure_vlan()
777 v = &dev->vlans[vid]; in b53_configure_vlan()
779 if (!v->members) in b53_configure_vlan()
792 int gpio = dev->reset_gpio; in b53_switch_reset_gpio()
797 /* Reset sequence: RESET low(50ms)->high(20ms) in b53_switch_reset_gpio()
805 dev->current_page = 0xff; in b53_switch_reset_gpio()
825 if (dev->chip_id == BCM58XX_DEVICE_ID || in b53_switch_reset()
826 dev->chip_id == BCM583XX_DEVICE_ID) { in b53_switch_reset()
837 } while (timeout-- > 0); in b53_switch_reset()
840 dev_err(dev->dev, in b53_switch_reset()
842 return -ETIMEDOUT; in b53_switch_reset()
856 dev_err(dev->dev, "Failed to enable switch!\n"); in b53_switch_reset()
857 return -EINVAL; in b53_switch_reset()
868 struct b53_device *priv = ds->priv; in b53_phy_read16()
872 if (priv->ops->phy_read16) in b53_phy_read16()
873 ret = priv->ops->phy_read16(priv, addr, reg, &value); in b53_phy_read16()
883 struct b53_device *priv = ds->priv; in b53_phy_write16()
885 if (priv->ops->phy_write16) in b53_phy_write16()
886 return priv->ops->phy_write16(priv, addr, reg, val); in b53_phy_write16()
894 memset(priv->vlans, 0, sizeof(*priv->vlans) * priv->num_vlans); in b53_reset_switch()
895 memset(priv->ports, 0, sizeof(*priv->ports) * priv->num_ports); in b53_reset_switch()
897 priv->serdes_lane = B53_INVALID_LANE; in b53_reset_switch()
907 b53_configure_vlan(priv->ds); in b53_apply_config()
953 /* These ports typically do not have built-in PHYs */ in b53_get_phy_device()
961 return mdiobus_get_phy(ds->user_mii_bus, port); in b53_get_phy_device()
967 struct b53_device *dev = ds->priv; in b53_get_strings()
989 struct b53_device *dev = ds->priv; in b53_get_ethtool_stats()
999 mutex_lock(&dev->stats_mutex); in b53_get_ethtool_stats()
1004 if (s->size == 8) { in b53_get_ethtool_stats()
1005 b53_read64(dev, B53_MIB_PAGE(port), s->offset, &val); in b53_get_ethtool_stats()
1009 b53_read32(dev, B53_MIB_PAGE(port), s->offset, in b53_get_ethtool_stats()
1016 mutex_unlock(&dev->stats_mutex); in b53_get_ethtool_stats()
1034 struct b53_device *dev = ds->priv; in b53_get_sset_count()
1062 for (i = 0; i < dev->num_vlans; i++) { in b53_devlink_vlan_table_get()
1063 vl = &dev->vlans[i]; in b53_devlink_vlan_table_get()
1064 if (vl->members) in b53_devlink_vlan_table_get()
1074 struct b53_device *dev = ds->priv; in b53_setup_devlink_resources()
1077 devlink_resource_size_params_init(&size_params, dev->num_vlans, in b53_setup_devlink_resources()
1078 dev->num_vlans, in b53_setup_devlink_resources()
1081 err = dsa_devlink_resource_register(ds, "VLAN", dev->num_vlans, in b53_setup_devlink_resources()
1101 struct b53_device *dev = ds->priv; in b53_setup()
1108 ds->untag_bridge_pvid = dev->tag_protocol == DSA_TAG_PROTO_NONE; in b53_setup()
1112 dev_err(ds->dev, "failed to reset switch\n"); in b53_setup()
1120 dev_err(ds->dev, "failed to apply configuration\n"); in b53_setup()
1127 for (port = 0; port < dev->num_ports; port++) { in b53_setup()
1147 if (port == dev->imp_port) { in b53_force_link()
1165 int speed, int duplex, in b53_force_port_config() argument
1171 if (port == dev->imp_port) { in b53_force_port_config()
1186 switch (speed) { in b53_force_port_config()
1200 dev_err(dev->dev, "unknown speed: %d\n", speed); in b53_force_port_config()
1215 struct b53_device *dev = ds->priv; in b53_adjust_63xx_rgmii()
1218 if (port == dev->imp_port) in b53_adjust_63xx_rgmii()
1243 if (port != dev->imp_port) { in b53_adjust_63xx_rgmii()
1252 dev_dbg(ds->dev, "Configured port %d for %s\n", port, in b53_adjust_63xx_rgmii()
1259 struct b53_device *dev = ds->priv; in b53_adjust_link()
1260 struct ethtool_eee *p = &dev->ports[port].eee; in b53_adjust_link()
1272 if (phydev->pause) { in b53_adjust_link()
1273 if (phydev->asym_pause) in b53_adjust_link()
1278 b53_force_port_config(dev, port, phydev->speed, phydev->duplex, in b53_adjust_link()
1280 b53_force_link(dev, port, phydev->link); in b53_adjust_link()
1283 b53_adjust_63xx_rgmii(ds, port, phydev->interface); in b53_adjust_link()
1286 if (port == dev->imp_port) in b53_adjust_link()
1312 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) in b53_adjust_link()
1314 if (phydev->interface == PHY_INTERFACE_MODE_RGMII) in b53_adjust_link()
1319 dev_info(ds->dev, "Configured port %d for %s\n", port, in b53_adjust_link()
1320 phy_modes(phydev->interface)); in b53_adjust_link()
1336 dev_err(ds->dev, in b53_adjust_link()
1343 /* Re-negotiate EEE if it was enabled already */ in b53_adjust_link()
1344 p->eee_enabled = b53_eee_init(ds, port, phydev); in b53_adjust_link()
1349 struct b53_device *dev = ds->priv; in b53_port_event()
1362 struct b53_device *dev = ds->priv; in b53_phylink_get_caps()
1365 __set_bit(PHY_INTERFACE_MODE_GMII, config->supported_interfaces); in b53_phylink_get_caps()
1378 __set_bit(PHY_INTERFACE_MODE_MII, config->supported_interfaces); in b53_phylink_get_caps()
1379 __set_bit(PHY_INTERFACE_MODE_REVMII, config->supported_interfaces); in b53_phylink_get_caps()
1381 config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | in b53_phylink_get_caps()
1391 config->mac_capabilities |= MAC_1000; in b53_phylink_get_caps()
1394 if (dev->ops->phylink_get_caps) in b53_phylink_get_caps()
1395 dev->ops->phylink_get_caps(dev, port, config); in b53_phylink_get_caps()
1402 struct b53_device *dev = ds->priv; in b53_phylink_mac_select_pcs()
1404 if (!dev->ops->phylink_mac_select_pcs) in b53_phylink_mac_select_pcs()
1407 return dev->ops->phylink_mac_select_pcs(dev, port, interface); in b53_phylink_mac_select_pcs()
1421 struct b53_device *dev = ds->priv; in b53_phylink_mac_link_down()
1432 dev->ops->serdes_link_set) in b53_phylink_mac_link_down()
1433 dev->ops->serdes_link_set(dev, port, mode, interface, false); in b53_phylink_mac_link_down()
1441 int speed, int duplex, in b53_phylink_mac_link_up() argument
1444 struct b53_device *dev = ds->priv; in b53_phylink_mac_link_up()
1453 b53_force_port_config(dev, port, speed, duplex, in b53_phylink_mac_link_up()
1460 dev->ops->serdes_link_set) in b53_phylink_mac_link_up()
1461 dev->ops->serdes_link_set(dev, port, mode, interface, true); in b53_phylink_mac_link_up()
1468 struct b53_device *dev = ds->priv; in b53_vlan_filtering()
1470 b53_enable_vlan(dev, port, dev->vlan_enabled, vlan_filtering); in b53_vlan_filtering()
1479 struct b53_device *dev = ds->priv; in b53_vlan_prepare()
1481 if ((is5325(dev) || is5365(dev)) && vlan->vid == 0) in b53_vlan_prepare()
1482 return -EOPNOTSUPP; in b53_vlan_prepare()
1488 if (dev->chip_id == BCM7278_DEVICE_ID && port == 7 && in b53_vlan_prepare()
1489 !(vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED)) in b53_vlan_prepare()
1490 return -EINVAL; in b53_vlan_prepare()
1492 if (vlan->vid >= dev->num_vlans) in b53_vlan_prepare()
1493 return -ERANGE; in b53_vlan_prepare()
1495 b53_enable_vlan(dev, port, true, ds->vlan_filtering); in b53_vlan_prepare()
1504 struct b53_device *dev = ds->priv; in b53_vlan_add()
1505 bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; in b53_vlan_add()
1506 bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID; in b53_vlan_add()
1514 vl = &dev->vlans[vlan->vid]; in b53_vlan_add()
1516 b53_get_vlan_entry(dev, vlan->vid, vl); in b53_vlan_add()
1518 if (vlan->vid == 0 && vlan->vid == b53_default_pvid(dev)) in b53_vlan_add()
1521 vl->members |= BIT(port); in b53_vlan_add()
1523 vl->untag |= BIT(port); in b53_vlan_add()
1525 vl->untag &= ~BIT(port); in b53_vlan_add()
1527 b53_set_vlan_entry(dev, vlan->vid, vl); in b53_vlan_add()
1528 b53_fast_age_vlan(dev, vlan->vid); in b53_vlan_add()
1532 vlan->vid); in b53_vlan_add()
1533 b53_fast_age_vlan(dev, vlan->vid); in b53_vlan_add()
1543 struct b53_device *dev = ds->priv; in b53_vlan_del()
1544 bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED; in b53_vlan_del()
1550 vl = &dev->vlans[vlan->vid]; in b53_vlan_del()
1552 b53_get_vlan_entry(dev, vlan->vid, vl); in b53_vlan_del()
1554 vl->members &= ~BIT(port); in b53_vlan_del()
1556 if (pvid == vlan->vid) in b53_vlan_del()
1560 vl->untag &= ~(BIT(port)); in b53_vlan_del()
1562 b53_set_vlan_entry(dev, vlan->vid, vl); in b53_vlan_del()
1563 b53_fast_age_vlan(dev, vlan->vid); in b53_vlan_del()
1572 /* Address Resolution Logic routines. Caller must hold &dev->arl_mutex. */
1584 } while (timeout--); in b53_arl_op_wait()
1586 dev_warn(dev->dev, "timeout waiting for ARL to finish: 0x%02x\n", reg); in b53_arl_op_wait()
1588 return -ETIMEDOUT; in b53_arl_op_wait()
1596 return -EINVAL; in b53_arl_rw_op()
1604 if (dev->vlan_enabled) in b53_arl_rw_op()
1624 bitmap_zero(free_bins, dev->num_arl_bins); in b53_arl_read()
1626 /* Read the bins */ in b53_arl_read()
1627 for (i = 0; i < dev->num_arl_bins; i++) { in b53_arl_read()
1643 if (dev->vlan_enabled && in b53_arl_read()
1650 *idx = find_first_bit(free_bins, dev->num_arl_bins); in b53_arl_read()
1651 return *idx >= dev->num_arl_bins ? -ENOSPC : -ENOENT; in b53_arl_read()
1663 /* Convert the array into a 64-bit MAC */ in b53_arl_op()
1682 case -ETIMEDOUT: in b53_arl_op()
1684 case -ENOSPC: in b53_arl_op()
1685 dev_dbg(dev->dev, "{%pM,%.4d} no space left in ARL\n", in b53_arl_op()
1688 case -ENOENT: in b53_arl_op()
1690 dev_dbg(dev->dev, "{%pM,%.4d} not found, using idx: %d\n", in b53_arl_op()
1695 dev_dbg(dev->dev, "{%pM,%.4d} found, using idx: %d\n", in b53_arl_op()
1733 struct b53_device *priv = ds->priv; in b53_fdb_add()
1740 return -EOPNOTSUPP; in b53_fdb_add()
1742 mutex_lock(&priv->arl_mutex); in b53_fdb_add()
1744 mutex_unlock(&priv->arl_mutex); in b53_fdb_add()
1754 struct b53_device *priv = ds->priv; in b53_fdb_del()
1757 mutex_lock(&priv->arl_mutex); in b53_fdb_del()
1759 mutex_unlock(&priv->arl_mutex); in b53_fdb_del()
1779 } while (timeout--); in b53_arl_search_wait()
1781 return -ETIMEDOUT; in b53_arl_search_wait()
1800 if (!ent->is_valid) in b53_fdb_copy()
1803 if (port != ent->port) in b53_fdb_copy()
1806 return cb(ent->mac, ent->vid, ent->is_static, data); in b53_fdb_copy()
1812 struct b53_device *priv = ds->priv; in b53_fdb_dump()
1818 mutex_lock(&priv->arl_mutex); in b53_fdb_dump()
1834 if (priv->num_arl_bins > 2) { in b53_fdb_dump()
1846 mutex_unlock(&priv->arl_mutex); in b53_fdb_dump()
1856 struct b53_device *priv = ds->priv; in b53_mdb_add()
1863 return -EOPNOTSUPP; in b53_mdb_add()
1865 mutex_lock(&priv->arl_mutex); in b53_mdb_add()
1866 ret = b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, true); in b53_mdb_add()
1867 mutex_unlock(&priv->arl_mutex); in b53_mdb_add()
1877 struct b53_device *priv = ds->priv; in b53_mdb_del()
1880 mutex_lock(&priv->arl_mutex); in b53_mdb_del()
1881 ret = b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, false); in b53_mdb_del()
1882 mutex_unlock(&priv->arl_mutex); in b53_mdb_del()
1884 dev_err(ds->dev, "failed to delete MDB entry\n"); in b53_mdb_del()
1893 struct b53_device *dev = ds->priv; in b53_br_join()
1894 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_br_join()
1901 if (dev->chip_id == BCM7278_DEVICE_ID && port == 7) in b53_br_join()
1902 return -EINVAL; in b53_br_join()
1927 dev->ports[i].vlan_ctl_mask = reg; in b53_br_join()
1936 dev->ports[port].vlan_ctl_mask = pvlan; in b53_br_join()
1944 struct b53_device *dev = ds->priv; in b53_br_leave()
1945 struct b53_vlan *vl = &dev->vlans[0]; in b53_br_leave()
1946 s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index; in b53_br_leave()
1960 dev->ports[port].vlan_ctl_mask = reg; in b53_br_leave()
1968 dev->ports[port].vlan_ctl_mask = pvlan; in b53_br_leave()
1981 vl->members |= BIT(port) | BIT(cpu_port); in b53_br_leave()
1982 vl->untag |= BIT(port) | BIT(cpu_port); in b53_br_leave()
1990 struct b53_device *dev = ds->priv; in b53_br_set_stp_state()
2011 dev_err(ds->dev, "invalid STP state: %d\n", state); in b53_br_set_stp_state()
2024 struct b53_device *dev = ds->priv; in b53_br_fast_age()
2027 dev_err(ds->dev, "fast ageing failed\n"); in b53_br_fast_age()
2036 return -EINVAL; in b53_br_flags_pre()
2047 b53_port_set_ucast_flood(ds->priv, port, in b53_br_flags()
2050 b53_port_set_mcast_flood(ds->priv, port, in b53_br_flags()
2053 b53_port_set_learning(ds->priv, port, in b53_br_flags()
2081 dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n", in b53_can_enable_brcm_tags()
2089 dev_warn(ds->dev, in b53_can_enable_brcm_tags()
2104 struct b53_device *dev = ds->priv; in b53_get_tag_protocol()
2107 dev->tag_protocol = DSA_TAG_PROTO_NONE; in b53_get_tag_protocol()
2113 dev->tag_protocol = DSA_TAG_PROTO_BRCM_LEGACY; in b53_get_tag_protocol()
2120 if (dev->chip_id == BCM58XX_DEVICE_ID && port == B53_CPU_PORT) { in b53_get_tag_protocol()
2121 dev->tag_protocol = DSA_TAG_PROTO_BRCM_PREPEND; in b53_get_tag_protocol()
2125 dev->tag_protocol = DSA_TAG_PROTO_BRCM; in b53_get_tag_protocol()
2127 return dev->tag_protocol; in b53_get_tag_protocol()
2135 struct b53_device *dev = ds->priv; in b53_mirror_add()
2149 reg |= mirror->to_local_port; in b53_mirror_add()
2160 struct b53_device *dev = ds->priv; in b53_mirror_del()
2164 if (mirror->ingress) in b53_mirror_del()
2179 if (mirror->ingress) in b53_mirror_del()
2190 reg &= ~mirror->to_local_port; in b53_mirror_del()
2198 struct b53_device *dev = ds->priv; in b53_eee_enable_set()
2229 struct b53_device *dev = ds->priv; in b53_get_mac_eee()
2230 struct ethtool_eee *p = &dev->ports[port].eee; in b53_get_mac_eee()
2234 return -EOPNOTSUPP; in b53_get_mac_eee()
2237 e->eee_enabled = p->eee_enabled; in b53_get_mac_eee()
2238 e->eee_active = !!(reg & BIT(port)); in b53_get_mac_eee()
2246 struct b53_device *dev = ds->priv; in b53_set_mac_eee()
2247 struct ethtool_eee *p = &dev->ports[port].eee; in b53_set_mac_eee()
2250 return -EOPNOTSUPP; in b53_set_mac_eee()
2252 p->eee_enabled = e->eee_enabled; in b53_set_mac_eee()
2253 b53_eee_enable_set(ds, port, e->eee_enabled); in b53_set_mac_eee()
2261 struct b53_device *dev = ds->priv; in b53_change_mtu()
2266 return -EOPNOTSUPP; in b53_change_mtu()
2269 allow_10_100 = (dev->chip_id == BCM583XX_DEVICE_ID); in b53_change_mtu()
2634 if (chip->chip_id == dev->chip_id) { in b53_switch_init()
2635 if (!dev->enabled_ports) in b53_switch_init()
2636 dev->enabled_ports = chip->enabled_ports; in b53_switch_init()
2637 dev->name = chip->dev_name; in b53_switch_init()
2638 dev->duplex_reg = chip->duplex_reg; in b53_switch_init()
2639 dev->vta_regs[0] = chip->vta_regs[0]; in b53_switch_init()
2640 dev->vta_regs[1] = chip->vta_regs[1]; in b53_switch_init()
2641 dev->vta_regs[2] = chip->vta_regs[2]; in b53_switch_init()
2642 dev->jumbo_pm_reg = chip->jumbo_pm_reg; in b53_switch_init()
2643 dev->imp_port = chip->imp_port; in b53_switch_init()
2644 dev->num_vlans = chip->vlans; in b53_switch_init()
2645 dev->num_arl_bins = chip->arl_bins; in b53_switch_init()
2646 dev->num_arl_buckets = chip->arl_buckets; in b53_switch_init()
2663 /* BCM5325F - do not use port 4 */ in b53_switch_init()
2664 dev->enabled_ports &= ~BIT(4); in b53_switch_init()
2670 return -EINVAL; in b53_switch_init()
2677 dev->num_ports = fls(dev->enabled_ports); in b53_switch_init()
2679 dev->ds->num_ports = min_t(unsigned int, dev->num_ports, DSA_MAX_PORTS); in b53_switch_init()
2681 /* Include non standard CPU port built-in PHYs to be probed */ in b53_switch_init()
2683 for (i = 0; i < dev->num_ports; i++) { in b53_switch_init()
2684 if (!(dev->ds->phys_mii_mask & BIT(i)) && in b53_switch_init()
2685 !b53_possible_cpu_port(dev->ds, i)) in b53_switch_init()
2686 dev->ds->phys_mii_mask |= BIT(i); in b53_switch_init()
2690 dev->ports = devm_kcalloc(dev->dev, in b53_switch_init()
2691 dev->num_ports, sizeof(struct b53_port), in b53_switch_init()
2693 if (!dev->ports) in b53_switch_init()
2694 return -ENOMEM; in b53_switch_init()
2696 dev->vlans = devm_kcalloc(dev->dev, in b53_switch_init()
2697 dev->num_vlans, sizeof(struct b53_vlan), in b53_switch_init()
2699 if (!dev->vlans) in b53_switch_init()
2700 return -ENOMEM; in b53_switch_init()
2702 dev->reset_gpio = b53_switch_get_reset_gpio(dev); in b53_switch_init()
2703 if (dev->reset_gpio >= 0) { in b53_switch_init()
2704 ret = devm_gpio_request_one(dev->dev, dev->reset_gpio, in b53_switch_init()
2724 ds->dev = base; in b53_switch_alloc()
2730 ds->priv = dev; in b53_switch_alloc()
2731 dev->dev = base; in b53_switch_alloc()
2733 dev->ds = ds; in b53_switch_alloc()
2734 dev->priv = priv; in b53_switch_alloc()
2735 dev->ops = ops; in b53_switch_alloc()
2736 ds->ops = &b53_switch_ops; in b53_switch_alloc()
2737 dev->vlan_enabled = true; in b53_switch_alloc()
2743 ds->vlan_filtering_is_global = true; in b53_switch_alloc()
2745 mutex_init(&dev->reg_mutex); in b53_switch_alloc()
2746 mutex_init(&dev->stats_mutex); in b53_switch_alloc()
2747 mutex_init(&dev->arl_mutex); in b53_switch_alloc()
2777 dev->chip_id = BCM5325_DEVICE_ID; in b53_switch_detect()
2779 dev->chip_id = BCM5365_DEVICE_ID; in b53_switch_detect()
2785 dev->chip_id = id8; in b53_switch_detect()
2802 dev->chip_id = id32; in b53_switch_detect()
2805 dev_err(dev->dev, in b53_switch_detect()
2808 return -ENODEV; in b53_switch_detect()
2812 if (dev->chip_id == BCM5325_DEVICE_ID) in b53_switch_detect()
2814 &dev->core_rev); in b53_switch_detect()
2817 &dev->core_rev); in b53_switch_detect()
2825 if (dev->pdata) { in b53_switch_register()
2826 dev->chip_id = dev->pdata->chip_id; in b53_switch_register()
2827 dev->enabled_ports = dev->pdata->enabled_ports; in b53_switch_register()
2830 if (!dev->chip_id && b53_switch_detect(dev)) in b53_switch_register()
2831 return -EINVAL; in b53_switch_register()
2837 dev_info(dev->dev, "found switch: %s, rev %i\n", in b53_switch_register()
2838 dev->name, dev->core_rev); in b53_switch_register()
2840 return dsa_register_switch(dev->ds); in b53_switch_register()