Skip to content

Commit

Permalink
net: macb: Fix SUBNS increment and increase resolution
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Harini Katakam authored and David S. Miller committed Jun 29, 2019
1 parent a8ee4dc commit 7ad342b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion drivers/net/ethernet/cadence/macb.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,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
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/ethernet/cadence/macb_ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,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);

Expand Down

0 comments on commit 7ad342b

Please sign in to comment.