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