Message ID | 20240807144349.297342-4-francesco@dolcini.it (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | net: fec: add PPS channel configuration | expand |
On Wed, Aug 07, 2024 at 04:43:48PM +0200, Francesco Dolcini wrote: > 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. > > Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> > --- > 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 6f0f8bf61752..8e17fd0c8e6d 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; > -- > 2.39.2 >
On 07/08/2024 11:43, Francesco Dolcini wrote: > 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. > > Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> > --- > 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 6f0f8bf61752..8e17fd0c8e6d 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; Tested-by: rafael.beims@toradex.com
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index 6f0f8bf61752..8e17fd0c8e6d 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;