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