[PATCH v2 6/8] net: ethernet: renesas: rswitch: Add R-Car Gen4 gPTP support

Yoshihiro Shimoda yoshihiro.shimoda.uh at renesas.com
Wed Sep 21 17:10:27 PDT 2022


Hi Richard,

Thank you for your review!

> From: Richard Cochran, Sent: Wednesday, September 21, 2022 11:35 PM
> 
> On Wed, Sep 21, 2022 at 05:47:43PM +0900, Yoshihiro Shimoda wrote:
> 
> > +static int rcar_gen4_ptp_gettime(struct ptp_clock_info *ptp,
> > +				 struct timespec64 *ts)
> > +{
> > +	struct rcar_gen4_ptp_private *ptp_priv = ptp_to_priv(ptp);
> > +
> > +	ts->tv_nsec = ioread32(ptp_priv->addr + ptp_priv->offs->monitor_t0);
> > +	ts->tv_sec = ioread32(ptp_priv->addr + ptp_priv->offs->monitor_t1) |
> > +		     ((s64)ioread32(ptp_priv->addr + ptp_priv->offs->monitor_t2) << 32);
> 
> No locking here ...
> 
> > +	return 0;
> > +}
> > +
> > +static int rcar_gen4_ptp_settime(struct ptp_clock_info *ptp,
> > +				 const struct timespec64 *ts)
> > +{
> > +	struct rcar_gen4_ptp_private *ptp_priv = ptp_to_priv(ptp);
> > +
> > +	iowrite32(1, ptp_priv->addr + ptp_priv->offs->disable);
> > +	iowrite32(0, ptp_priv->addr + ptp_priv->offs->config_t2);
> > +	iowrite32(0, ptp_priv->addr + ptp_priv->offs->config_t1);
> > +	iowrite32(0, ptp_priv->addr + ptp_priv->offs->config_t0);
> > +	iowrite32(1, ptp_priv->addr + ptp_priv->offs->enable);
> > +	iowrite32(ts->tv_sec >> 32, ptp_priv->addr + ptp_priv->offs->config_t2);
> > +	iowrite32(ts->tv_sec, ptp_priv->addr + ptp_priv->offs->config_t1);
> > +	iowrite32(ts->tv_nsec, ptp_priv->addr + ptp_priv->offs->config_t0);
> 
> ... or here?
> 
> You need to protect multiple register access against concurrent callers.

I understood it. I'll add such protections.

Best regards,
Yoshihiro Shimoda

> Thanks,
> Richard
> 
> > +	return 0;
> > +}



More information about the linux-phy mailing list