litex_acorn_baseboard_mini: Allow simultaneous pcie and ethernet.

This commit is contained in:
Florent Kermarrec 2024-06-18 13:55:01 +02:00
parent 805a520b5a
commit 6857418deb

View file

@ -76,7 +76,7 @@ class CRG(LiteXModule):
# IDelayCtrl. # IDelayCtrl.
if with_dram: if with_dram:
self.comb += self.cd_idelay.clk.eq(clk200_se) self.specials += Instance("BUFG", i_I=clk200_se, o_O=self.cd_idelay.clk)
self.idelayctrl = S7IDELAYCTRL(self.cd_idelay) self.idelayctrl = S7IDELAYCTRL(self.cd_idelay)
# Eth PLL. # Eth PLL.
@ -144,32 +144,63 @@ class BaseSoC(SoCCore):
platform.toolchain.pre_placement_commands.append("reset_property LOC [get_cells -hierarchical -filter {{NAME=~pcie_s7/*gtp_channel.gtpe2_channel_i}}]") platform.toolchain.pre_placement_commands.append("reset_property LOC [get_cells -hierarchical -filter {{NAME=~pcie_s7/*gtp_channel.gtpe2_channel_i}}]")
platform.toolchain.pre_placement_commands.append("set_property LOC GTPE2_CHANNEL_X0Y7 [get_cells -hierarchical -filter {{NAME=~pcie_s7/*gtp_channel.gtpe2_channel_i}}]") platform.toolchain.pre_placement_commands.append("set_property LOC GTPE2_CHANNEL_X0Y7 [get_cells -hierarchical -filter {{NAME=~pcie_s7/*gtp_channel.gtpe2_channel_i}}]")
# Ethernet / SATA RefClk/Shared-QPLL ------------------------------------------------------- # PCIe / Ethernet / SATA / Shared-QPLL -----------------------------------------------------
# Ethernet QPLL Settings. assert not (with_pcie and with_sata)
qpll_eth_settings = QPLLSettings(
refclksel = 0b111,
fbdiv = 4,
fbdiv_45 = 4,
refclk_div = 1,
)
# SATA QPLL Settings. if not with_pcie:
qpll_sata_settings = QPLLSettings( # Ethernet QPLL Settings.
refclksel = 0b111, qpll_eth_settings = QPLLSettings(
fbdiv = 5, refclksel = 0b111,
fbdiv_45 = 4, fbdiv = 4,
refclk_div = 1, fbdiv_45 = 4,
) refclk_div = 1,
)
platform.add_platform_command("set_property SEVERITY {{Warning}} [get_drc_checks REQP-49]")
# Shared QPLL. # SATA QPLL Settings.
self.qpll = qpll = QPLL( qpll_sata_settings = QPLLSettings(
gtgrefclk0 = Open() if not with_eth else self.crg.cd_eth_ref.clk, refclksel = 0b111,
qpllsettings0 = None if not with_eth else qpll_eth_settings, fbdiv = 5,
gtgrefclk1 = Open() if not with_sata else self.crg.cd_sata_ref.clk, fbdiv_45 = 4,
qpllsettings1 = None if not with_sata else qpll_sata_settings, refclk_div = 1,
) )
platform.add_platform_command("set_property SEVERITY {{Warning}} [get_drc_checks REQP-49]") platform.add_platform_command("set_property SEVERITY {{Warning}} [get_drc_checks REQP-49]")
# Shared QPLL.
self.qpll = qpll = QPLL(
gtgrefclk0 = Open() if not with_eth else self.crg.cd_eth_ref.clk,
qpllsettings0 = None if not with_eth else qpll_eth_settings,
gtgrefclk1 = Open() if not with_sata else self.crg.cd_sata_ref.clk,
qpllsettings1 = None if not with_sata else qpll_sata_settings,
)
if with_pcie:
# PCIe QPLL Settings.
qpll_pcie_settings = QPLLSettings(
refclksel = 0b001,
fbdiv = 5,
fbdiv_45 = 5,
refclk_div = 1,
)
# Ethernet QPLL Settings.
qpll_eth_settings = QPLLSettings(
refclksel = 0b111,
fbdiv = 4,
fbdiv_45 = 4,
refclk_div = 1,
)
platform.add_platform_command("set_property SEVERITY {{Warning}} [get_drc_checks REQP-49]")
# Shared QPLL.
self.qpll = qpll = QPLL(
gtrefclk0 = Open() if not with_pcie else self.pcie_phy.pcie_refclk,
qpllsettings0 = None if not with_pcie else qpll_pcie_settings,
gtgrefclk1 = Open() if not with_eth else self.crg.cd_eth_ref.clk,
qpllsettings1 = None if not with_eth else qpll_eth_settings,
)
self.pcie_phy.use_external_qpll(qpll_channel=qpll.channels[0])
# Ethernet / Etherbone --------------------------------------------------------------------- # Ethernet / Etherbone ---------------------------------------------------------------------
if with_ethernet or with_etherbone: if with_ethernet or with_etherbone:
@ -184,7 +215,7 @@ class BaseSoC(SoCCore):
platform.add_extension(_eth_io) platform.add_extension(_eth_io)
self.ethphy = A7_1000BASEX( self.ethphy = A7_1000BASEX(
qpll_channel = qpll.channels[0], qpll_channel = qpll.channels[1 if with_pcie else 0],
data_pads = self.platform.request("sfp"), data_pads = self.platform.request("sfp"),
sys_clk_freq = sys_clk_freq, sys_clk_freq = sys_clk_freq,
rx_polarity = 1, # Inverted on Acorn. rx_polarity = 1, # Inverted on Acorn.