Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 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 | #define FELIX_NUM_TC 8 |
| 9 | |
| 10 | /* Platform-specific information */ |
| 11 | struct felix_info { |
| 12 | const struct resource *target_io_res; |
| 13 | const struct resource *port_io_res; |
| 14 | const struct resource *imdio_res; |
| 15 | const struct reg_field *regfields; |
| 16 | const u32 *const *map; |
| 17 | const struct ocelot_ops *ops; |
| 18 | int shared_queue_sz; |
| 19 | int num_mact_rows; |
| 20 | const struct ocelot_stat_layout *stats_layout; |
| 21 | unsigned int num_stats; |
| 22 | int num_ports; |
| 23 | int num_tx_queues; |
| 24 | struct vcap_props *vcap; |
| 25 | int switch_pci_bar; |
| 26 | int imdio_pci_bar; |
| 27 | const struct ptp_clock_info *ptp_caps; |
| 28 | int (*mdio_bus_alloc)(struct ocelot *ocelot); |
| 29 | void (*mdio_bus_free)(struct ocelot *ocelot); |
| 30 | void (*phylink_validate)(struct ocelot *ocelot, int port, |
| 31 | unsigned long *supported, |
| 32 | struct phylink_link_state *state); |
| 33 | int (*prevalidate_phy_mode)(struct ocelot *ocelot, int port, |
| 34 | phy_interface_t phy_mode); |
| 35 | int (*port_setup_tc)(struct dsa_switch *ds, int port, |
| 36 | enum tc_setup_type type, void *type_data); |
| 37 | void (*port_sched_speed_set)(struct ocelot *ocelot, int port, |
| 38 | u32 speed); |
| 39 | void (*xmit_template_populate)(struct ocelot *ocelot, int port); |
| 40 | }; |
| 41 | |
| 42 | extern const struct dsa_switch_ops felix_switch_ops; |
| 43 | |
| 44 | /* DSA glue / front-end for struct ocelot */ |
| 45 | struct felix { |
| 46 | struct dsa_switch *ds; |
| 47 | const struct felix_info *info; |
| 48 | struct ocelot ocelot; |
| 49 | struct mii_bus *imdio; |
| 50 | struct lynx_pcs **pcs; |
| 51 | resource_size_t switch_base; |
| 52 | resource_size_t imdio_base; |
| 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 |