}
EXPORT_SYMBOL_GPL(xpcs_config_eee);
+static void xpcs_pre_config(struct phylink_pcs *pcs, phy_interface_t interface)
+{
+ struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);
+ const struct dw_xpcs_compat *compat;
+ int ret;
+
+ if (!xpcs->need_reset)
+ return;
+
+ compat = xpcs_find_compat(xpcs->desc, interface);
+ if (!compat) {
+ dev_err(&xpcs->mdiodev->dev, "unsupported interface %s\n",
+ phy_modes(interface));
+ return;
+ }
+
+ ret = xpcs_soft_reset(xpcs, compat);
+ if (ret)
+ dev_err(&xpcs->mdiodev->dev, "soft reset failed: %pe\n",
+ ERR_PTR(ret));
+
+ xpcs->need_reset = false;
+}
+
static int xpcs_config_aneg_c37_sgmii(struct dw_xpcs *xpcs,
unsigned int neg_mode)
{
static const struct phylink_pcs_ops xpcs_phylink_ops = {
.pcs_validate = xpcs_validate,
+ .pcs_pre_config = xpcs_pre_config,
.pcs_config = xpcs_config,
.pcs_get_state = xpcs_get_state,
.pcs_an_restart = xpcs_an_restart,
static int xpcs_init_iface(struct dw_xpcs *xpcs, phy_interface_t interface)
{
- const struct dw_xpcs_compat *compat;
-
- compat = xpcs_find_compat(xpcs->desc, interface);
- if (!compat)
- return -EINVAL;
-
- if (xpcs->info.pma == WX_TXGBE_XPCS_PMA_10G_ID) {
+ if (xpcs->info.pma == WX_TXGBE_XPCS_PMA_10G_ID)
xpcs->pcs.poll = false;
- return 0;
- }
+ else
+ xpcs->need_reset = true;
- return xpcs_soft_reset(xpcs, compat);
+ return 0;
}
static struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev,