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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net-phylink-rearrange-ovr_an_inband-support'

Russell King says:

====================
net: phylink: rearrange ovr_an_inband support

This series addresses the use of the ovr_an_inband flag, which is used
by two drivers to indicate to phylink that they wish to use inband mode
without firmware specifying inband mode.

The issue with ovr_an_inband is that it overrides not only PHY mode,
but also fixed-link mode. Both of the drivers that set this flag
contain code to detect when fixed-link mode will be used, and then
either avoid setting it or explicitly clear the flag. This is
wasteful when phylink already knows this.

Therefore, the approach taken in this patch set is to replace the
ovr_an_inband flag with a default_an_inband flag which means that
phylink defaults to MLO_AN_INBAND instead of MLO_AN_PHY, and will
allow that default to be overriden if firmware specifies a fixed-link.
This allows users of ovr_an_inband to be simplified.

What's more is this requires minimal changes in phylink to allow this
new mode of operation.

This series changes phylink, and also updates the two drivers
(fman_memac and stmmac), and then removes the unnecessary complexity
from the drivers.

This series may depend on the stmmac cleanup series I've posted
earlier - this is something I have not checked, but I currently have
these patches on top of that series.
====================

Link: https://lore.kernel.org/r/ZlctinnTT8Xhemsm@shell.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+22 -31
+6 -10
drivers/net/ethernet/freescale/fman/fman_memac.c
··· 1066 1066 struct fman_mac_params *params) 1067 1067 { 1068 1068 int err; 1069 - struct device_node *fixed; 1070 1069 struct phylink_pcs *pcs; 1071 1070 struct fman_mac *memac; 1072 1071 unsigned long capabilities; ··· 1221 1222 memac->rgmii_no_half_duplex = true; 1222 1223 1223 1224 /* Most boards should use MLO_AN_INBAND, but existing boards don't have 1224 - * a managed property. Default to MLO_AN_INBAND if nothing else is 1225 - * specified. We need to be careful and not enable this if we have a 1226 - * fixed link or if we are using MII or RGMII, since those 1227 - * configurations modes don't use in-band autonegotiation. 1225 + * a managed property. Default to MLO_AN_INBAND rather than MLO_AN_PHY. 1226 + * Phylink will allow this to be overriden by a fixed link. We need to 1227 + * be careful and not enable this if we are using MII or RGMII, since 1228 + * those configurations modes don't use in-band autonegotiation. 1228 1229 */ 1229 - fixed = of_get_child_by_name(mac_node, "fixed-link"); 1230 - if (!fixed && !of_property_read_bool(mac_node, "fixed-link") && 1231 - !of_property_read_bool(mac_node, "managed") && 1230 + if (!of_property_read_bool(mac_node, "managed") && 1232 1231 mac_dev->phy_if != PHY_INTERFACE_MODE_MII && 1233 1232 !phy_interface_mode_is_rgmii(mac_dev->phy_if)) 1234 - mac_dev->phylink_config.ovr_an_inband = true; 1235 - of_node_put(fixed); 1233 + mac_dev->phylink_config.default_an_inband = true; 1236 1234 1237 1235 err = memac_init(mac_dev->fman_mac); 1238 1236 if (err < 0)
+2 -13
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
··· 248 248 dev_info(priv->device, "Link Speed Mode: 2.5Gbps\n"); 249 249 priv->plat->max_speed = 2500; 250 250 priv->plat->phy_interface = PHY_INTERFACE_MODE_2500BASEX; 251 - priv->plat->mdio_bus_data->xpcs_an_inband = false; 251 + priv->plat->mdio_bus_data->default_an_inband = false; 252 252 } else { 253 253 priv->plat->max_speed = 1000; 254 254 } ··· 586 586 if (plat->phy_interface == PHY_INTERFACE_MODE_SGMII || 587 587 plat->phy_interface == PHY_INTERFACE_MODE_1000BASEX) { 588 588 plat->mdio_bus_data->has_xpcs = true; 589 - plat->mdio_bus_data->xpcs_an_inband = true; 590 - } 591 - 592 - /* For fixed-link setup, we clear xpcs_an_inband */ 593 - if (fwnode) { 594 - struct fwnode_handle *fixed_node; 595 - 596 - fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link"); 597 - if (fixed_node) 598 - plat->mdio_bus_data->xpcs_an_inband = false; 599 - 600 - fwnode_handle_put(fixed_node); 589 + plat->mdio_bus_data->default_an_inband = true; 601 590 } 602 591 603 592 /* Ensure mdio bus scan skips intel serdes and pcs-xpcs */
+2 -2
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 1221 1221 1222 1222 mdio_bus_data = priv->plat->mdio_bus_data; 1223 1223 if (mdio_bus_data) 1224 - priv->phylink_config.ovr_an_inband = 1225 - mdio_bus_data->xpcs_an_inband; 1224 + priv->phylink_config.default_an_inband = 1225 + mdio_bus_data->default_an_inband; 1226 1226 1227 1227 /* Set the platform/firmware specified interface mode. Note, phylink 1228 1228 * deals with the PHY interface mode, not the MAC interface mode.
+8 -3
drivers/net/phy/phylink.c
··· 885 885 const char *managed; 886 886 unsigned long caps; 887 887 888 + if (pl->config->default_an_inband) 889 + pl->cfg_link_an_mode = MLO_AN_INBAND; 890 + 888 891 dn = fwnode_get_named_child_node(fwnode, "fixed-link"); 889 892 if (dn || fwnode_property_present(fwnode, "fixed-link")) 890 893 pl->cfg_link_an_mode = MLO_AN_FIXED; 891 894 fwnode_handle_put(dn); 892 895 893 896 if ((fwnode_property_read_string(fwnode, "managed", &managed) == 0 && 894 - strcmp(managed, "in-band-status") == 0) || 895 - pl->config->ovr_an_inband) { 897 + strcmp(managed, "in-band-status") == 0)) { 896 898 if (pl->cfg_link_an_mode == MLO_AN_FIXED) { 897 899 phylink_err(pl, 898 900 "can't use both fixed-link and in-band-status\n"); 899 901 return -EINVAL; 900 902 } 901 903 904 + pl->cfg_link_an_mode = MLO_AN_INBAND; 905 + } 906 + 907 + if (pl->cfg_link_an_mode == MLO_AN_INBAND) { 902 908 linkmode_zero(pl->supported); 903 909 phylink_set(pl->supported, MII); 904 910 phylink_set(pl->supported, Autoneg); 905 911 phylink_set(pl->supported, Asym_Pause); 906 912 phylink_set(pl->supported, Pause); 907 - pl->cfg_link_an_mode = MLO_AN_INBAND; 908 913 909 914 switch (pl->link_config.interface) { 910 915 case PHY_INTERFACE_MODE_SGMII:
+3 -2
include/linux/phylink.h
··· 141 141 * @mac_requires_rxc: if true, the MAC always requires a receive clock from PHY. 142 142 * The PHY driver should start the clock signal as soon as 143 143 * possible and avoid stopping it during suspend events. 144 - * @ovr_an_inband: if true, override PCS to MLO_AN_INBAND 144 + * @default_an_inband: if true, defaults to MLO_AN_INBAND rather than 145 + * MLO_AN_PHY. A fixed-link specification will override. 145 146 * @get_fixed_state: callback to execute to determine the fixed link state, 146 147 * if MAC link is at %MLO_AN_FIXED mode. 147 148 * @supported_interfaces: bitmap describing which PHY_INTERFACE_MODE_xxx ··· 155 154 bool poll_fixed_state; 156 155 bool mac_managed_pm; 157 156 bool mac_requires_rxc; 158 - bool ovr_an_inband; 157 + bool default_an_inband; 159 158 void (*get_fixed_state)(struct phylink_config *config, 160 159 struct phylink_link_state *state); 161 160 DECLARE_PHY_INTERFACE_MASK(supported_interfaces);
+1 -1
include/linux/stmmac.h
··· 83 83 struct stmmac_mdio_bus_data { 84 84 unsigned int phy_mask; 85 85 unsigned int has_xpcs; 86 - unsigned int xpcs_an_inband; 86 + unsigned int default_an_inband; 87 87 int *irqs; 88 88 int probed_phy_irq; 89 89 bool needs_reset;