Lines Matching refs:port

221 static void ksz9477_phylink_mac_link_up(struct ksz_device *dev, int port,
502 /* port 1 */
532 /* port 2 */
562 /* port 3 */
629 /* port 1 */
662 /* port 2 */
695 /* port 3 */
728 /* port 4 */
761 /* port 5 */
794 /* port 6 */
823 /* port 7 */
886 /* port 1 */
916 /* port 2 */
946 /* port 3 */
976 /* port 4 */
1006 /* port 5 */
1036 /* port 6 */
1078 /* port registers */
1119 .cpu_ports = 0x07, /* can be configured as cpu port */
1120 .port_cnt = 3, /* total port count */
1149 .cpu_ports = 0x10, /* can be configured as cpu port */
1171 * KSZ8794 is similar to KSZ8795, except the port map
1173 * port map is NOT continuous. The per-port register
1176 * used on KSZ8795 for external port 3.
1188 .cpu_ports = 0x10, /* can be configured as cpu port */
1213 .cpu_ports = 0x10, /* can be configured as cpu port */
1238 .cpu_ports = 0x4, /* can be configured as cpu port */
1261 .cpu_ports = 0x7F, /* can be configured as cpu port */
1262 .port_cnt = 7, /* total physical port count */
1295 .cpu_ports = 0x3F, /* can be configured as cpu port */
1296 .port_cnt = 6, /* total physical port count */
1327 .cpu_ports = 0x7F, /* can be configured as cpu port */
1328 .port_cnt = 7, /* total physical port count */
1357 .cpu_ports = 0x07, /* can be configured as cpu port */
1358 .port_cnt = 3, /* total port count */
1383 .cpu_ports = 0x07, /* can be configured as cpu port */
1384 .port_cnt = 3, /* total port count */
1411 .cpu_ports = 0x7F, /* can be configured as cpu port */
1412 .port_cnt = 7, /* total physical port count */
1443 .cpu_ports = 0x10, /* can be configured as cpu port */
1444 .port_cnt = 5, /* total physical port count */
1470 .cpu_ports = 0x30, /* can be configured as cpu port */
1471 .port_cnt = 6, /* total physical port count */
1497 .cpu_ports = 0x30, /* can be configured as cpu port */
1498 .port_cnt = 8, /* total physical port count */
1528 .cpu_ports = 0x38, /* can be configured as cpu port */
1529 .port_cnt = 5, /* total physical port count */
1559 .cpu_ports = 0x30, /* can be configured as cpu port */
1560 .port_cnt = 8, /* total physical port count */
1617 static void ksz_phylink_get_caps(struct dsa_switch *ds, int port,
1622 if (dev->info->supports_mii[port])
1625 if (dev->info->supports_rmii[port])
1629 if (dev->info->supports_rgmii[port])
1632 if (dev->info->internal_phy[port]) {
1643 dev->dev_ops->get_caps(dev, port, config);
1646 void ksz_r_mib_stats64(struct ksz_device *dev, int port)
1653 mib = &dev->ports[port].mib;
1695 void ksz88xx_r_mib_stats64(struct ksz_device *dev, int port)
1702 mib = &dev->ports[port].mib;
1744 static void ksz_get_stats64(struct dsa_switch *ds, int port,
1750 mib = &dev->ports[port].mib;
1757 static void ksz_get_pause_stats(struct dsa_switch *ds, int port,
1763 mib = &dev->ports[port].mib;
1770 static void ksz_get_strings(struct dsa_switch *ds, int port,
1785 static void ksz_update_port_member(struct ksz_device *dev, int port)
1787 struct ksz_port *p = &dev->ports[port];
1793 if (!dsa_is_user_port(ds, port))
1796 dp = dsa_to_port(ds, port);
1797 cpu_port = BIT(dsa_upstream_port(ds, port));
1806 if (port == i)
1814 val |= BIT(port);
1818 /* Retain port [i]'s relationship to other ports than [port] */
1825 if (j == port)
1840 dev->dev_ops->cfg_port_member(dev, port, port_member | cpu_port);
2153 * on the CPU port. In lack of other finer mechanisms, learning on the
2154 * CPU port will avoid flooding bridge local addresses on the network
2232 static void port_r_cnt(struct ksz_device *dev, int port)
2234 struct ksz_port_mib *mib = &dev->ports[port].mib;
2239 dev->dev_ops->r_mib_cnt(dev, port, mib->cnt_ptr,
2249 dev->dev_ops->r_mib_pkt(dev, port, mib->cnt_ptr,
2272 /* Only read MIB counters when the port is told to do.
2334 static u32 ksz_get_phy_flags(struct dsa_switch *ds, int port)
2344 if (!port)
2364 static void ksz_mac_link_down(struct dsa_switch *ds, int port,
2368 struct ksz_port *p = &dev->ports[port];
2377 static int ksz_sset_count(struct dsa_switch *ds, int port, int sset)
2387 static void ksz_get_ethtool_stats(struct dsa_switch *ds, int port,
2390 const struct dsa_port *dp = dsa_to_port(ds, port);
2394 mib = &dev->ports[port].mib;
2400 port_r_cnt(dev, port);
2405 static int ksz_port_bridge_join(struct dsa_switch *ds, int port,
2410 /* port_stp_state_set() will be called after to put the port in
2417 static void ksz_port_bridge_leave(struct dsa_switch *ds, int port,
2420 /* port_stp_state_set() will be called after to put the port in
2425 static void ksz_port_fast_age(struct dsa_switch *ds, int port)
2429 dev->dev_ops->flush_dyn_mac_table(dev, port);
2442 static int ksz_port_fdb_add(struct dsa_switch *ds, int port,
2451 return dev->dev_ops->fdb_add(dev, port, addr, vid, db);
2454 static int ksz_port_fdb_del(struct dsa_switch *ds, int port,
2463 return dev->dev_ops->fdb_del(dev, port, addr, vid, db);
2466 static int ksz_port_fdb_dump(struct dsa_switch *ds, int port,
2474 return dev->dev_ops->fdb_dump(dev, port, cb, data);
2477 static int ksz_port_mdb_add(struct dsa_switch *ds, int port,
2486 return dev->dev_ops->mdb_add(dev, port, mdb, db);
2489 static int ksz_port_mdb_del(struct dsa_switch *ds, int port,
2498 return dev->dev_ops->mdb_del(dev, port, mdb, db);
2501 static int ksz_enable_port(struct dsa_switch *ds, int port,
2506 if (!dsa_is_user_port(ds, port))
2509 /* setup slave port */
2510 dev->dev_ops->port_setup(dev, port, false);
2512 /* port_stp_state_set() will be called after to enable the port so
2519 void ksz_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
2528 ksz_pread8(dev, port, regs[P_STP_CTRL], &data);
2531 p = &dev->ports[port];
2558 ksz_pwrite8(dev, port, regs[P_STP_CTRL], data);
2562 ksz_update_port_member(dev, port);
2565 static int ksz_port_pre_bridge_flags(struct dsa_switch *ds, int port,
2575 static int ksz_port_bridge_flags(struct dsa_switch *ds, int port,
2580 struct ksz_port *p = &dev->ports[port];
2586 ksz_port_stp_state_set(ds, port, p->stp_state);
2593 int port,
2641 static int ksz_port_vlan_filtering(struct dsa_switch *ds, int port,
2649 return dev->dev_ops->vlan_filtering(dev, port, flag, extack);
2652 static int ksz_port_vlan_add(struct dsa_switch *ds, int port,
2661 return dev->dev_ops->vlan_add(dev, port, vlan, extack);
2664 static int ksz_port_vlan_del(struct dsa_switch *ds, int port,
2672 return dev->dev_ops->vlan_del(dev, port, vlan);
2675 static int ksz_port_mirror_add(struct dsa_switch *ds, int port,
2684 return dev->dev_ops->mirror_add(dev, port, mirror, ingress, extack);
2687 static void ksz_port_mirror_del(struct dsa_switch *ds, int port,
2693 dev->dev_ops->mirror_del(dev, port, mirror);
2696 static int ksz_change_mtu(struct dsa_switch *ds, int port, int mtu)
2703 return dev->dev_ops->change_mtu(dev, port, mtu);
2706 static int ksz_max_mtu(struct dsa_switch *ds, int port)
2735 static int ksz_validate_eee(struct dsa_switch *ds, int port)
2739 if (!dev->info->internal_phy[port])
2756 static int ksz_get_mac_eee(struct dsa_switch *ds, int port,
2761 ret = ksz_validate_eee(ds, port);
2776 static int ksz_set_mac_eee(struct dsa_switch *ds, int port,
2782 ret = ksz_validate_eee(ds, port);
2799 static void ksz_set_xmii(struct ksz_device *dev, int port,
2803 struct ksz_port *p = &dev->ports[port];
2807 ksz_pread8(dev, port, regs[P_XMII_CTRL_1], &data8);
2834 dev_err(dev->dev, "Unsupported interface '%s' for port %d\n",
2835 phy_modes(interface), port);
2846 ksz_pwrite8(dev, port, regs[P_XMII_CTRL_1], data8);
2849 phy_interface_t ksz_get_xmii(struct ksz_device *dev, int port, bool gbit)
2857 ksz_pread8(dev, port, regs[P_XMII_CTRL_1], &data8);
2882 static void ksz_phylink_mac_config(struct dsa_switch *ds, int port,
2892 if (dev->info->internal_phy[port])
2900 ksz_set_xmii(dev, port, state->interface);
2903 dev->dev_ops->phylink_mac_config(dev, port, mode, state);
2906 dev->dev_ops->setup_rgmii_delay(dev, port);
2909 bool ksz_get_gbit(struct ksz_device *dev, int port)
2917 ksz_pread8(dev, port, regs[P_XMII_CTRL_1], &data8);
2927 static void ksz_set_gbit(struct ksz_device *dev, int port, bool gbit)
2933 ksz_pread8(dev, port, regs[P_XMII_CTRL_1], &data8);
2943 ksz_pwrite8(dev, port, regs[P_XMII_CTRL_1], data8);
2946 static void ksz_set_100_10mbit(struct ksz_device *dev, int port, int speed)
2952 ksz_pread8(dev, port, regs[P_XMII_CTRL_0], &data8);
2962 ksz_pwrite8(dev, port, regs[P_XMII_CTRL_0], data8);
2965 static void ksz_port_set_xmii_speed(struct ksz_device *dev, int port, int speed)
2968 ksz_set_gbit(dev, port, true);
2970 ksz_set_gbit(dev, port, false);
2973 ksz_set_100_10mbit(dev, port, speed);
2976 static void ksz_duplex_flowctrl(struct ksz_device *dev, int port, int duplex,
2999 ksz_prmw8(dev, port, regs[P_XMII_CTRL_0], mask, val);
3002 static void ksz9477_phylink_mac_link_up(struct ksz_device *dev, int port,
3011 p = &dev->ports[port];
3014 if (dev->info->internal_phy[port])
3019 ksz_port_set_xmii_speed(dev, port, speed);
3021 ksz_duplex_flowctrl(dev, port, duplex, tx_pause, rx_pause);
3024 static void ksz_phylink_mac_link_up(struct dsa_switch *ds, int port,
3033 dev->dev_ops->phylink_mac_link_up(dev, port, mode, interface,
3153 static int ksz_setup_tc_mode(struct ksz_device *dev, int port, u8 scheduler,
3156 return ksz_pwrite8(dev, port, REG_PORT_MTI_QUEUE_CTRL_0,
3161 static int ksz_setup_tc_cbs(struct dsa_switch *ds, int port,
3175 ret = ksz_pwrite32(dev, port, REG_PORT_MTI_QUEUE_INDEX__4, qopt->queue);
3180 return ksz_setup_tc_mode(dev, port, MTI_SCHEDULE_WRR,
3184 ret = ksz_pwrite16(dev, port, REG_PORT_MTI_HI_WATER_MARK,
3190 ret = ksz_pwrite16(dev, port, REG_PORT_MTI_LO_WATER_MARK,
3201 ret = dev->dev_ops->tc_cbs_set_cinc(dev, port, bw);
3206 return ksz_setup_tc_mode(dev, port, MTI_SCHEDULE_STRICT_PRIO,
3210 static int ksz_disable_egress_rate_limit(struct ksz_device *dev, int port)
3218 ret = ksz_pwrite8(dev, port, KSZ9477_REG_PORT_OUT_RATE_0 + queue,
3237 static int ksz_queue_set_strict(struct ksz_device *dev, int port, int queue)
3241 ret = ksz_pwrite32(dev, port, REG_PORT_MTI_QUEUE_INDEX__4, queue);
3245 return ksz_setup_tc_mode(dev, port, MTI_SCHEDULE_STRICT_PRIO,
3249 static int ksz_queue_set_wrr(struct ksz_device *dev, int port, int queue,
3254 ret = ksz_pwrite32(dev, port, REG_PORT_MTI_QUEUE_INDEX__4, queue);
3258 ret = ksz_setup_tc_mode(dev, port, MTI_SCHEDULE_WRR,
3263 return ksz_pwrite8(dev, port, KSZ9477_PORT_MTI_QUEUE_CTRL_1, weight);
3266 static int ksz_tc_ets_add(struct ksz_device *dev, int port,
3276 ret = ksz_disable_egress_rate_limit(dev, port);
3286 ret = ksz_queue_set_strict(dev, port, queue);
3305 return ksz_pwrite32(dev, port, KSZ9477_PORT_MRI_TC_MAP__4, queue_map);
3308 static int ksz_tc_ets_del(struct ksz_device *dev, int port)
3317 ret = ksz_queue_set_wrr(dev, port, queue,
3347 return ksz_pwrite32(dev, port, KSZ9477_PORT_MRI_TC_MAP__4, queue_map);
3350 static int ksz_tc_ets_validate(struct ksz_device *dev, int port,
3355 /* Since it is not feasible to share one port among multiple qdisc,
3386 static int ksz_tc_setup_qdisc_ets(struct dsa_switch *ds, int port,
3402 ret = ksz_tc_ets_validate(dev, port, &qopt->replace_params);
3406 return ksz_tc_ets_add(dev, port, &qopt->replace_params);
3408 return ksz_tc_ets_del(dev, port);
3417 static int ksz_setup_tc(struct dsa_switch *ds, int port,
3422 return ksz_setup_tc_cbs(ds, port, type_data);
3424 return ksz_tc_setup_qdisc_ets(ds, port, type_data);
3544 struct device_node *port, *ports;
3617 /* Host port interface will be self detected, or specifically set in
3630 for_each_available_child_of_node(ports, port) {
3631 if (of_property_read_u32(port, "reg",
3635 of_node_put(port);
3639 of_get_phy_mode(port,
3642 ksz_parse_rgmii_delay(dev, port_num, port);