Skip to content

Commit 95e467b

Browse files
Danielmachonkuba-moo
authored andcommitted
net: sparx5: verify RGMII speeds
When doing a port config, we verify the port speed against the PHY mode and supported speeds of that PHY mode. Add checks for the four RGMII phy modes: RGMII, RGMII_ID, RGMII_TXID and RGMII_RXID. Reviewed-by: Steen Hegelund <[email protected]> Reviewed-by: Horatiu Vultur <[email protected]> Tested-by: Robert Marko <[email protected]> Signed-off-by: Daniel Machon <[email protected]> Link: https://patch.msgid.link/20241220-sparx5-lan969x-switch-driver-4-v5-6-fa8ba5dff732@microchip.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9b8d70e commit 95e467b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/net/ethernet/microchip/sparx5/sparx5_port.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,15 @@ static int sparx5_port_verify_speed(struct sparx5 *sparx5,
257257
conf->speed != SPEED_25000))
258258
return sparx5_port_error(port, conf, SPX5_PERR_SPEED);
259259
break;
260+
case PHY_INTERFACE_MODE_RGMII:
261+
case PHY_INTERFACE_MODE_RGMII_ID:
262+
case PHY_INTERFACE_MODE_RGMII_TXID:
263+
case PHY_INTERFACE_MODE_RGMII_RXID:
264+
if (conf->speed != SPEED_1000 &&
265+
conf->speed != SPEED_100 &&
266+
conf->speed != SPEED_10)
267+
return sparx5_port_error(port, conf, SPX5_PERR_SPEED);
268+
break;
260269
default:
261270
return sparx5_port_error(port, conf, SPX5_PERR_IFTYPE);
262271
}

0 commit comments

Comments
 (0)