Commit 5a12b2cf authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Jakub Kicinski
Browse files

net: xpcs: convert to phylink managed EEE



Convert XPCS to use the new pcs_disable_eee() and pcs_enable_eee()
methods. Since stmmac is the only user of xpcs_config_eee(), we can
make this a no-op along with this change.

Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1thRQJ-003w7C-6v@rmk-PC.armlinux.org.uk


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 060fb270
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -602,7 +602,8 @@ static void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces)
		__set_bit(compat->interface, interfaces);
}

int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable)
static int __xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns,
			     int enable)
{
	u16 mask, val;
	int ret;
@@ -630,6 +631,11 @@ int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable)
			   DW_VR_MII_EEE_TRN_LPI,
			   enable ? DW_VR_MII_EEE_TRN_LPI : 0);
}

int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable)
{
	return 0;
}
EXPORT_SYMBOL_GPL(xpcs_config_eee);

static void xpcs_pre_config(struct phylink_pcs *pcs, phy_interface_t interface)
@@ -1193,6 +1199,20 @@ static void xpcs_an_restart(struct phylink_pcs *pcs)
		    BMCR_ANRESTART);
}

static void xpcs_disable_eee(struct phylink_pcs *pcs)
{
	struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);

	__xpcs_config_eee(xpcs, 0, false);
}

static void xpcs_enable_eee(struct phylink_pcs *pcs)
{
	struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);

	__xpcs_config_eee(xpcs, xpcs->eee_mult_fact, true);
}

/**
 * xpcs_config_eee_mult_fact() - set the EEE clock multiplying factor
 * @xpcs: pointer to a &struct dw_xpcs instance
@@ -1355,6 +1375,8 @@ static const struct phylink_pcs_ops xpcs_phylink_ops = {
	.pcs_get_state = xpcs_get_state,
	.pcs_an_restart = xpcs_an_restart,
	.pcs_link_up = xpcs_link_up,
	.pcs_disable_eee = xpcs_disable_eee,
	.pcs_enable_eee = xpcs_enable_eee,
};

static int xpcs_identify(struct dw_xpcs *xpcs)