summaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)Author
2022-01-18net: phylink: remove phylink_config's pcs_pollRussell King (Oracle)
phylink_config's pcs_poll is no longer used, let's get rid of it. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-18net: sparx5: remove phylink_config.pcs_poll usageRussell King (Oracle)
Phylink will use PCS polling whenever the PCS's poll member is set, so setting phylink_config.pcs_poll as well is redundant. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-18net: sparx5: use .mac_select_pcs() interfaceRussell King (Oracle)
Convert sparx5 to use the mac_select_interface rather than using phylink_set_pcs(). The intention here is to unify the approach for PCS and eventually remove phylink_set_pcs(). Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-18net: dsa: qca8k: convert to use phylink_pcsRussell King (Oracle)
Convert the qca8k driver to use the phylink_pcs support to talk to the SGMII PCS. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-18net: qca8k: move qca8k_mac_config_setup_internal_delay()Russell King (Oracle)
Move qca8k_mac_config_setup_internal_delay() so we can make use of it without needing a forward declaraction. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-15net: dsa: xrs700x: convert to phylink_generic_validate()Russell King (Oracle)
Populate the supported interfaces and MAC capabilities for the xrs700x family of DSA switches and remove the old validate implementation to allow DSA to use phylink_generic_validate() for this switch driver. According to commit ee00b24f32eb ("net: dsa: add Arrow SpeedChips XRS700x driver") the switch supports one RMII port and up to three RGMII ports. This commit assumes that port 0 is the RMII port and the remainder are RGMII. This commit also results in the Autoneg bit being set in the ethtool link modes, which wasn't in the original; if this switch supports RGMII to a 10/100/1G PHY, then surely we want to allow Autoneg on the PHY. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-15net: dsa: qca8k: convert to phylink_generic_validate()Russell King (Oracle)
Populate the supported interfaces and MAC capabilities for the QCA8K DSA switch and remove the old validate implementation to allow DSA to use phylink_generic_validate() for this switch driver. In making this change, we bring consistency to the ethtool linkmodes that phylink's validate step produces, thereby following the expected behaviour as the phylink documentation has explained. Specifically, the ethtool 1000baseX_Full capability is now permitted for all interface modes, as it is a property of the PHY driver whether 1000baseX fiber connections can be supported. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-15net: dsa: ksz8795: convert to phylink_generic_validate()Russell King (Oracle)
Populate the supported interfaces and MAC capabilities for the Microchip KSZ8795 DSA switch and remove the old validate implementation to allow DSA to use phylink_generic_validate() for this switch driver. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-15net: dsa: bcm_sf2: convert to phylink_generic_validate()Russell King (Oracle)
Populate the supported interfaces and MAC capabilities for the bcm_sf2 DSA switch and remove the old validate implementation to allow DSA to use phylink_generic_validate() for this switch driver. The exclusion of Gigabit linkmodes for MII and Reverse MII links is handled within phylink_generic_validate() in phylink, so there is no need to make them conditional on the interface mode in the driver. Thanks to Florian Fainelli for suggesting how to populate the supported interfaces. Link: https://lore.kernel.org/r/3b3fed98-0c82-99e9-dc72-09fe01c2bcf3@gmail.com Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-15net: dsa: ar9331: convert to phylink_generic_validate()Russell King (Oracle)
Populate the supported interfaces and MAC capabilities for the AR9331 DSA switch and remove the old validate implementation to allow DSA to use phylink_generic_validate() for this switch driver. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-15net: mvneta: use .mac_select_pcs() interfaceRussell King (Oracle)
Convert mvneta to use the mac_select_interface rather than using phylink_set_pcs(). The intention here is to unify the approach for PCS and eventually remove phylink_set_pcs(). Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-15net: mvneta: reorder initialisationRussell King (Oracle)
Re-order the mvneta initialisation to move devm based resources and easy setup earlier in the probe function. The primary reason for this is to allow us to switch the driver to use phylink's mac_select_pcs() callback. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-14net: stmmac: use .mac_select_pcs() interfaceRussell King (Oracle)
Convert stmmac to use the mac_select_pcs() interface rather than using phylink_set_pcs(). The intention here is to unify the approach for PCS and eventually to remove phylink_set_pcs(). Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-14net: stmmac: convert to phylink_generic_validate()Russell King (Oracle)
Convert stmmac to use phylink_generic_validate() now that we have the MAC capabilities and supported interfaces filled in, and we have the PCS validation handled via the PCS operations. Tested-by: Wong Vee Khee <vee.khee.wong@linux.intel.com> # Intel EHL Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-14net: stmmac: remove phylink_config.pcs_poll usageRussell King (Oracle)
Phylink will use PCS polling whenever the PCS's poll member is set, so setting phylink_config.pcs_poll as well is redundant. Tested-by: Wong Vee Khee <vee.khee.wong@linux.intel.com> # Intel EHL Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-14net: stmmac/xpcs: convert to pcs_validate()Russell King (Oracle)
stmmac explicitly calls the xpcs driver to validate the ethtool linkmodes. This is no longer necessary as phylink now supports validation through a PCS method. Convert both drivers to use this new mechanism. Tested-by: Wong Vee Khee <vee.khee.wong@linux.intel.com> # Intel EHL Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-14net: stmmac: fill in supported_interfacesRussell King (Oracle)
Fill in phylink's supported_interfaces bitmap with the PHY interface modes which can be used to talk to the PHY. We indicate that the PHY interface mode passed in platform data is always supported, as this is the initial mode passed into phylink. When there is no PCS specified, we assume that this is the only mode that is supported - indeed, the driver appears not to support dynamic switching of interface types at present. When a xpcs is present, it defines the PHY interface modes that the stmmac driver can support. Request the supported interfaces from the xpcs driver, and pass them to phylink. Tested-by: Wong Vee Khee <vee.khee.wong@linux.intel.com> # Intel EHL Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-14net: stmmac: convert to phylink_get_linkmodes()Russell King (Oracle)
Add the MAC speed, duplex and pause capabilities to the phylink_config structure, and switch stmmac_validate() to use phylink_get_linkmodes() to generate the mask of supported ethtool link modes. Tested-by: Wong Vee Khee <vee.khee.wong@linux.intel.com> # Intel EHL Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-14net: xpcs: add support for retrieving supported interface modesRussell King (Oracle)
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>
2022-01-14net: enetc: use .mac_select_pcs() interfaceRussell King (Oracle)
Convert the PCS selection to use mac_select_pcs, which allows the PCS to perform any validation it needs. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-14net: dpaa2-mac: use .mac_select_pcs() interfaceRussell King (Oracle)
Convert dpaa2-mac to use the mac_select_pcs() interface rather than using phylink_set_pcs(). The intention here is to unify the approach for PCS and eventually to remove phylink_set_pcs(). Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: axienet: replace mdiobus_write() with mdiodev_write()Russell King (Oracle)
Commit 0ebecb2644c8 ("net: mdio: Add helper functions for accessing MDIO devices") added support for mdiodev accessor operations that neatly wrap the mdiobus accessor operations. Since we are dealing with a mdio device here, update the driver to use mdiodev_write(). Tested-by: Harini Katakam <harini.katakam@xilinx.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: axienet: convert to phylink_pcsRussell King (Oracle)
Convert axienet to use the phylink_pcs layer, resulting in it no longer being a legacy driver. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: macb: use .mac_select_pcs() interfaceRussell King (Oracle)
Convert the PCS selection to use mac_select_pcs, which allows the PCS to perform any validation it needs. We must use separate phylink_pcs instances for the USX and SGMII PCS, rather than just changing the "ops" pointer before re-setting it to phylink as this interface queries the PCS, rather than requesting it to be changed. Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: mvneta: convert to pcs_validate() and phylink_generic_validate()Russell King (Oracle)
Convert mvneta to validate the autoneg state for 1000base-X in the pcs_validate() operation, rather than the MAC validate() operation. This allows us to switch the MAC validate() to use phylink_generic_validate(). Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: mvneta: convert to phylink pcs operationsRussell King
An initial stab at converting mvneta to PCS operations. There's a few FIXMEs to be solved. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
2022-01-12net: mvneta: convert to use mac_prepare()/mac_finish()Russell King
Convert mvneta to use the mac_prepare() and mac_finish() methods in preparation to converting mvneta to split-PCS support. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
2022-01-12net: mvpp2: convert to pcs_validate() and phylink_generic_validate()Russell King (Oracle)
Convert mvpp2 to validate the autoneg state for 1000base-X in the pcs_validate() operation, rather than the MAC validate() operation. This allows us to switch the MAC validate() to use phylink_generic_validate(). Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: mvpp2: use .mac_select_pcs() interfaceRussell King (Oracle)
Use the mac_select_pcs() method to choose between the GMAC and XLG PCS implementations. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: phylink: add pcs_validate() methodRussell King (Oracle)
Add a hook for PCS to validate the link parameters. This avoids MAC drivers having to have knowledge of their PCS in their validate() method, thereby allowing several MAC drivers to be simplfied. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: phylink: add mac_select_pcs() method to phylink_mac_opsRussell King (Oracle)
mac_select_pcs() allows us to have an explicit point to query which PCS the MAC wishes to use for a particular PHY interface mode, thereby allowing us to add support to validate the link settings with the PCS. Phylink will also use this to select the PCS to be used during a major configuration event without the MAC driver needing to call phylink_set_pcs(). Note that if mac_select_pcs() is present, the supported_interfaces bitmap must be filled in; this avoids mac_select_pcs() being called with PHY_INTERFACE_MODE_NA when we want to get support for all interface types. Phylink will return an error in phylink_create() unless this condition is satisfied. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: mvneta: mark as a legacy_pre_march2020 driverRussell King (Oracle)
mvneta provides mac_an_restart and mac_pcs_get_state methods, so needs to be marked as a legacy driver. Marek spotted that mvneta had stopped working in 2500base-X mode - thanks for reporting. Reported-by: Marek Behún <kabel@kernel.org> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: axienet: mark as a legacy_pre_march2020 driverRussell King (Oracle)
axienet has a PCS, but does not make use of the phylink PCS support. Mark it was a pre-March 2020 driver. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: phy: prefer 1000baseT over 1000baseKXRussell King (Oracle)
The PHY settings table is supposed to be sorted by descending match priority - in other words, earlier entries are preferred over later entries. The order of 1000baseKX/Full and 1000baseT/Full is such that we prefer 1000baseKX/Full over 1000baseT/Full, but 1000baseKX/Full is a lot rarer than 1000baseT/Full, and thus is much less likely to be preferred. This causes phylink problems - it means a fixed link specifying a speed of 1G and full duplex gets an ethtool linkmode of 1000baseKX/Full rather than 1000baseT/Full as would be expected - and since we offer userspace a software emulation of a conventional copper PHY, we want to offer copper modes in preference to anything else. However, we do still want to allow the rarer modes as well. Hence, let's reorder these two modes to prefer copper. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: ag71xx: remove unnecessary legacy methodsRussell King (Oracle)
ag71xx may have a PCS, but it does not appear to support configuration of the PCS in the current code. The functions to get its state merely report that the link is down, and the AN restart function is empty. Since neither of these functions will be called unless phylink's legacy flag is set, we can safely remove these functions and indicate this is a modern driver. Should PCS support be added later, it will need to be modelled using the phylink_pcs support rather than operating as a legacy driver. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: phylink: use legacy_pre_march2020Russell King (Oracle)
Use the legacy flag to indicate whether we should operate in legacy mode. This allows us to stop using the presence of a PCS as an indicator to the age of the phylink user, and make PCS presence optional. Legacy mode involves: 1) calling mac_config() whenever the link comes up 2) calling mac_config() whenever the inband advertisement changes, possibly followed by a call to mac_an_restart() 3) making use of mac_an_restart() 4) making use of mac_pcs_get_state() All the above functionality was moved to a seperate "PCS" block of operations in March 2020. Update the documents to indicate that the differences that this flag makes. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: mtk_eth_soc: mark as a legacy_pre_march2020 driverRussell King (Oracle)
mtk_eth_soc has not been updated for commit 7cceb599d15d ("net: phylink: avoid mac_config calls"), and makes use of state->speed and state->duplex in contravention of the phylink documentation. This makes reliant on the legacy behaviours, so mark it as a legacy driver. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: mvneta: program 1ms autonegotiation clock divisorRussell King
Program the 1ms autonegotiation clock divisor according to the clocking rate of neta - without this, the 1ms clock ticks at about 660us on Armada 38x configured for 250MHz. Bring this into correct specification. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
2022-01-12net: phylink: tidy up disable bit clearingRussell King
Tidy up the disable bit clearing where we clear a bit and the run the link resolver. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
2022-01-12net: dsa: lantiq: convert to phylink_generic_validate()Russell King (Oracle)
Populate the supported interfaces and MAC capabilities for the Lantiq DSA switches and remove the old validate implementation to allow DSA to use phylink_generic_validate() for this switch driver. The exclusion of Gigabit linkmodes for MII, Reverse MII and Reduced MII links is handled within phylink_generic_validate() in phylink, so there is no need to make them conditional on the interface mode in the driver. Reviewed-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: dsa: hellcreek: convert to phylink_generic_validate()Russell King (Oracle)
Populate the supported interfaces and MAC capabilities for the hellcreek DSA switch and remove the old validate implementation to allow DSA to use phylink_generic_validate() for this switch driver. The switch actually only supports MII and RGMII, but as phylib defaults to GMII, we need to include this interface mode to keep existing DT working. Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de> Tested-by: Kurt Kanzenbach <kurt@linutronix.de> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: macb: convert to phylink_generic_validate()Russell King (Oracle)
Populate the supported interfaces bitmap and MAC capabilities mask for the macb driver and remove the old validate implementation. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: marvell: mvpp2: Add support for 5gbase-rMarek Behún
Add support for PHY_INTERFACE_MODE_5GBASER. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-01-12phy: marvell: phy-mvebu-cp110-comphy: add support for 5gbase-rMarek Behún
Add support for PHY_INTERFACE_MODE_5GBASER mode within the Marvell CP110 common PHY driver. This is currently only supported via SMC calls to TF-A. Legacy support may be added later, if needed. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-01-12Fix coverity issue 'Uninitialized scalar variable"Yacov Simhony
There are three boolean variable which were not initialized and later being used in the code. Signed-off-by: Yacov Simhony <ysimhony@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-01-12net: phylink: handle NA interface mode in phylink_fwnode_phy_connect()Russell King (Oracle)
Commit 4904b6ea1f9db ("net: phy: phylink: Use PHY device interface if N/A") introduced handling for the phy interface mode where this is not known at phylink creation time. This was never added to the OF/fwnode paths, but is necessary when the phy is present in DT, but the phy-mode is not specified. Add this handling. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: phylink: Add helpers for c22 registers without MDIORussell King (Oracle)
Some devices expose memory-mapped c22-compliant PHYs. Because these devices do not have an MDIO bus, we cannot use the existing helpers. Refactor the existing helpers to allow supplying the values for c22 registers directly, instead of using MDIO to access them. Only get_state and set_adversisement are converted, since they contain the most complex logic. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: phylink: add 1000base-KX to phylink_caps_to_linkmodes()Russell King (Oracle)
1000base-KX was missed in phylink_caps_to_linkmodes(), add it. This will be necessary to convert stmmac with xpcs to ensure we don't drop any supported linkmodes. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: macb: Fix several edge cases in validateSean Anderson
There were several cases where validate() would return bogus supported modes with unusual combinations of interfaces and capabilities. For example, if state->interface was 10GBASER and the macb had HIGH_SPEED and PCS but not GIGABIT MODE, then 10/100 modes would be set anyway. In another case, SGMII could be enabled even if the mac was not a GEM (despite this being checked for later on in mac_config()). These inconsistencies make it difficult to refactor this function cleanly. There is still the open question of what exactly the requirements for SGMII and 10GBASER are, and what SGMII actually supports. If someone from Cadence (or anyone else with access to the GEM/MACB datasheet) could comment on this, it would be greatly appreciated. In particular, what is supported by Cadence vs. vendor extension/limitation? To address this, the current logic is split into three parts. First, we determine what we support, then we eliminate unsupported interfaces, and finally we set the appropriate link modes. There is still some cruft related to NA, but this can be removed in a future patch. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
2022-01-12net: dpaa2-mac: use phylink_generic_validate()Russell King (Oracle)
DPAA2 has no special behaviour in its validation implementation, so can be switched to phylink_generic_validate(). Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>