Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Russell King (Oracle) and committed by
David S. Miller
aee60988 90ef0a7b

+30
+24
drivers/net/phy/phylink.c
··· 998 998 } 999 999 } 1000 1000 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 + 1001 1019 static void phylink_pcs_disable(struct phylink_pcs *pcs) 1002 1020 { 1003 1021 if (pcs && pcs->ops->pcs_disable) ··· 1140 1122 pl->pcs = pcs; 1141 1123 } 1142 1124 1125 + if (pl->pcs) 1126 + phylink_pcs_pre_config(pl->pcs, state->interface); 1127 + 1143 1128 phylink_mac_config(pl, state); 1129 + 1130 + if (pl->pcs) 1131 + phylink_pcs_post_config(pl->pcs, state->interface); 1144 1132 1145 1133 if (pl->pcs_state == PCS_STATE_STARTING || pcs_changed) 1146 1134 phylink_pcs_enable(pl->pcs);
+6
include/linux/phylink.h
··· 537 537 * @pcs_validate: validate the link configuration. 538 538 * @pcs_enable: enable the PCS. 539 539 * @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) 540 542 * @pcs_get_state: read the current MAC PCS link state from the hardware. 541 543 * @pcs_config: configure the MAC PCS for the selected mode and state. 542 544 * @pcs_an_restart: restart 802.3z BaseX autonegotiation. ··· 550 548 const struct phylink_link_state *state); 551 549 int (*pcs_enable)(struct phylink_pcs *pcs); 552 550 void (*pcs_disable)(struct phylink_pcs *pcs); 551 + void (*pcs_pre_config)(struct phylink_pcs *pcs, 552 + phy_interface_t interface); 553 + int (*pcs_post_config)(struct phylink_pcs *pcs, 554 + phy_interface_t interface); 553 555 void (*pcs_get_state)(struct phylink_pcs *pcs, 554 556 struct phylink_link_state *state); 555 557 int (*pcs_config)(struct phylink_pcs *pcs, unsigned int neg_mode,