diff mbox series

[net-next,v3,3/3] net: fec: make PPS channel configurable

Message ID 20240809094804.391441-4-francesco@dolcini.it (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: fec: add PPS channel configuration | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for 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: 29 this patch: 29
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: 29 this patch: 29
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 No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 29 this patch: 29
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 19 this patch: 19
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-09--15-00 (tests: 705)

Commit Message

Francesco Dolcini Aug. 9, 2024, 9:48 a.m. UTC
From: Francesco Dolcini <francesco.dolcini@toradex.com>

Depending on the SoC where the FEC is integrated into the PPS channel
might be routed to different timer instances. Make this configurable
from the devicetree.

When the related DT property is not present fallback to the previous
default and use channel 0.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Tested-by: Rafael Beims <rafael.beims@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
v3: added net-next subject prefix
v2: add Reviewed|Tested-by
---
 drivers/net/ethernet/freescale/fec_ptp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Wei Fang Aug. 12, 2024, 2:37 a.m. UTC | #1
> -----Original Message-----
> From: Francesco Dolcini <francesco@dolcini.it>
> Sent: 2024年8月9日 17:48
> To: Wei Fang <wei.fang@nxp.com>; Shenwei Wang
> <shenwei.wang@nxp.com>; Clark Wang <xiaoning.wang@nxp.com>; David S.
> Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>;
> Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>;
> Richard Cochran <richardcochran@gmail.com>
> Cc: Francesco Dolcini <francesco.dolcini@toradex.com>; imx@lists.linux.dev;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Frank Li
> <frank.li@nxp.com>; Rafael Beims <rafael.beims@toradex.com>
> Subject: [PATCH net-next v3 3/3] net: fec: make PPS channel configurable
> 
> From: Francesco Dolcini <francesco.dolcini@toradex.com>
> 
> Depending on the SoC where the FEC is integrated into the PPS channel might
> be routed to different timer instances. Make this configurable from the
> devicetree.
> 
> When the related DT property is not present fallback to the previous default
> and use channel 0.
> 
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Tested-by: Rafael Beims <rafael.beims@toradex.com>
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> ---
> v3: added net-next subject prefix
> v2: add Reviewed|Tested-by
> ---
>  drivers/net/ethernet/freescale/fec_ptp.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_ptp.c
> b/drivers/net/ethernet/freescale/fec_ptp.c
> index 25f988b9c7cf..2e05083cbf29 100644
> --- a/drivers/net/ethernet/freescale/fec_ptp.c
> +++ b/drivers/net/ethernet/freescale/fec_ptp.c
> @@ -529,8 +529,6 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp,
>  	unsigned long flags;
>  	int ret = 0;
> 
> -	fep->pps_channel = DEFAULT_PPS_CHANNEL;
> -
>  	if (rq->type == PTP_CLK_REQ_PPS) {
>  		fep->reload_period = PPS_OUPUT_RELOAD_PERIOD;
> 
> @@ -712,12 +710,16 @@ void fec_ptp_init(struct platform_device *pdev, int
> irq_idx)  {
>  	struct net_device *ndev = platform_get_drvdata(pdev);
>  	struct fec_enet_private *fep = netdev_priv(ndev);
> +	struct device_node *np = fep->pdev->dev.of_node;
nit
struct device_node *np = pdev->dev.of_node;

>  	int irq;
>  	int ret;
> 
>  	fep->ptp_caps.owner = THIS_MODULE;
>  	strscpy(fep->ptp_caps.name, "fec ptp", sizeof(fep->ptp_caps.name));
> 
> +	fep->pps_channel = DEFAULT_PPS_CHANNEL;
> +	of_property_read_u32(np, "fsl,pps-channel", &fep->pps_channel);
> +
>  	fep->ptp_caps.max_adj = 250000000;
>  	fep->ptp_caps.n_alarm = 0;
>  	fep->ptp_caps.n_ext_ts = 0;
> --
> 2.39.2
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
index 25f988b9c7cf..2e05083cbf29 100644
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -529,8 +529,6 @@  static int fec_ptp_enable(struct ptp_clock_info *ptp,
 	unsigned long flags;
 	int ret = 0;
 
-	fep->pps_channel = DEFAULT_PPS_CHANNEL;
-
 	if (rq->type == PTP_CLK_REQ_PPS) {
 		fep->reload_period = PPS_OUPUT_RELOAD_PERIOD;
 
@@ -712,12 +710,16 @@  void fec_ptp_init(struct platform_device *pdev, int irq_idx)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct fec_enet_private *fep = netdev_priv(ndev);
+	struct device_node *np = fep->pdev->dev.of_node;
 	int irq;
 	int ret;
 
 	fep->ptp_caps.owner = THIS_MODULE;
 	strscpy(fep->ptp_caps.name, "fec ptp", sizeof(fep->ptp_caps.name));
 
+	fep->pps_channel = DEFAULT_PPS_CHANNEL;
+	of_property_read_u32(np, "fsl,pps-channel", &fep->pps_channel);
+
 	fep->ptp_caps.max_adj = 250000000;
 	fep->ptp_caps.n_alarm = 0;
 	fep->ptp_caps.n_ext_ts = 0;