lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 25 Apr 2022 16:47:28 -0700
From:   Jonathan Lemon <jonathan.lemon@...il.com>
To:     Richard Cochran <richardcochran@...il.com>
Cc:     f.fainelli@...il.com, bcm-kernel-feedback-list@...adcom.com,
        andrew@...n.ch, hkallweit1@...il.com, linux@...linux.org.uk,
        netdev@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH net-next v1 1/4] net: phy: broadcom: Add PTP support for
 some Broadcom PHYs.

On Sun, Apr 24, 2022 at 08:12:39PM -0700, Richard Cochran wrote:
> On Sat, Apr 23, 2022 at 07:23:53PM -0700, Jonathan Lemon wrote:
> 
> > +static int bcm_ptp_settime_locked(struct bcm_ptp_private *priv,
> > +				  const struct timespec64 *ts)
> > +{
> > +	struct phy_device *phydev = priv->phydev;
> > +	u16 ctrl;
> > +
> > +	/* set up time code */
> > +	bcm_phy_write_exp(phydev, TIME_CODE_0, ts->tv_nsec);
> > +	bcm_phy_write_exp(phydev, TIME_CODE_1, ts->tv_nsec >> 16);
> > +	bcm_phy_write_exp(phydev, TIME_CODE_2, ts->tv_sec);
> > +	bcm_phy_write_exp(phydev, TIME_CODE_3, ts->tv_sec >> 16);
> > +	bcm_phy_write_exp(phydev, TIME_CODE_4, ts->tv_sec >> 32);
> > +
> > +	/* zero out NCO counter */
> > +	bcm_phy_write_exp(phydev, NCO_TIME_0, 0);
> > +	bcm_phy_write_exp(phydev, NCO_TIME_1, 0);
> > +	bcm_phy_write_exp(phydev, NCO_TIME_2_CTRL, 0);
> 
> You are setting the 48 bit counter to zero.
> 
> But Lasse's version does this:
> 
> 	// Assign original time codes (48 bit)
> 	local_time_codes[2] = 0x4000;
> 	local_time_codes[1] = (u16)(ts->tv_nsec >> 20);
> 	local_time_codes[0] = (u16)(ts->tv_nsec >> 4);
> 
> 	...
> 
> 	// Write Local Time Code Register
> 	bcm_phy_write_exp(phydev, NSE_DPPL_NCO_2_0_REG, local_time_codes[0]);
> 	bcm_phy_write_exp(phydev, NSE_DPPL_NCO_2_1_REG, local_time_codes[1]);
> 	bcm_phy_write_exp(phydev, NSE_DPPL_NCO_2_2_REG, local_time_codes[2]);
> 
> My understanding is that the PPS output function uses the 48 bit
> counter, and so it ought to be set to a non-zero value.

I'm not sure what this is doing.  Setting BIT(14) says this is a
frequency control adjustment.  From my understanding, the local timer is
used for generating a oneshot output pulse, which the driver currently
doesn't do.


> In any case, it would be nice to have the 80/48 bit register usage
> clearly explained.

You and me both.
-- 
Jonathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