Skip to content

Commit ee50d07

Browse files
vladimirolteandavem330
authored andcommitted
net: mscc: ocelot: make phy_mode a member of the common struct ocelot_port
The Ocelot switchdev driver and the Felix DSA one need it for different reasons. Felix (or at least the VSC9959 instantiation in NXP LS1028A) is integrated with the traditional NXP Layerscape PCS design which does not support runtime configuration of SerDes protocol. So it needs to pre-validate the phy-mode from the device tree and prevent PHYLINK from attempting to change it. For this, it needs to cache it in a private variable. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d79d303 commit ee50d07

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,21 +500,22 @@ EXPORT_SYMBOL(ocelot_port_enable);
500500
static int ocelot_port_open(struct net_device *dev)
501501
{
502502
struct ocelot_port_private *priv = netdev_priv(dev);
503-
struct ocelot *ocelot = priv->port.ocelot;
503+
struct ocelot_port *ocelot_port = &priv->port;
504+
struct ocelot *ocelot = ocelot_port->ocelot;
504505
int port = priv->chip_port;
505506
int err;
506507

507508
if (priv->serdes) {
508509
err = phy_set_mode_ext(priv->serdes, PHY_MODE_ETHERNET,
509-
priv->phy_mode);
510+
ocelot_port->phy_mode);
510511
if (err) {
511512
netdev_err(dev, "Could not set mode of SerDes\n");
512513
return err;
513514
}
514515
}
515516

516517
err = phy_connect_direct(dev, priv->phy, &ocelot_port_adjust_link,
517-
priv->phy_mode);
518+
ocelot_port->phy_mode);
518519
if (err) {
519520
netdev_err(dev, "Could not attach to PHY\n");
520521
return err;

drivers/net/ethernet/mscc/ocelot.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ struct ocelot_port_private {
6868

6969
u8 vlan_aware;
7070

71-
phy_interface_t phy_mode;
7271
struct phy *serdes;
7372

7473
struct ocelot_port_tc tc;

drivers/net/ethernet/mscc/ocelot_board.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,9 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
402402

403403
of_get_phy_mode(portnp, &phy_mode);
404404

405-
priv->phy_mode = phy_mode;
405+
ocelot_port->phy_mode = phy_mode;
406406

407-
switch (priv->phy_mode) {
407+
switch (ocelot_port->phy_mode) {
408408
case PHY_INTERFACE_MODE_NA:
409409
continue;
410410
case PHY_INTERFACE_MODE_SGMII:

include/soc/mscc/ocelot.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@ struct ocelot_port {
420420
u8 ptp_cmd;
421421
struct sk_buff_head tx_skbs;
422422
u8 ts_id;
423+
424+
phy_interface_t phy_mode;
423425
};
424426

425427
struct ocelot {

0 commit comments

Comments
 (0)