Title: [7491] trunk/drivers/net/bfin_mac.c: clear any existing hardware timestamp while start-up;
Revision
7491
Author
bhsong
Date
2009-09-28 05:29:40 -0400 (Mon, 28 Sep 2009)

Log Message

clear any existing hardware timestamp while start-up;
dump hardware/system time to help IEEE 1588 protocols analysis

Modified Paths

Diff

Modified: trunk/drivers/net/bfin_mac.c (7490 => 7491)


--- trunk/drivers/net/bfin_mac.c	2009-09-28 09:23:05 UTC (rev 7490)
+++ trunk/drivers/net/bfin_mac.c	2009-09-28 09:29:40 UTC (rev 7491)
@@ -707,6 +707,15 @@
 		bfin_write_EMAC_PTP_CTL(ptpctl);
 
 		/*
+		 * clear any existing timestamp
+		 */
+		bfin_read_EMAC_PTP_RXSNAPLO();
+		bfin_read_EMAC_PTP_RXSNAPHI();
+
+		bfin_read_EMAC_PTP_TXSNAPLO();
+		bfin_read_EMAC_PTP_TXSNAPHI();
+
+		/*
 		 * Set registers so that rollover occurs soon to test this.
 		 */
 		bfin_write_EMAC_PTP_TIMELO(0x00000000);
@@ -726,6 +735,15 @@
 		-EFAULT : 0;
 }
 
+static void bfin_dump_hwtamp(char *s, ktime_t *hw, ktime_t *ts, struct timecompare *cmp)
+{
+	ktime_t sys = ktime_get_real();
+
+	pr_debug("%s %s hardware:%d,%d transform system:%d,%d system:%d,%d, cmp:%lld, %lld\n",
+			__func__, s, hw->tv.sec, hw->tv.nsec, ts->tv.sec, ts->tv.nsec, sys.tv.sec,
+			sys.tv.nsec, cmp->offset, cmp->skew);
+}
+
 static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
 {
 	struct bfin_mac_local *lp = netdev_priv(netdev);
@@ -766,7 +784,7 @@
 				timecompare_transform(&lp->compare, ns);
 			skb_tstamp_tx(skb, &shhwtstamps);
 
-			pr_debug("%s tx time counter:%016llx\n", __func__, regval);
+			bfin_dump_hwtamp("TX", &shhwtstamps.hwtstamp, &shhwtstamps.syststamp, &lp->compare);
 		}
 	}
 }
@@ -795,7 +813,7 @@
 	shhwtstamps->hwtstamp = ns_to_ktime(ns);
 	shhwtstamps->syststamp = timecompare_transform(&lp->compare, ns);
 
-	pr_debug("%s rx time counter: %016llx\n", __func__, regval);
+	bfin_dump_hwtamp("RX", &shhwtstamps->hwtstamp, &shhwtstamps->syststamp, &lp->compare);
 }
 
 /*
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to