| .. | .. |
|---|
| 29 | 29 | |
|---|
| 30 | 30 | struct b53_device; |
|---|
| 31 | 31 | struct net_device; |
|---|
| 32 | +struct phylink_link_state; |
|---|
| 32 | 33 | |
|---|
| 33 | 34 | struct b53_io_ops { |
|---|
| 34 | 35 | int (*read8)(struct b53_device *dev, u8 page, u8 reg, u8 *value); |
|---|
| .. | .. |
|---|
| 43 | 44 | int (*write64)(struct b53_device *dev, u8 page, u8 reg, u64 value); |
|---|
| 44 | 45 | int (*phy_read16)(struct b53_device *dev, int addr, int reg, u16 *value); |
|---|
| 45 | 46 | int (*phy_write16)(struct b53_device *dev, int addr, int reg, u16 value); |
|---|
| 47 | + int (*irq_enable)(struct b53_device *dev, int port); |
|---|
| 48 | + void (*irq_disable)(struct b53_device *dev, int port); |
|---|
| 49 | + u8 (*serdes_map_lane)(struct b53_device *dev, int port); |
|---|
| 50 | + int (*serdes_link_state)(struct b53_device *dev, int port, |
|---|
| 51 | + struct phylink_link_state *state); |
|---|
| 52 | + void (*serdes_config)(struct b53_device *dev, int port, |
|---|
| 53 | + unsigned int mode, |
|---|
| 54 | + const struct phylink_link_state *state); |
|---|
| 55 | + void (*serdes_an_restart)(struct b53_device *dev, int port); |
|---|
| 56 | + void (*serdes_link_set)(struct b53_device *dev, int port, |
|---|
| 57 | + unsigned int mode, phy_interface_t interface, |
|---|
| 58 | + bool link_up); |
|---|
| 59 | + void (*serdes_phylink_validate)(struct b53_device *dev, int port, |
|---|
| 60 | + unsigned long *supported, |
|---|
| 61 | + struct phylink_link_state *state); |
|---|
| 46 | 62 | }; |
|---|
| 63 | + |
|---|
| 64 | +#define B53_INVALID_LANE 0xff |
|---|
| 47 | 65 | |
|---|
| 48 | 66 | enum { |
|---|
| 49 | 67 | BCM5325_DEVICE_ID = 0x25, |
|---|
| .. | .. |
|---|
| 73 | 91 | struct b53_port { |
|---|
| 74 | 92 | u16 vlan_ctl_mask; |
|---|
| 75 | 93 | struct ethtool_eee eee; |
|---|
| 76 | | - u16 pvid; |
|---|
| 77 | 94 | }; |
|---|
| 78 | 95 | |
|---|
| 79 | 96 | struct b53_vlan { |
|---|
| .. | .. |
|---|
| 99 | 116 | u8 jumbo_pm_reg; |
|---|
| 100 | 117 | u8 jumbo_size_reg; |
|---|
| 101 | 118 | int reset_gpio; |
|---|
| 102 | | - u8 num_arl_entries; |
|---|
| 119 | + u8 num_arl_bins; |
|---|
| 120 | + u16 num_arl_buckets; |
|---|
| 121 | + enum dsa_tag_protocol tag_protocol; |
|---|
| 103 | 122 | |
|---|
| 104 | 123 | /* used ports mask */ |
|---|
| 105 | 124 | u16 enabled_ports; |
|---|
| 125 | + unsigned int imp_port; |
|---|
| 106 | 126 | unsigned int cpu_port; |
|---|
| 107 | 127 | |
|---|
| 108 | 128 | /* connect specific data */ |
|---|
| 109 | 129 | u8 current_page; |
|---|
| 110 | 130 | struct device *dev; |
|---|
| 131 | + u8 serdes_lane; |
|---|
| 111 | 132 | |
|---|
| 112 | 133 | /* Master MDIO bus we got probed from */ |
|---|
| 113 | 134 | struct mii_bus *bus; |
|---|
| .. | .. |
|---|
| 120 | 141 | unsigned int num_vlans; |
|---|
| 121 | 142 | struct b53_vlan *vlans; |
|---|
| 122 | 143 | bool vlan_enabled; |
|---|
| 123 | | - bool vlan_filtering_enabled; |
|---|
| 124 | 144 | unsigned int num_ports; |
|---|
| 125 | 145 | struct b53_port *ports; |
|---|
| 126 | 146 | }; |
|---|
| .. | .. |
|---|
| 193 | 213 | #define B53_CPU_PORT_25 5 |
|---|
| 194 | 214 | #define B53_CPU_PORT 8 |
|---|
| 195 | 215 | |
|---|
| 216 | +static inline unsigned int b53_max_arl_entries(struct b53_device *dev) |
|---|
| 217 | +{ |
|---|
| 218 | + return dev->num_arl_buckets * dev->num_arl_bins; |
|---|
| 219 | +} |
|---|
| 220 | + |
|---|
| 196 | 221 | struct b53_device *b53_switch_alloc(struct device *base, |
|---|
| 197 | 222 | const struct b53_io_ops *ops, |
|---|
| 198 | 223 | void *priv); |
|---|
| .. | .. |
|---|
| 232 | 257 | b53_build_op(write64, u64); |
|---|
| 233 | 258 | |
|---|
| 234 | 259 | struct b53_arl_entry { |
|---|
| 235 | | - u8 port; |
|---|
| 260 | + u16 port; |
|---|
| 236 | 261 | u8 mac[ETH_ALEN]; |
|---|
| 237 | 262 | u16 vid; |
|---|
| 238 | 263 | u8 is_valid:1; |
|---|
| .. | .. |
|---|
| 301 | 326 | void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *bridge); |
|---|
| 302 | 327 | void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state); |
|---|
| 303 | 328 | void b53_br_fast_age(struct dsa_switch *ds, int port); |
|---|
| 304 | | -int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering); |
|---|
| 329 | +int b53_br_egress_floods(struct dsa_switch *ds, int port, |
|---|
| 330 | + bool unicast, bool multicast); |
|---|
| 331 | +int b53_setup_devlink_resources(struct dsa_switch *ds); |
|---|
| 332 | +void b53_port_event(struct dsa_switch *ds, int port); |
|---|
| 333 | +void b53_phylink_validate(struct dsa_switch *ds, int port, |
|---|
| 334 | + unsigned long *supported, |
|---|
| 335 | + struct phylink_link_state *state); |
|---|
| 336 | +int b53_phylink_mac_link_state(struct dsa_switch *ds, int port, |
|---|
| 337 | + struct phylink_link_state *state); |
|---|
| 338 | +void b53_phylink_mac_config(struct dsa_switch *ds, int port, |
|---|
| 339 | + unsigned int mode, |
|---|
| 340 | + const struct phylink_link_state *state); |
|---|
| 341 | +void b53_phylink_mac_an_restart(struct dsa_switch *ds, int port); |
|---|
| 342 | +void b53_phylink_mac_link_down(struct dsa_switch *ds, int port, |
|---|
| 343 | + unsigned int mode, |
|---|
| 344 | + phy_interface_t interface); |
|---|
| 345 | +void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, |
|---|
| 346 | + unsigned int mode, |
|---|
| 347 | + phy_interface_t interface, |
|---|
| 348 | + struct phy_device *phydev, |
|---|
| 349 | + int speed, int duplex, |
|---|
| 350 | + bool tx_pause, bool rx_pause); |
|---|
| 351 | +int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, |
|---|
| 352 | + struct switchdev_trans *trans); |
|---|
| 305 | 353 | int b53_vlan_prepare(struct dsa_switch *ds, int port, |
|---|
| 306 | 354 | const struct switchdev_obj_port_vlan *vlan); |
|---|
| 307 | 355 | void b53_vlan_add(struct dsa_switch *ds, int port, |
|---|
| .. | .. |
|---|
| 314 | 362 | const unsigned char *addr, u16 vid); |
|---|
| 315 | 363 | int b53_fdb_dump(struct dsa_switch *ds, int port, |
|---|
| 316 | 364 | dsa_fdb_dump_cb_t *cb, void *data); |
|---|
| 365 | +int b53_mdb_prepare(struct dsa_switch *ds, int port, |
|---|
| 366 | + const struct switchdev_obj_port_mdb *mdb); |
|---|
| 367 | +void b53_mdb_add(struct dsa_switch *ds, int port, |
|---|
| 368 | + const struct switchdev_obj_port_mdb *mdb); |
|---|
| 369 | +int b53_mdb_del(struct dsa_switch *ds, int port, |
|---|
| 370 | + const struct switchdev_obj_port_mdb *mdb); |
|---|
| 317 | 371 | int b53_mirror_add(struct dsa_switch *ds, int port, |
|---|
| 318 | 372 | struct dsa_mall_mirror_tc_entry *mirror, bool ingress); |
|---|
| 319 | | -enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port); |
|---|
| 373 | +enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port, |
|---|
| 374 | + enum dsa_tag_protocol mprot); |
|---|
| 320 | 375 | void b53_mirror_del(struct dsa_switch *ds, int port, |
|---|
| 321 | 376 | struct dsa_mall_mirror_tc_entry *mirror); |
|---|
| 322 | 377 | int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy); |
|---|
| 323 | | -void b53_disable_port(struct dsa_switch *ds, int port, struct phy_device *phy); |
|---|
| 378 | +void b53_disable_port(struct dsa_switch *ds, int port); |
|---|
| 324 | 379 | void b53_brcm_hdr_setup(struct dsa_switch *ds, int port); |
|---|
| 325 | 380 | void b53_eee_enable_set(struct dsa_switch *ds, int port, bool enable); |
|---|
| 326 | 381 | int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy); |
|---|