Skip to content

Commit aee6098

Browse files
Russell King (Oracle)davem330
authored andcommitted
net: phylink: add pcs_pre_config()/pcs_post_config() methods
Add hooks that are called before and after the mac_config() call, which will be needed to deal with errata workarounds for the Marvell 88e639x DSA switches. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 90ef0a7 commit aee6098

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

drivers/net/phy/phylink.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,24 @@ static void phylink_resolve_an_pause(struct phylink_link_state *state)
998998
}
999999
}
10001000

1001+
static void phylink_pcs_pre_config(struct phylink_pcs *pcs,
1002+
phy_interface_t interface)
1003+
{
1004+
if (pcs && pcs->ops->pcs_pre_config)
1005+
pcs->ops->pcs_pre_config(pcs, interface);
1006+
}
1007+
1008+
static int phylink_pcs_post_config(struct phylink_pcs *pcs,
1009+
phy_interface_t interface)
1010+
{
1011+
int err = 0;
1012+
1013+
if (pcs && pcs->ops->pcs_post_config)
1014+
err = pcs->ops->pcs_post_config(pcs, interface);
1015+
1016+
return err;
1017+
}
1018+
10011019
static void phylink_pcs_disable(struct phylink_pcs *pcs)
10021020
{
10031021
if (pcs && pcs->ops->pcs_disable)
@@ -1122,8 +1140,14 @@ static void phylink_major_config(struct phylink *pl, bool restart,
11221140
pl->pcs = pcs;
11231141
}
11241142

1143+
if (pl->pcs)
1144+
phylink_pcs_pre_config(pl->pcs, state->interface);
1145+
11251146
phylink_mac_config(pl, state);
11261147

1148+
if (pl->pcs)
1149+
phylink_pcs_post_config(pl->pcs, state->interface);
1150+
11271151
if (pl->pcs_state == PCS_STATE_STARTING || pcs_changed)
11281152
phylink_pcs_enable(pl->pcs);
11291153

include/linux/phylink.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,8 @@ struct phylink_pcs {
537537
* @pcs_validate: validate the link configuration.
538538
* @pcs_enable: enable the PCS.
539539
* @pcs_disable: disable the PCS.
540+
* @pcs_pre_config: pre-mac_config method (for errata)
541+
* @pcs_post_config: post-mac_config method (for arrata)
540542
* @pcs_get_state: read the current MAC PCS link state from the hardware.
541543
* @pcs_config: configure the MAC PCS for the selected mode and state.
542544
* @pcs_an_restart: restart 802.3z BaseX autonegotiation.
@@ -548,6 +550,10 @@ struct phylink_pcs_ops {
548550
const struct phylink_link_state *state);
549551
int (*pcs_enable)(struct phylink_pcs *pcs);
550552
void (*pcs_disable)(struct phylink_pcs *pcs);
553+
void (*pcs_pre_config)(struct phylink_pcs *pcs,
554+
phy_interface_t interface);
555+
int (*pcs_post_config)(struct phylink_pcs *pcs,
556+
phy_interface_t interface);
551557
void (*pcs_get_state)(struct phylink_pcs *pcs,
552558
struct phylink_link_state *state);
553559
int (*pcs_config)(struct phylink_pcs *pcs, unsigned int neg_mode,

0 commit comments

Comments
 (0)