linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antoine Tenart <antoine.tenart@bootlin.com>
To: davem@davemloft.net, sd@queasysnail.net, andrew@lunn.ch,
	f.fainelli@gmail.com, hkallweit1@gmail.com
Cc: Antoine Tenart <antoine.tenart@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	thomas.petazzoni@bootlin.com, alexandre.belloni@bootlin.com,
	allan.nielsen@microchip.com, camelia.groza@nxp.com,
	Simon.Edelhaus@aquantia.com, Igor.Russkikh@aquantia.com,
	jakub.kicinski@netronome.com
Subject: [PATCH net-next v4 07/15] net: phy: export __phy_read_page/__phy_write_page
Date: Thu, 19 Dec 2019 11:55:07 +0100	[thread overview]
Message-ID: <20191219105515.78400-8-antoine.tenart@bootlin.com> (raw)
In-Reply-To: <20191219105515.78400-1-antoine.tenart@bootlin.com>

This patch exports the __phy_read_page and __phy_write_page helpers, to
allow reading and setting the current page when a function already holds
the MDIO lock.

This is something the Microsemi PHY driver does during its
initialization because parts of its registers and engines are shared
between ports. With the upcoming MACsec offloading support in this PHY,
we'll need to configure the MACsec engine and to do so changing pages is
required.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
 drivers/net/phy/phy-core.c | 6 ++++--
 include/linux/phy.h        | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
index 769a076514b0..1075d34518f2 100644
--- a/drivers/net/phy/phy-core.c
+++ b/drivers/net/phy/phy-core.c
@@ -695,21 +695,23 @@ int phy_modify_mmd(struct phy_device *phydev, int devad, u32 regnum,
 }
 EXPORT_SYMBOL_GPL(phy_modify_mmd);
 
-static int __phy_read_page(struct phy_device *phydev)
+int __phy_read_page(struct phy_device *phydev)
 {
 	if (WARN_ONCE(!phydev->drv->read_page, "read_page callback not available, PHY driver not loaded?\n"))
 		return -EOPNOTSUPP;
 
 	return phydev->drv->read_page(phydev);
 }
+EXPORT_SYMBOL_GPL(__phy_read_page);
 
-static int __phy_write_page(struct phy_device *phydev, int page)
+int __phy_write_page(struct phy_device *phydev, int page)
 {
 	if (WARN_ONCE(!phydev->drv->write_page, "write_page callback not available, PHY driver not loaded?\n"))
 		return -EOPNOTSUPP;
 
 	return phydev->drv->write_page(phydev, page);
 }
+EXPORT_SYMBOL_GPL(__phy_write_page);
 
 /**
  * phy_save_page() - take the bus lock and save the current page
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 11b92da25681..4179b59c5727 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -802,6 +802,9 @@ int __phy_modify_changed(struct phy_device *phydev, u32 regnum, u16 mask,
 			 u16 set);
 int phy_modify_changed(struct phy_device *phydev, u32 regnum, u16 mask,
 		       u16 set);
+int __phy_read_page(struct phy_device *phydev);
+int __phy_write_page(struct phy_device *phydev, int page);
+
 int __phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set);
 int phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set);
 
-- 
2.24.1


  parent reply	other threads:[~2019-12-19 11:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-19 10:55 [PATCH net-next v4 00/15] net: macsec: initial support for hardware offloading Antoine Tenart
2019-12-19 10:55 ` [PATCH net-next v4 01/15] net: macsec: move some definitions in a dedicated header Antoine Tenart
2019-12-19 10:55 ` [PATCH net-next v4 02/15] net: macsec: introduce the macsec_context structure Antoine Tenart
2019-12-19 10:55 ` [PATCH net-next v4 03/15] net: macsec: introduce MACsec ops Antoine Tenart
2019-12-19 10:55 ` [PATCH net-next v4 04/15] net: phy: add MACsec ops in phy_device Antoine Tenart
2019-12-19 10:55 ` [PATCH net-next v4 05/15] net: macsec: hardware offloading infrastructure Antoine Tenart
2019-12-19 10:55 ` [PATCH net-next v4 06/15] net: macsec: add nla support for changing the offloading selection Antoine Tenart
2019-12-19 10:55 ` Antoine Tenart [this message]
2019-12-19 10:55 ` [PATCH net-next v4 08/15] net: phy: mscc: macsec initialization Antoine Tenart
2019-12-19 20:11   ` David Miller
2020-01-09 13:18     ` Antoine Tenart
2019-12-19 10:55 ` [PATCH net-next v4 09/15] net: phy: mscc: macsec support Antoine Tenart
2019-12-19 10:55 ` [PATCH net-next v4 10/15] net: macsec: PN wrap callback Antoine Tenart
2019-12-19 10:55 ` [PATCH net-next v4 11/15] net: phy: mscc: PN rollover support Antoine Tenart
2019-12-19 10:55 ` [PATCH net-next v4 12/15] net: introduce the MACSEC netdev feature Antoine Tenart
2019-12-19 10:55 ` [PATCH net-next v4 13/15] net: add a reference to MACsec ops in net_device Antoine Tenart
2019-12-19 10:55 ` [PATCH net-next v4 14/15] net: macsec: allow to reference a netdev from a MACsec context Antoine Tenart
2019-12-19 10:55 ` [PATCH net-next v4 15/15] net: macsec: add support for offloading to the MAC Antoine Tenart
2019-12-23 11:36   ` [EXT] " Igor Russkikh
2020-01-09 13:21     ` Antoine Tenart

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=20191219105515.78400-8-antoine.tenart@bootlin.com \
    --to=antoine.tenart@bootlin.com \
    --cc=Igor.Russkikh@aquantia.com \
    --cc=Simon.Edelhaus@aquantia.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=camelia.groza@nxp.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sd@queasysnail.net \
    --cc=thomas.petazzoni@bootlin.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).