18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Copyright 2019 NXP Semiconductors
38c2ecf20Sopenharmony_ci */
48c2ecf20Sopenharmony_ci#ifndef _MSCC_FELIX_H
58c2ecf20Sopenharmony_ci#define _MSCC_FELIX_H
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#define ocelot_to_felix(o)		container_of((o), struct felix, ocelot)
88c2ecf20Sopenharmony_ci#define FELIX_NUM_TC			8
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/* Platform-specific information */
118c2ecf20Sopenharmony_cistruct felix_info {
128c2ecf20Sopenharmony_ci	const struct resource		*target_io_res;
138c2ecf20Sopenharmony_ci	const struct resource		*port_io_res;
148c2ecf20Sopenharmony_ci	const struct resource		*imdio_res;
158c2ecf20Sopenharmony_ci	const struct reg_field		*regfields;
168c2ecf20Sopenharmony_ci	const u32 *const		*map;
178c2ecf20Sopenharmony_ci	const struct ocelot_ops		*ops;
188c2ecf20Sopenharmony_ci	int				shared_queue_sz;
198c2ecf20Sopenharmony_ci	int				num_mact_rows;
208c2ecf20Sopenharmony_ci	const struct ocelot_stat_layout	*stats_layout;
218c2ecf20Sopenharmony_ci	unsigned int			num_stats;
228c2ecf20Sopenharmony_ci	int				num_ports;
238c2ecf20Sopenharmony_ci	int				num_tx_queues;
248c2ecf20Sopenharmony_ci	struct vcap_props		*vcap;
258c2ecf20Sopenharmony_ci	int				switch_pci_bar;
268c2ecf20Sopenharmony_ci	int				imdio_pci_bar;
278c2ecf20Sopenharmony_ci	const struct ptp_clock_info	*ptp_caps;
288c2ecf20Sopenharmony_ci	int	(*mdio_bus_alloc)(struct ocelot *ocelot);
298c2ecf20Sopenharmony_ci	void	(*mdio_bus_free)(struct ocelot *ocelot);
308c2ecf20Sopenharmony_ci	void	(*phylink_validate)(struct ocelot *ocelot, int port,
318c2ecf20Sopenharmony_ci				    unsigned long *supported,
328c2ecf20Sopenharmony_ci				    struct phylink_link_state *state);
338c2ecf20Sopenharmony_ci	int	(*prevalidate_phy_mode)(struct ocelot *ocelot, int port,
348c2ecf20Sopenharmony_ci					phy_interface_t phy_mode);
358c2ecf20Sopenharmony_ci	int	(*port_setup_tc)(struct dsa_switch *ds, int port,
368c2ecf20Sopenharmony_ci				 enum tc_setup_type type, void *type_data);
378c2ecf20Sopenharmony_ci	void	(*port_sched_speed_set)(struct ocelot *ocelot, int port,
388c2ecf20Sopenharmony_ci					u32 speed);
398c2ecf20Sopenharmony_ci	void	(*xmit_template_populate)(struct ocelot *ocelot, int port);
408c2ecf20Sopenharmony_ci};
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciextern const struct dsa_switch_ops felix_switch_ops;
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* DSA glue / front-end for struct ocelot */
458c2ecf20Sopenharmony_cistruct felix {
468c2ecf20Sopenharmony_ci	struct dsa_switch		*ds;
478c2ecf20Sopenharmony_ci	const struct felix_info		*info;
488c2ecf20Sopenharmony_ci	struct ocelot			ocelot;
498c2ecf20Sopenharmony_ci	struct mii_bus			*imdio;
508c2ecf20Sopenharmony_ci	struct lynx_pcs			**pcs;
518c2ecf20Sopenharmony_ci	resource_size_t			switch_base;
528c2ecf20Sopenharmony_ci	resource_size_t			imdio_base;
538c2ecf20Sopenharmony_ci};
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistruct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port);
568c2ecf20Sopenharmony_ciint felix_netdev_to_port(struct net_device *dev);
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#endif
59