Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340688
b: refs/heads/master
c: 7da716a
h: refs/heads/master
v: v3
  • Loading branch information
Frank Li authored and David S. Miller committed Nov 7, 2012
1 parent 31b4876 commit b140c77
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0f2f7a40f9ae91b9e837c3cd2cacd7f46c168eb1
refs/heads/master: 7da716aee2532399e213a14f656d304098f67a11
14 changes: 6 additions & 8 deletions trunk/drivers/net/ethernet/freescale/fec_ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ static int fec_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
u64 diff;
unsigned long flags;
int neg_adj = 0;
u32 mult = FEC_CC_MULT;

struct fec_enet_private *fep =
container_of(ptp, struct fec_enet_private, ptp_caps);
Expand All @@ -154,22 +155,19 @@ static int fec_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
neg_adj = 1;
}

diff = mult;
diff *= ppb;
diff = div_u64(diff, 1000000000ULL);

spin_lock_irqsave(&fep->tmreg_lock, flags);
/*
* dummy read to set cycle_last in tc to now.
* So use adjusted mult to calculate when next call
* timercounter_read.
*/
timecounter_read(&fep->tc);
fep->cc.mult = FEC_CC_MULT;
diff = fep->cc.mult;
diff *= ppb;
diff = div_u64(diff, 1000000000ULL);

if (neg_adj)
fep->cc.mult -= diff;
else
fep->cc.mult += diff;
fep->cc.mult = neg_adj ? mult - diff : mult + diff;

spin_unlock_irqrestore(&fep->tmreg_lock, flags);

Expand Down

0 comments on commit b140c77

Please sign in to comment.