All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xu Liang <lxu@maxlinear.com>
To: <andrew@lunn.ch>, <hkallweit1@gmail.com>,
	<netdev@vger.kernel.org>, <davem@davemloft.net>,
	<kuba@kernel.org>, <vee.khee.wong@linux.intel.com>
Cc: <linux@armlinux.org.uk>, <hmehrtens@maxlinear.com>,
	<tmohren@maxlinear.com>, <mohammad.athari.ismail@intel.com>,
	Xu Liang <lxu@maxlinear.com>
Subject: [PATCH v5 1/2] net: phy: add API to read 802.3-c45 IDs
Date: Thu, 1 Jul 2021 16:26:57 +0800	[thread overview]
Message-ID: <20210701082658.21875-1-lxu@maxlinear.com> (raw)

Add API to read 802.3-c45 IDs so that C22/C45 mixed device can use
C45 APIs without failing ID checks.

Signed-off-by: Xu Liang <lxu@maxlinear.com>
---
v5 changes:
 Fix incorrect prototype name in comment.

 drivers/net/phy/phy_device.c | 14 ++++++++++++++
 include/linux/phy.h          |  1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 0a2d8bedf73d..f0ad1c4add48 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -935,6 +935,20 @@ void phy_device_remove(struct phy_device *phydev)
 }
 EXPORT_SYMBOL(phy_device_remove);
 
+/**
+ * phy_get_c45_ids - Read 802.3-c45 IDs for phy device.
+ * @phydev: phy_device structure to read 802.3-c45 IDs
+ *
+ * Returns zero on success, %-EIO on bus access error, or %-ENODEV if
+ * the "devices in package" is invalid.
+ */
+int phy_get_c45_ids(struct phy_device *phydev)
+{
+	return get_phy_c45_ids(phydev->mdio.bus, phydev->mdio.addr,
+			       &phydev->c45_ids);
+}
+EXPORT_SYMBOL(phy_get_c45_ids);
+
 /**
  * phy_find_first - finds the first PHY device on the bus
  * @bus: the target MII bus
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 852743f07e3e..e46b23a2113b 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1391,6 +1391,7 @@ static inline int phy_device_register(struct phy_device *phy)
 static inline void phy_device_free(struct phy_device *phydev) { }
 #endif /* CONFIG_PHYLIB */
 void phy_device_remove(struct phy_device *phydev);
+int phy_get_c45_ids(struct phy_device *phydev);
 int phy_init_hw(struct phy_device *phydev);
 int phy_suspend(struct phy_device *phydev);
 int phy_resume(struct phy_device *phydev);
-- 
2.17.1


             reply	other threads:[~2021-07-01  8:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01  8:26 Xu Liang [this message]
2021-07-01  8:26 ` [PATCH v5 2/2] net: phy: add Maxlinear GPY115/21x/24x driver Xu Liang
2021-07-06 15:34   ` Liang Xu
2021-07-06 15:44     ` Russell King (Oracle)
     [not found]       ` <c4772ca8-42e3-9c9d-2388-e19acb19e073@maxlinear.com>
2021-07-07 15:22         ` Andrew Lunn
2021-07-08  5:04           ` Liang Xu

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=20210701082658.21875-1-lxu@maxlinear.com \
    --to=lxu@maxlinear.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=hmehrtens@maxlinear.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mohammad.athari.ismail@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=tmohren@maxlinear.com \
    --cc=vee.khee.wong@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.