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

net: xpcs: add support for retrieving supported interface modes

Add a function to the xpcs driver to retrieve the supported PHY
interface modes, which can be used by drivers to fill in phylink's
supported_interfaces mask.

We validate the interface bit index to ensure that it fits within the
bitmap as xpcs lists PHY_INTERFACE_MODE_MAX in an entry.
Tested-by: default avatarWong Vee Khee &lt;vee.khee.wong@linux.intel.com&gt; # Intel EHL            Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3cade91d
...@@ -662,6 +662,20 @@ void xpcs_validate(struct dw_xpcs *xpcs, unsigned long *supported, ...@@ -662,6 +662,20 @@ void xpcs_validate(struct dw_xpcs *xpcs, unsigned long *supported,
} }
EXPORT_SYMBOL_GPL(xpcs_validate); EXPORT_SYMBOL_GPL(xpcs_validate);
void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces)
{
int i, j;
for (i = 0; i < DW_XPCS_INTERFACE_MAX; i++) {
const struct xpcs_compat *compat = &xpcs->id->compat[i];
for (j = 0; j < compat->num_interfaces; j++)
if (compat->interface[j] < PHY_INTERFACE_MODE_MAX)
__set_bit(compat->interface[j], interfaces);
}
}
EXPORT_SYMBOL_GPL(xpcs_get_interfaces);
int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable) int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int enable)
{ {
int ret; int ret;
......
...@@ -33,6 +33,7 @@ int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface, ...@@ -33,6 +33,7 @@ int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
unsigned int mode); unsigned int mode);
void xpcs_validate(struct dw_xpcs *xpcs, unsigned long *supported, void xpcs_validate(struct dw_xpcs *xpcs, unsigned long *supported,
struct phylink_link_state *state); struct phylink_link_state *state);
void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces);
int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns, int xpcs_config_eee(struct dw_xpcs *xpcs, int mult_fact_100ns,
int enable); int enable);
struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev, struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev,
......
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