From 747effed0e5f414d539d2044fd71c90a259a7245 Mon Sep 17 00:00:00 2001
From: Grzegorz Daniluk <grzegorz.daniluk@cern.ch>
Date: Mon, 7 Sep 2015 14:33:48 +0200
Subject: [PATCH] adding Kconfig option to build sw for 16-bit PCS platforms

E.g. Kintex-7
---
 Kconfig             |  8 ++++++++
 include/board-wrc.h | 15 ++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/Kconfig b/Kconfig
index bab76e8..a1b61ca 100644
--- a/Kconfig
+++ b/Kconfig
@@ -28,6 +28,14 @@ config RAMSIZE
 
 # CONFIG_WR_SWITCH has no further options at all at this point
 
+config WR_NODE_PCS16
+	depends on WR_NODE
+	boolean "Compile for 16-bit PCS"
+	default n
+	help
+		This allows to compile the WR PTP Core software for 16-bit PCS platforms
+		(e.g. Kintex-7).
+
 config STACKSIZE
 	depends on WR_NODE
 	int
diff --git a/include/board-wrc.h b/include/board-wrc.h
index 97cb8a3..149980c 100644
--- a/include/board-wrc.h
+++ b/include/board-wrc.h
@@ -14,8 +14,13 @@
 #define CPU_CLOCK 62500000ULL
 
 /* WR Reference clock period (picoseconds) and frequency (Hz) */
-#define REF_CLOCK_PERIOD_PS 8000
-#define REF_CLOCK_FREQ_HZ 125000000
+#ifdef CONFIG_WR_NODE_PCS16
+#  define REF_CLOCK_PERIOD_PS 16000
+#  define REF_CLOCK_FREQ_HZ 62500000
+#else
+#  define REF_CLOCK_PERIOD_PS 8000
+#  define REF_CLOCK_FREQ_HZ 125000000
+#endif
 
 /* Baud rate of the builtin UART (does not apply to the VUART) */
 #define UART_BAUDRATE 115200ULL
@@ -33,7 +38,11 @@ int board_init(void);
 int board_update(void);
 
 /* spll parameter that are board-specific */
-#define BOARD_DIVIDE_DMTD_CLOCKS	1
+#ifdef CONFIG_WR_NODE_PCS16
+#  define BOARD_DIVIDE_DMTD_CLOCKS	0
+#else
+#  define BOARD_DIVIDE_DMTD_CLOCKS	1
+#endif
 #define BOARD_MAX_CHAN_REF		1
 #define BOARD_MAX_CHAN_AUX		2
 #define BOARD_MAX_PTRACKERS		1
-- 
GitLab