From e842d702950d60c1d1df6297b800e4e9bcc4e04b Mon Sep 17 00:00:00 2001
From: Grzegorz Daniluk <grzegorz.daniluk@gmail.com>
Date: Fri, 20 Jul 2012 14:33:14 +0200
Subject: [PATCH] wrc_ptp: reset wr servo when changing mode (master/slave)

---
 wrc_ptp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/wrc_ptp.c b/wrc_ptp.c
index e5fbedf..ec7a54f 100644
--- a/wrc_ptp.c
+++ b/wrc_ptp.c
@@ -80,7 +80,7 @@ int wrc_ptp_set_mode(int mode)
 
 	ptp_mode = 0;
 	
-	ptp_enabled = 0;
+  wrc_ptp_stop();
 	
 	switch(mode)
 	{
@@ -147,6 +147,7 @@ int wrc_ptp_get_mode()
 int wrc_ptp_start()
 {
   ptpPortDS->linkUP = FALSE;
+  wr_servo_reset();
   initDataClock(&rtOpts, &ptpClockDS);
 
   ptp_enabled = 1;
@@ -156,6 +157,7 @@ int wrc_ptp_start()
 int wrc_ptp_stop()
 {
 	ptp_enabled = 0;
+  wr_servo_reset();
 	return 0;
 }
 
-- 
GitLab