^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* Copyright 2019 NXP Semiconductors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #ifndef _MSCC_FELIX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #define _MSCC_FELIX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define ocelot_to_felix(o) container_of((o), struct felix, ocelot)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define FELIX_NUM_TC 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) /* Platform-specific information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct felix_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) const struct resource *target_io_res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) const struct resource *port_io_res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) const struct resource *imdio_res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) const struct reg_field *regfields;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) const u32 *const *map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) const struct ocelot_ops *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) int shared_queue_sz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) int num_mact_rows;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) const struct ocelot_stat_layout *stats_layout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) unsigned int num_stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) int num_ports;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int num_tx_queues;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct vcap_props *vcap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) int switch_pci_bar;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) int imdio_pci_bar;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) const struct ptp_clock_info *ptp_caps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) int (*mdio_bus_alloc)(struct ocelot *ocelot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) void (*mdio_bus_free)(struct ocelot *ocelot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) void (*phylink_validate)(struct ocelot *ocelot, int port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) unsigned long *supported,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct phylink_link_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int (*prevalidate_phy_mode)(struct ocelot *ocelot, int port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) phy_interface_t phy_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) int (*port_setup_tc)(struct dsa_switch *ds, int port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) enum tc_setup_type type, void *type_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) void (*port_sched_speed_set)(struct ocelot *ocelot, int port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) u32 speed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) void (*xmit_template_populate)(struct ocelot *ocelot, int port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) extern const struct dsa_switch_ops felix_switch_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) /* DSA glue / front-end for struct ocelot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct felix {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct dsa_switch *ds;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) const struct felix_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) struct ocelot ocelot;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct mii_bus *imdio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct lynx_pcs **pcs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) resource_size_t switch_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) resource_size_t imdio_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) int felix_netdev_to_port(struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #endif