[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1uzIbk-00000006n06-0a3X@rmk-PC.armlinux.org.uk>
Date: Thu, 18 Sep 2025 18:39:48 +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 11/20] net: dsa: mv88e6xxx: split out EXTTS pin
setup
Split out the EXTTS pin setup from the extts configuration.
Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
---
drivers/net/dsa/mv88e6xxx/ptp.c | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c
index de44622d8513..19ccc8cda1f0 100644
--- a/drivers/net/dsa/mv88e6xxx/ptp.c
+++ b/drivers/net/dsa/mv88e6xxx/ptp.c
@@ -111,6 +111,20 @@ static int mv88e6352_set_gpio_func(struct mv88e6xxx_chip *chip, int pin,
return chip->info->ops->gpio_ops->set_pctl(chip, pin, func);
}
+static int mv88e6352_ptp_pin_setup(struct mv88e6xxx_chip *chip, int pin,
+ enum ptp_pin_function func, int enable)
+{
+ if (func != PTP_PF_EXTTS)
+ return -EOPNOTSUPP;
+
+ if (enable)
+ func = MV88E6352_G2_SCRATCH_GPIO_PCTL_EVREQ;
+ else
+ func = MV88E6352_G2_SCRATCH_GPIO_PCTL_GPIO;
+
+ return mv88e6352_set_gpio_func(chip, pin, func, true);
+}
+
static const struct mv88e6xxx_cc_coeffs *
mv88e6xxx_cc_coeff_get(struct mv88e6xxx_chip *chip)
{
@@ -352,27 +366,18 @@ static int mv88e6352_ptp_enable_extts(struct mv88e6xxx_chip *chip,
return -EBUSY;
mv88e6xxx_reg_lock(chip);
+ err = mv88e6352_ptp_pin_setup(chip, pin, PTP_PF_EXTTS, on);
- if (on) {
- func = MV88E6352_G2_SCRATCH_GPIO_PCTL_EVREQ;
-
- err = mv88e6352_set_gpio_func(chip, pin, func, true);
- if (err)
- goto out;
-
+ if (!on) {
+ /* Always cancel the work, even if an error occurs */
+ cancel_delayed_work_sync(&chip->tai_event_work);
+ } else if (!err) {
schedule_delayed_work(&chip->tai_event_work,
TAI_EVENT_WORK_INTERVAL);
err = mv88e6352_config_eventcap(chip, rising);
- } else {
- func = MV88E6352_G2_SCRATCH_GPIO_PCTL_GPIO;
-
- err = mv88e6352_set_gpio_func(chip, pin, func, true);
-
- cancel_delayed_work_sync(&chip->tai_event_work);
}
-out:
mv88e6xxx_reg_unlock(chip);
return err;
--
2.47.3
Powered by blists - more mailing lists