stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: stable@vger.kernel.org
Subject: [PATCH 4.14 04/14] net: macb: Fix SUBNS increment and increase resolution
Date: Mon,  2 Dec 2019 10:03:02 +0000	[thread overview]
Message-ID: <20191202100312.1397-4-lee.jones@linaro.org> (raw)
In-Reply-To: <20191202100312.1397-1-lee.jones@linaro.org>

From: Harini Katakam <harini.katakam@xilinx.com>

[ Upstream commit 7ad342bc58cc5197cd2f12a3c30b3949528c6d83 ]

The subns increment register has 24 bits as follows:
RegBit[15:0] = Subns[23:8]; RegBit[31:24] = Subns[7:0]

Fix the same in the driver and increase sub ns resolution to the
best capable, 24 bits. This should be the case on all GEM versions
that this PTP driver supports.

Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/net/ethernet/cadence/macb.h     | 6 +++++-
 drivers/net/ethernet/cadence/macb_ptp.c | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index c93f3a2dc6c1..4c0bcfd1d250 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -457,7 +457,11 @@
 
 /* Bitfields in TISUBN */
 #define GEM_SUBNSINCR_OFFSET			0
-#define GEM_SUBNSINCR_SIZE			16
+#define GEM_SUBNSINCRL_OFFSET			24
+#define GEM_SUBNSINCRL_SIZE			8
+#define GEM_SUBNSINCRH_OFFSET			0
+#define GEM_SUBNSINCRH_SIZE			16
+#define GEM_SUBNSINCR_SIZE			24
 
 /* Bitfields in TI */
 #define GEM_NSINCR_OFFSET			0
diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c
index 678835136bf8..f1f07e9d53f8 100755
--- a/drivers/net/ethernet/cadence/macb_ptp.c
+++ b/drivers/net/ethernet/cadence/macb_ptp.c
@@ -115,7 +115,10 @@ static int gem_tsu_incr_set(struct macb *bp, struct tsu_incr *incr_spec)
 	 * to take effect.
 	 */
 	spin_lock_irqsave(&bp->tsu_clk_lock, flags);
-	gem_writel(bp, TISUBN, GEM_BF(SUBNSINCR, incr_spec->sub_ns));
+	/* RegBit[15:0] = Subns[23:8]; RegBit[31:24] = Subns[7:0] */
+	gem_writel(bp, TISUBN, GEM_BF(SUBNSINCRL, incr_spec->sub_ns) |
+		   GEM_BF(SUBNSINCRH, (incr_spec->sub_ns >>
+			  GEM_SUBNSINCRL_SIZE)));
 	gem_writel(bp, TI, GEM_BF(NSINCR, incr_spec->ns));
 	spin_unlock_irqrestore(&bp->tsu_clk_lock, flags);
 
-- 
2.24.0


  parent reply	other threads:[~2019-12-02 10:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-02 10:02 [PATCH 4.14 01/14] clk: at91: fix update bit maps on CFG_MOR write Lee Jones
2019-12-02 10:03 ` [PATCH 4.14 02/14] arm: add missing include platform-data/atmel.h Lee Jones
2019-12-02 10:03 ` [PATCH 4.14 03/14] watchdog: sama5d4: fix WDD value to be always set to max Lee Jones
2019-12-02 10:03 ` Lee Jones [this message]
2019-12-02 10:03 ` [PATCH 4.14 05/14] media: v4l2-ctrl: fix flags for DO_WHITE_BALANCE Lee Jones
2019-12-02 10:03 ` [PATCH 4.14 06/14] net: macb: fix error format in dev_err() Lee Jones
2019-12-02 10:03 ` [PATCH 4.14 07/14] media: atmel: atmel-isc: fix asd memory allocation Lee Jones
2019-12-02 10:03 ` [PATCH 4.14 08/14] media: atmel: atmel-isc: fix INIT_WORK misplacement Lee Jones
2019-12-02 10:03 ` [PATCH 4.14 09/14] mtd: rawnand: atmel: Fix spelling mistake in error message Lee Jones
2019-12-02 10:03 ` [PATCH 4.14 10/14] pwm: Clear chip_data in pwm_put() Lee Jones
2019-12-02 10:03 ` [PATCH 4.14 11/14] net: macb driver, check for SKBTX_HW_TSTAMP Lee Jones
2019-12-02 10:03 ` [PATCH 4.14 12/14] mtd: rawnand: atmel: fix possible object reference leak Lee Jones
2019-12-02 10:03 ` [PATCH 4.14 13/14] mtd: spi-nor: cast to u64 to avoid uint overflows Lee Jones
2019-12-02 10:03 ` [PATCH 4.14 14/14] clk: at91: generated: set audio_pll_allowed in at91_clk_register_generated() Lee Jones

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=20191202100312.1397-4-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=stable@vger.kernel.org \
    /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).