liteeth_gen: Allow external QPLL on Artix7 to allow multiple PHYs per Quad.

Requires setting qpll parameter to False in .yml config file.
This commit is contained in:
Florent Kermarrec 2024-03-18 14:24:32 +01:00
parent 0914fb5e51
commit 5eb986b004
1 changed files with 29 additions and 16 deletions

View File

@ -145,6 +145,12 @@ _io = [
), ),
# SGMII PHY Pads # SGMII PHY Pads
("sgmii_qpll", 0,
Subsignal("clk", Pins(1)),
Subsignal("refclk", Pins(1)),
Subsignal("reset", Pins(1)),
Subsignal("lock", Pins(1)),
),
("sgmii", 0, ("sgmii", 0,
Subsignal("refclk", Pins(1)), Subsignal("refclk", Pins(1)),
Subsignal("rst", Pins(1)), Subsignal("rst", Pins(1)),
@ -293,23 +299,30 @@ class PHYCore(SoCMini):
if phy in [liteeth_phys.A7_1000BASEX, liteeth_phys.A7_2500BASEX]: if phy in [liteeth_phys.A7_1000BASEX, liteeth_phys.A7_2500BASEX]:
refclk_freq = core_config.get("refclk_freq", 0) refclk_freq = core_config.get("refclk_freq", 0)
assert refclk_freq in [125e6, 156.25e6] assert refclk_freq in [125e6, 156.25e6]
from liteeth.phy.a7_gtp import QPLLSettings, QPLL # QPLL.
qpll_settings = QPLLSettings( if core_config.get("qpll", True):
refclksel = 0b001, from liteeth.phy.a7_gtp import QPLLSettings, QPLL
fbdiv = { qpll_settings = QPLLSettings(
liteeth_phys.A7_1000BASEX : 4, refclksel = 0b001,
liteeth_phys.A7_2500BASEX : 5, fbdiv = {
}[phy], liteeth_phys.A7_1000BASEX : 4,
fbdiv_45 = { liteeth_phys.A7_2500BASEX : 5,
125e6 : 5, }[phy],
156.25e6 : 4, fbdiv_45 = {
}[refclk_freq], 125e6 : 5,
refclk_div = 1 156.25e6 : 4,
) }[refclk_freq],
qpll = QPLL(ethphy_pads.refclk, qpll_settings) refclk_div = 1
self.submodules += qpll )
qpll = QPLL(ethphy_pads.refclk, qpll_settings)
self.submodules += qpll
qpll_channel = qpll.channels[0] # FIXME: Allow 1?
else:
qpll_channel = platform.request("sgmii_qpll")
qpll_channel.index = 0 # FIXME: Allow 1?
# PHY.
ethphy = phy( ethphy = phy(
qpll_channel = qpll.channels[0], qpll_channel = qpll_channel,
data_pads = ethphy_pads, data_pads = ethphy_pads,
sys_clk_freq = self.clk_freq, sys_clk_freq = self.clk_freq,
with_csr = False, with_csr = False,