summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/cadence/macb.h9
-rw-r--r--drivers/net/ethernet/cadence/macb_ptp.c7
2 files changed, 13 insertions, 3 deletions
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index 6ff123da6a14..98735584570d 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -496,7 +496,11 @@
496 496
497/* Bitfields in TISUBN */ 497/* Bitfields in TISUBN */
498#define GEM_SUBNSINCR_OFFSET 0 498#define GEM_SUBNSINCR_OFFSET 0
499#define GEM_SUBNSINCR_SIZE 16 499#define GEM_SUBNSINCRL_OFFSET 24
500#define GEM_SUBNSINCRL_SIZE 8
501#define GEM_SUBNSINCRH_OFFSET 0
502#define GEM_SUBNSINCRH_SIZE 16
503#define GEM_SUBNSINCR_SIZE 24
500 504
501/* Bitfields in TI */ 505/* Bitfields in TI */
502#define GEM_NSINCR_OFFSET 0 506#define GEM_NSINCR_OFFSET 0
@@ -834,6 +838,9 @@ struct gem_tx_ts {
834/* limit RX checksum offload to TCP and UDP packets */ 838/* limit RX checksum offload to TCP and UDP packets */
835#define GEM_RX_CSUM_CHECKED_MASK 2 839#define GEM_RX_CSUM_CHECKED_MASK 2
836 840
841/* Scaled PPM fraction */
842#define PPM_FRACTION 16
843
837/* struct macb_tx_skb - data about an skb which is being transmitted 844/* struct macb_tx_skb - data about an skb which is being transmitted
838 * @skb: skb currently being transmitted, only set for the last buffer 845 * @skb: skb currently being transmitted, only set for the last buffer
839 * of the frame 846 * of the frame
diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c
index 0a8aca8d3634..43a3f0dbf857 100644
--- a/drivers/net/ethernet/cadence/macb_ptp.c
+++ b/drivers/net/ethernet/cadence/macb_ptp.c
@@ -104,7 +104,10 @@ static int gem_tsu_incr_set(struct macb *bp, struct tsu_incr *incr_spec)
104 * to take effect. 104 * to take effect.
105 */ 105 */
106 spin_lock_irqsave(&bp->tsu_clk_lock, flags); 106 spin_lock_irqsave(&bp->tsu_clk_lock, flags);
107 gem_writel(bp, TISUBN, GEM_BF(SUBNSINCR, incr_spec->sub_ns)); 107 /* RegBit[15:0] = Subns[23:8]; RegBit[31:24] = Subns[7:0] */
108 gem_writel(bp, TISUBN, GEM_BF(SUBNSINCRL, incr_spec->sub_ns) |
109 GEM_BF(SUBNSINCRH, (incr_spec->sub_ns >>
110 GEM_SUBNSINCRL_SIZE)));
108 gem_writel(bp, TI, GEM_BF(NSINCR, incr_spec->ns)); 111 gem_writel(bp, TI, GEM_BF(NSINCR, incr_spec->ns));
109 spin_unlock_irqrestore(&bp->tsu_clk_lock, flags); 112 spin_unlock_irqrestore(&bp->tsu_clk_lock, flags);
110 113
@@ -135,7 +138,7 @@ static int gem_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
135 * (temp / USEC_PER_SEC) + 0.5 138 * (temp / USEC_PER_SEC) + 0.5
136 */ 139 */
137 adj += (USEC_PER_SEC >> 1); 140 adj += (USEC_PER_SEC >> 1);
138 adj >>= GEM_SUBNSINCR_SIZE; /* remove fractions */ 141 adj >>= PPM_FRACTION; /* remove fractions */
139 adj = div_u64(adj, USEC_PER_SEC); 142 adj = div_u64(adj, USEC_PER_SEC);
140 adj = neg_adj ? (word - adj) : (word + adj); 143 adj = neg_adj ? (word - adj) : (word + adj);
141 144