1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright 2019 NXP Semiconductors
7 #define ocelot_to_felix(o) container_of((o), struct felix, ocelot)
8 #define FELIX_MAC_QUIRKS OCELOT_QUIRK_PCS_PERFORMS_RATE_ADAPTATION
10 /* Platform-specific information */
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;
19 const struct ocelot_stat_layout *stats_layout;
20 unsigned int num_stats;
23 struct vcap_props *vcap;
26 const struct ptp_clock_info *ptp_caps;
28 /* Some Ocelot switches are integrated into the SoC without the
29 * extraction IRQ line connected to the ARM GIC. By enabling this
30 * workaround, the few packets that are delivered to the CPU port
31 * module (currently only PTP) are copied not only to the hardware CPU
32 * port module, but also to the 802.1Q Ethernet CPU port, and polling
33 * the extraction registers is triggered once the DSA tagger sees a PTP
34 * frame. The Ethernet frame is only used as a notification: it is
35 * dropped, and the original frame is extracted over MMIO and annotated
36 * with the RX timestamp.
38 bool quirk_no_xtr_irq;
40 int (*mdio_bus_alloc)(struct ocelot *ocelot);
41 void (*mdio_bus_free)(struct ocelot *ocelot);
42 void (*phylink_validate)(struct ocelot *ocelot, int port,
43 unsigned long *supported,
44 struct phylink_link_state *state);
45 int (*prevalidate_phy_mode)(struct ocelot *ocelot, int port,
46 phy_interface_t phy_mode);
47 int (*port_setup_tc)(struct dsa_switch *ds, int port,
48 enum tc_setup_type type, void *type_data);
49 void (*port_sched_speed_set)(struct ocelot *ocelot, int port,
53 extern const struct dsa_switch_ops felix_switch_ops;
55 /* DSA glue / front-end for struct ocelot */
57 struct dsa_switch *ds;
58 const struct felix_info *info;
60 struct mii_bus *imdio;
61 struct lynx_pcs **pcs;
62 resource_size_t switch_base;
63 resource_size_t imdio_base;
64 enum dsa_tag_protocol tag_proto;
67 struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port);
68 int felix_netdev_to_port(struct net_device *dev);