netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/4] net: dsa: mv88e6xxx: remove redundant ptp/timestamping code
@ 2025-09-11 10:45 Russell King (Oracle)
  2025-09-11 10:46 ` [PATCH net-next v2 1/4] net: dsa: mv88e6xxx: remove mv88e6250_ptp_ops Russell King (Oracle)
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2025-09-11 10:45 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, netdev,
	Paolo Abeni, Richard Cochran, Vladimir Oltean

Hi,

mv88e6xxx as accumulated some unused data structures and code over the
years. This series removes it and simplifies the code. See the patches
for each change.

v2: fix evap_config typo, remove MV88E6XXX_TAI_EVENT_STATUS_CAP_TRIG
definitio

 drivers/net/dsa/mv88e6xxx/chip.c |  2 +-
 drivers/net/dsa/mv88e6xxx/chip.h |  2 --
 drivers/net/dsa/mv88e6xxx/ptp.c  | 55 ++++++----------------------------------
 drivers/net/dsa/mv88e6xxx/ptp.h  |  3 --
 4 files changed, 9 insertions(+), 53 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next v2 1/4] net: dsa: mv88e6xxx: remove mv88e6250_ptp_ops
  2025-09-11 10:45 [PATCH net-next v2 0/4] net: dsa: mv88e6xxx: remove redundant ptp/timestamping code Russell King (Oracle)
@ 2025-09-11 10:46 ` Russell King (Oracle)
  2025-09-11 10:46 ` [PATCH net-next v2 2/4] net: dsa: mv88e6xxx: remove chip->trig_config Russell King (Oracle)
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2025-09-11 10:46 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, netdev,
	Paolo Abeni, Richard Cochran, Vladimir Oltean

mv88e6250_ptp_ops and mv88e6352_ptp_ops are identical since commit
7e3c18097a70 ("net: dsa: mv88e6xxx: read cycle counter period from
hardware"). Remove the unnecessary duplication.

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/dsa/mv88e6xxx/chip.c |  2 +-
 drivers/net/dsa/mv88e6xxx/ptp.c  | 23 -----------------------
 drivers/net/dsa/mv88e6xxx/ptp.h  |  2 --
 3 files changed, 1 insertion(+), 26 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 2281d6ab8c9a..25d4c89d36b8 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -5088,7 +5088,7 @@ static const struct mv88e6xxx_ops mv88e6250_ops = {
 	.vtu_getnext = mv88e6185_g1_vtu_getnext,
 	.vtu_loadpurge = mv88e6185_g1_vtu_loadpurge,
 	.avb_ops = &mv88e6352_avb_ops,
-	.ptp_ops = &mv88e6250_ptp_ops,
+	.ptp_ops = &mv88e6352_ptp_ops,
 	.phylink_get_caps = mv88e6250_phylink_get_caps,
 	.set_max_frame_size = mv88e6185_g1_set_max_frame_size,
 };
diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c
index e8c9207e932e..62a74bcdc90a 100644
--- a/drivers/net/dsa/mv88e6xxx/ptp.c
+++ b/drivers/net/dsa/mv88e6xxx/ptp.c
@@ -413,29 +413,6 @@ const struct mv88e6xxx_ptp_ops mv88e6165_ptp_ops = {
 		(1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ),
 };
 
-const struct mv88e6xxx_ptp_ops mv88e6250_ptp_ops = {
-	.clock_read = mv88e6352_ptp_clock_read,
-	.ptp_enable = mv88e6352_ptp_enable,
-	.ptp_verify = mv88e6352_ptp_verify,
-	.event_work = mv88e6352_tai_event_work,
-	.port_enable = mv88e6352_hwtstamp_port_enable,
-	.port_disable = mv88e6352_hwtstamp_port_disable,
-	.n_ext_ts = 1,
-	.arr0_sts_reg = MV88E6XXX_PORT_PTP_ARR0_STS,
-	.arr1_sts_reg = MV88E6XXX_PORT_PTP_ARR1_STS,
-	.dep_sts_reg = MV88E6XXX_PORT_PTP_DEP_STS,
-	.rx_filters = (1 << HWTSTAMP_FILTER_NONE) |
-		(1 << HWTSTAMP_FILTER_PTP_V2_L4_EVENT) |
-		(1 << HWTSTAMP_FILTER_PTP_V2_L4_SYNC) |
-		(1 << HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ) |
-		(1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
-		(1 << HWTSTAMP_FILTER_PTP_V2_L2_SYNC) |
-		(1 << HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ) |
-		(1 << HWTSTAMP_FILTER_PTP_V2_EVENT) |
-		(1 << HWTSTAMP_FILTER_PTP_V2_SYNC) |
-		(1 << HWTSTAMP_FILTER_PTP_V2_DELAY_REQ),
-};
-
 const struct mv88e6xxx_ptp_ops mv88e6352_ptp_ops = {
 	.clock_read = mv88e6352_ptp_clock_read,
 	.ptp_enable = mv88e6352_ptp_enable,
diff --git a/drivers/net/dsa/mv88e6xxx/ptp.h b/drivers/net/dsa/mv88e6xxx/ptp.h
index 6c4d09adc93c..24b824f42046 100644
--- a/drivers/net/dsa/mv88e6xxx/ptp.h
+++ b/drivers/net/dsa/mv88e6xxx/ptp.h
@@ -149,7 +149,6 @@ void mv88e6xxx_ptp_free(struct mv88e6xxx_chip *chip);
 				      ptp_clock_info)
 
 extern const struct mv88e6xxx_ptp_ops mv88e6165_ptp_ops;
-extern const struct mv88e6xxx_ptp_ops mv88e6250_ptp_ops;
 extern const struct mv88e6xxx_ptp_ops mv88e6352_ptp_ops;
 extern const struct mv88e6xxx_ptp_ops mv88e6390_ptp_ops;
 
@@ -170,7 +169,6 @@ static inline void mv88e6xxx_ptp_free(struct mv88e6xxx_chip *chip)
 }
 
 static const struct mv88e6xxx_ptp_ops mv88e6165_ptp_ops = {};
-static const struct mv88e6xxx_ptp_ops mv88e6250_ptp_ops = {};
 static const struct mv88e6xxx_ptp_ops mv88e6352_ptp_ops = {};
 static const struct mv88e6xxx_ptp_ops mv88e6390_ptp_ops = {};
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next v2 2/4] net: dsa: mv88e6xxx: remove chip->trig_config
  2025-09-11 10:45 [PATCH net-next v2 0/4] net: dsa: mv88e6xxx: remove redundant ptp/timestamping code Russell King (Oracle)
  2025-09-11 10:46 ` [PATCH net-next v2 1/4] net: dsa: mv88e6xxx: remove mv88e6250_ptp_ops Russell King (Oracle)
