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