From: Antoine Tenart <antoine.tenart@bootlin.com>
To: davem@davemloft.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,
alexandre.belloni@bootlin.com, thomas.petazzoni@bootlin.com,
allan.nielsen@microchip.com, vladimir.oltean@nxp.com
Subject: [PATCH net-next 1/2] net: mscc: use the PHY MII ioctl interface when possible
Date: Tue, 26 May 2020 17:01:48 +0200 [thread overview]
Message-ID: <20200526150149.456719-2-antoine.tenart@bootlin.com> (raw)
In-Reply-To: <20200526150149.456719-1-antoine.tenart@bootlin.com>
Allow ioctl to be implemented by the PHY, when a PHY is attached to the
Ocelot switch. In case the ioctl is a request to set or get the hardware
timestamp, use the Ocelot switch implementation for now.
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
drivers/net/ethernet/mscc/ocelot.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index e621c4c3ee86..2151c08a57c7 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -1204,18 +1204,16 @@ static int ocelot_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
struct ocelot *ocelot = priv->port.ocelot;
int port = priv->chip_port;
- /* The function is only used for PTP operations for now */
- if (!ocelot->ptp)
- return -EOPNOTSUPP;
-
- switch (cmd) {
- case SIOCSHWTSTAMP:
- return ocelot_hwstamp_set(ocelot, port, ifr);
- case SIOCGHWTSTAMP:
- return ocelot_hwstamp_get(ocelot, port, ifr);
- default:
- return -EOPNOTSUPP;
+ if (ocelot->ptp) {
+ switch (cmd) {
+ case SIOCSHWTSTAMP:
+ return ocelot_hwstamp_set(ocelot, port, ifr);
+ case SIOCGHWTSTAMP:
+ return ocelot_hwstamp_get(ocelot, port, ifr);
+ }
}
+
+ return phy_mii_ioctl(dev->phydev, ifr, cmd);
}
static const struct net_device_ops ocelot_port_netdev_ops = {
--
2.26.2
next prev parent reply other threads:[~2020-05-26 15:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-26 15:01 [PATCH net-next 0/2] net: mscc: allow forwarding ioctl operations to attached PHYs Antoine Tenart
2020-05-26 15:01 ` Antoine Tenart [this message]
2020-05-27 14:11 ` [PATCH net-next 1/2] net: mscc: use the PHY MII ioctl interface when possible Andrew Lunn
2020-05-26 15:01 ` [PATCH net-next 2/2] net: mscc: allow offloading timestamping operations to the PHY Antoine Tenart
2020-05-27 14:11 ` Andrew Lunn
2020-05-27 21:54 ` [PATCH net-next 0/2] net: mscc: allow forwarding ioctl operations to attached PHYs David Miller
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=20200526150149.456719-2-antoine.tenart@bootlin.com \
--to=antoine.tenart@bootlin.com \
--cc=alexandre.belloni@bootlin.com \
--cc=allan.nielsen@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=vladimir.oltean@nxp.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
all inboxes | Powered by JetHome®