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