From 99d4073c6ad9d8cce5f1c7f4f9ec652936498662 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 25 Nov 2024 09:21:17 +0100 Subject: [PATCH] phy/usp_gth/gty_1000basex: Add refclk_from_fabric parameter to allow selecting GTGREFCLK or GTREFCLK0. --- liteeth/gen.py | 1 + liteeth/phy/usp_gth_1000basex.py | 6 +++--- liteeth/phy/usp_gty_1000basex.py | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/liteeth/gen.py b/liteeth/gen.py index c40092c..3300647 100755 --- a/liteeth/gen.py +++ b/liteeth/gen.py @@ -362,6 +362,7 @@ class PHYCore(SoCMini): # Clocking. refclk_or_clk_pads = ethphy_pads.refclk, refclk_freq = core_config.get("refclk_freq", 200e6), + refclk_from_fabric = core_config.get("refclk_from_fabric", True), # TX. tx_polarity = core_config.get("phy_tx_polarity", 0), # RX. diff --git a/liteeth/phy/usp_gth_1000basex.py b/liteeth/phy/usp_gth_1000basex.py index 09fe8bf..bb59dba 100644 --- a/liteeth/phy/usp_gth_1000basex.py +++ b/liteeth/phy/usp_gth_1000basex.py @@ -22,7 +22,7 @@ class USP_GTH_1000BASEX(LiteXModule): linerate = 1.25e9 rx_clk_freq = 125e6 tx_clk_freq = 125e6 - def __init__(self, refclk_or_clk_pads, data_pads, sys_clk_freq, refclk_freq=200e6, with_csr=True, rx_polarity=0, tx_polarity=0): + def __init__(self, refclk_or_clk_pads, data_pads, sys_clk_freq, refclk_freq=200e6, with_csr=True, rx_polarity=0, tx_polarity=0, refclk_from_fabric=False): from liteiclink.serdes.gth4_ultrascale import GTHChannelPLL assert refclk_freq in [200e6, 156.25e6] self.pcs = pcs = PCS(lsb_first=True) @@ -579,12 +579,12 @@ class USP_GTH_1000BASEX(LiteXModule): i_DRPWE = 0b0, i_EYESCANRESET = 0b0, i_EYESCANTRIGGER = 0b0, - i_GTGREFCLK = refclk, + i_GTGREFCLK = refclk if refclk_from_fabric else 0b0, i_GTHRXN = data_pads.rxn, i_GTHRXP = data_pads.rxp, i_GTNORTHREFCLK0 = 0b0, i_GTNORTHREFCLK1 = 0b0, - i_GTREFCLK0 = 0b0, + i_GTREFCLK0 = refclk if not refclk_from_fabric else 0b0, i_GTREFCLK1 = 0b0, i_GTRSVD = 0b0000000000000000, i_GTRXRESET = rx_reset, diff --git a/liteeth/phy/usp_gty_1000basex.py b/liteeth/phy/usp_gty_1000basex.py index 4125fae..cdc65be 100644 --- a/liteeth/phy/usp_gty_1000basex.py +++ b/liteeth/phy/usp_gty_1000basex.py @@ -22,7 +22,7 @@ class USP_GTY_1000BASEX(LiteXModule): linerate = 1.25e9 rx_clk_freq = 125e6 tx_clk_freq = 125e6 - def __init__(self, refclk_or_clk_pads, data_pads, sys_clk_freq, refclk_freq=200e6, with_csr=True, rx_polarity=0, tx_polarity=0): + def __init__(self, refclk_or_clk_pads, data_pads, sys_clk_freq, refclk_freq=200e6, with_csr=True, rx_polarity=0, tx_polarity=0, refclk_from_fabric=False): from liteiclink.serdes.gty_ultrascale import GTYChannelPLL assert refclk_freq in [200e6, 156.25e6] self.pcs = pcs = PCS(lsb_first=True) @@ -599,10 +599,10 @@ class USP_GTY_1000BASEX(LiteXModule): i_EYESCANRESET = 0b0, i_EYESCANTRIGGER = 0b0, i_FREQOS = 0b0, - i_GTGREFCLK = refclk, + i_GTGREFCLK = refclk if refclk_from_fabric else 0b0, i_GTNORTHREFCLK0 = 0b0, i_GTNORTHREFCLK1 = 0b0, - i_GTREFCLK0 = 0b0, + i_GTREFCLK0 = refclk if not refclk_from_fabric else 0b0, i_GTREFCLK1 = 0b0, i_GTRSVD = 0b0, i_GTRXRESET = rx_reset,