| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Marvell 88E6xxx Switch Port Registers support |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Copyright (c) 2016-2017 Savoir-faire Linux Inc. |
|---|
| 7 | 8 | * Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 11 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 12 | | - * (at your option) any later version. |
|---|
| 13 | 9 | */ |
|---|
| 14 | 10 | |
|---|
| 15 | 11 | #ifndef _MV88E6XXX_PORT_H |
|---|
| .. | .. |
|---|
| 23 | 19 | #define MV88E6XXX_PORT_STS_MY_PAUSE 0x4000 |
|---|
| 24 | 20 | #define MV88E6XXX_PORT_STS_HD_FLOW 0x2000 |
|---|
| 25 | 21 | #define MV88E6XXX_PORT_STS_PHY_DETECT 0x1000 |
|---|
| 22 | +#define MV88E6250_PORT_STS_LINK 0x1000 |
|---|
| 23 | +#define MV88E6250_PORT_STS_PORTMODE_MASK 0x0f00 |
|---|
| 24 | +#define MV88E6250_PORT_STS_PORTMODE_PHY_10_HALF 0x0800 |
|---|
| 25 | +#define MV88E6250_PORT_STS_PORTMODE_PHY_100_HALF 0x0900 |
|---|
| 26 | +#define MV88E6250_PORT_STS_PORTMODE_PHY_10_FULL 0x0a00 |
|---|
| 27 | +#define MV88E6250_PORT_STS_PORTMODE_PHY_100_FULL 0x0b00 |
|---|
| 28 | +#define MV88E6250_PORT_STS_PORTMODE_MII_10_HALF 0x0c00 |
|---|
| 29 | +#define MV88E6250_PORT_STS_PORTMODE_MII_100_HALF 0x0d00 |
|---|
| 30 | +#define MV88E6250_PORT_STS_PORTMODE_MII_10_FULL 0x0e00 |
|---|
| 31 | +#define MV88E6250_PORT_STS_PORTMODE_MII_100_FULL 0x0f00 |
|---|
| 26 | 32 | #define MV88E6XXX_PORT_STS_LINK 0x0800 |
|---|
| 27 | 33 | #define MV88E6XXX_PORT_STS_DUPLEX 0x0400 |
|---|
| 28 | 34 | #define MV88E6XXX_PORT_STS_SPEED_MASK 0x0300 |
|---|
| .. | .. |
|---|
| 36 | 42 | #define MV88E6XXX_PORT_STS_TX_PAUSED 0x0020 |
|---|
| 37 | 43 | #define MV88E6XXX_PORT_STS_FLOW_CTL 0x0010 |
|---|
| 38 | 44 | #define MV88E6XXX_PORT_STS_CMODE_MASK 0x000f |
|---|
| 39 | | -#define MV88E6XXX_PORT_STS_CMODE_100BASE_X 0x0008 |
|---|
| 40 | | -#define MV88E6XXX_PORT_STS_CMODE_1000BASE_X 0x0009 |
|---|
| 45 | +#define MV88E6XXX_PORT_STS_CMODE_RGMII 0x0007 |
|---|
| 46 | +#define MV88E6XXX_PORT_STS_CMODE_100BASEX 0x0008 |
|---|
| 47 | +#define MV88E6XXX_PORT_STS_CMODE_1000BASEX 0x0009 |
|---|
| 41 | 48 | #define MV88E6XXX_PORT_STS_CMODE_SGMII 0x000a |
|---|
| 42 | 49 | #define MV88E6XXX_PORT_STS_CMODE_2500BASEX 0x000b |
|---|
| 43 | 50 | #define MV88E6XXX_PORT_STS_CMODE_XAUI 0x000c |
|---|
| .. | .. |
|---|
| 52 | 59 | #define MV88E6185_PORT_STS_CMODE_1000BASE_X 0x0005 |
|---|
| 53 | 60 | #define MV88E6185_PORT_STS_CMODE_PHY 0x0006 |
|---|
| 54 | 61 | #define MV88E6185_PORT_STS_CMODE_DISABLED 0x0007 |
|---|
| 55 | | -#define MV88E6XXX_PORT_STS_CMODE_INVALID 0xff |
|---|
| 56 | 62 | |
|---|
| 57 | 63 | /* Offset 0x01: MAC (or PCS or Physical) Control Register */ |
|---|
| 58 | 64 | #define MV88E6XXX_PORT_MAC_CTL 0x01 |
|---|
| .. | .. |
|---|
| 112 | 118 | #define MV88E6XXX_PORT_SWITCH_ID_PROD_6190 0x1900 |
|---|
| 113 | 119 | #define MV88E6XXX_PORT_SWITCH_ID_PROD_6191 0x1910 |
|---|
| 114 | 120 | #define MV88E6XXX_PORT_SWITCH_ID_PROD_6185 0x1a70 |
|---|
| 121 | +#define MV88E6XXX_PORT_SWITCH_ID_PROD_6220 0x2200 |
|---|
| 115 | 122 | #define MV88E6XXX_PORT_SWITCH_ID_PROD_6240 0x2400 |
|---|
| 123 | +#define MV88E6XXX_PORT_SWITCH_ID_PROD_6250 0x2500 |
|---|
| 116 | 124 | #define MV88E6XXX_PORT_SWITCH_ID_PROD_6290 0x2900 |
|---|
| 117 | 125 | #define MV88E6XXX_PORT_SWITCH_ID_PROD_6321 0x3100 |
|---|
| 118 | 126 | #define MV88E6XXX_PORT_SWITCH_ID_PROD_6141 0x3400 |
|---|
| .. | .. |
|---|
| 214 | 222 | #define MV88E6XXX_PORT_PRI_OVERRIDE 0x0d |
|---|
| 215 | 223 | |
|---|
| 216 | 224 | /* Offset 0x0E: Policy Control Register */ |
|---|
| 217 | | -#define MV88E6XXX_PORT_POLICY_CTL 0x0e |
|---|
| 225 | +#define MV88E6XXX_PORT_POLICY_CTL 0x0e |
|---|
| 226 | +#define MV88E6XXX_PORT_POLICY_CTL_DA_MASK 0xc000 |
|---|
| 227 | +#define MV88E6XXX_PORT_POLICY_CTL_SA_MASK 0x3000 |
|---|
| 228 | +#define MV88E6XXX_PORT_POLICY_CTL_VTU_MASK 0x0c00 |
|---|
| 229 | +#define MV88E6XXX_PORT_POLICY_CTL_ETYPE_MASK 0x0300 |
|---|
| 230 | +#define MV88E6XXX_PORT_POLICY_CTL_PPPOE_MASK 0x00c0 |
|---|
| 231 | +#define MV88E6XXX_PORT_POLICY_CTL_VBAS_MASK 0x0030 |
|---|
| 232 | +#define MV88E6XXX_PORT_POLICY_CTL_OPT82_MASK 0x000c |
|---|
| 233 | +#define MV88E6XXX_PORT_POLICY_CTL_UDP_MASK 0x0003 |
|---|
| 234 | +#define MV88E6XXX_PORT_POLICY_CTL_NORMAL 0x0000 |
|---|
| 235 | +#define MV88E6XXX_PORT_POLICY_CTL_MIRROR 0x0001 |
|---|
| 236 | +#define MV88E6XXX_PORT_POLICY_CTL_TRAP 0x0002 |
|---|
| 237 | +#define MV88E6XXX_PORT_POLICY_CTL_DISCARD 0x0003 |
|---|
| 218 | 238 | |
|---|
| 219 | 239 | /* Offset 0x0F: Port Special Ether Type */ |
|---|
| 220 | 240 | #define MV88E6XXX_PORT_ETH_TYPE 0x0f |
|---|
| .. | .. |
|---|
| 253 | 273 | #define MV88E6095_PORT_IEEE_PRIO_REMAP_4567 0x19 |
|---|
| 254 | 274 | |
|---|
| 255 | 275 | /* Offset 0x1a: Magic undocumented errata register */ |
|---|
| 256 | | -#define PORT_RESERVED_1A 0x1a |
|---|
| 257 | | -#define PORT_RESERVED_1A_BUSY BIT(15) |
|---|
| 258 | | -#define PORT_RESERVED_1A_WRITE BIT(14) |
|---|
| 259 | | -#define PORT_RESERVED_1A_READ 0 |
|---|
| 260 | | -#define PORT_RESERVED_1A_PORT_SHIFT 5 |
|---|
| 261 | | -#define PORT_RESERVED_1A_BLOCK (0xf << 10) |
|---|
| 262 | | -#define PORT_RESERVED_1A_CTRL_PORT 4 |
|---|
| 263 | | -#define PORT_RESERVED_1A_DATA_PORT 5 |
|---|
| 276 | +#define MV88E6XXX_PORT_RESERVED_1A 0x1a |
|---|
| 277 | +#define MV88E6XXX_PORT_RESERVED_1A_BUSY 0x8000 |
|---|
| 278 | +#define MV88E6XXX_PORT_RESERVED_1A_WRITE 0x4000 |
|---|
| 279 | +#define MV88E6XXX_PORT_RESERVED_1A_READ 0x0000 |
|---|
| 280 | +#define MV88E6XXX_PORT_RESERVED_1A_PORT_SHIFT 5 |
|---|
| 281 | +#define MV88E6XXX_PORT_RESERVED_1A_BLOCK_SHIFT 10 |
|---|
| 282 | +#define MV88E6XXX_PORT_RESERVED_1A_CTRL_PORT 0x04 |
|---|
| 283 | +#define MV88E6XXX_PORT_RESERVED_1A_DATA_PORT 0x05 |
|---|
| 284 | +#define MV88E6341_PORT_RESERVED_1A_FORCE_CMODE 0x8000 |
|---|
| 285 | +#define MV88E6341_PORT_RESERVED_1A_SGMII_AN 0x2000 |
|---|
| 264 | 286 | |
|---|
| 265 | 287 | int mv88e6xxx_port_read(struct mv88e6xxx_chip *chip, int port, int reg, |
|---|
| 266 | 288 | u16 *val); |
|---|
| .. | .. |
|---|
| 276 | 298 | |
|---|
| 277 | 299 | int mv88e6xxx_port_set_link(struct mv88e6xxx_chip *chip, int port, int link); |
|---|
| 278 | 300 | |
|---|
| 279 | | -int mv88e6xxx_port_set_duplex(struct mv88e6xxx_chip *chip, int port, int dup); |
|---|
| 301 | +int mv88e6065_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, |
|---|
| 302 | + int speed, int duplex); |
|---|
| 303 | +int mv88e6185_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, |
|---|
| 304 | + int speed, int duplex); |
|---|
| 305 | +int mv88e6250_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, |
|---|
| 306 | + int speed, int duplex); |
|---|
| 307 | +int mv88e6341_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, |
|---|
| 308 | + int speed, int duplex); |
|---|
| 309 | +int mv88e6352_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, |
|---|
| 310 | + int speed, int duplex); |
|---|
| 311 | +int mv88e6390_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, |
|---|
| 312 | + int speed, int duplex); |
|---|
| 313 | +int mv88e6390x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, |
|---|
| 314 | + int speed, int duplex); |
|---|
| 280 | 315 | |
|---|
| 281 | | -int mv88e6065_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); |
|---|
| 282 | | -int mv88e6185_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); |
|---|
| 283 | | -int mv88e6341_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); |
|---|
| 284 | | -int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); |
|---|
| 285 | | -int mv88e6390_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); |
|---|
| 286 | | -int mv88e6390x_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); |
|---|
| 316 | +phy_interface_t mv88e6341_port_max_speed_mode(int port); |
|---|
| 317 | +phy_interface_t mv88e6390_port_max_speed_mode(int port); |
|---|
| 318 | +phy_interface_t mv88e6390x_port_max_speed_mode(int port); |
|---|
| 287 | 319 | |
|---|
| 288 | 320 | int mv88e6xxx_port_set_state(struct mv88e6xxx_chip *chip, int port, u8 state); |
|---|
| 289 | 321 | |
|---|
| .. | .. |
|---|
| 309 | 341 | bool unicast, bool multicast); |
|---|
| 310 | 342 | int mv88e6352_port_set_egress_floods(struct mv88e6xxx_chip *chip, int port, |
|---|
| 311 | 343 | bool unicast, bool multicast); |
|---|
| 344 | +int mv88e6352_port_set_policy(struct mv88e6xxx_chip *chip, int port, |
|---|
| 345 | + enum mv88e6xxx_policy_mapping mapping, |
|---|
| 346 | + enum mv88e6xxx_policy_action action); |
|---|
| 312 | 347 | int mv88e6351_port_set_ether_type(struct mv88e6xxx_chip *chip, int port, |
|---|
| 313 | 348 | u16 etype); |
|---|
| 314 | 349 | int mv88e6xxx_port_set_message_port(struct mv88e6xxx_chip *chip, int port, |
|---|
| .. | .. |
|---|
| 321 | 356 | u8 out); |
|---|
| 322 | 357 | int mv88e6390_port_pause_limit(struct mv88e6xxx_chip *chip, int port, u8 in, |
|---|
| 323 | 358 | u8 out); |
|---|
| 359 | +int mv88e6341_port_set_cmode(struct mv88e6xxx_chip *chip, int port, |
|---|
| 360 | + phy_interface_t mode); |
|---|
| 361 | +int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port, |
|---|
| 362 | + phy_interface_t mode); |
|---|
| 324 | 363 | int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, |
|---|
| 325 | 364 | phy_interface_t mode); |
|---|
| 326 | 365 | int mv88e6185_port_get_cmode(struct mv88e6xxx_chip *chip, int port, u8 *cmode); |
|---|
| 327 | 366 | int mv88e6352_port_get_cmode(struct mv88e6xxx_chip *chip, int port, u8 *cmode); |
|---|
| 328 | | -int mv88e6185_port_link_state(struct mv88e6xxx_chip *chip, int port, |
|---|
| 329 | | - struct phylink_link_state *state); |
|---|
| 330 | | -int mv88e6352_port_link_state(struct mv88e6xxx_chip *chip, int port, |
|---|
| 331 | | - struct phylink_link_state *state); |
|---|
| 332 | 367 | int mv88e6xxx_port_set_map_da(struct mv88e6xxx_chip *chip, int port); |
|---|
| 333 | 368 | int mv88e6095_port_set_upstream_port(struct mv88e6xxx_chip *chip, int port, |
|---|
| 334 | 369 | int upstream_port); |
|---|
| 370 | +int mv88e6xxx_port_set_mirror(struct mv88e6xxx_chip *chip, int port, |
|---|
| 371 | + enum mv88e6xxx_egress_direction direction, |
|---|
| 372 | + bool mirror); |
|---|
| 335 | 373 | |
|---|
| 336 | 374 | int mv88e6xxx_port_disable_learn_limit(struct mv88e6xxx_chip *chip, int port); |
|---|
| 337 | 375 | int mv88e6xxx_port_disable_pri_override(struct mv88e6xxx_chip *chip, int port); |
|---|
| 338 | 376 | |
|---|
| 377 | +int mv88e6xxx_port_hidden_write(struct mv88e6xxx_chip *chip, int block, |
|---|
| 378 | + int port, int reg, u16 val); |
|---|
| 379 | +int mv88e6xxx_port_hidden_wait(struct mv88e6xxx_chip *chip); |
|---|
| 380 | +int mv88e6xxx_port_hidden_read(struct mv88e6xxx_chip *chip, int block, int port, |
|---|
| 381 | + int reg, u16 *val); |
|---|
| 382 | + |
|---|
| 339 | 383 | #endif /* _MV88E6XXX_PORT_H */ |
|---|