phy/rmii: add refclk_cd parameter (to select reference eth clock domain) and make clock_pads optional.

This commit is contained in:
Florent Kermarrec 2020-12-23 11:00:25 +01:00
parent 617400fe9e
commit dea35908c9
1 changed files with 7 additions and 8 deletions

View File

@ -93,7 +93,7 @@ class LiteEthPHYRMIIRX(Module):
class LiteEthPHYRMIICRG(Module, AutoCSR): class LiteEthPHYRMIICRG(Module, AutoCSR):
def __init__(self, clock_pads, pads, with_hw_init_reset): def __init__(self, clock_pads, pads, refclk_cd, with_hw_init_reset):
self._reset = CSRStorage() self._reset = CSRStorage()
# # # # # #
@ -101,10 +101,9 @@ class LiteEthPHYRMIICRG(Module, AutoCSR):
# RX/TX clocks # RX/TX clocks
self.clock_domains.cd_eth_rx = ClockDomain() self.clock_domains.cd_eth_rx = ClockDomain()
self.clock_domains.cd_eth_tx = ClockDomain() self.clock_domains.cd_eth_tx = ClockDomain()
self.comb += [ self.comb += self.cd_eth_rx.clk.eq(ClockSignal(refclk_cd))
self.cd_eth_rx.clk.eq(ClockSignal("eth")), self.comb += self.cd_eth_tx.clk.eq(ClockSignal(refclk_cd))
self.cd_eth_tx.clk.eq(ClockSignal("eth")) if clock_pads is not None:
]
self.specials += DDROutput(0, 1, clock_pads.ref_clk, ClockSignal("eth_tx")) self.specials += DDROutput(0, 1, clock_pads.ref_clk, ClockSignal("eth_tx"))
# Reset # Reset
@ -126,8 +125,8 @@ class LiteEthPHYRMII(Module, AutoCSR):
dw = 8 dw = 8
tx_clk_freq = 50e6 tx_clk_freq = 50e6
rx_clk_freq = 50e6 rx_clk_freq = 50e6
def __init__(self, clock_pads, pads, with_hw_init_reset=True): def __init__(self, clock_pads, pads, refclk_cd="eth", with_hw_init_reset=True):
self.submodules.crg = LiteEthPHYRMIICRG(clock_pads, pads, with_hw_init_reset) self.submodules.crg = LiteEthPHYRMIICRG(clock_pads, pads, refclk_cd, with_hw_init_reset)
self.submodules.tx = ClockDomainsRenamer("eth_tx")(LiteEthPHYRMIITX(pads)) self.submodules.tx = ClockDomainsRenamer("eth_tx")(LiteEthPHYRMIITX(pads))
self.submodules.rx = ClockDomainsRenamer("eth_rx")(LiteEthPHYRMIIRX(pads)) self.submodules.rx = ClockDomainsRenamer("eth_rx")(LiteEthPHYRMIIRX(pads))
self.sink, self.source = self.tx.sink, self.rx.source self.sink, self.source = self.tx.sink, self.rx.source