0001
0002
0003
0004 #ifndef _MSCC_FELIX_H
0005 #define _MSCC_FELIX_H
0006
0007 #define ocelot_to_felix(o) container_of((o), struct felix, ocelot)
0008 #define FELIX_MAC_QUIRKS OCELOT_QUIRK_PCS_PERFORMS_RATE_ADAPTATION
0009
0010 #define OCELOT_PORT_MODE_INTERNAL BIT(0)
0011 #define OCELOT_PORT_MODE_SGMII BIT(1)
0012 #define OCELOT_PORT_MODE_QSGMII BIT(2)
0013 #define OCELOT_PORT_MODE_2500BASEX BIT(3)
0014 #define OCELOT_PORT_MODE_USXGMII BIT(4)
0015 #define OCELOT_PORT_MODE_1000BASEX BIT(5)
0016
0017
0018 struct felix_info {
0019 const struct resource *target_io_res;
0020 const struct resource *port_io_res;
0021 const struct resource *imdio_res;
0022 const struct reg_field *regfields;
0023 const u32 *const *map;
0024 const struct ocelot_ops *ops;
0025 const u32 *port_modes;
0026 int num_mact_rows;
0027 const struct ocelot_stat_layout *stats_layout;
0028 int num_ports;
0029 int num_tx_queues;
0030 struct vcap_props *vcap;
0031 u16 vcap_pol_base;
0032 u16 vcap_pol_max;
0033 u16 vcap_pol_base2;
0034 u16 vcap_pol_max2;
0035 const struct ptp_clock_info *ptp_caps;
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047 bool quirk_no_xtr_irq;
0048
0049 int (*mdio_bus_alloc)(struct ocelot *ocelot);
0050 void (*mdio_bus_free)(struct ocelot *ocelot);
0051 void (*phylink_validate)(struct ocelot *ocelot, int port,
0052 unsigned long *supported,
0053 struct phylink_link_state *state);
0054 int (*port_setup_tc)(struct dsa_switch *ds, int port,
0055 enum tc_setup_type type, void *type_data);
0056 void (*tas_guard_bands_update)(struct ocelot *ocelot, int port);
0057 void (*port_sched_speed_set)(struct ocelot *ocelot, int port,
0058 u32 speed);
0059 struct regmap *(*init_regmap)(struct ocelot *ocelot,
0060 struct resource *res);
0061 };
0062
0063
0064
0065
0066
0067
0068
0069
0070 struct felix_tag_proto_ops {
0071 int (*setup)(struct dsa_switch *ds);
0072 void (*teardown)(struct dsa_switch *ds);
0073 unsigned long (*get_host_fwd_mask)(struct dsa_switch *ds);
0074 };
0075
0076 extern const struct dsa_switch_ops felix_switch_ops;
0077
0078
0079 struct felix {
0080 struct dsa_switch *ds;
0081 const struct felix_info *info;
0082 struct ocelot ocelot;
0083 struct mii_bus *imdio;
0084 struct phylink_pcs **pcs;
0085 resource_size_t switch_base;
0086 resource_size_t imdio_base;
0087 enum dsa_tag_protocol tag_proto;
0088 const struct felix_tag_proto_ops *tag_proto_ops;
0089 struct kthread_worker *xmit_worker;
0090 unsigned long host_flood_uc_mask;
0091 unsigned long host_flood_mc_mask;
0092 };
0093
0094 struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port);
0095 int felix_netdev_to_port(struct net_device *dev);
0096
0097 #endif