[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1uzIbp-00000006n0M-0xxM@rmk-PC.armlinux.org.uk>
Date: Thu, 18 Sep 2025 18:39:53 +0100
From: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
To: netdev@...r.kernel.org
Cc: Andrew Lunn <andrew@...n.ch>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Richard Cochran <richardcochran@...il.com>,
Vladimir Oltean <olteanv@...il.com>
Subject: [PATCH RFC net-next 12/20] net: dsa: mv88e6xxx: move EXTTS flag
validation and pin lookup
Move the flag validation and pin lookup to mv88e6xxx_ptp_enable()
mv88e6352_ptp_enable_extts().
Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
---
drivers/net/dsa/mv88e6xxx/chip.h | 2 +-
drivers/net/dsa/mv88e6xxx/ptp.c | 29 +++++++++++++++--------------
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h
index ae56a88ca1c5..fe4a618c8ddd 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.h
+++ b/drivers/net/dsa/mv88e6xxx/chip.h
@@ -732,7 +732,7 @@ struct mv88e6xxx_avb_ops {
struct mv88e6xxx_ptp_ops {
u64 (*clock_read)(struct mv88e6xxx_chip *chip);
int (*ptp_enable_extts)(struct mv88e6xxx_chip *chip,
- struct ptp_clock_request *rq, int on);
+ struct ptp_clock_request *rq, int pin, 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 19ccc8cda1f0..efaefca1eef1 100644
--- a/drivers/net/dsa/mv88e6xxx/ptp.c
+++ b/drivers/net/dsa/mv88e6xxx/ptp.c
@@ -324,11 +324,23 @@ static int mv88e6xxx_ptp_enable(struct ptp_clock_info *ptp,
struct ptp_clock_request *req, int enable)
{
struct mv88e6xxx_chip *chip = ptp_to_chip(ptp);
+ int pin;
if (req->type != PTP_CLK_REQ_EXTTS)
return -EOPNOTSUPP;
- return chip->info->ops->ptp_ops->ptp_enable_extts(chip, req, enable);
+ /* Reject requests to enable time stamping on both edges. */
+ if (req->extts.flags & PTP_STRICT_FLAGS &&
+ req->extts.flags & PTP_ENABLE_FEATURE &&
+ (req->extts.flags & PTP_EXTTS_EDGES) == PTP_EXTTS_EDGES)
+ return -EOPNOTSUPP;
+
+ pin = ptp_find_pin(chip->ptp_clock, PTP_PF_EXTTS, req->extts.index);
+ if (pin < 0)
+ return -EBUSY;
+
+ return chip->info->ops->ptp_ops->ptp_enable_extts(chip, req, pin,
+ enable);
}
static int mv88e6xxx_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,
@@ -347,24 +359,13 @@ static int mv88e6xxx_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,
}
static int mv88e6352_ptp_enable_extts(struct mv88e6xxx_chip *chip,
- struct ptp_clock_request *rq, int on)
+ struct ptp_clock_request *rq, int pin,
+ int on)
{
int rising = (rq->extts.flags & PTP_RISING_EDGE);
int func;
- int pin;
int err;
- /* Reject requests to enable time stamping on both edges. */
- if ((rq->extts.flags & PTP_STRICT_FLAGS) &&
- (rq->extts.flags & PTP_ENABLE_FEATURE) &&
- (rq->extts.flags & PTP_EXTTS_EDGES) == PTP_EXTTS_EDGES)
- return -EOPNOTSUPP;
-
- pin = ptp_find_pin(chip->ptp_clock, PTP_PF_EXTTS, rq->extts.index);
-
- if (pin < 0)
- return -EBUSY;
-
mv88e6xxx_reg_lock(chip);
err = mv88e6352_ptp_pin_setup(chip, pin, PTP_PF_EXTTS, on);
--
2.47.3
Powered by blists - more mailing lists