devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ptp_qoriq: support FIPER3
@ 2020-09-12  3:30 Yangbo Lu
  2020-09-12  3:30 ` [PATCH 1/2] dt-binding: ptp_qoriq: support fsl,tmr-fiper3 property Yangbo Lu
  2020-09-12  3:30 ` [PATCH 2/2] ptp_qoriq: support FIPER3 Yangbo Lu
  0 siblings, 2 replies; 7+ messages in thread
From: Yangbo Lu @ 2020-09-12  3:30 UTC (permalink / raw)
  To: netdev
  Cc: Yangbo Lu, devicetree, David S . Miller, Richard Cochran,
	Rob Herring, Mark Rutland

The FIPER3 (fixed interval period pulse generator) is supported on
DPAA2 and ENETC network controller hardware. This patch-set is to
support it in ptp_qoriq driver and dt-binding.

Yangbo Lu (2):
  dt-binding: ptp_qoriq: support fsl,tmr-fiper3 property
  ptp_qoriq: support FIPER3

 .../devicetree/bindings/ptp/ptp-qoriq.txt          |  2 ++
 drivers/ptp/ptp_qoriq.c                            | 23 +++++++++++++++++++++-
 include/linux/fsl/ptp_qoriq.h                      |  3 +++
 3 files changed, 27 insertions(+), 1 deletion(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] dt-binding: ptp_qoriq: support fsl,tmr-fiper3 property
  2020-09-12  3:30 [PATCH 0/2] ptp_qoriq: support FIPER3 Yangbo Lu
@ 2020-09-12  3:30 ` Yangbo Lu
  2020-09-12  3:30 ` [PATCH 2/2] ptp_qoriq: support FIPER3 Yangbo Lu
  1 sibling, 0 replies; 7+ messages in thread
From: Yangbo Lu @ 2020-09-12  3:30 UTC (permalink / raw)
  To: netdev
  Cc: Yangbo Lu, devicetree, David S . Miller, Richard Cochran,
	Rob Herring, Mark Rutland

Add fsl,tmr-fiper3 property definition which is supported only
on DPAA2 and ENETC network controller hardware.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 Documentation/devicetree/bindings/ptp/ptp-qoriq.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/ptp/ptp-qoriq.txt b/Documentation/devicetree/bindings/ptp/ptp-qoriq.txt
index d48f9eb..743eda7 100644
--- a/Documentation/devicetree/bindings/ptp/ptp-qoriq.txt
+++ b/Documentation/devicetree/bindings/ptp/ptp-qoriq.txt
@@ -18,6 +18,8 @@ Clock Properties:
   - fsl,tmr-add      Frequency compensation value.
   - fsl,tmr-fiper1   Fixed interval period pulse generator.
   - fsl,tmr-fiper2   Fixed interval period pulse generator.
+  - fsl,tmr-fiper3   Fixed interval period pulse generator.
+                     Supported only on DPAA2 and ENETC hardware.
   - fsl,max-adj      Maximum frequency adjustment in parts per billion.
   - fsl,extts-fifo   The presence of this property indicates hardware
 		     support for the external trigger stamp FIFO.
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] ptp_qoriq: support FIPER3
  2020-09-12  3:30 [PATCH 0/2] ptp_qoriq: support FIPER3 Yangbo Lu
  2020-09-12  3:30 ` [PATCH 1/2] dt-binding: ptp_qoriq: support fsl,tmr-fiper3 property Yangbo Lu
@ 2020-09-12  3:30 ` Yangbo Lu
  2020-09-12  7:35   ` Vladimir Oltean
  2020-09-12 18:31   ` Vladimir Oltean
  1 sibling, 2 replies; 7+ messages in thread
From: Yangbo Lu @ 2020-09-12  3:30 UTC (permalink / raw)
  To: netdev
  Cc: Yangbo Lu, devicetree, David S . Miller, Richard Cochran,
	Rob Herring, Mark Rutland

The FIPER3 (fixed interval period pulse generator) is supported on
DPAA2 and ENETC network controller hardware. This patch is to support
it in ptp_qoriq driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/ptp/ptp_qoriq.c       | 23 ++++++++++++++++++++++-
 include/linux/fsl/ptp_qoriq.h |  3 +++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index c09c16be..68beb1b 100644
--- a/drivers/ptp/ptp_qoriq.c
+++ b/drivers/ptp/ptp_qoriq.c
@@ -72,6 +72,10 @@ static void set_fipers(struct ptp_qoriq *ptp_qoriq)
 	set_alarm(ptp_qoriq);
 	ptp_qoriq->write(&regs->fiper_regs->tmr_fiper1, ptp_qoriq->tmr_fiper1);
 	ptp_qoriq->write(&regs->fiper_regs->tmr_fiper2, ptp_qoriq->tmr_fiper2);
+
+	if (ptp_qoriq->fiper3_support)
+		ptp_qoriq->write(&regs->fiper_regs->tmr_fiper3,
+				 ptp_qoriq->tmr_fiper3);
 }
 
 int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index, bool update_event)
@@ -366,6 +370,7 @@ static u32 ptp_qoriq_nominal_freq(u32 clk_src)
  *   "fsl,tmr-add"
  *   "fsl,tmr-fiper1"
  *   "fsl,tmr-fiper2"
+ *   "fsl,tmr-fiper3" (required only for DPAA2 and ENETC hardware)
  *   "fsl,max-adj"
  *
  * Return 0 if success
@@ -412,6 +417,7 @@ static int ptp_qoriq_auto_config(struct ptp_qoriq *ptp_qoriq,
 	ptp_qoriq->tmr_add = freq_comp;
 	ptp_qoriq->tmr_fiper1 = DEFAULT_FIPER1_PERIOD - ptp_qoriq->tclk_period;
 	ptp_qoriq->tmr_fiper2 = DEFAULT_FIPER2_PERIOD - ptp_qoriq->tclk_period;
+	ptp_qoriq->tmr_fiper3 = DEFAULT_FIPER3_PERIOD - ptp_qoriq->tclk_period;
 
 	/* max_adj = 1000000000 * (freq_ratio - 1.0) - 1
 	 * freq_ratio = reference_clock_freq / nominal_freq
@@ -446,6 +452,13 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
 	else
 		ptp_qoriq->extts_fifo_support = false;
 
+	if (of_device_is_compatible(node, "fsl,dpaa2-ptp") ||
+	    of_device_is_compatible(node, "fsl,enetc-ptp")) {
+		ptp_qoriq->fiper3_support = true;
+	} else {
+		ptp_qoriq->fiper3_support = false;
+	}
+
 	if (of_property_read_u32(node,
 				 "fsl,tclk-period", &ptp_qoriq->tclk_period) ||
 	    of_property_read_u32(node,
@@ -457,7 +470,10 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
 	    of_property_read_u32(node,
 				 "fsl,tmr-fiper2", &ptp_qoriq->tmr_fiper2) ||
 	    of_property_read_u32(node,
-				 "fsl,max-adj", &ptp_qoriq->caps.max_adj)) {
+				 "fsl,max-adj", &ptp_qoriq->caps.max_adj) ||
+	    (of_property_read_u32(node,
+				 "fsl,tmr-fiper3", &ptp_qoriq->tmr_fiper3) &&
+	     ptp_qoriq->fiper3_support)) {
 		pr_warn("device tree node missing required elements, try automatic configuration\n");
 
 		if (ptp_qoriq_auto_config(ptp_qoriq, node))
@@ -502,6 +518,11 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
 	ptp_qoriq->write(&regs->ctrl_regs->tmr_prsc, ptp_qoriq->tmr_prsc);
 	ptp_qoriq->write(&regs->fiper_regs->tmr_fiper1, ptp_qoriq->tmr_fiper1);
 	ptp_qoriq->write(&regs->fiper_regs->tmr_fiper2, ptp_qoriq->tmr_fiper2);
+
+	if (ptp_qoriq->fiper3_support)
+		ptp_qoriq->write(&regs->fiper_regs->tmr_fiper3,
+				 ptp_qoriq->tmr_fiper3);
+
 	set_alarm(ptp_qoriq);
 	ptp_qoriq->write(&regs->ctrl_regs->tmr_ctrl,
 			 tmr_ctrl|FIPERST|RTPE|TE|FRD);
diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h
index 884b8f8..01acebe 100644
--- a/include/linux/fsl/ptp_qoriq.h
+++ b/include/linux/fsl/ptp_qoriq.h
@@ -136,6 +136,7 @@ struct ptp_qoriq_registers {
 #define DEFAULT_TMR_PRSC	2
 #define DEFAULT_FIPER1_PERIOD	1000000000
 #define DEFAULT_FIPER2_PERIOD	1000000000
+#define DEFAULT_FIPER3_PERIOD	1000000000
 
 struct ptp_qoriq {
 	void __iomem *base;
@@ -147,6 +148,7 @@ struct ptp_qoriq {
 	struct dentry *debugfs_root;
 	struct device *dev;
 	bool extts_fifo_support;
+	bool fiper3_support;
 	int irq;
 	int phc_index;
 	u32 tclk_period;  /* nanoseconds */
@@ -155,6 +157,7 @@ struct ptp_qoriq {
 	u32 cksel;
 	u32 tmr_fiper1;
 	u32 tmr_fiper2;
+	u32 tmr_fiper3;
 	u32 (*read)(unsigned __iomem *addr);
 	void (*write)(unsigned __iomem *addr, u32 val);
 };
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] ptp_qoriq: support FIPER3
  2020-09-12  3:30 ` [PATCH 2/2] ptp_qoriq: support FIPER3 Yangbo Lu
@ 2020-09-12  7:35   ` Vladimir Oltean
  2020-09-18  9:53     ` Y.b. Lu
  2020-09-12 18:31   ` Vladimir Oltean
  1 sibling, 1 reply; 7+ messages in thread
From: Vladimir Oltean @ 2020-09-12  7:35 UTC (permalink / raw)
  To: Yangbo Lu
  Cc: netdev, devicetree, David S . Miller, Richard Cochran,
	Rob Herring, Mark Rutland

Hi Yangbo,

On Sat, Sep 12, 2020 at 11:30:06AM +0800, Yangbo Lu wrote:
> The FIPER3 (fixed interval period pulse generator) is supported on
> DPAA2 and ENETC network controller hardware. This patch is to support
> it in ptp_qoriq driver.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> ---
>  drivers/ptp/ptp_qoriq.c       | 23 ++++++++++++++++++++++-
>  include/linux/fsl/ptp_qoriq.h |  3 +++
>  2 files changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
> index c09c16be..68beb1b 100644
> --- a/drivers/ptp/ptp_qoriq.c
> +++ b/drivers/ptp/ptp_qoriq.c
> @@ -72,6 +72,10 @@ static void set_fipers(struct ptp_qoriq *ptp_qoriq)
>  	set_alarm(ptp_qoriq);
>  	ptp_qoriq->write(&regs->fiper_regs->tmr_fiper1, ptp_qoriq->tmr_fiper1);
>  	ptp_qoriq->write(&regs->fiper_regs->tmr_fiper2, ptp_qoriq->tmr_fiper2);
> +
> +	if (ptp_qoriq->fiper3_support)
> +		ptp_qoriq->write(&regs->fiper_regs->tmr_fiper3,
> +				 ptp_qoriq->tmr_fiper3);
>  }
>  
>  int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index, bool update_event)
> @@ -366,6 +370,7 @@ static u32 ptp_qoriq_nominal_freq(u32 clk_src)
>   *   "fsl,tmr-add"
>   *   "fsl,tmr-fiper1"
>   *   "fsl,tmr-fiper2"
> + *   "fsl,tmr-fiper3" (required only for DPAA2 and ENETC hardware)
>   *   "fsl,max-adj"
>   *
>   * Return 0 if success
> @@ -412,6 +417,7 @@ static int ptp_qoriq_auto_config(struct ptp_qoriq *ptp_qoriq,
>  	ptp_qoriq->tmr_add = freq_comp;
>  	ptp_qoriq->tmr_fiper1 = DEFAULT_FIPER1_PERIOD - ptp_qoriq->tclk_period;
>  	ptp_qoriq->tmr_fiper2 = DEFAULT_FIPER2_PERIOD - ptp_qoriq->tclk_period;
> +	ptp_qoriq->tmr_fiper3 = DEFAULT_FIPER3_PERIOD - ptp_qoriq->tclk_period;
>  
>  	/* max_adj = 1000000000 * (freq_ratio - 1.0) - 1
>  	 * freq_ratio = reference_clock_freq / nominal_freq
> @@ -446,6 +452,13 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
>  	else
>  		ptp_qoriq->extts_fifo_support = false;
>  
> +	if (of_device_is_compatible(node, "fsl,dpaa2-ptp") ||
> +	    of_device_is_compatible(node, "fsl,enetc-ptp")) {
> +		ptp_qoriq->fiper3_support = true;
> +	} else {
> +		ptp_qoriq->fiper3_support = false;
> +	}

Since struct ptp_qoriq is kzalloc()-ed, maybe you can skip the "else"
branch?

> +
>  	if (of_property_read_u32(node,
>  				 "fsl,tclk-period", &ptp_qoriq->tclk_period) ||
>  	    of_property_read_u32(node,
> @@ -457,7 +470,10 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
>  	    of_property_read_u32(node,
>  				 "fsl,tmr-fiper2", &ptp_qoriq->tmr_fiper2) ||
>  	    of_property_read_u32(node,
> -				 "fsl,max-adj", &ptp_qoriq->caps.max_adj)) {
> +				 "fsl,max-adj", &ptp_qoriq->caps.max_adj) ||
> +	    (of_property_read_u32(node,
> +				 "fsl,tmr-fiper3", &ptp_qoriq->tmr_fiper3) &&
> +	     ptp_qoriq->fiper3_support)) {

Could you check for the "ptp_qoriq->fiper3_support" boolean first, so
that a useless device tree property lookup is not performed?

>  		pr_warn("device tree node missing required elements, try automatic configuration\n");
>  
>  		if (ptp_qoriq_auto_config(ptp_qoriq, node))
> @@ -502,6 +518,11 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
>  	ptp_qoriq->write(&regs->ctrl_regs->tmr_prsc, ptp_qoriq->tmr_prsc);
>  	ptp_qoriq->write(&regs->fiper_regs->tmr_fiper1, ptp_qoriq->tmr_fiper1);
>  	ptp_qoriq->write(&regs->fiper_regs->tmr_fiper2, ptp_qoriq->tmr_fiper2);
> +
> +	if (ptp_qoriq->fiper3_support)
> +		ptp_qoriq->write(&regs->fiper_regs->tmr_fiper3,
> +				 ptp_qoriq->tmr_fiper3);
> +
>  	set_alarm(ptp_qoriq);
>  	ptp_qoriq->write(&regs->ctrl_regs->tmr_ctrl,
>  			 tmr_ctrl|FIPERST|RTPE|TE|FRD);
> diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h
> index 884b8f8..01acebe 100644
> --- a/include/linux/fsl/ptp_qoriq.h
> +++ b/include/linux/fsl/ptp_qoriq.h
> @@ -136,6 +136,7 @@ struct ptp_qoriq_registers {
>  #define DEFAULT_TMR_PRSC	2
>  #define DEFAULT_FIPER1_PERIOD	1000000000
>  #define DEFAULT_FIPER2_PERIOD	1000000000
> +#define DEFAULT_FIPER3_PERIOD	1000000000
>  
>  struct ptp_qoriq {
>  	void __iomem *base;
> @@ -147,6 +148,7 @@ struct ptp_qoriq {
>  	struct dentry *debugfs_root;
>  	struct device *dev;
>  	bool extts_fifo_support;
> +	bool fiper3_support;
>  	int irq;
>  	int phc_index;
>  	u32 tclk_period;  /* nanoseconds */
> @@ -155,6 +157,7 @@ struct ptp_qoriq {
>  	u32 cksel;
>  	u32 tmr_fiper1;
>  	u32 tmr_fiper2;
> +	u32 tmr_fiper3;
>  	u32 (*read)(unsigned __iomem *addr);
>  	void (*write)(unsigned __iomem *addr, u32 val);
>  };
> -- 
> 2.7.4
> 

With that,

Acked-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Thanks for doing this!
-Vladimir

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] ptp_qoriq: support FIPER3
  2020-09-12  3:30 ` [PATCH 2/2] ptp_qoriq: support FIPER3 Yangbo Lu
  2020-09-12  7:35   ` Vladimir Oltean
@ 2020-09-12 18:31   ` Vladimir Oltean
  2020-09-18  9:54     ` Y.b. Lu
  1 sibling, 1 reply; 7+ messages in thread
From: Vladimir Oltean @ 2020-09-12 18:31 UTC (permalink / raw)
  To: Yangbo Lu
  Cc: netdev, devicetree, David S . Miller, Richard Cochran,
	Rob Herring, Mark Rutland

On Sat, Sep 12, 2020 at 11:30:06AM +0800, Yangbo Lu wrote:
> The FIPER3 (fixed interval period pulse generator) is supported on
> DPAA2 and ENETC network controller hardware. This patch is to support
> it in ptp_qoriq driver.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> ---

Would you also want to add the debugfs support for the 3rd FIPER
loopback?

Thanks,
-Vladimir

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 2/2] ptp_qoriq: support FIPER3
  2020-09-12  7:35   ` Vladimir Oltean
@ 2020-09-18  9:53     ` Y.b. Lu
  0 siblings, 0 replies; 7+ messages in thread
From: Y.b. Lu @ 2020-09-18  9:53 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	David S . Miller, Richard Cochran, Rob Herring, Mark Rutland

Hi Vladimir,

> -----Original Message-----
> From: Vladimir Oltean <olteanv@gmail.com>
> Sent: Saturday, September 12, 2020 3:36 PM
> To: Y.b. Lu <yangbo.lu@nxp.com>
> Cc: netdev@vger.kernel.org; devicetree@vger.kernel.org; David S . Miller
> <davem@davemloft.net>; Richard Cochran <richardcochran@gmail.com>; Rob
> Herring <robh+dt@kernel.org>; Mark Rutland <mark.rutland@arm.com>
> Subject: Re: [PATCH 2/2] ptp_qoriq: support FIPER3
> 
> Hi Yangbo,
> 
> On Sat, Sep 12, 2020 at 11:30:06AM +0800, Yangbo Lu wrote:
> > The FIPER3 (fixed interval period pulse generator) is supported on
> > DPAA2 and ENETC network controller hardware. This patch is to support
> > it in ptp_qoriq driver.
> >
> > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > ---
> >  drivers/ptp/ptp_qoriq.c       | 23 ++++++++++++++++++++++-
> >  include/linux/fsl/ptp_qoriq.h |  3 +++
> >  2 files changed, 25 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
> > index c09c16be..68beb1b 100644
> > --- a/drivers/ptp/ptp_qoriq.c
> > +++ b/drivers/ptp/ptp_qoriq.c
> > @@ -72,6 +72,10 @@ static void set_fipers(struct ptp_qoriq *ptp_qoriq)
> >  	set_alarm(ptp_qoriq);
> >  	ptp_qoriq->write(&regs->fiper_regs->tmr_fiper1, ptp_qoriq->tmr_fiper1);
> >  	ptp_qoriq->write(&regs->fiper_regs->tmr_fiper2, ptp_qoriq->tmr_fiper2);
> > +
> > +	if (ptp_qoriq->fiper3_support)
> > +		ptp_qoriq->write(&regs->fiper_regs->tmr_fiper3,
> > +				 ptp_qoriq->tmr_fiper3);
> >  }
> >
> >  int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index, bool
> update_event)
> > @@ -366,6 +370,7 @@ static u32 ptp_qoriq_nominal_freq(u32 clk_src)
> >   *   "fsl,tmr-add"
> >   *   "fsl,tmr-fiper1"
> >   *   "fsl,tmr-fiper2"
> > + *   "fsl,tmr-fiper3" (required only for DPAA2 and ENETC hardware)
> >   *   "fsl,max-adj"
> >   *
> >   * Return 0 if success
> > @@ -412,6 +417,7 @@ static int ptp_qoriq_auto_config(struct ptp_qoriq
> *ptp_qoriq,
> >  	ptp_qoriq->tmr_add = freq_comp;
> >  	ptp_qoriq->tmr_fiper1 = DEFAULT_FIPER1_PERIOD -
> ptp_qoriq->tclk_period;
> >  	ptp_qoriq->tmr_fiper2 = DEFAULT_FIPER2_PERIOD -
> ptp_qoriq->tclk_period;
> > +	ptp_qoriq->tmr_fiper3 = DEFAULT_FIPER3_PERIOD -
> ptp_qoriq->tclk_period;
> >
> >  	/* max_adj = 1000000000 * (freq_ratio - 1.0) - 1
> >  	 * freq_ratio = reference_clock_freq / nominal_freq
> > @@ -446,6 +452,13 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq,
> void __iomem *base,
> >  	else
> >  		ptp_qoriq->extts_fifo_support = false;
> >
> > +	if (of_device_is_compatible(node, "fsl,dpaa2-ptp") ||
> > +	    of_device_is_compatible(node, "fsl,enetc-ptp")) {
> > +		ptp_qoriq->fiper3_support = true;
> > +	} else {
> > +		ptp_qoriq->fiper3_support = false;
> > +	}
> 
> Since struct ptp_qoriq is kzalloc()-ed, maybe you can skip the "else"
> branch?

Right. Let me remove it.

> 
> > +
> >  	if (of_property_read_u32(node,
> >  				 "fsl,tclk-period", &ptp_qoriq->tclk_period) ||
> >  	    of_property_read_u32(node,
> > @@ -457,7 +470,10 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq,
> void __iomem *base,
> >  	    of_property_read_u32(node,
> >  				 "fsl,tmr-fiper2", &ptp_qoriq->tmr_fiper2) ||
> >  	    of_property_read_u32(node,
> > -				 "fsl,max-adj", &ptp_qoriq->caps.max_adj)) {
> > +				 "fsl,max-adj", &ptp_qoriq->caps.max_adj) ||
> > +	    (of_property_read_u32(node,
> > +				 "fsl,tmr-fiper3", &ptp_qoriq->tmr_fiper3) &&
> > +	     ptp_qoriq->fiper3_support)) {
> 
> Could you check for the "ptp_qoriq->fiper3_support" boolean first, so
> that a useless device tree property lookup is not performed?

Ok.

> 
> >  		pr_warn("device tree node missing required elements, try automatic
> configuration\n");
> >
> >  		if (ptp_qoriq_auto_config(ptp_qoriq, node))
> > @@ -502,6 +518,11 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq,
> void __iomem *base,
> >  	ptp_qoriq->write(&regs->ctrl_regs->tmr_prsc, ptp_qoriq->tmr_prsc);
> >  	ptp_qoriq->write(&regs->fiper_regs->tmr_fiper1, ptp_qoriq->tmr_fiper1);
> >  	ptp_qoriq->write(&regs->fiper_regs->tmr_fiper2, ptp_qoriq->tmr_fiper2);
> > +
> > +	if (ptp_qoriq->fiper3_support)
> > +		ptp_qoriq->write(&regs->fiper_regs->tmr_fiper3,
> > +				 ptp_qoriq->tmr_fiper3);
> > +
> >  	set_alarm(ptp_qoriq);
> >  	ptp_qoriq->write(&regs->ctrl_regs->tmr_ctrl,
> >  			 tmr_ctrl|FIPERST|RTPE|TE|FRD);
> > diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h
> > index 884b8f8..01acebe 100644
> > --- a/include/linux/fsl/ptp_qoriq.h
> > +++ b/include/linux/fsl/ptp_qoriq.h
> > @@ -136,6 +136,7 @@ struct ptp_qoriq_registers {
> >  #define DEFAULT_TMR_PRSC	2
> >  #define DEFAULT_FIPER1_PERIOD	1000000000
> >  #define DEFAULT_FIPER2_PERIOD	1000000000
> > +#define DEFAULT_FIPER3_PERIOD	1000000000
> >
> >  struct ptp_qoriq {
> >  	void __iomem *base;
> > @@ -147,6 +148,7 @@ struct ptp_qoriq {
> >  	struct dentry *debugfs_root;
> >  	struct device *dev;
> >  	bool extts_fifo_support;
> > +	bool fiper3_support;
> >  	int irq;
> >  	int phc_index;
> >  	u32 tclk_period;  /* nanoseconds */
> > @@ -155,6 +157,7 @@ struct ptp_qoriq {
> >  	u32 cksel;
> >  	u32 tmr_fiper1;
> >  	u32 tmr_fiper2;
> > +	u32 tmr_fiper3;
> >  	u32 (*read)(unsigned __iomem *addr);
> >  	void (*write)(unsigned __iomem *addr, u32 val);
> >  };
> > --
> > 2.7.4
> >
> 
> With that,
> 
> Acked-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> Thanks for doing this!
> -Vladimir

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 2/2] ptp_qoriq: support FIPER3
  2020-09-12 18:31   ` Vladimir Oltean
@ 2020-09-18  9:54     ` Y.b. Lu
  0 siblings, 0 replies; 7+ messages in thread
