diff mbox series

[resubmit,3] net: fec: Fix FEC_ECR_EN1588 being cleared on link-down

Message ID 20240619123111.2798142-1-csokas.bence@prolan.hu (mailing list archive)
State Accepted
Commit c32fe1986f27cac329767d3497986e306cad1d5e
Delegated to: Netdev Maintainers
Headers show
Series [resubmit,3] net: fec: Fix FEC_ECR_EN1588 being cleared on link-down | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 845 this patch: 845
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 849 this patch: 849
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 849 this patch: 849
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-06-20--03-00 (tests: 659)

Commit Message

Csókás Bence June 19, 2024, 12:31 p.m. UTC
FEC_ECR_EN1588 bit gets cleared after MAC reset in `fec_stop()`, which
makes all 1588 functionality shut down, and all the extended registers
disappear, on link-down, making the adapter fall back to compatibility
"dumb mode". However, some functionality needs to be retained (e.g. PPS)
even without link.

Fixes: 6605b730c061 ("FEC: Add time stamping code and a PTP hardware clock")
Cc: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/netdev/5fa9fadc-a89d-467a-aae9-c65469ff5fe1@lunn.ch/
Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
---
 drivers/net/ethernet/freescale/fec_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Wei Fang June 21, 2024, 2:27 a.m. UTC | #1
> -----Original Message-----
> From: Csókás, Bence <csokas.bence@prolan.hu>
> Sent: 2024年6月19日 20:31
> To: Frank Li <Frank.Li@freescale.com>; David S. Miller
> <davem@davemloft.net>; imx@lists.linux.dev; netdev@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Cc: Csókás, Bence <csokas.bence@prolan.hu>; Richard Cochran
> <richardcochran@gmail.com>; Andrew Lunn <andrew@lunn.ch>; Wei Fang
> <wei.fang@nxp.com>; Shenwei Wang <shenwei.wang@nxp.com>; Clark
> Wang <xiaoning.wang@nxp.com>; Eric Dumazet <edumazet@google.com>;
> Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>
> Subject: [PATCH resubmit 3] net: fec: Fix FEC_ECR_EN1588 being cleared on
> link-down
>
> FEC_ECR_EN1588 bit gets cleared after MAC reset in `fec_stop()`, which
> makes all 1588 functionality shut down, and all the extended registers
> disappear, on link-down, making the adapter fall back to compatibility "dumb
> mode". However, some functionality needs to be retained (e.g. PPS) even
> without link.
>
> Fixes: 6605b730c061 ("FEC: Add time stamping code and a PTP hardware
> clock")
> Cc: Richard Cochran <richardcochran@gmail.com>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> Link:
> https://lore.ker/
> nel.org%2Fnetdev%2F5fa9fadc-a89d-467a-aae9-c65469ff5fe1%40lunn.ch%2F
> &data=05%7C02%7Cwei.fang%40nxp.com%7C68af958c8a3545b457c408dc90
> 5c129b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6385439723
> 35606813%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV
> 2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=GfV0Lj
> 6k5RwRLUArRhbxaDoNpG6wLlZSQh9vNxuReZA%3D&reserved=0
> Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
> ---
>  drivers/net/ethernet/freescale/fec_main.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 881ece735dcf..fb19295529a2 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1361,6 +1361,12 @@ fec_stop(struct net_device *ndev)
>               writel(FEC_ECR_ETHEREN, fep->hwp + FEC_ECNTRL);
>               writel(rmii_mode, fep->hwp + FEC_R_CNTRL);
>       }
> +
> +     if (fep->bufdesc_ex) {
> +             val = readl(fep->hwp + FEC_ECNTRL);
> +             val |= FEC_ECR_EN1588;
> +             writel(val, fep->hwp + FEC_ECNTRL);
> +     }
>  }
>
>  static void
> --
> 2.34.1
>

Thank you!

Reviewed-by: Wei Fang <wei.fang@nxp.com>
patchwork-bot+netdevbpf@kernel.org June 21, 2024, 9:20 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Wed, 19 Jun 2024 14:31:11 +0200 you wrote:
> FEC_ECR_EN1588 bit gets cleared after MAC reset in `fec_stop()`, which
> makes all 1588 functionality shut down, and all the extended registers
> disappear, on link-down, making the adapter fall back to compatibility
> "dumb mode". However, some functionality needs to be retained (e.g. PPS)
> even without link.
> 
> Fixes: 6605b730c061 ("FEC: Add time stamping code and a PTP hardware clock")
> Cc: Richard Cochran <richardcochran@gmail.com>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> Link: https://lore.kernel.org/netdev/5fa9fadc-a89d-467a-aae9-c65469ff5fe1@lunn.ch/
> Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
> 
> [...]

Here is the summary with links:
  - [resubmit,3] net: fec: Fix FEC_ECR_EN1588 being cleared on link-down
    https://git.kernel.org/netdev/net-next/c/c32fe1986f27

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 881ece735dcf..fb19295529a2 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1361,6 +1361,12 @@  fec_stop(struct net_device *ndev)
 		writel(FEC_ECR_ETHEREN, fep->hwp + FEC_ECNTRL);
 		writel(rmii_mode, fep->hwp + FEC_R_CNTRL);
 	}
+
+	if (fep->bufdesc_ex) {
+		val = readl(fep->hwp + FEC_ECNTRL);
+		val |= FEC_ECR_EN1588;
+		writel(val, fep->hwp + FEC_ECNTRL);
+	}
 }
 
 static void