On certain i.MX8 series parts [1], the PPS channel 0 is routed internally to eDMA, and the external PPS pin is available on channel 1. In addition, on certain boards, the PPS may be wired on the PCB to an EVENTOUTn pin other than 0. On these systems it is necessary that the PPS channel be able to be configured from the Device Tree.
[1] https://lore.kernel.org/all/ZrPYOWA3FESx197L@lizhi-Precision-Tower-5810/
Francesco Dolcini (3): dt-bindings: net: fec: add pps channel property net: fec: refactor PPS channel configuration net: fec: make PPS channel configurable
Documentation/devicetree/bindings/net/fsl,fec.yaml | 7 +++++++ drivers/net/ethernet/freescale/fec_ptp.c | 11 ++++++----- 2 files changed, 13 insertions(+), 5 deletions(-)
From: Francesco Dolcini francesco.dolcini@toradex.com
Add fsl,pps-channel property to select where to connect the PPS signal. This depends on the internal SoC routing and on the board, for example on the i.MX8 SoC it can be connected to an external pin (using channel 1) or to internal eDMA as DMA request (channel 0).
Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com Acked-by: Conor Dooley conor.dooley@microchip.com Signed-off-by: Paolo Abeni pabeni@redhat.com
(cherry picked from commit 1aa772be0444a2bd06957f6d31865e80e6ae4244) Signed-off-by: Csókás, Bence csokas.bence@prolan.hu --- Documentation/devicetree/bindings/net/fsl,fec.yaml | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/fsl,fec.yaml b/Documentation/devicetree/bindings/net/fsl,fec.yaml index b494e009326e..9925563e5e14 100644 --- a/Documentation/devicetree/bindings/net/fsl,fec.yaml +++ b/Documentation/devicetree/bindings/net/fsl,fec.yaml @@ -182,6 +182,13 @@ properties: description: Register bits of stop mode control, the format is <&gpr req_gpr req_bit>.
+ fsl,pps-channel: + $ref: /schemas/types.yaml#/definitions/uint32 + default: 0 + description: + Specifies to which timer instance the PPS signal is routed. + enum: [0, 1, 2, 3] + mdio: $ref: mdio.yaml# unevaluatedProperties: false
[ Sasha's backport helper bot ]
Hi,
Found matching upstream commit: 1aa772be0444a2bd06957f6d31865e80e6ae4244
WARNING: Author mismatch between patch and found commit: Backport author: =?UTF-8?q?Cs=C3=B3k=C3=A1s=2C=20Bence?= csokas.bence@prolan.hu Commit author: Francesco Dolcini francesco.dolcini@toradex.com
Status in newer kernel trees: 6.12.y | Not found 6.11.y | Not found 6.6.y | Not found
Note: The patch differs from the upstream commit: --- --- - 2024-11-25 09:11:16.976864779 -0500 +++ /tmp/tmp.L8bIAVDsFo 2024-11-25 09:11:16.968567367 -0500 @@ -6,15 +6,18 @@ Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com Acked-by: Conor Dooley conor.dooley@microchip.com Signed-off-by: Paolo Abeni pabeni@redhat.com + +(cherry picked from commit 1aa772be0444a2bd06957f6d31865e80e6ae4244) +Signed-off-by: Csókás, Bence csokas.bence@prolan.hu --- Documentation/devicetree/bindings/net/fsl,fec.yaml | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/fsl,fec.yaml b/Documentation/devicetree/bindings/net/fsl,fec.yaml -index 5536c06139cae..24e863fdbdab0 100644 +index b494e009326e..9925563e5e14 100644 --- a/Documentation/devicetree/bindings/net/fsl,fec.yaml +++ b/Documentation/devicetree/bindings/net/fsl,fec.yaml -@@ -183,6 +183,13 @@ properties: +@@ -182,6 +182,13 @@ properties: description: Register bits of stop mode control, the format is <&gpr req_gpr req_bit>.
@@ -28,3 +31,7 @@ mdio: $ref: mdio.yaml# unevaluatedProperties: false +-- +2.34.1 + + ---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.6.y | Success | Success | | stable/linux-6.1.y | Success | Success |
From: Francesco Dolcini francesco.dolcini@toradex.com
Preparation patch to allow for PPS channel configuration, no functional change intended.
Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com Reviewed-by: Frank Li Frank.Li@nxp.com Reviewed-by: Csókás, Bence csokas.bence@prolan.hu Signed-off-by: Paolo Abeni pabeni@redhat.com
(cherry picked from commit bf8ca67e21671e7a56e31da45360480b28f185f1) Signed-off-by: Csókás, Bence csokas.bence@prolan.hu --- drivers/net/ethernet/freescale/fec_ptp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index a4eb6edb850a..37e1c895f1b8 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -84,8 +84,7 @@ #define FEC_CC_MULT (1 << 31) #define FEC_COUNTER_PERIOD (1 << 31) #define PPS_OUPUT_RELOAD_PERIOD NSEC_PER_SEC -#define FEC_CHANNLE_0 0 -#define DEFAULT_PPS_CHANNEL FEC_CHANNLE_0 +#define DEFAULT_PPS_CHANNEL 0
#define FEC_PTP_MAX_NSEC_PERIOD 4000000000ULL #define FEC_PTP_MAX_NSEC_COUNTER 0x80000000ULL @@ -524,8 +523,9 @@ 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->pps_channel = DEFAULT_PPS_CHANNEL; fep->reload_period = PPS_OUPUT_RELOAD_PERIOD;
ret = fec_ptp_enable_pps(fep, on); @@ -536,10 +536,9 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp, if (rq->perout.flags) return -EOPNOTSUPP;
- if (rq->perout.index != DEFAULT_PPS_CHANNEL) + if (rq->perout.index != fep->pps_channel) return -EOPNOTSUPP;
- fep->pps_channel = DEFAULT_PPS_CHANNEL; period.tv_sec = rq->perout.period.sec; period.tv_nsec = rq->perout.period.nsec; period_ns = timespec64_to_ns(&period);
[ Sasha's backport helper bot ]
Hi,
Found matching upstream commit: bf8ca67e21671e7a56e31da45360480b28f185f1
WARNING: Author mismatch between patch and found commit: Backport author: =?UTF-8?q?Cs=C3=B3k=C3=A1s=2C=20Bence?= csokas.bence@prolan.hu Commit author: Francesco Dolcini francesco.dolcini@toradex.com
Status in newer kernel trees: 6.12.y | Not found 6.11.y | Not found 6.6.y | Not found
Note: The patch differs from the upstream commit: --- --- - 2024-11-25 09:20:12.188256676 -0500 +++ /tmp/tmp.UYjfIU1OfM 2024-11-25 09:20:12.180896704 -0500 @@ -5,12 +5,15 @@ Reviewed-by: Frank Li Frank.Li@nxp.com Reviewed-by: Csókás, Bence csokas.bence@prolan.hu Signed-off-by: Paolo Abeni pabeni@redhat.com + +(cherry picked from commit bf8ca67e21671e7a56e31da45360480b28f185f1) +Signed-off-by: Csókás, Bence csokas.bence@prolan.hu --- drivers/net/ethernet/freescale/fec_ptp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c -index a4eb6edb850ad..37e1c895f1b86 100644 +index a4eb6edb850a..37e1c895f1b8 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -84,8 +84,7 @@ @@ -46,3 +49,7 @@ period.tv_sec = rq->perout.period.sec; period.tv_nsec = rq->perout.period.nsec; period_ns = timespec64_to_ns(&period); +-- +2.34.1 + + ---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.6.y | Success | Success |
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 Reviewed-by: Csókás, Bence csokas.bence@prolan.hu Signed-off-by: Paolo Abeni pabeni@redhat.com
(cherry picked from commit 566c2d83887f0570056833102adc5b88e681b0c7) Signed-off-by: Csókás, Bence csokas.bence@prolan.hu --- 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 37e1c895f1b8..7f6b57432071 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -523,8 +523,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;
@@ -706,12 +704,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;
[ Sasha's backport helper bot ]
Hi,
Found matching upstream commit: 566c2d83887f0570056833102adc5b88e681b0c7
WARNING: Author mismatch between patch and found commit: Backport author: =?UTF-8?q?Cs=C3=B3k=C3=A1s=2C=20Bence?= csokas.bence@prolan.hu Commit author: Francesco Dolcini francesco.dolcini@toradex.com
Status in newer kernel trees: 6.12.y | Not found 6.11.y | Not found 6.6.y | Not found
Note: The patch differs from the upstream commit: --- --- - 2024-11-25 09:25:02.822819093 -0500 +++ /tmp/tmp.NUygUEJTBz 2024-11-25 09:25:02.816734590 -0500 @@ -10,12 +10,15 @@ Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com Reviewed-by: Csókás, Bence csokas.bence@prolan.hu Signed-off-by: Paolo Abeni pabeni@redhat.com + +(cherry picked from commit 566c2d83887f0570056833102adc5b88e681b0c7) +Signed-off-by: Csókás, Bence csokas.bence@prolan.hu --- 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 37e1c895f1b86..7f6b574320716 100644 +index 37e1c895f1b8..7f6b57432071 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -523,8 +523,6 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp, @@ -44,3 +47,7 @@ fep->ptp_caps.max_adj = 250000000; fep->ptp_caps.n_alarm = 0; fep->ptp_caps.n_ext_ts = 0; +-- +2.34.1 + + ---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.6.y | Success | Success |
Hi,
On 2024. 11. 25. 16:20, Sasha Levin wrote:
[ Sasha's backport helper bot ]
Hi,
Found matching upstream commit: 566c2d83887f0570056833102adc5b88e681b0c7
WARNING: Author mismatch between patch and found commit: Backport author: =?UTF-8?q?Cs=C3=B3k=C3=A1s=2C=20Bence?= csokas.bence@prolan.hu Commit author: Francesco Dolcini francesco.dolcini@toradex.com
Status in newer kernel trees: 6.12.y | Not found 6.11.y | Not found 6.6.y | Not found
Note: The patch differs from the upstream commit:
--- - 2024-11-25 09:25:02.822819093 -0500 +++ /tmp/tmp.NUygUEJTBz 2024-11-25 09:25:02.816734590 -0500 @@ -10,12 +10,15 @@ Signed-off-by: Francesco Dolcini francesco.dolcini@toradex.com Reviewed-by: Csókás, Bence csokas.bence@prolan.hu Signed-off-by: Paolo Abeni pabeni@redhat.com
+(cherry picked from commit 566c2d83887f0570056833102adc5b88e681b0c7) +Signed-off-by: Csókás, Bence csokas.bence@prolan.hu
Was I wrong to sign-off the cherry pick? Should I resubmit without it? Or will you re-pick it from upstream instead?
Bence
On Mon, Nov 25, 2024 at 10:16:36AM +0100, Csókás, Bence wrote:
On certain i.MX8 series parts [1], the PPS channel 0 is routed internally to eDMA, and the external PPS pin is available on channel 1. In addition, on certain boards, the PPS may be wired on the PCB to an EVENTOUTn pin other than 0. On these systems it is necessary that the PPS channel be able to be configured from the Device Tree.
[1] https://lore.kernel.org/all/ZrPYOWA3FESx197L@lizhi-Precision-Tower-5810/
Francesco Dolcini (3): dt-bindings: net: fec: add pps channel property net: fec: refactor PPS channel configuration net: fec: make PPS channel configurable
Documentation/devicetree/bindings/net/fsl,fec.yaml | 7 +++++++ drivers/net/ethernet/freescale/fec_ptp.c | 11 ++++++----- 2 files changed, 13 insertions(+), 5 deletions(-)
We can't take patches only for older stable kernels, and not newer ones for obvious reasons (i.e. you will upgrade and have a regression.) So please provide backports for all active kernels and we will be glad to review them then.
thanks,
greg k-h
linux-stable-mirror@lists.linaro.org