Commit ec636707 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'fix-aqr-pma-capabilities'

Abhishek Chauhan says:

====================
Fix AQR PMA capabilities

Patch 1:-
AQR115c reports incorrect PMA capabilities which includes
10G/5G and also incorrectly disables capabilities like autoneg
and 10Mbps support.

AQR115c as per the Marvell databook supports speeds up to 2.5Gbps
with autonegotiation.

Patch 2:-
Remove the use of phy_set_max_speed in phy driver as the
function is mainly used in MAC driver to set the max
speed.

Instead use get_features to fix up Phy PMA capabilities for
AQR111, AQR111B0, AQR114C and AQCS109
====================

Link: https://patch.msgid.link/20241001224626.2400222-1-quic_abchauha@quicinc.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 55e80246 8f61d733
Loading
Loading
Loading
Loading
+33 −18
Original line number Diff line number Diff line
@@ -537,12 +537,6 @@ static int aqcs109_config_init(struct phy_device *phydev)
	if (!ret)
		aqr107_chip_info(phydev);

	/* AQCS109 belongs to a chip family partially supporting 10G and 5G.
	 * PMA speed ability bits are the same for all members of the family,
	 * AQCS109 however supports speeds up to 2.5G only.
	 */
	phy_set_max_speed(phydev, SPEED_2500);

	return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT);
}

@@ -731,6 +725,31 @@ static int aqr113c_fill_interface_modes(struct phy_device *phydev)
	return aqr107_fill_interface_modes(phydev);
}

static int aqr115c_get_features(struct phy_device *phydev)
{
	unsigned long *supported = phydev->supported;

	/* PHY supports speeds up to 2.5G with autoneg. PMA capabilities
	 * are not useful.
	 */
	linkmode_or(supported, supported, phy_gbit_features);
	linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, supported);

	return 0;
}

static int aqr111_get_features(struct phy_device *phydev)
{
	/* PHY supports speeds up to 5G with autoneg. PMA capabilities
	 * are not useful.
	 */
	aqr115c_get_features(phydev);
	linkmode_set_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
			 phydev->supported);

	return 0;
}

static int aqr113c_config_init(struct phy_device *phydev)
{
	int ret;
@@ -767,15 +786,6 @@ static int aqr107_probe(struct phy_device *phydev)
	return aqr_hwmon_probe(phydev);
}

static int aqr111_config_init(struct phy_device *phydev)
{
	/* AQR111 reports supporting speed up to 10G,
	 * however only speeds up to 5G are supported.
	 */
	phy_set_max_speed(phydev, SPEED_5000);

	return aqr107_config_init(phydev);
}

static struct phy_driver aqr_driver[] = {
{
@@ -853,6 +863,7 @@ static struct phy_driver aqr_driver[] = {
	.get_sset_count	= aqr107_get_sset_count,
	.get_strings	= aqr107_get_strings,
	.get_stats	= aqr107_get_stats,
	.get_features   = aqr115c_get_features,
	.link_change_notify = aqr107_link_change_notify,
	.led_brightness_set = aqr_phy_led_brightness_set,
	.led_hw_is_supported = aqr_phy_led_hw_is_supported,
@@ -865,7 +876,7 @@ static struct phy_driver aqr_driver[] = {
	.name		= "Aquantia AQR111",
	.probe		= aqr107_probe,
	.get_rate_matching = aqr107_get_rate_matching,
	.config_init	= aqr111_config_init,
	.config_init	= aqr107_config_init,
	.config_aneg    = aqr_config_aneg,
	.config_intr	= aqr_config_intr,
	.handle_interrupt = aqr_handle_interrupt,
@@ -877,6 +888,7 @@ static struct phy_driver aqr_driver[] = {
	.get_sset_count	= aqr107_get_sset_count,
	.get_strings	= aqr107_get_strings,
	.get_stats	= aqr107_get_stats,
	.get_features   = aqr111_get_features,
	.link_change_notify = aqr107_link_change_notify,
	.led_brightness_set = aqr_phy_led_brightness_set,
	.led_hw_is_supported = aqr_phy_led_hw_is_supported,
@@ -889,7 +901,7 @@ static struct phy_driver aqr_driver[] = {
	.name		= "Aquantia AQR111B0",
	.probe		= aqr107_probe,
	.get_rate_matching = aqr107_get_rate_matching,
	.config_init	= aqr111_config_init,
	.config_init	= aqr107_config_init,
	.config_aneg    = aqr_config_aneg,
	.config_intr	= aqr_config_intr,
	.handle_interrupt = aqr_handle_interrupt,
@@ -901,6 +913,7 @@ static struct phy_driver aqr_driver[] = {
	.get_sset_count	= aqr107_get_sset_count,
	.get_strings	= aqr107_get_strings,
	.get_stats	= aqr107_get_stats,
	.get_features   = aqr111_get_features,
	.link_change_notify = aqr107_link_change_notify,
	.led_brightness_set = aqr_phy_led_brightness_set,
	.led_hw_is_supported = aqr_phy_led_hw_is_supported,
@@ -1010,7 +1023,7 @@ static struct phy_driver aqr_driver[] = {
	.name           = "Aquantia AQR114C",
	.probe          = aqr107_probe,
	.get_rate_matching = aqr107_get_rate_matching,
	.config_init    = aqr111_config_init,
	.config_init    = aqr107_config_init,
	.config_aneg    = aqr_config_aneg,
	.config_intr    = aqr_config_intr,
	.handle_interrupt = aqr_handle_interrupt,
@@ -1022,6 +1035,7 @@ static struct phy_driver aqr_driver[] = {
	.get_sset_count = aqr107_get_sset_count,
	.get_strings    = aqr107_get_strings,
	.get_stats      = aqr107_get_stats,
	.get_features   = aqr111_get_features,
	.link_change_notify = aqr107_link_change_notify,
	.led_brightness_set = aqr_phy_led_brightness_set,
	.led_hw_is_supported = aqr_phy_led_hw_is_supported,
@@ -1046,6 +1060,7 @@ static struct phy_driver aqr_driver[] = {
	.get_sset_count = aqr107_get_sset_count,
	.get_strings    = aqr107_get_strings,
	.get_stats      = aqr107_get_stats,
	.get_features   = aqr115c_get_features,
	.link_change_notify = aqr107_link_change_notify,
	.led_brightness_set = aqr_phy_led_brightness_set,
	.led_hw_is_supported = aqr_phy_led_hw_is_supported,