netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Marko <robimarko@gmail.com>
To: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, ansuelsmth@gmail.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Robert Marko <robimarko@gmail.com>
Subject: [PATCH 1/2] net: phy: aquantia: validate PHY mode on AQR107
Date: Fri, 17 Nov 2023 11:05:04 +0100	[thread overview]
Message-ID: <20231117100848.424372-1-robimarko@gmail.com> (raw)

The Aquantia driver is not setting the PHY mode itself, but it does however
still check if the PHY mode set in DTS is one of the supported modes.

However, the set PHY mode does not have to match the actual one, so lets
add update the PHY mode during .config_init and warn if they differ.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
 drivers/net/phy/aquantia/aquantia_main.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c
index cc4a97741c4a..7711e052e737 100644
--- a/drivers/net/phy/aquantia/aquantia_main.c
+++ b/drivers/net/phy/aquantia/aquantia_main.c
@@ -505,6 +505,21 @@ static void aqr107_chip_info(struct phy_device *phydev)
 		   fw_major, fw_minor, build_id, prov_id);
 }
 
+static void aqr107_validate_mode(struct phy_device *phydev,
+				 phy_interface_t dts_mode)
+{
+	int ret;
+
+	/* Get the actual PHY mode */
+	ret = aqr107_read_status(phydev);
+	if (ret)
+		return;
+
+	if (dts_mode != phydev->interface)
+		phydev_info(phydev, "%s mode is set in DTS while %s mode is actual. Please update your devicetree.\n",
+			    phy_modes(dts_mode), phy_modes(phydev->interface));
+}
+
 static int aqr107_config_init(struct phy_device *phydev)
 {
 	int ret;
@@ -528,6 +543,8 @@ static int aqr107_config_init(struct phy_device *phydev)
 	if (!ret)
 		aqr107_chip_info(phydev);
 
+	aqr107_validate_mode(phydev, phydev->interface);
+
 	return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT);
 }
 
-- 
2.42.0


             reply	other threads:[~2023-11-17 10:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 10:05 Robert Marko [this message]
2023-11-17 10:05 ` [PATCH 2/2] net: phy: aquantia: enable USXGMII autoneg on AQR107 Robert Marko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231117100848.424372-1-robimarko@gmail.com \
    --to=robimarko@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=ansuelsmth@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).