diff mbox series

[4.19.y-cip] ravb: remove undocumented counter processing

Message ID 20240205090303.34620-1-biju.das.jz@bp.renesas.com (mailing list archive)
State Accepted
Headers show
Series [4.19.y-cip] ravb: remove undocumented counter processing | expand

Commit Message

Biju Das Feb. 5, 2024, 9:03 a.m. UTC
From: Simon Horman <horms+renesas@verge.net.au>

commit 009a470365b37106bbd66f1e1a53bc6c3c0072bc upstream.

This patch removes the use of the undocumented counter registers
CDCR, LCCR, CERCR, CEECR.

Offsets used for undocumented registers are considered reserved and
should not be written to. After some internal investigation with Renesas
it remains unclear why this driver accesses these fields but regardless of
what the historical reasons are the current code is considered incorrect.

Based on work by Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
Note:
 This patch is depend upon[1]
 [1] https://lore.kernel.org/cip-dev/OS0PR01MB638896E67835B158BC93D8C592422@OS0PR01MB6388.jpnprd01.prod.outlook.com/T/#t
---
 drivers/net/ethernet/renesas/ravb.h      | 4 ----
 drivers/net/ethernet/renesas/ravb_main.c | 9 ---------
 2 files changed, 13 deletions(-)

Comments

Pavel Machek Feb. 6, 2024, 10:53 a.m. UTC | #1
Hi!

> From: Simon Horman <horms+renesas@verge.net.au>
> 
> commit 009a470365b37106bbd66f1e1a53bc6c3c0072bc upstream.
> 
> This patch removes the use of the undocumented counter registers
> CDCR, LCCR, CERCR, CEECR.
> 
> Offsets used for undocumented registers are considered reserved and
> should not be written to. After some internal investigation with Renesas
> it remains unclear why this driver accesses these fields but regardless of
> what the historical reasons are the current code is considered incorrect.
> 
> Based on work by Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> 
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

This looks okay to me, I can apply it to 4.4/4.19 if it passes testing and if
there are no other comments.

Best regards,
									Pavel
Nobuhiro Iwamatsu Feb. 6, 2024, 11:57 p.m. UTC | #2
Hi all,

> -----Original Message-----
> From: Pavel Machek <pavel@denx.de>
> Sent: Tuesday, February 6, 2024 7:54 PM
> To: Biju Das <biju.das.jz@bp.renesas.com>
> Cc: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 ○DITC□
> DIT○OST) <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>; Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com>; Simon Horman
> <horms+renesas@verge.net.au>; David S . Miller <davem@davemloft.net>
> Subject: Re: [PATCH 4.19.y-cip] ravb: remove undocumented counter
> processing
> 
> Hi!
> 
> > From: Simon Horman <horms+renesas@verge.net.au>
> >
> > commit 009a470365b37106bbd66f1e1a53bc6c3c0072bc upstream.
> >
> > This patch removes the use of the undocumented counter registers CDCR,
> > LCCR, CERCR, CEECR.
> >
> > Offsets used for undocumented registers are considered reserved and
> > should not be written to. After some internal investigation with
> > Renesas it remains unclear why this driver accesses these fields but
> > regardless of what the historical reasons are the current code is considered
> incorrect.
> >
> > Based on work by Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> >
> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > Signed-off-by: David S. Miller <davem@davemloft.net>
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> 
> This looks okay to me, I can apply it to 4.4/4.19 if it passes testing and if there
> are no other comments.

Looks good to me, too.
Reviewed-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>

Best regards,
  Nobuhiro
Pavel Machek Feb. 7, 2024, 10:21 a.m. UTC | #3
Hi!

> > > commit 009a470365b37106bbd66f1e1a53bc6c3c0072bc upstream.
> > >
> > > This patch removes the use of the undocumented counter registers CDCR,
> > > LCCR, CERCR, CEECR.
> > >
> > > Offsets used for undocumented registers are considered reserved and
> > > should not be written to. After some internal investigation with
> > > Renesas it remains unclear why this driver accesses these fields but
> > > regardless of what the historical reasons are the current code is considered
> > incorrect.
> > >
> > > Based on work by Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> > >
> > > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > > Signed-off-by: David S. Miller <davem@davemloft.net>
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > 
> > This looks okay to me, I can apply it to 4.4/4.19 if it passes testing and if there
> > are no other comments.
> 
> Looks good to me, too.
> Reviewed-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>

Thank you. 4.4/4.19 passed testing, so I'm pushing both trees.

Best regards,
								Pavel
diff mbox series

Patch

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index f17e7948444a..7ad35954a332 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -194,15 +194,11 @@  enum ravb_reg {
 	MAHR	= 0x05c0,
 	MALR	= 0x05c8,
 	TROCR	= 0x0700,	/* Undocumented? */
-	CDCR	= 0x0708,	/* Undocumented? */
-	LCCR	= 0x0710,	/* Undocumented? */
 	CEFCR	= 0x0740,
 	FRECR	= 0x0748,
 	TSFRCR	= 0x0750,
 	TLFRCR	= 0x0758,
 	RFCR	= 0x0760,
-	CERCR	= 0x0768,	/* Undocumented? */
-	CEECR	= 0x0770,	/* Undocumented? */
 	MAFCR	= 0x0778,
 };
 
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 2cd14c37c36d..d9b31d49321b 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1656,15 +1656,6 @@  static struct net_device_stats *ravb_get_stats(struct net_device *ndev)
 
 	nstats->tx_dropped += ravb_read(ndev, TROCR);
 	ravb_write(ndev, 0, TROCR);	/* (write clear) */
-	nstats->collisions += ravb_read(ndev, CDCR);
-	ravb_write(ndev, 0, CDCR);	/* (write clear) */
-	nstats->tx_carrier_errors += ravb_read(ndev, LCCR);
-	ravb_write(ndev, 0, LCCR);	/* (write clear) */
-
-	nstats->tx_carrier_errors += ravb_read(ndev, CERCR);
-	ravb_write(ndev, 0, CERCR);	/* (write clear) */
-	nstats->tx_carrier_errors += ravb_read(ndev, CEECR);
-	ravb_write(ndev, 0, CEECR);	/* (write clear) */
 
 	nstats->rx_packets = stats0->rx_packets + stats1->rx_packets;
 	nstats->tx_packets = stats0->tx_packets + stats1->tx_packets;