netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Richard Cochran <richardcochran@gmail.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Antoine Tenart <antoine.tenart@bootlin.com>,
	Matteo Croce <mcroce@redhat.com>,
	Andre Przywara <andre.przywara@arm.com>,
	Sven Auhagen <sven.auhagen@voleatech.de>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2 4/6] net: mvpp2: ptp: add TAI support
Date: Sun, 6 Sep 2020 21:04:02 +0100	[thread overview]
Message-ID: <20200906200402.GX1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <20200905170258.GA30943@hoboy>

On Sat, Sep 05, 2020 at 10:02:58AM -0700, Richard Cochran wrote:
> On Fri, Sep 04, 2020 at 08:29:27AM +0100, Russell King wrote:
> > Add support for the TAI block in the mvpp2.2 hardware.
> > 
> > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> 
> Acked-by: Richard Cochran <richardcochran@gmail.com>
> 
> A few minor questions/comments follow...
> 
> > diff --git a/drivers/net/ethernet/marvell/Kconfig b/drivers/net/ethernet/marvell/Kconfig
> > index ef4f35ba077d..a599e44a36a8 100644
> > --- a/drivers/net/ethernet/marvell/Kconfig
> > +++ b/drivers/net/ethernet/marvell/Kconfig
> > @@ -92,6 +92,12 @@ config MVPP2
> >  	  This driver supports the network interface units in the
> >  	  Marvell ARMADA 375, 7K and 8K SoCs.
> >  
> > +config MVPP2_PTP
> > +	bool "Marvell Armada 8K Enable PTP support"
> > +	depends on NETWORK_PHY_TIMESTAMPING
> > +	depends on (PTP_1588_CLOCK = y && MVPP2 = y) || \
> > +		   (PTP_1588_CLOCK && MVPP2 = m)
> 
> So I guess this incantation obviates the need for checking whether
> ptp_clock_register() returns null?

There's no point offering the option if the result isn't going to be
functional.

> > +static long mvpp22_tai_aux_work(struct ptp_clock_info *ptp)
> > +{
> > +	return 0;
> > +}
> 
> Since this is a noop, you can leave 
> 	tai->caps.do_aux_work = mvpp22_tai_aux_work;
> as null.

Ok.

> > +static void mvpp22_tai_set_step(struct mvpp2_tai *tai)
> > +{
> > +	void __iomem *base = tai->base;
> > +	u32 nano, frac;
> > +
> > +	nano = upper_32_bits(tai->period);
> > +	frac = lower_32_bits(tai->period);
> > +
> > +	/* As the fractional nanosecond is a signed offset, if the MSB (sign)
> > +	 * bit is set, we have to increment the whole nanoseconds.
> > +	 */
> > +	if (frac >= 0x80000000)
> > +		nano += 1;
> > +
> > +	mvpp2_tai_write(nano, base + MVPP22_TAI_TOD_STEP_NANO_CR);
> > +	mvpp2_tai_write(frac >> 16, base + MVPP22_TAI_TOD_STEP_FRAC_HIGH);
> > +	mvpp2_tai_write(frac, base + MVPP22_TAI_TOD_STEP_FRAC_LOW);
> > +}
> > +
> > +static void mvpp22_tai_set_tod(struct mvpp2_tai *tai)
> > +{
> > +	struct timespec64 now;
> > +
> > +	ktime_get_real_ts64(&now);
> > +	mvpp22_tai_settime64(&tai->caps, &now);
> > +}
> > +
> > +static void mvpp22_tai_init(struct mvpp2_tai *tai)
> > +{
> > +	void __iomem *base = tai->base;
> > +
> > +	mvpp22_tai_set_step(tai);
> > +
> > +	/* Release the TAI reset */
> > +	mvpp2_tai_modify(base + MVPP22_TAI_CR0, CR0_SW_NRESET, CR0_SW_NRESET);
> > +
> > +	mvpp22_tai_set_tod(tai);
> 
> The consensus on the list seems to be that new PHCs should start
> ticking from time zero (1970), although some older drivers do use
> ktime.  For new clocks, I'd prefer using zero.

Ok.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2020-09-06 20:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04  7:28 [PATCH net-next v2 0/6] Marvell PP2.2 PTP support Russell King - ARM Linux admin
2020-09-04  7:29 ` [PATCH net-next v2 1/6] net: mvpp2: restructure "link status" interrupt handling Russell King
2020-09-04  7:29 ` [PATCH net-next v2 2/6] net: mvpp2: rename mis-named "link status" interrupt Russell King
2020-09-04  7:29 ` [PATCH net-next v2 3/6] net: mvpp2: check first level interrupt status registers Russell King
2020-09-04  7:29 ` [PATCH net-next v2 4/6] net: mvpp2: ptp: add TAI support Russell King
2020-09-05 17:02   ` Richard Cochran
2020-09-06 20:04     ` Russell King - ARM Linux admin [this message]
2020-09-08  7:41       ` Russell King - ARM Linux admin
2020-09-08 14:25         ` Richard Cochran
2020-09-04  7:29 ` [PATCH net-next v2 5/6] net: mvpp2: ptp: add support for receive timestamping Russell King
2020-09-04  7:29 ` [PATCH net-next v2 6/6] net: mvpp2: ptp: add support for transmit timestamping Russell King

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=20200906200402.GX1551@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andre.przywara@arm.com \
    --cc=antoine.tenart@bootlin.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=mcroce@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=sven.auhagen@voleatech.de \
    /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;
as well as URLs for NNTP newsgroup(s).