Skip to content

Commit fdc71ee

Browse files
lunndavem330
authored andcommitted
net: dsa: mv88e6xxx: Differentiate between 6390 and 6390X cmodes
The X family variants support additional ports modes, for 10G operation, which the non-X variants don't have. Add a port_set_cmode() for non-X variants to enforce this. Signed-off-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b3dce4d commit fdc71ee

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

drivers/net/dsa/mv88e6xxx/chip.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3234,6 +3234,7 @@ static const struct mv88e6xxx_ops mv88e6190_ops = {
32343234
.port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
32353235
.port_link_state = mv88e6352_port_link_state,
32363236
.port_get_cmode = mv88e6352_port_get_cmode,
3237+
.port_set_cmode = mv88e6390_port_set_cmode,
32373238
.stats_snapshot = mv88e6390_g1_stats_snapshot,
32383239
.stats_set_histogram = mv88e6390_g1_stats_set_histogram,
32393240
.stats_get_sset_count = mv88e6320_stats_get_sset_count,
@@ -3276,6 +3277,7 @@ static const struct mv88e6xxx_ops mv88e6190x_ops = {
32763277
.port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
32773278
.port_link_state = mv88e6352_port_link_state,
32783279
.port_get_cmode = mv88e6352_port_get_cmode,
3280+
.port_set_cmode = mv88e6390x_port_set_cmode,
32793281
.stats_snapshot = mv88e6390_g1_stats_snapshot,
32803282
.stats_set_histogram = mv88e6390_g1_stats_set_histogram,
32813283
.stats_get_sset_count = mv88e6320_stats_get_sset_count,
@@ -3318,6 +3320,7 @@ static const struct mv88e6xxx_ops mv88e6191_ops = {
33183320
.port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
33193321
.port_link_state = mv88e6352_port_link_state,
33203322
.port_get_cmode = mv88e6352_port_get_cmode,
3323+
.port_set_cmode = mv88e6390_port_set_cmode,
33213324
.stats_snapshot = mv88e6390_g1_stats_snapshot,
33223325
.stats_set_histogram = mv88e6390_g1_stats_set_histogram,
33233326
.stats_get_sset_count = mv88e6320_stats_get_sset_count,
@@ -3409,7 +3412,7 @@ static const struct mv88e6xxx_ops mv88e6290_ops = {
34093412
.port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
34103413
.port_link_state = mv88e6352_port_link_state,
34113414
.port_get_cmode = mv88e6352_port_get_cmode,
3412-
.port_set_cmode = mv88e6390x_port_set_cmode,
3415+
.port_set_cmode = mv88e6390_port_set_cmode,
34133416
.stats_snapshot = mv88e6390_g1_stats_snapshot,
34143417
.stats_set_histogram = mv88e6390_g1_stats_set_histogram,
34153418
.stats_get_sset_count = mv88e6320_stats_get_sset_count,
@@ -3714,7 +3717,7 @@ static const struct mv88e6xxx_ops mv88e6390_ops = {
37143717
.port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
37153718
.port_link_state = mv88e6352_port_link_state,
37163719
.port_get_cmode = mv88e6352_port_get_cmode,
3717-
.port_set_cmode = mv88e6390x_port_set_cmode,
3720+
.port_set_cmode = mv88e6390_port_set_cmode,
37183721
.stats_snapshot = mv88e6390_g1_stats_snapshot,
37193722
.stats_set_histogram = mv88e6390_g1_stats_set_histogram,
37203723
.stats_get_sset_count = mv88e6320_stats_get_sset_count,

drivers/net/dsa/mv88e6xxx/port.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,21 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
437437
return 0;
438438
}
439439

440+
int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
441+
phy_interface_t mode)
442+
{
443+
switch (mode) {
444+
case PHY_INTERFACE_MODE_XGMII:
445+
case PHY_INTERFACE_MODE_XAUI:
446+
case PHY_INTERFACE_MODE_RXAUI:
447+
return -EINVAL;
448+
default:
449+
break;
450+
}
451+
452+
return mv88e6390x_port_set_cmode(chip, port, mode);
453+
}
454+
440455
int mv88e6185_port_get_cmode(struct mv88e6xxx_chip *chip, int port, u8 *cmode)
441456
{
442457
int err;

drivers/net/dsa/mv88e6xxx/port.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ int mv88e6097_port_pause_limit(struct mv88e6xxx_chip *chip, int port, u8 in,
310310
u8 out);
311311
int mv88e6390_port_pause_limit(struct mv88e6xxx_chip *chip, int port, u8 in,
312312
u8 out);
313+
int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
314+
phy_interface_t mode);
313315
int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
314316
phy_interface_t mode);
315317
int mv88e6185_port_get_cmode(struct mv88e6xxx_chip *chip, int port, u8 *cmode);

0 commit comments

Comments
 (0)