summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2022-04-14 15:28:26 +0100
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2022-06-18 12:12:04 +0100
commit97ee90e1bd3c30361ba6099047d140ea2550a1ab (patch)
treefa1f71023a5f4ef2461fe4d855daf5acbe293029
parent255ce71ef1e22b3b529b91a27dcd73628accead8 (diff)
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>
-rw-r--r--drivers/net/phy/phylink.c24
-rw-r--r--include/linux/phylink.h6
2 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 49615f89128e..cacce8539a48 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -761,6 +761,24 @@ static void phylink_resolve_flow(struct phylink_link_state *state)
}
}
+static void phylink_pcs_pre_config(struct phylink_pcs *pcs,
+ phy_interface_t interface)
+{
+ if (pcs && pcs->ops->pcs_pre_config)
+ pcs->ops->pcs_pre_config(pcs, interface);
+}
+
+static int phylink_pcs_post_config(struct phylink_pcs *pcs,
+ phy_interface_t interface)
+{
+ int err = 0;
+
+ if (pcs && pcs->ops->pcs_post_config)
+ err = pcs->ops->pcs_post_config(pcs, interface);
+
+ return err;
+}
+
static void phylink_pcs_disable(struct phylink_pcs *pcs)
{
if (pcs && pcs->ops->pcs_disable)
@@ -859,8 +877,14 @@ static void phylink_major_config(struct phylink *pl, bool restart,
pl->pcs = pcs;
}
+ if (pl->pcs)
+ phylink_pcs_pre_config(pl->pcs, state->interface);
+
phylink_mac_config(pl, state);
+ if (pl->pcs)
+ phylink_pcs_post_config(pl->pcs, state->interface);
+
if (pl->pcs_state == PCS_STATE_STARTING || pcs_changed)
phylink_pcs_enable(pl->pcs);
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index 2fb19b576bda..ec7aa5d54dda 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -431,6 +431,8 @@ struct phylink_pcs {
* @pcs_validate: validate the link configuration.
* @pcs_enable: enable the PCS.
* @pcs_disable: disable the PCS.
+ * @pcs_pre_config: pre-mac_config method (for errata)
+ * @pcs_post_config: post-mac_config method (for arrata)
* @pcs_get_state: read the current MAC PCS link state from the hardware.
* @pcs_config: configure the MAC PCS for the selected mode and state.
* @pcs_an_restart: restart 802.3z BaseX autonegotiation.
@@ -442,6 +444,10 @@ struct phylink_pcs_ops {
const struct phylink_link_state *state);
int (*pcs_enable)(struct phylink_pcs *pcs);
void (*pcs_disable)(struct phylink_pcs *pcs);
+ void (*pcs_pre_config)(struct phylink_pcs *pcs,
+ phy_interface_t interface);
+ int (*pcs_post_config)(struct phylink_pcs *pcs,
+ phy_interface_t interface);
void (*pcs_get_state)(struct phylink_pcs *pcs,
struct phylink_link_state *state);
int (*pcs_config)(struct phylink_pcs *pcs, unsigned int mode,