807f18b748479abe09a1d157271d4686d6e2b54d
[linux-2.6-microblaze.git] / drivers / net / dsa / ocelot / felix.h
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         const struct resource           *target_io_res;
13         const struct resource           *port_io_res;
14         const 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         int                             num_tx_queues;
24         struct vcap_field               *vcap_is2_keys;
25         struct vcap_field               *vcap_is2_actions;
26         const struct vcap_props         *vcap;
27         int                             switch_pci_bar;
28         int                             imdio_pci_bar;
29         int     (*mdio_bus_alloc)(struct ocelot *ocelot);
30         void    (*mdio_bus_free)(struct ocelot *ocelot);
31         void    (*phylink_validate)(struct ocelot *ocelot, int port,
32                                     unsigned long *supported,
33                                     struct phylink_link_state *state);
34         int     (*prevalidate_phy_mode)(struct ocelot *ocelot, int port,
35                                         phy_interface_t phy_mode);
36         int     (*port_setup_tc)(struct dsa_switch *ds, int port,
37                                  enum tc_setup_type type, void *type_data);
38         void    (*port_sched_speed_set)(struct ocelot *ocelot, int port,
39                                         u32 speed);
40         void    (*xmit_template_populate)(struct ocelot *ocelot, int port);
41 };
42
43 extern const struct dsa_switch_ops felix_switch_ops;
44 extern struct pci_driver felix_vsc9959_pci_driver;
45 extern struct platform_driver seville_vsc9953_driver;
46
47 /* DSA glue / front-end for struct ocelot */
48 struct felix {
49         struct dsa_switch               *ds;
50         const struct felix_info         *info;
51         struct ocelot                   ocelot;
52         struct mii_bus                  *imdio;
53         struct lynx_pcs                 **pcs;
54         resource_size_t                 switch_base;
55         resource_size_t                 imdio_base;
56 };
57
58 void vsc9959_mdio_bus_free(struct ocelot *ocelot);
59
60 #endif