diff options
author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2022-01-26 10:25:55 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-01-26 11:20:37 +0000 |
commit | be6ec5b7026620b931e0fa9287d24ad2cd2ab9b6 (patch) | |
tree | 1bac086e5fa55151df980b32b11f958377cd0e76 /drivers/net/pcs/pcs-xpcs.c | |
parent | 3cade91d0e1817e7cf62943525c7b6fe15ff8f1b (diff) | |
download | lwn-be6ec5b7026620b931e0fa9287d24ad2cd2ab9b6.tar.gz lwn-be6ec5b7026620b931e0fa9287d24ad2cd2ab9b6.zip |
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: Wong Vee Khee <vee.khee.wong@linux.intel.com> # Intel EHL Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pcs/pcs-xpcs.c')
-rw-r--r-- | drivers/net/pcs/pcs-xpcs.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index cd6742e6ba8b..f45821524fab 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -662,6 +662,20 @@ void xpcs_validate(struct dw_xpcs *xpcs, unsigned long *supported, } 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 ret; |