From: Harini Katakam <harini.katakam@xilinx.com>
To: nicolas.ferre@microchip.com, davem@davemloft.net,
richardcochran@gmail.com, claudiu.beznea@microchip.com,
rafalo@cadence.com, andrei.pistirica@microchip.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
michal.simek@xilinx.com, harinikatakamlinux@gmail.com,
harini.katakam@xilinx.com
Subject: [PATCH 1/2] net: macb: Add separate definition for PPM fraction
Date: Thu, 27 Jun 2019 11:50:59 +0530 [thread overview]
Message-ID: <1561616460-32439-2-git-send-email-harini.katakam@xilinx.com> (raw)
In-Reply-To: <1561616460-32439-1-git-send-email-harini.katakam@xilinx.com>
The scaled ppm parameter passed to _adjfine() contains a 16 bit
fraction. This just happens to be the same as SUBNSINCR_SIZE now.
Hence define this separately.
Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
---
drivers/net/ethernet/cadence/macb.h | 3 +++
drivers/net/ethernet/cadence/macb_ptp.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index 515bfd2..90bc70b 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -834,6 +834,9 @@ struct gem_tx_ts {
/* limit RX checksum offload to TCP and UDP packets */
#define GEM_RX_CSUM_CHECKED_MASK 2
+/* Scaled PPM fraction */
+#define PPM_FRACTION 16
+
/* struct macb_tx_skb - data about an skb which is being transmitted
* @skb: skb currently being transmitted, only set for the last buffer
* of the frame
diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c
index 0a8aca8..6276eac 100644
--- a/drivers/net/ethernet/cadence/macb_ptp.c
+++ b/drivers/net/ethernet/cadence/macb_ptp.c
@@ -135,7 +135,7 @@ static int gem_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
* (temp / USEC_PER_SEC) + 0.5
*/
adj += (USEC_PER_SEC >> 1);
- adj >>= GEM_SUBNSINCR_SIZE; /* remove fractions */
+ adj >>= PPM_FRACTION; /* remove fractions */
adj = div_u64(adj, USEC_PER_SEC);
adj = neg_adj ? (word - adj) : (word + adj);
--
2.7.4
next prev parent reply other threads:[~2019-06-27 6:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-27 6:20 [PATCH 0/2] Sub ns increment fixes in Macb PTP Harini Katakam
2019-06-27 6:20 ` Harini Katakam [this message]
2019-06-27 6:21 ` [PATCH 2/2] net: macb: Fix SUBNS increment and increase resolution Harini Katakam
2019-06-29 18:09 ` [PATCH 0/2] Sub ns increment fixes in Macb PTP David Miller
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=1561616460-32439-2-git-send-email-harini.katakam@xilinx.com \
--to=harini.katakam@xilinx.com \
--cc=andrei.pistirica@microchip.com \
--cc=claudiu.beznea@microchip.com \
--cc=davem@davemloft.net \
--cc=harinikatakamlinux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=rafalo@cadence.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