/** * enum mv88e6xxx_edsa_support - Ethertype DSA tag support level * @MV88E6XXX_EDSA_UNSUPPORTED: Device has no support for EDSA tags * @MV88E6XXX_EDSA_UNDOCUMENTED: Documentation indicates that * egressing FORWARD frames with an EDSA * tag is reserved for future use, but * empirical data shows that this mode * is supported. * @MV88E6XXX_EDSA_SUPPORTED: EDSA tags are fully supported.
*/ enum mv88e6xxx_edsa_support {
MV88E6XXX_EDSA_UNSUPPORTED = 0,
MV88E6XXX_EDSA_UNDOCUMENTED,
MV88E6XXX_EDSA_SUPPORTED,
};
/* Mark certain ports as invalid. This is required for example for the * MV88E6220 (which is in general a MV88E6250 with 7 ports) but the * ports 2-4 are not routet to pins.
*/ unsignedint invalid_port_mask; /* Multi-chip Addressing Mode. * Some chips respond to only 2 registers of its own SMI device address * when it is non-zero, and use indirect access to internal registers.
*/ bool multi_chip; /* Dual-chip Addressing Mode * Some chips respond to only half of the 32 SMI addresses, * allowing two to coexist on the same SMI interface.
*/ bool dual_chip;
enum mv88e6xxx_edsa_support edsa_support;
/* Mask for FromPort and ToPort value of PortVec used in ATU Move * operation. 0 means that the ATU Move operation is not supported.
*/
u8 atu_move_port_mask; conststruct mv88e6xxx_ops *ops;
/* Supports PTP */ bool ptp_support;
/* Internal PHY start index. 0 means that internal PHYs range starts at * port 0, 1 means internal PHYs range starts at port 1, etc
*/ unsignedint internal_phys_offset;
};
/* Currently configured tagging protocol */ enum dsa_tag_protocol tag_protocol;
/* The dsa_switch this private structure is related to */ struct dsa_switch *ds;
/* The device this structure is associated to */ struct device *dev;
/* This mutex protects the access to the switch registers */ struct mutex reg_lock;
/* The MII bus and the address on the bus that is used to * communication with the switch
*/ conststruct mv88e6xxx_bus_ops *smi_ops; struct mii_bus *bus; int sw_addr;
/* Handles automatic disabling and re-enabling of the PHY * polling unit.
*/ conststruct mv88e6xxx_bus_ops *phy_ops; struct mutex ppu_mutex; int ppu_disabled; struct work_struct ppu_work; struct timer_list ppu_timer;
/* This mutex serialises access to the statistics unit. * Hold this mutex over snapshot + dump sequences.
*/ struct mutex stats_mutex;
/* A switch may have a GPIO line tied to its reset pin. Parse * this from the device tree, and use it before performing * switch soft reset.
*/ struct gpio_desc *reset;
/* set to size of eeprom if supported by the switch */
u32 eeprom_len;
/* List of mdio busses */ struct list_head mdios;
/* Policy Control List IDs and rules */ struct idr policies;
/* There can be two interrupt controllers, which are chained * off a GPIO as interrupt source
*/ struct mv88e6xxx_irq g1_irq; struct mv88e6xxx_irq g2_irq; int irq; char irq_name[64]; int device_irq; char device_irq_name[64]; int watchdog_irq; char watchdog_irq_name[64];
int atu_prob_irq; char atu_prob_irq_name[64]; int vtu_prob_irq; char vtu_prob_irq_name[64]; struct kthread_worker *kworker; struct kthread_delayed_work irq_poll_work;
/* GPIO resources */
u8 gpio_data[2];
/* This cyclecounter abstracts the switch PTP time. * reg_lock must be held for any operation that read()s.
*/ struct cyclecounter tstamp_cc; struct timecounter tstamp_tc; struct delayed_work overflow_work; conststruct mv88e6xxx_cc_coeffs *cc_coeffs;
struct mv88e6xxx_bus_ops { int (*read)(struct mv88e6xxx_chip *chip, int addr, int reg, u16 *val); int (*write)(struct mv88e6xxx_chip *chip, int addr, int reg, u16 val); int (*init)(struct mv88e6xxx_chip *chip);
};
struct mv88e6xxx_ops { /* Switch Setup Errata, called early in the switch setup to * allow any errata actions to be performed
*/ int (*setup_errata)(struct mv88e6xxx_chip *chip);
int (*ieee_pri_map)(struct mv88e6xxx_chip *chip); int (*ip_pri_map)(struct mv88e6xxx_chip *chip);
/* Ingress Rate Limit unit (IRL) operations */ int (*irl_init_all)(struct mv88e6xxx_chip *chip, int port);
int (*get_eeprom)(struct mv88e6xxx_chip *chip, struct ethtool_eeprom *eeprom, u8 *data); int (*set_eeprom)(struct mv88e6xxx_chip *chip, struct ethtool_eeprom *eeprom, u8 *data);
int (*set_switch_mac)(struct mv88e6xxx_chip *chip, u8 *addr);
int (*phy_read)(struct mv88e6xxx_chip *chip, struct mii_bus *bus, int addr, int reg, u16 *val); int (*phy_write)(struct mv88e6xxx_chip *chip, struct mii_bus *bus, int addr, int reg, u16 val);
int (*phy_read_c45)(struct mv88e6xxx_chip *chip, struct mii_bus *bus, int addr, int devad, int reg, u16 *val); int (*phy_write_c45)(struct mv88e6xxx_chip *chip, struct mii_bus *bus, int addr, int devad, int reg, u16 val);
/* Priority Override Table operations */ int (*pot_clear)(struct mv88e6xxx_chip *chip);
/* PHY Polling Unit (PPU) operations */ int (*ppu_enable)(struct mv88e6xxx_chip *chip); int (*ppu_disable)(struct mv88e6xxx_chip *chip);
/* Additional handlers to run before and after hard reset, to make sure * that the switch and EEPROM are in a good state.
*/ int (*hardware_reset_pre)(struct mv88e6xxx_chip *chip); int (*hardware_reset_post)(struct mv88e6xxx_chip *chip);
/* Switch Software Reset */ int (*reset)(struct mv88e6xxx_chip *chip);
/* RGMII Receive/Transmit Timing Control * Add delay on PHY_INTERFACE_MODE_RGMII_*ID, no delay otherwise.
*/ int (*port_set_rgmii_delay)(struct mv88e6xxx_chip *chip, int port,
phy_interface_t mode);
/* Port's MAC link state * Use LINK_FORCED_UP or LINK_FORCED_DOWN to force link up or down, * or LINK_UNFORCED for normal link detection.
*/ int (*port_set_link)(struct mv88e6xxx_chip *chip, int port, int link);
/* Synchronise the port link state with that of the SERDES
*/ int (*port_sync_link)(struct mv88e6xxx_chip *chip, int port, unsignedint mode, bool isup);
#define PAUSE_ON 1 #define PAUSE_OFF 0
/* Enable/disable sending Pause */ int (*port_set_pause)(struct mv88e6xxx_chip *chip, int port, int pause);
/* Port's MAC speed (in Mbps) and MAC duplex mode * * Depending on the chip, 10, 100, 200, 1000, 2500, 10000 are valid. * Use SPEED_UNFORCED for normal detection. * * Use DUPLEX_HALF or DUPLEX_FULL to force half or full duplex, * or DUPLEX_UNFORCED for normal duplex detection.
*/ int (*port_set_speed_duplex)(struct mv88e6xxx_chip *chip, int port, int speed, int duplex);
/* What interface mode should be used for maximum speed? */
phy_interface_t (*port_max_speed_mode)(struct mv88e6xxx_chip *chip, int port);
int (*port_tag_remap)(struct mv88e6xxx_chip *chip, int port);
int (*port_set_policy)(struct mv88e6xxx_chip *chip, int port, enum mv88e6xxx_policy_mapping mapping, enum mv88e6xxx_policy_action action);
int (*port_set_frame_mode)(struct mv88e6xxx_chip *chip, int port, enum mv88e6xxx_frame_mode mode); int (*port_set_ucast_flood)(struct mv88e6xxx_chip *chip, int port, bool unicast); int (*port_set_mcast_flood)(struct mv88e6xxx_chip *chip, int port, bool multicast); int (*port_set_ether_type)(struct mv88e6xxx_chip *chip, int port,
u16 etype); int (*port_set_jumbo_size)(struct mv88e6xxx_chip *chip, int port,
size_t size);
int (*port_egress_rate_limiting)(struct mv88e6xxx_chip *chip, int port); int (*port_pause_limit)(struct mv88e6xxx_chip *chip, int port, u8 in,
u8 out); int (*port_disable_learn_limit)(struct mv88e6xxx_chip *chip, int port); int (*port_disable_pri_override)(struct mv88e6xxx_chip *chip, int port); int (*port_setup_message_port)(struct mv88e6xxx_chip *chip, int port);
/* CMODE control what PHY mode the MAC will use, eg. SGMII, RGMII, etc. * Some chips allow this to be configured on specific ports.
*/ int (*port_set_cmode)(struct mv88e6xxx_chip *chip, int port,
phy_interface_t mode); int (*port_get_cmode)(struct mv88e6xxx_chip *chip, int port, u8 *cmode);
/* LED control */ int (*port_setup_leds)(struct mv88e6xxx_chip *chip, int port);
/* Some devices have a per port register indicating what is * the upstream port this port should forward to.
*/ int (*port_set_upstream_port)(struct mv88e6xxx_chip *chip, int port, int upstream_port);
/* Snapshot the statistics for a port. The statistics can then * be read back a leisure but still with a consistent view.
*/ int (*stats_snapshot)(struct mv88e6xxx_chip *chip, int port);
/* Set the histogram mode for statistics, when the control registers * are separated out of the STATS_OP register.
*/ int (*stats_set_histogram)(struct mv88e6xxx_chip *chip);
/* Return the number of strings describing statistics */ int (*stats_get_sset_count)(struct mv88e6xxx_chip *chip); void (*stats_get_strings)(struct mv88e6xxx_chip *chip, uint8_t **data);
size_t (*stats_get_stat)(struct mv88e6xxx_chip *chip, int port, conststruct mv88e6xxx_hw_stat *stat,
uint64_t *data); int (*set_cpu_port)(struct mv88e6xxx_chip *chip, int port); int (*set_egress_port)(struct mv88e6xxx_chip *chip, enum mv88e6xxx_egress_direction direction, int port);
/* Statistics from the SERDES interface */ int (*serdes_get_sset_count)(struct mv88e6xxx_chip *chip, int port); int (*serdes_get_strings)(struct mv88e6xxx_chip *chip, int port,
uint8_t **data);
size_t (*serdes_get_stats)(struct mv88e6xxx_chip *chip, int port,
uint64_t *data);
/* SERDES registers for ethtool */ int (*serdes_get_regs_len)(struct mv88e6xxx_chip *chip, int port); void (*serdes_get_regs)(struct mv88e6xxx_chip *chip, int port, void *_p);
/* SERDES SGMII/Fiber Output Amplitude */ int (*serdes_set_tx_amplitude)(struct mv88e6xxx_chip *chip, int port, int val);
/* Address Translation Unit operations */ int (*atu_get_hash)(struct mv88e6xxx_chip *chip, u8 *hash); int (*atu_set_hash)(struct mv88e6xxx_chip *chip, u8 hash);
/* VLAN Translation Unit operations */ int (*vtu_getnext)(struct mv88e6xxx_chip *chip, struct mv88e6xxx_vtu_entry *entry); int (*vtu_loadpurge)(struct mv88e6xxx_chip *chip, struct mv88e6xxx_vtu_entry *entry);
/* Spanning Tree Unit operations */ int (*stu_getnext)(struct mv88e6xxx_chip *chip, struct mv88e6xxx_stu_entry *entry); int (*stu_loadpurge)(struct mv88e6xxx_chip *chip, struct mv88e6xxx_stu_entry *entry);
/* Max Frame Size */ int (*set_max_frame_size)(struct mv88e6xxx_chip *chip, int mtu);
};
struct mv88e6xxx_irq_ops { /* Action to be performed when the interrupt happens */ int (*irq_action)(struct mv88e6xxx_chip *chip, int irq); /* Setup the hardware to generate the interrupt */ int (*irq_setup)(struct mv88e6xxx_chip *chip); /* Reset the hardware to stop generating the interrupt */ void (*irq_free)(struct mv88e6xxx_chip *chip);
};
struct mv88e6xxx_gpio_ops { /* Get/set data on GPIO pin */ int (*get_data)(struct mv88e6xxx_chip *chip, unsignedint pin); int (*set_data)(struct mv88e6xxx_chip *chip, unsignedint pin, int value);
/* get/set GPIO direction */ int (*get_dir)(struct mv88e6xxx_chip *chip, unsignedint pin); int (*set_dir)(struct mv88e6xxx_chip *chip, unsignedint pin, bool input);
/* get/set GPIO pin control */ int (*get_pctl)(struct mv88e6xxx_chip *chip, unsignedint pin, int *func); int (*set_pctl)(struct mv88e6xxx_chip *chip, unsignedint pin, int func);
};
struct mv88e6xxx_avb_ops { /* Access port-scoped Precision Time Protocol registers */ int (*port_ptp_read)(struct mv88e6xxx_chip *chip, int port, int addr,
u16 *data, int len); int (*port_ptp_write)(struct mv88e6xxx_chip *chip, int port, int addr,
u16 data);
/* Access global Precision Time Protocol registers */ int (*ptp_read)(struct mv88e6xxx_chip *chip, int addr, u16 *data, int len); int (*ptp_write)(struct mv88e6xxx_chip *chip, int addr, u16 data);
/* Access global Time Application Interface registers */ int (*tai_read)(struct mv88e6xxx_chip *chip, int addr, u16 *data, int len); int (*tai_write)(struct mv88e6xxx_chip *chip, int addr, u16 data);
};
struct mv88e6xxx_ptp_ops {
u64 (*clock_read)(struct cyclecounter *cc); int (*ptp_enable)(struct ptp_clock_info *ptp, struct ptp_clock_request *rq, int on); int (*ptp_verify)(struct ptp_clock_info *ptp, unsignedint pin, enum ptp_pin_function func, unsignedint chan); void (*event_work)(struct work_struct *ugly); int (*port_enable)(struct mv88e6xxx_chip *chip, int port); int (*port_disable)(struct mv88e6xxx_chip *chip, int port); int (*global_enable)(struct mv88e6xxx_chip *chip); int (*global_disable)(struct mv88e6xxx_chip *chip); int (*set_ptp_cpu_port)(struct mv88e6xxx_chip *chip, int port); int n_ext_ts; int arr0_sts_reg; int arr1_sts_reg; int dep_sts_reg;
u32 rx_filters;
};
struct mv88e6xxx_pcs_ops { int (*pcs_init)(struct mv88e6xxx_chip *chip, int port); void (*pcs_teardown)(struct mv88e6xxx_chip *chip, int port); struct phylink_pcs *(*pcs_select)(struct mv88e6xxx_chip *chip, int port,
phy_interface_t mode);
int mv88e6xxx_read(struct mv88e6xxx_chip *chip, int addr, int reg, u16 *val); int mv88e6xxx_write(struct mv88e6xxx_chip *chip, int addr, int reg, u16 val); int mv88e6xxx_wait_mask(struct mv88e6xxx_chip *chip, int addr, int reg,
u16 mask, u16 val); int mv88e6xxx_wait_bit(struct mv88e6xxx_chip *chip, int addr, int reg, int bit, int val); struct mii_bus *mv88e6xxx_default_mdio_bus(struct mv88e6xxx_chip *chip);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.