forked from M-Labs/artiq
sayma: set up Si5324 for RGMII clock rerouting
This commit is contained in:
parent
c3c13da1a6
commit
2b01aa22b6
|
@ -82,6 +82,8 @@ fn startup() {
|
|||
#[cfg(has_ad9154)]
|
||||
board::ad9154::init().expect("cannot initialize AD9154");
|
||||
|
||||
#[cfg(rgmii_clock_rerouted)]
|
||||
setup_rgmii_si5324();
|
||||
#[cfg(has_ethmac)]
|
||||
startup_ethernet();
|
||||
#[cfg(not(has_ethmac))]
|
||||
|
@ -91,6 +93,27 @@ fn startup() {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(rgmii_clock_rerouted)]
|
||||
fn setup_rgmii_si5324()
|
||||
{
|
||||
const SI5324_SETTINGS: board::si5324::FrequencySettings
|
||||
= board::si5324::FrequencySettings {
|
||||
n1_hs : 5,
|
||||
nc1_ls : 8,
|
||||
n2_hs : 7,
|
||||
n2_ls : 360,
|
||||
n31 : 63,
|
||||
n32 : 63,
|
||||
bwsel : 4
|
||||
};
|
||||
info!("rerouting RGMII clock through Si5324");
|
||||
unsafe { board::csr::ethphy::crg_reset_write(1); }
|
||||
board::i2c::init();
|
||||
board::si5324::setup(&SI5324_SETTINGS).expect("cannot initialize Si5324");
|
||||
board::si5324::select_ext_input(true).expect("failed to select Si5324 input");
|
||||
unsafe { board::csr::ethphy::crg_reset_write(0); }
|
||||
}
|
||||
|
||||
#[cfg(has_ethmac)]
|
||||
fn startup_ethernet() {
|
||||
let hardware_addr;
|
||||
|
|
|
@ -140,6 +140,15 @@ class SaymaAMCStandalone(MiniSoC, AMPSoC):
|
|||
serial_rtm.tx.eq(serial_1.rx)
|
||||
]
|
||||
|
||||
# Si5324 used to work around RGMII clock routing issue on first PCB revision
|
||||
self.submodules.si5324_rst_n = gpio.GPIOOut(platform.request("si5324").rst_n)
|
||||
self.csr_devices.append("si5324_rst_n")
|
||||
i2c = self.platform.request("i2c")
|
||||
self.submodules.i2c = gpio.GPIOTristate([i2c.scl, i2c.sda])
|
||||
self.csr_devices.append("i2c")
|
||||
self.config["I2C_BUS_COUNT"] = 1
|
||||
self.config["HAS_SI5324"] = None
|
||||
|
||||
# AMC/RTM serwb
|
||||
serwb_pll = serwb.phy.SERWBPLL(125e6, 1.25e9, vco_div=2)
|
||||
self.comb += serwb_pll.refclk.eq(self.crg.cd_sys.clk)
|
||||
|
|
Loading…
Reference in New Issue