Commit aee60988 authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by David S. Miller

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: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 90ef0a7b
...@@ -998,6 +998,24 @@ static void phylink_resolve_an_pause(struct phylink_link_state *state) ...@@ -998,6 +998,24 @@ static void phylink_resolve_an_pause(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) static void phylink_pcs_disable(struct phylink_pcs *pcs)
{ {
if (pcs && pcs->ops->pcs_disable) if (pcs && pcs->ops->pcs_disable)
...@@ -1122,8 +1140,14 @@ static void phylink_major_config(struct phylink *pl, bool restart, ...@@ -1122,8 +1140,14 @@ static void phylink_major_config(struct phylink *pl, bool restart,
pl->pcs = pcs; pl->pcs = pcs;
} }
if (pl->pcs)
phylink_pcs_pre_config(pl->pcs, state->interface);
phylink_mac_config(pl, state); 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) if (pl->pcs_state == PCS_STATE_STARTING || pcs_changed)
phylink_pcs_enable(pl->pcs); phylink_pcs_enable(pl->pcs);
......
...@@ -537,6 +537,8 @@ struct phylink_pcs { ...@@ -537,6 +537,8 @@ struct phylink_pcs {
* @pcs_validate: validate the link configuration. * @pcs_validate: validate the link configuration.
* @pcs_enable: enable the PCS. * @pcs_enable: enable the PCS.
* @pcs_disable: disable 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_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_config: configure the MAC PCS for the selected mode and state.
* @pcs_an_restart: restart 802.3z BaseX autonegotiation. * @pcs_an_restart: restart 802.3z BaseX autonegotiation.
...@@ -548,6 +550,10 @@ struct phylink_pcs_ops { ...@@ -548,6 +550,10 @@ struct phylink_pcs_ops {
const struct phylink_link_state *state); const struct phylink_link_state *state);
int (*pcs_enable)(struct phylink_pcs *pcs); int (*pcs_enable)(struct phylink_pcs *pcs);
void (*pcs_disable)(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, void (*pcs_get_state)(struct phylink_pcs *pcs,
struct phylink_link_state *state); struct phylink_link_state *state);
int (*pcs_config)(struct phylink_pcs *pcs, unsigned int neg_mode, int (*pcs_config)(struct phylink_pcs *pcs, unsigned int neg_mode,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment