mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shmuel Hazan <shmuel.h@siklu.com>
To: "horatiu.vultur@microchip.com" <horatiu.vultur@microchip.com>
Cc: "linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"mw@semihalf.com" <mw@semihalf.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"richardcochran@gmail.com" <richardcochran@gmail.com>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>
Subject: Re: [PATCH v2 2/3] net: mvpp2: tai: add extts support
Date: Tue, 18 Apr 2023 10:09:15 +0000	[thread overview]
Message-ID: <ddbc260a41cb8203fcc1e9348557c7c35af01ee1.camel@siklu.com> (raw)
In-Reply-To: <20230418093747.jxxvoizofd6cgk6v@soft-dev3-1>

On Tue, 2023-04-18 at 11:37 +0200, Horatiu Vultur wrote:
> 
> The 04/17/2023 20:07, Shmuel Hazan wrote:
> > 
> > This commit add support for capturing a timestamp in which the PTP_PULSE
> > pin, received a signal.
> > 
> > This feature is needed in order to synchronize multiple clocks in the
> > same board, using tools like ts2phc from the linuxptp project.
> > 
> > On the Armada 8040, this is the only way to do so as a result of
> > multiple erattas with the PTP_PULSE_IN interface that was designed to
> > synchronize the TAI on an external PPS signal (the errattas are
> > FE-6856276, FE-7382160 from document MV-S501388-00).
> > 
> > This patch introduces a pinctrl configuration "extts" that will be
> > selected once the user had enabled extts, and then will be returned back
> > to the "default" pinctrl config once it has been disabled. Additionally
> > these configurations will be also used in any case that the user asks us
> > to perform any action that involves "triggerering" the TAI subsystem, in
> > order to avoid a case where the external trigger would trigger with the
> > wrong action.
> > 
> > This pinctrl mess is needed due to the fact that there is no way for us
> > to distinguish betwee an external trigger (e.g. from the PTP_PULSE_IN
> > pin) or an internal one, triggered by the registers.
> > 
> > This feature has been tested on an Aramda
> > 8040 based board, with linuxptp 3.1.1's ts2phc.
> 
> It looks good to me, just one more questions bellow.
> Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> 
> > 
> > Signed-off-by: Shmuel Hazan <shmuel.h@siklu.com>
> > ---
> >  .../net/ethernet/marvell/mvpp2/mvpp2_tai.c    | 304 ++++++++++++++++--
> >  1 file changed, 273 insertions(+), 31 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c
> > index 2e3d43b1bac1..ff57075c6ebc 100644
> > --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c
> > +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_tai.c
> > @@ -3,8 +3,11 @@
> >   * Marvell PP2.2 TAI support
> >   *
> >   * Note:
> > - *   Do NOT use the event capture support.
> > - *   Do Not even set the MPP muxes to allow PTP_EVENT_REQ to be used.
> > + *   In order to use the event capture support, please see the example
> > + *   in marvell,pp2.yaml.
> > + *   Do not manually (e.g. without pinctrl-1, as described in
> > + *   marvell,pp2.yaml) set the MPP muxes to allow PTP_EVENT_REQ to be
> > + *   used.
> >   *   It will disrupt the operation of this driver, and there is nothing
> >   *   that this driver can do to prevent that.  Even using PTP_EVENT_REQ
> >   *   as an output will be seen as a trigger input, which can't be masked.
> > @@ -33,6 +36,8 @@
> >   * Consequently, we support none of these.
> >   */
> >  #include <linux/io.h>
> > +#include <linux/pinctrl/consumer.h>
> > +#include <linux/ptp_clock.h>
> >  #include <linux/ptp_clock_kernel.h>
> >  #include <linux/slab.h>
> > 
> > @@ -53,6 +58,10 @@
> >  #define TCSR_CAPTURE_1_VALID           BIT(1)
> >  #define TCSR_CAPTURE_0_VALID           BIT(0)
> > 
> > +#define MVPP2_PINCTRL_EXTTS_STATE              "extts"
> > +#define MAX_PINS 1
> > +#define EXTTS_PERIOD_MS 95
> 
> How have you come with this 95 value?

Hi Horatiu,

Thanks for your review. 

As for the 95 value, I just borrowed it from a similar driver
(ptp_clockmatrix) that also employs a similar polling mechanism for
extts support. It seems to work pretty well in testing so I had no
reason to change it.

> 
> > <snip>
> --
> /Horatiu


  reply	other threads:[~2023-04-18 10:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17 17:07 [PATCH v2 0/3] " Shmuel Hazan
2023-04-17 17:07 ` [PATCH v2 1/3] net: mvpp2: tai: add refcount for ptp worker Shmuel Hazan
2023-04-18  0:44   ` Andrew Lunn
2023-04-18  8:54     ` Shmuel Hazan
2023-04-17 17:07 ` [PATCH v2 2/3] net: mvpp2: tai: add extts support Shmuel Hazan
2023-04-18  9:37   ` Horatiu Vultur
2023-04-18 10:09     ` Shmuel Hazan [this message]
2023-04-17 17:07 ` [PATCH v2 3/3] dt-bindings: net: marvell,pp2: add extts docs Shmuel Hazan
2023-04-17 17:47   ` Krzysztof Kozlowski
2023-04-18  8:32     ` Shmuel Hazan
2023-04-17 19:01 ` [PATCH v2 0/3] net: mvpp2: tai: add extts support Jakub Kicinski
2023-04-18  8:36   ` Shmuel Hazan
2023-04-18  0:36 ` Andrew Lunn
2023-04-18  8:43   ` Shmuel Hazan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ddbc260a41cb8203fcc1e9348557c7c35af01ee1.camel@siklu.com \
    --to=shmuel.h@siklu.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mw@semihalf.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®