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