All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: netdev@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>
Subject: [PATCH RFC net-next 10/20] net: dsa: mv88e6xxx: only support EXTTS for pins
Date: Thu, 18 Sep 2025 18:39:43 +0100	[thread overview]
Message-ID: <E1uzIbf-00000006n00-06XG@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <aMxDh17knIDhJany@shell.armlinux.org.uk>

The sole implementation for the PTP verify/enable methods only supports
the EXTTS function. Move these checks into mv88e6xxx_ptp_verify() and
mv88e6xxx_ptp_enable(), renaming the ptp_enable() method to
ptp_enable_extts().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/dsa/mv88e6xxx/chip.h |  4 ++--
 drivers/net/dsa/mv88e6xxx/ptp.c  | 26 +++++++++-----------------
 2 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h
index 7618f6db235e..ae56a88ca1c5 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.h
+++ b/drivers/net/dsa/mv88e6xxx/chip.h
@@ -731,8 +731,8 @@ struct mv88e6xxx_avb_ops {
 
 struct mv88e6xxx_ptp_ops {
 	u64 (*clock_read)(struct mv88e6xxx_chip *chip);
-	int (*ptp_enable)(struct mv88e6xxx_chip *chip,
-			  struct ptp_clock_request *rq, int on);
+	int (*ptp_enable_extts)(struct mv88e6xxx_chip *chip,
+				struct ptp_clock_request *rq, int on);
 	int (*ptp_verify)(struct mv88e6xxx_chip *chip, unsigned int pin,
 			  enum ptp_pin_function func, unsigned int chan);
 	void (*event_work)(struct work_struct *ugly);
diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c
index 72ad6be05943..de44622d8513 100644
--- a/drivers/net/dsa/mv88e6xxx/ptp.c
+++ b/drivers/net/dsa/mv88e6xxx/ptp.c
@@ -311,7 +311,10 @@ static int mv88e6xxx_ptp_enable(struct ptp_clock_info *ptp,
 {
 	struct mv88e6xxx_chip *chip = ptp_to_chip(ptp);
 
-	return chip->info->ops->ptp_ops->ptp_enable(chip, req, enable);
+	if (req->type != PTP_CLK_REQ_EXTTS)
+		return -EOPNOTSUPP;
+
+	return chip->info->ops->ptp_ops->ptp_enable_extts(chip, req, enable);
 }
 
 static int mv88e6xxx_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,
@@ -323,6 +326,9 @@ static int mv88e6xxx_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,
 	if (func == PTP_PF_NONE)
 		return 0;
 
+	if (func != PTP_PF_EXTTS)
+		return -EOPNOTSUPP;
+
 	return chip->info->ops->ptp_ops->ptp_verify(chip, pin, func, chan);
 }
 
@@ -372,23 +378,9 @@ static int mv88e6352_ptp_enable_extts(struct mv88e6xxx_chip *chip,
 	return err;
 }
 
-static int mv88e6352_ptp_enable(struct mv88e6xxx_chip *chip,
-				struct ptp_clock_request *rq, int on)
-{
-	switch (rq->type) {
-	case PTP_CLK_REQ_EXTTS:
-		return mv88e6352_ptp_enable_extts(chip, rq, on);
-	default:
-		return -EOPNOTSUPP;
-	}
-}
-
 static int mv88e6352_ptp_verify(struct mv88e6xxx_chip *chip, unsigned int pin,
 				enum ptp_pin_function func, unsigned int chan)
 {
-	if (func != PTP_PF_EXTTS)
-		return -EOPNOTSUPP;
-
 	return 0;
 }
 
@@ -410,7 +402,7 @@ const struct mv88e6xxx_ptp_ops mv88e6165_ptp_ops = {
 
 const struct mv88e6xxx_ptp_ops mv88e6352_ptp_ops = {
 	.clock_read = mv88e6352_ptp_clock_read,
-	.ptp_enable = mv88e6352_ptp_enable,
+	.ptp_enable_extts = mv88e6352_ptp_enable_extts,
 	.ptp_verify = mv88e6352_ptp_verify,
 	.event_work = mv88e6352_tai_event_work,
 	.port_enable = mv88e6352_hwtstamp_port_enable,
@@ -433,7 +425,7 @@ const struct mv88e6xxx_ptp_ops mv88e6352_ptp_ops = {
 
 const struct mv88e6xxx_ptp_ops mv88e6390_ptp_ops = {
 	.clock_read = mv88e6352_ptp_clock_read,
-	.ptp_enable = mv88e6352_ptp_enable,
+	.ptp_enable_extts = mv88e6352_ptp_enable_extts,
 	.ptp_verify = mv88e6352_ptp_verify,
 	.event_work = mv88e6352_tai_event_work,
 	.port_enable = mv88e6352_hwtstamp_port_enable,
-- 
2.47.3


  parent reply	other threads:[~2025-09-18 17:39 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-18 17:38 [PATCH RFC net-next 00/20] Marvell PTP stuffs Russell King (Oracle)
2025-09-18 17:38 ` [PATCH RFC net-next 01/20] ptp: marvell: add core support for Marvell PTP Russell King
2025-09-18 17:39 ` [PATCH RFC net-next 02/20] net: phy: add hwtstamp_get() method for mii timestampers Russell King (Oracle)
2025-09-18 20:38   ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 03/20] net: phy: marvell: add PHY PTP support Russell King
2025-09-18 20:12   ` Andrew Lunn
2025-09-18 20:33     ` Russell King (Oracle)
2025-09-19  1:47       ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 04/20] net: dsa: mv88e6xxx: split out set_ptp_cpu_port() code Russell King (Oracle)
2025-09-18 20:46   ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 05/20] net: dsa: mv88e6xxx: convert PTP clock_read() method to take chip Russell King (Oracle)
2025-09-18 20:13   ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 06/20] net: dsa: mv88e6xxx: convert PTP ptp_verify() " Russell King (Oracle)
2025-09-18 20:48   ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 07/20] net: dsa: mv88e6xxx: convert PTP ptp_enable() " Russell King (Oracle)
2025-09-18 20:48   ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 08/20] net: dsa: mv88e6xxx: convert mv88e6xxx_hwtstamp_work() " Russell King (Oracle)
2025-09-18 20:51   ` Andrew Lunn
2025-09-18 17:39 ` [PATCH RFC net-next 09/20] net: dsa: mv88e6xxx: always verify PTP_PF_NONE Russell King (Oracle)
2025-09-18 20:14   ` Andrew Lunn
2025-09-18 17:39 ` Russell King (Oracle) [this message]
2025-09-19 11:29   ` [PATCH RFC net-next 10/20] net: dsa: mv88e6xxx: only support EXTTS for pins Vadim Fedorenko
2025-09-19 13:50     ` Russell King (Oracle)
2025-09-18 17:39 ` [PATCH RFC net-next 11/20] net: dsa: mv88e6xxx: split out EXTTS pin setup Russell King (Oracle)
2025-09-18 20:59   ` Andrew Lunn
2025-09-28  9:51     ` Russell King (Oracle)
2025-09-18 17:39 ` [PATCH RFC net-next 12/20] net: dsa: mv88e6xxx: move EXTTS flag validation and pin lookup Russell King (Oracle)
2025-09-18 17:39 ` [PATCH RFC net-next 13/20] net: dsa: mv88e6xxx: convert to marvell TAI Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 14/20] net: dsa: mv88e6xxx: convert mv88e6xxx_cc_coeffs to marvell_tai_param Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 15/20] net: dsa: mv88e6xxx: allow generic core to configure global regs Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 16/20] net: dsa: mv88e6xxx: add beginnings of generic Marvell PTP ts layer Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 17/20] net: dsa: mv88e6xxx: switch tx timestamping to core Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 18/20] net: dsa: mv88e6xxx: switch rx " Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 19/20] net: dsa: mv88e6xxx: switch hwtstamp config to core XXX Fix 6165 Russell King (Oracle)
2025-09-18 17:40 ` [PATCH RFC net-next 20/20] net: dsa: mv88e6xxx: add ptp irq support Russell King (Oracle)

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=E1uzIbf-00000006n00-06XG@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.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.