Lines Matching full:ocelot

5  * register-compatible with Ocelot and that perform I/O to their host CPU
15 #include <soc/mscc/ocelot.h>
37 struct ocelot *ocelot = ds->priv; in felix_set_ageing_time() local
39 ocelot_set_ageing_time(ocelot, ageing_time); in felix_set_ageing_time()
47 struct ocelot *ocelot = ds->priv; in felix_fdb_dump() local
49 return ocelot_fdb_dump(ocelot, port, cb, data); in felix_fdb_dump()
55 struct ocelot *ocelot = ds->priv; in felix_fdb_add() local
57 return ocelot_fdb_add(ocelot, port, addr, vid); in felix_fdb_add()
63 struct ocelot *ocelot = ds->priv; in felix_fdb_del() local
65 return ocelot_fdb_del(ocelot, port, addr, vid); in felix_fdb_del()
78 struct ocelot *ocelot = ds->priv; in felix_mdb_add() local
80 ocelot_port_mdb_add(ocelot, port, mdb); in felix_mdb_add()
86 struct ocelot *ocelot = ds->priv; in felix_mdb_del() local
88 return ocelot_port_mdb_del(ocelot, port, mdb); in felix_mdb_del()
94 struct ocelot *ocelot = ds->priv; in felix_bridge_stp_state_set() local
96 return ocelot_bridge_stp_state_set(ocelot, port, state); in felix_bridge_stp_state_set()
102 struct ocelot *ocelot = ds->priv; in felix_bridge_join() local
104 return ocelot_port_bridge_join(ocelot, port, br); in felix_bridge_join()
110 struct ocelot *ocelot = ds->priv; in felix_bridge_leave() local
112 ocelot_port_bridge_leave(ocelot, port, br); in felix_bridge_leave()
125 struct ocelot *ocelot = ds->priv; in felix_vlan_filtering() local
127 return ocelot_port_vlan_filtering(ocelot, port, enabled, trans); in felix_vlan_filtering()
133 struct ocelot *ocelot = ds->priv; in felix_vlan_add() local
142 err = ocelot_vlan_add(ocelot, port, vid, in felix_vlan_add()
156 struct ocelot *ocelot = ds->priv; in felix_vlan_del() local
161 err = ocelot_vlan_del(ocelot, port, vid); in felix_vlan_del()
174 struct ocelot *ocelot = ds->priv; in felix_port_enable() local
176 ocelot_port_enable(ocelot, port, phy); in felix_port_enable()
183 struct ocelot *ocelot = ds->priv; in felix_port_disable() local
185 return ocelot_port_disable(ocelot, port); in felix_port_disable()
192 struct ocelot *ocelot = ds->priv; in felix_phylink_validate() local
193 struct felix *felix = ocelot_to_felix(ocelot); in felix_phylink_validate()
196 felix->info->phylink_validate(ocelot, port, supported, state); in felix_phylink_validate()
203 struct ocelot *ocelot = ds->priv; in felix_phylink_mac_config() local
204 struct felix *felix = ocelot_to_felix(ocelot); in felix_phylink_mac_config()
215 struct ocelot *ocelot = ds->priv; in felix_phylink_mac_link_down() local
216 struct ocelot_port *ocelot_port = ocelot->ports[port]; in felix_phylink_mac_link_down()
219 ocelot_fields_write(ocelot, port, QSYS_SWITCH_PORT_MODE_PORT_ENA, 0); in felix_phylink_mac_link_down()
229 struct ocelot *ocelot = ds->priv; in felix_phylink_mac_link_up() local
230 struct ocelot_port *ocelot_port = ocelot->ports[port]; in felix_phylink_mac_link_up()
231 struct felix *felix = ocelot_to_felix(ocelot); in felix_phylink_mac_link_up()
257 dev_err(ocelot->dev, "Unsupported speed on port %d: %d\n", in felix_phylink_mac_link_up()
276 ocelot_write_rix(ocelot, mac_fc_cfg, SYS_MAC_FC_CFG, port); in felix_phylink_mac_link_up()
278 ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port); in felix_phylink_mac_link_up()
289 ocelot_write_gix(ocelot, ANA_PORT_PORT_CFG_LEARNAUTO | in felix_phylink_mac_link_up()
295 ocelot_fields_write(ocelot, port, in felix_phylink_mac_link_up()
299 felix->info->port_sched_speed_set(ocelot, port, speed); in felix_phylink_mac_link_up()
302 static void felix_port_qos_map_init(struct ocelot *ocelot, int port) in felix_port_qos_map_init() argument
306 ocelot_rmw_gix(ocelot, in felix_port_qos_map_init()
313 ocelot_rmw_ix(ocelot, in felix_port_qos_map_init()
326 struct ocelot *ocelot = ds->priv; in felix_get_strings() local
328 return ocelot_get_strings(ocelot, port, stringset, data); in felix_get_strings()
333 struct ocelot *ocelot = ds->priv; in felix_get_ethtool_stats() local
335 ocelot_get_ethtool_stats(ocelot, port, data); in felix_get_ethtool_stats()
340 struct ocelot *ocelot = ds->priv; in felix_get_sset_count() local
342 return ocelot_get_sset_count(ocelot, port, sset); in felix_get_sset_count()
348 struct ocelot *ocelot = ds->priv; in felix_get_ts_info() local
350 return ocelot_get_ts_info(ocelot, port, info); in felix_get_ts_info()
357 struct ocelot *ocelot = &felix->ocelot; in felix_parse_ports_node() local
358 struct device *dev = felix->ocelot.dev; in felix_parse_ports_node()
384 err = felix->info->prevalidate_phy_mode(ocelot, port, phy_mode); in felix_parse_ports_node()
400 struct device *dev = felix->ocelot.dev; in felix_parse_dt()
421 struct ocelot *ocelot = &felix->ocelot; in felix_init_structs() local
426 ocelot->num_phys_ports = num_phys_ports; in felix_init_structs()
427 ocelot->ports = devm_kcalloc(ocelot->dev, num_phys_ports, in felix_init_structs()
429 if (!ocelot->ports) in felix_init_structs()
432 ocelot->map = felix->info->map; in felix_init_structs()
433 ocelot->stats_layout = felix->info->stats_layout; in felix_init_structs()
434 ocelot->num_stats = felix->info->num_stats; in felix_init_structs()
435 ocelot->shared_queue_sz = felix->info->shared_queue_sz; in felix_init_structs()
436 ocelot->num_mact_rows = felix->info->num_mact_rows; in felix_init_structs()
437 ocelot->vcap = felix->info->vcap; in felix_init_structs()
438 ocelot->ops = felix->info->ops; in felix_init_structs()
439 ocelot->inj_prefix = OCELOT_TAG_PREFIX_SHORT; in felix_init_structs()
440 ocelot->xtr_prefix = OCELOT_TAG_PREFIX_SHORT; in felix_init_structs()
464 target = ocelot_regmap_init(ocelot, &res); in felix_init_structs()
466 dev_err(ocelot->dev, in felix_init_structs()
472 ocelot->targets[i] = target; in felix_init_structs()
475 err = ocelot_regfields_init(ocelot, felix->info->regfields); in felix_init_structs()
477 dev_err(ocelot->dev, "failed to init reg fields map\n"); in felix_init_structs()
487 ocelot_port = devm_kzalloc(ocelot->dev, in felix_init_structs()
491 dev_err(ocelot->dev, in felix_init_structs()
502 target = ocelot_regmap_init(ocelot, &res); in felix_init_structs()
504 dev_err(ocelot->dev, in felix_init_structs()
511 template = devm_kzalloc(ocelot->dev, OCELOT_TOTAL_TAG_LEN, in felix_init_structs()
514 dev_err(ocelot->dev, in felix_init_structs()
521 ocelot_port->ocelot = ocelot; in felix_init_structs()
524 ocelot->ports[port] = ocelot_port; in felix_init_structs()
526 felix->info->xmit_template_populate(ocelot, port); in felix_init_structs()
532 err = felix->info->mdio_bus_alloc(ocelot); in felix_init_structs()
544 static void felix_npi_port_init(struct ocelot *ocelot, int port) in felix_npi_port_init() argument
546 ocelot->npi = port; in felix_npi_port_init()
548 ocelot_write(ocelot, QSYS_EXT_CPU_CFG_EXT_CPUQ_MSK_M | in felix_npi_port_init()
553 ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_XTR_HDR, in felix_npi_port_init()
554 ocelot->xtr_prefix); in felix_npi_port_init()
555 ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_INJ_HDR, in felix_npi_port_init()
556 ocelot->inj_prefix); in felix_npi_port_init()
559 ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, 0); in felix_npi_port_init()
569 struct ocelot *ocelot = ds->priv; in felix_setup() local
570 struct felix *felix = ocelot_to_felix(ocelot); in felix_setup()
577 err = ocelot_init(ocelot); in felix_setup()
581 if (ocelot->ptp) { in felix_setup()
582 err = ocelot_init_timestamp(ocelot, felix->info->ptp_caps); in felix_setup()
584 dev_err(ocelot->dev, in felix_setup()
586 ocelot->ptp = 0; in felix_setup()
591 ocelot_init_port(ocelot, port); in felix_setup()
594 felix_npi_port_init(ocelot, port); in felix_setup()
599 felix_port_qos_map_init(ocelot, port); in felix_setup()
604 * excludes BIT(ocelot->num_phys_ports), and so does ocelot_init, since in felix_setup()
605 * Ocelot relies on whitelisting MAC addresses towards PGID_CPU. in felix_setup()
607 ocelot_write_rix(ocelot, in felix_setup()
608 ANA_PGID_PGID_PGID(GENMASK(ocelot->num_phys_ports, 0)), in felix_setup()
619 struct ocelot *ocelot = ds->priv; in felix_teardown() local
620 struct felix *felix = ocelot_to_felix(ocelot); in felix_teardown()
624 felix->info->mdio_bus_free(ocelot); in felix_teardown()
626 for (port = 0; port < ocelot->num_phys_ports; port++) in felix_teardown()
627 ocelot_deinit_port(ocelot, port); in felix_teardown()
628 ocelot_deinit_timestamp(ocelot); in felix_teardown()
630 ocelot_deinit(ocelot); in felix_teardown()
636 struct ocelot *ocelot = ds->priv; in felix_hwtstamp_get() local
638 return ocelot_hwstamp_get(ocelot, port, ifr); in felix_hwtstamp_get()
644 struct ocelot *ocelot = ds->priv; in felix_hwtstamp_set() local
646 return ocelot_hwstamp_set(ocelot, port, ifr); in felix_hwtstamp_set()
653 struct ocelot *ocelot = ds->priv; in felix_rxtstamp() local
659 ocelot_ptp_gettime64(&ocelot->ptp_info, &ts); in felix_rxtstamp()
680 struct ocelot *ocelot = ds->priv; in felix_txtstamp() local
681 struct ocelot_port *ocelot_port = ocelot->ports[port]; in felix_txtstamp()
683 if (ocelot->ptp && (skb_shinfo(clone)->tx_flags & SKBTX_HW_TSTAMP) && in felix_txtstamp()
685 ocelot_port_add_txtstamp_skb(ocelot, port, clone); in felix_txtstamp()
694 struct ocelot *ocelot = ds->priv; in felix_change_mtu() local
696 ocelot_port_set_maxlen(ocelot, port, new_mtu); in felix_change_mtu()
703 struct ocelot *ocelot = ds->priv; in felix_get_max_mtu() local
705 return ocelot_get_max_mtu(ocelot, port); in felix_get_max_mtu()
711 struct ocelot *ocelot = ds->priv; in felix_cls_flower_add() local
713 return ocelot_cls_flower_replace(ocelot, port, cls, ingress); in felix_cls_flower_add()
719 struct ocelot *ocelot = ds->priv; in felix_cls_flower_del() local
721 return ocelot_cls_flower_destroy(ocelot, port, cls, ingress); in felix_cls_flower_del()
727 struct ocelot *ocelot = ds->priv; in felix_cls_flower_stats() local
729 return ocelot_cls_flower_stats(ocelot, port, cls, ingress); in felix_cls_flower_stats()
735 struct ocelot *ocelot = ds->priv; in felix_port_policer_add() local
741 return ocelot_port_policer_add(ocelot, port, &pol); in felix_port_policer_add()
746 struct ocelot *ocelot = ds->priv; in felix_port_policer_del() local
748 ocelot_port_policer_del(ocelot, port); in felix_port_policer_del()
755 struct ocelot *ocelot = ds->priv; in felix_port_setup_tc() local
756 struct felix *felix = ocelot_to_felix(ocelot); in felix_port_setup_tc()
806 struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port) in felix_port_to_netdev() argument
808 struct felix *felix = ocelot_to_felix(ocelot); in felix_port_to_netdev()