xref: /openbmc/linux/drivers/net/dsa/ocelot/felix.h (revision 82df5b73)
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_field		*vcap_is2_keys;
25 	struct vcap_field		*vcap_is2_actions;
26 	const struct vcap_props		*vcap;
27 	int				switch_pci_bar;
28 	int				imdio_pci_bar;
29 	int	(*mdio_bus_alloc)(struct ocelot *ocelot);
30 	void	(*mdio_bus_free)(struct ocelot *ocelot);
31 	void	(*pcs_init)(struct ocelot *ocelot, int port,
32 			    unsigned int link_an_mode,
33 			    const struct phylink_link_state *state);
34 	void	(*pcs_an_restart)(struct ocelot *ocelot, int port);
35 	void	(*pcs_link_state)(struct ocelot *ocelot, int port,
36 				  struct phylink_link_state *state);
37 	int	(*prevalidate_phy_mode)(struct ocelot *ocelot, int port,
38 					phy_interface_t phy_mode);
39 	int	(*port_setup_tc)(struct dsa_switch *ds, int port,
40 				 enum tc_setup_type type, void *type_data);
41 	void	(*port_sched_speed_set)(struct ocelot *ocelot, int port,
42 					u32 speed);
43 };
44 
45 extern struct felix_info		felix_info_vsc9959;
46 
47 enum felix_instance {
48 	FELIX_INSTANCE_VSC9959		= 0,
49 };
50 
51 /* DSA glue / front-end for struct ocelot */
52 struct felix {
53 	struct dsa_switch		*ds;
54 	struct pci_dev			*pdev;
55 	struct felix_info		*info;
56 	struct ocelot			ocelot;
57 	struct mii_bus			*imdio;
58 	struct phy_device		**pcs;
59 };
60 
61 #endif
62