[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190912.121203.1106283271122334199.davem@davemloft.net>
Date: Thu, 12 Sep 2019 12:12:03 +0200 (CEST)
From: David Miller <davem@...emloft.net>
To: olteanv@...il.com
Cc: f.fainelli@...il.com, vivien.didelot@...il.com, andrew@...n.ch,
richardcochran@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH v2 net-next 3/7] net: dsa: sja1105: Switch to hardware
operations for PTP
From: Vladimir Oltean <olteanv@...il.com>
Date: Tue, 10 Sep 2019 04:34:57 +0300
> static int sja1105_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
> {
> struct sja1105_private *priv = ptp_to_sja1105(ptp);
> + const struct sja1105_regs *regs = priv->info->regs;
> s64 clkrate;
> + int rc;
..
> -static int sja1105_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
> -{
> - struct sja1105_private *priv = ptp_to_sja1105(ptp);
> + rc = sja1105_spi_send_int(priv, SPI_WRITE, regs->ptpclkrate,
> + &clkrate, 4);
You're sending an arbitrary 4 bytes of a 64-bit value. This works on little endian
but will not on big endian.
Please properly copy this clkrate into a "u32" variable and pass that into
sja1105_spi_send_int().
It also seems to suggest that you want to use abs() to perform that weird
centering around 1 << 31 calculation.
Thank you.
Powered by blists - more mailing lists