]> Git Repo - J-linux.git/blob - drivers/net/dsa/ocelot/felix.h
Merge branch 'work.sparc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[J-linux.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
9 /* Platform-specific information */
10 struct felix_info {
11         const struct resource           *target_io_res;
12         const struct resource           *port_io_res;
13         const struct resource           *imdio_res;
14         const struct reg_field          *regfields;
15         const u32 *const                *map;
16         const struct ocelot_ops         *ops;
17         int                             num_mact_rows;
18         const struct ocelot_stat_layout *stats_layout;
19         unsigned int                    num_stats;
20         int                             num_ports;
21         int                             num_tx_queues;
22         struct vcap_props               *vcap;
23         int                             switch_pci_bar;
24         int                             imdio_pci_bar;
25         const struct ptp_clock_info     *ptp_caps;
26
27         /* Some Ocelot switches are integrated into the SoC without the
28          * extraction IRQ line connected to the ARM GIC. By enabling this
29          * workaround, the few packets that are delivered to the CPU port
30          * module (currently only PTP) are copied not only to the hardware CPU
31          * port module, but also to the 802.1Q Ethernet CPU port, and polling
32          * the extraction registers is triggered once the DSA tagger sees a PTP
33          * frame. The Ethernet frame is only used as a notification: it is
34          * dropped, and the original frame is extracted over MMIO and annotated
35          * with the RX timestamp.
36          */
37         bool                            quirk_no_xtr_irq;
38
39         int     (*mdio_bus_alloc)(struct ocelot *ocelot);
40         void    (*mdio_bus_free)(struct ocelot *ocelot);
41         void    (*phylink_validate)(struct ocelot *ocelot, int port,
42                                     unsigned long *supported,
43                                     struct phylink_link_state *state);
44         int     (*prevalidate_phy_mode)(struct ocelot *ocelot, int port,
45                                         phy_interface_t phy_mode);
46         int     (*port_setup_tc)(struct dsa_switch *ds, int port,
47                                  enum tc_setup_type type, void *type_data);
48         void    (*port_sched_speed_set)(struct ocelot *ocelot, int port,
49                                         u32 speed);
50 };
51
52 extern const struct dsa_switch_ops felix_switch_ops;
53
54 /* DSA glue / front-end for struct ocelot */
55 struct felix {
56         struct dsa_switch               *ds;
57         const struct felix_info         *info;
58         struct ocelot                   ocelot;
59         struct mii_bus                  *imdio;
60         struct lynx_pcs                 **pcs;
61         resource_size_t                 switch_base;
62         resource_size_t                 imdio_base;
63         struct dsa_8021q_context        *dsa_8021q_ctx;
64         enum dsa_tag_protocol           tag_proto;
65 };
66
67 struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port);
68 int felix_netdev_to_port(struct net_device *dev);
69
70 #endif
This page took 0.03319 seconds and 4 git commands to generate.