From: Y.b. Lu @ 2020-09-18  9:54 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	David S . Miller, Richard Cochran, Rob Herring, Mark Rutland

Hi Vladimir,

> -----Original Message-----
> From: Vladimir Oltean <olteanv@gmail.com>
> Sent: Sunday, September 13, 2020 2:32 AM
> To: Y.b. Lu <yangbo.lu@nxp.com>
> Cc: netdev@vger.kernel.org; devicetree@vger.kernel.org; David S . Miller
> <davem@davemloft.net>; Richard Cochran <richardcochran@gmail.com>; Rob
> Herring <robh+dt@kernel.org>; Mark Rutland <mark.rutland@arm.com>
> Subject: Re: [PATCH 2/2] ptp_qoriq: support FIPER3
> 
> On Sat, Sep 12, 2020 at 11:30:06AM +0800, Yangbo Lu wrote:
> > The FIPER3 (fixed interval period pulse generator) is supported on
> > DPAA2 and ENETC network controller hardware. This patch is to support
> > it in ptp_qoriq driver.
> >
> > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > ---
> 
> Would you also want to add the debugfs support for the 3rd FIPER
> loopback?

No. Because I didn't see loopback support on FIPER3 in RM register.

> 
> Thanks,
> -Vladimir

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-18  9:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-12  3:30 [PATCH 0/2] ptp_qoriq: support FIPER3 Yangbo Lu
2020-09-12  3:30 ` [PATCH 1/2] dt-binding: ptp_qoriq: support fsl,tmr-fiper3 property Yangbo Lu
2020-09-12  3:30 ` [PATCH 2/2] ptp_qoriq: support FIPER3 Yangbo Lu
2020-09-12  7:35   ` Vladimir Oltean
2020-09-18  9:53     ` Y.b. Lu
2020-09-12 18:31   ` Vladimir Oltean
2020-09-18  9:54     ` Y.b. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).