@ 2025-09-11 10:46 ` Russell King (Oracle)
  2025-09-11 10:46 ` [PATCH net-next v2 3/4] net: dsa: mv88e6xxx: remove chip->evcap_config Russell King (Oracle)
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2025-09-11 10:46 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, netdev,
	Paolo Abeni, Richard Cochran, Vladimir Oltean

chip->trig_config is never written, and thus takes the value zero.
Remove this struct member and its single reader.

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/dsa/mv88e6xxx/chip.h | 1 -
 drivers/net/dsa/mv88e6xxx/ptp.c  | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h
index feddf505c918..9beaffb2eb12 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.h
+++ b/drivers/net/dsa/mv88e6xxx/chip.h
@@ -424,7 +424,6 @@ struct mv88e6xxx_chip {
 	struct ptp_clock_info	ptp_clock_info;
 	struct delayed_work	tai_event_work;
 	struct ptp_pin_desc	pin_config[MV88E6XXX_MAX_GPIO];
-	u16 trig_config;
 	u16 evcap_config;
 	u16 enable_count;
 
diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c
index 62a74bcdc90a..402328b9349b 100644
--- a/drivers/net/dsa/mv88e6xxx/ptp.c
+++ b/drivers/net/dsa/mv88e6xxx/ptp.c
@@ -184,7 +184,7 @@ static int mv88e6352_config_eventcap(struct mv88e6xxx_chip *chip, int event,
 	if (!rising)
 		chip->evcap_config |= MV88E6XXX_TAI_CFG_EVREQ_FALLING;
 
-	global_config = (chip->evcap_config | chip->trig_config);
+	global_config = chip->evcap_config;
 	err = mv88e6xxx_tai_write(chip, MV88E6XXX_TAI_CFG, global_config);
 	if (err)
 		return err;
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next v2 3/4] net: dsa: mv88e6xxx: remove chip->evcap_config
  2025-09-11 10:45 [PATCH net-next v2 0/4] net: dsa: mv88e6xxx: remove redundant ptp/timestamping code Russell King (Oracle)
  2025-09-11 10:46 ` [PATCH net-next v2 1/4] net: dsa: mv88e6xxx: remove mv88e6250_ptp_ops Russell King (Oracle)
  2025-09-11 10:46 ` [PATCH net-next v2 2/4] net: dsa: mv88e6xxx: remove chip->trig_config Russell King (Oracle)
@ 2025-09-11 10:46 ` Russell King (Oracle)
  2025-09-11 10:46 ` [PATCH net-next v2 4/4] net: dsa: mv88e6xxx: remove unused support for PPS event capture Russell King (Oracle)
  2025-09-14 19:00 ` [PATCH net-next v2 0/4] net: dsa: mv88e6xxx: remove redundant ptp/timestamping code patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2025-09-11 10:46 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, netdev,
	Paolo Abeni, Richard Cochran, Vladimir Oltean

evcap_config is only read and written in mv88e6352_config_eventcap(),
so it makes little sense to store it in the global chip struct. Make
it a local variable instead.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
--
v2: fix evap_config typo
---
 drivers/net/dsa/mv88e6xxx/chip.h |  1 -
 drivers/net/dsa/mv88e6xxx/ptp.c  | 11 +++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h
index 9beaffb2eb12..2f211e55cb47 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.h
+++ b/drivers/net/dsa/mv88e6xxx/chip.h
@@ -424,7 +424,6 @@ struct mv88e6xxx_chip {
 	struct ptp_clock_info	ptp_clock_info;
 	struct delayed_work	tai_event_work;
 	struct ptp_pin_desc	pin_config[MV88E6XXX_MAX_GPIO];
-	u16 evcap_config;
 	u16 enable_count;
 
 	/* Current ingress and egress monitor ports */
diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c
index 402328b9349b..350f1d5c05f4 100644
--- a/drivers/net/dsa/mv88e6xxx/ptp.c
+++ b/drivers/net/dsa/mv88e6xxx/ptp.c
@@ -175,17 +175,16 @@ static u64 mv88e6165_ptp_clock_read(struct cyclecounter *cc)
 static int mv88e6352_config_eventcap(struct mv88e6xxx_chip *chip, int event,
 				     int rising)
 {
-	u16 global_config;
+	u16 evcap_config;
 	u16 cap_config;
 	int err;
 
-	chip->evcap_config = MV88E6XXX_TAI_CFG_CAP_OVERWRITE |
-			     MV88E6XXX_TAI_CFG_CAP_CTR_START;
+	evcap_config = MV88E6XXX_TAI_CFG_CAP_OVERWRITE |
+		       MV88E6XXX_TAI_CFG_CAP_CTR_START;
 	if (!rising)
-		chip->evcap_config |= MV88E6XXX_TAI_CFG_EVREQ_FALLING;
+		evcap_config |= MV88E6XXX_TAI_CFG_EVREQ_FALLING;
 
-	global_config = chip->evcap_config;
-	err = mv88e6xxx_tai_write(chip, MV88E6XXX_TAI_CFG, global_config);
+	err = mv88e6xxx_tai_write(chip, MV88E6XXX_TAI_CFG, evcap_config);
 	if (err)
 		return err;
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next v2 4/4] net: dsa: mv88e6xxx: remove unused support for PPS event capture
  2025-09-11 10:45 [PATCH net-next v2 0/4] net: dsa: mv88e6xxx: remove redundant ptp/timestamping code Russell King (Oracle)
                   ` (2 preceding siblings ...)
  2025-09-11 10:46 ` [PATCH net-next v2 3/4] net: dsa: mv88e6xxx: remove chip->evcap_config Russell King (Oracle)
@ 2025-09-11 10:46 ` Russell King (Oracle)
  2025-09-14 19:00 ` [PATCH net-next v2 0/4] net: dsa: mv88e6xxx: remove redundant ptp/timestamping code patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2025-09-11 10:46 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, netdev,
	Paolo Abeni, Richard Cochran, Vladimir Oltean

mv88e6352_config_eventcap() is documented as handling both EXTTS and
PPS capture modes, but nothing ever calls it for PPS capture. Remove
the unused PPS capture mode support, and the now unused
MV88E6XXX_TAI_EVENT_STATUS_CAP_TRIG definition.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
--
v2: remove MV88E6XXX_TAI_EVENT_STATUS_CAP_TRIG definition
---
 drivers/net/dsa/mv88e6xxx/ptp.c | 21 +++------------------
 drivers/net/dsa/mv88e6xxx/ptp.h |  1 -
 2 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c
index 350f1d5c05f4..89fb61ea891d 100644
--- a/drivers/net/dsa/mv88e6xxx/ptp.c
+++ b/drivers/net/dsa/mv88e6xxx/ptp.c
@@ -167,16 +167,13 @@ static u64 mv88e6165_ptp_clock_read(struct cyclecounter *cc)
 }
 
 /* mv88e6352_config_eventcap - configure TAI event capture
- * @event: PTP_CLOCK_PPS (internal) or PTP_CLOCK_EXTTS (external)
  * @rising: zero for falling-edge trigger, else rising-edge trigger
  *
  * This will also reset the capture sequence counter.
  */
-static int mv88e6352_config_eventcap(struct mv88e6xxx_chip *chip, int event,
-				     int rising)
+static int mv88e6352_config_eventcap(struct mv88e6xxx_chip *chip, int rising)
 {
 	u16 evcap_config;
-	u16 cap_config;
 	int err;
 
 	evcap_config = MV88E6XXX_TAI_CFG_CAP_OVERWRITE |
@@ -188,20 +185,8 @@ static int mv88e6352_config_eventcap(struct mv88e6xxx_chip *chip, int event,
 	if (err)
 		return err;
 
-	if (event == PTP_CLOCK_PPS) {
-		cap_config = MV88E6XXX_TAI_EVENT_STATUS_CAP_TRIG;
-	} else if (event == PTP_CLOCK_EXTTS) {
-		/* if STATUS_CAP_TRIG is unset we capture PTP_EVREQ events */
-		cap_config = 0;
-	} else {
-		return -EINVAL;
-	}
-
 	/* Write the capture config; this also clears the capture counter */
-	err = mv88e6xxx_tai_write(chip, MV88E6XXX_TAI_EVENT_STATUS,
-				  cap_config);
-
-	return err;
+	return mv88e6xxx_tai_write(chip, MV88E6XXX_TAI_EVENT_STATUS, 0);
 }
 
 static void mv88e6352_tai_event_work(struct work_struct *ugly)
@@ -354,7 +339,7 @@ static int mv88e6352_ptp_enable_extts(struct mv88e6xxx_chip *chip,
 		schedule_delayed_work(&chip->tai_event_work,
 				      TAI_EVENT_WORK_INTERVAL);
 
-		err = mv88e6352_config_eventcap(chip, PTP_CLOCK_EXTTS, rising);
+		err = mv88e6352_config_eventcap(chip, rising);
 	} else {
 		func = MV88E6352_G2_SCRATCH_GPIO_PCTL_GPIO;
 
diff --git a/drivers/net/dsa/mv88e6xxx/ptp.h b/drivers/net/dsa/mv88e6xxx/ptp.h
index 24b824f42046..b3fd177d67e3 100644
--- a/drivers/net/dsa/mv88e6xxx/ptp.h
+++ b/drivers/net/dsa/mv88e6xxx/ptp.h
@@ -54,7 +54,6 @@
 
 /* Offset 0x09: Event Status */
 #define MV88E6XXX_TAI_EVENT_STATUS		0x09
-#define MV88E6XXX_TAI_EVENT_STATUS_CAP_TRIG	0x4000
 #define MV88E6XXX_TAI_EVENT_STATUS_ERROR	0x0200
 #define MV88E6XXX_TAI_EVENT_STATUS_VALID	0x0100
 #define MV88E6XXX_TAI_EVENT_STATUS_CTR_MASK	0x00ff
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v2 0/4] net: dsa: mv88e6xxx: remove redundant ptp/timestamping code
  2025-09-11 10:45 [PATCH net-next v2 0/4] net: dsa: mv88e6xxx: remove redundant ptp/timestamping code Russell King (Oracle)
                   ` (3 preceding siblings ...)
  2025-09-11 10:46 ` [PATCH net-next v2 4/4] net: dsa: mv88e6xxx: remove unused support for PPS event capture Russell King (Oracle)
@ 2025-09-14 19:00 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-14 19:00 UTC (permalink / raw)
  To: Russell King
  Cc: andrew, davem, edumazet, kuba, netdev, pabeni, richardcochran,
	olteanv

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 11 Sep 2025 11:45:55 +0100 you wrote:
> Hi,
> 
> mv88e6xxx as accumulated some unused data structures and code over the
> years. This series removes it and simplifies the code. See the patches
> for each change.
> 
> v2: fix evap_config typo, remove MV88E6XXX_TAI_EVENT_STATUS_CAP_TRIG
> definitio
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/4] net: dsa: mv88e6xxx: remove mv88e6250_ptp_ops
    https://git.kernel.org/netdev/net-next/c/afc0e12a235c
  - [net-next,v2,2/4] net: dsa: mv88e6xxx: remove chip->trig_config
    https://git.kernel.org/netdev/net-next/c/578c1eb9c541
  - [net-next,v2,3/4] net: dsa: mv88e6xxx: remove chip->evcap_config
    https://git.kernel.org/netdev/net-next/c/ae4c94981683
  - [net-next,v2,4/4] net: dsa: mv88e6xxx: remove unused support for PPS event capture
    https://git.kernel.org/netdev/net-next/c/fbd12de4c5b1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-09-14 19:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-11 10:45 [PATCH net-next v2 0/4] net: dsa: mv88e6xxx: remove redundant ptp/timestamping code Russell King (Oracle)
2025-09-11 10:46 ` [PATCH net-next v2 1/4] net: dsa: mv88e6xxx: remove mv88e6250_ptp_ops Russell King (Oracle)
2025-09-11 10:46 ` [PATCH net-next v2 2/4] net: dsa: mv88e6xxx: remove chip->trig_config Russell King (Oracle)
2025-09-11 10:46 ` [PATCH net-next v2 3/4] net: dsa: mv88e6xxx: remove chip->evcap_config Russell King (Oracle)
2025-09-11 10:46 ` [PATCH net-next v2 4/4] net: dsa: mv88e6xxx: remove unused support for PPS event capture Russell King (Oracle)
2025-09-14 19:00 ` [PATCH net-next v2 0/4] net: dsa: mv88e6xxx: remove redundant ptp/timestamping code patchwork-bot+netdevbpf

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).