Add ebaz4205 support #327

Merged
sb10q merged 7 commits from newell/artiq-zynq:ebaz4205 into master 2024-10-05 15:05:54 +08:00
5 changed files with 44 additions and 31 deletions
Showing only changes of commit da8817064a - Show all commits

View File

@ -73,9 +73,19 @@ _ddr = [
) )
] ]
# Connector J3
_i2c = [
(
"i2c",
0,
Subsignal("scl", Pins("U12"), IOStandard("LVCMOS33")),
Subsignal("sda", Pins("V13"), IOStandard("LVCMOS33")),
)
]
class EBAZ4205(SoCCore): class EBAZ4205(SoCCore):
def __init__(self, rtio_clk=100e6, acpki=False): def __init__(self, rtio_clk=125e6, acpki=False):
self.acpki = acpki self.acpki = acpki
newell marked this conversation as resolved Outdated

This should be a commandline option (e.g. --no-xtal), rather than uncommenting

This should be a commandline option (e.g. ``--no-xtal``), rather than uncommenting

Yes, agreed. This board is known to come in different variants on the 2nd hand market and I don't feel like removing the xtal to test things as my board has the xtal populated. I will remove this commented out code and leave the commandline option for a possible future branch.

Yes, agreed. This board is known to come in different variants on the 2nd hand market and I don't feel like removing the xtal to test things as my board has the xtal populated. I will remove this commented out code and leave the commandline option for a possible future branch.

Fair enough, don't add anything that's not been tested either.

Fair enough, don't add anything that's not been tested either.
platform = ebaz4205.Platform() platform = ebaz4205.Platform()
@ -86,6 +96,7 @@ class EBAZ4205(SoCCore):
) )
platform.add_extension(_ps) platform.add_extension(_ps)
platform.add_extension(_ddr) platform.add_extension(_ddr)
platform.add_extension(_i2c)
gmii = platform.request("gmii") gmii = platform.request("gmii")
platform.add_period_constraint(gmii.rx_clk, 10) platform.add_period_constraint(gmii.rx_clk, 10)
@ -97,12 +108,7 @@ class EBAZ4205(SoCCore):
ident = self.__class__.__name__ ident = self.__class__.__name__
if self.acpki: if self.acpki:
ident = "acpki_" + ident ident = "acpki_" + ident
SoCCore.__init__( SoCCore.__init__(self, platform=platform, csr_data_width=32, ident=ident)
self,
platform=platform,
csr_data_width=32,
ident=ident,
)
fix_serdes_timing_path(platform) fix_serdes_timing_path(platform)
self.config["RTIO_FREQUENCY"] = str(rtio_clk / 1e6) self.config["RTIO_FREQUENCY"] = str(rtio_clk / 1e6)
platform.add_period_constraint(self.ps7.cd_sys.clk, 10) platform.add_period_constraint(self.ps7.cd_sys.clk, 10)
@ -128,21 +134,34 @@ class EBAZ4205(SoCCore):
# MDIO # MDIO
mdio = platform.request("mdio") mdio = platform.request("mdio")
self.comb += [ self.comb += mdio.mdc.eq(self.ps7.enet0.enet.mdio.mdc)
mdio.mdc.eq(self.ps7.enet0.enet.mdio.mdc), self.specials += Instance(
]
mdio_t = Signal()
self.comb += mdio_t.eq(~self.ps7.enet0.enet.mdio.t_n)
self.specials += [
Instance(
"IOBUF", "IOBUF",
i_I=self.ps7.enet0.enet.mdio.o, i_I=self.ps7.enet0.enet.mdio.o,
io_IO=mdio.mdio, io_IO=mdio.mdio,
o_O=self.ps7.enet0.enet.mdio.i, o_O=self.ps7.enet0.enet.mdio.i,
i_T=mdio_t, i_T=~self.ps7.enet0.enet.mdio.t_n,
) )
# I2C
i2c = self.platform.request("i2c")
self.specials += [
# SCL
Instance(
"IOBUF",
i_I=self.ps7.i2c0.scl.o,
io_IO=i2c.scl,
o_O=self.ps7.i2c0.scl.i,
i_T=~self.ps7.i2c0.scl.t_n,
),
# SDA
Instance(
"IOBUF",
i_I=self.ps7.i2c0.sda.o,
io_IO=i2c.sda,
o_O=self.ps7.i2c0.sda.i,
i_T=~self.ps7.i2c0.sda.t_n,
),
] ]
self.rtio_channels = [] self.rtio_channels = []
@ -211,7 +230,7 @@ def main():
parser.add_argument( parser.add_argument(
"-g", default=None, help="build gateware into the specified directory" "-g", default=None, help="build gateware into the specified directory"
) )
parser.add_argument("--rtio_clk", default=100e6, help="RTIO Clock Frequency (Hz)") parser.add_argument("--rtio-clk", default=125e6, help="RTIO Clock Frequency (Hz)")
parser.add_argument( parser.add_argument(
"--acpki", default=False, action="store_true", help="enable ACPKI" "--acpki", default=False, action="store_true", help="enable ACPKI"
) )

View File

@ -11,9 +11,7 @@ use super::{cache,
core1::rtio_get_destination_status, core1::rtio_get_destination_status,
dma, linalg, dma, linalg,
rpc::{rpc_recv, rpc_send, rpc_send_async}}; rpc::{rpc_recv, rpc_send, rpc_send_async}};
use crate::{eh_artiq, rtio}; use crate::{eh_artiq, i2c, rtio};
#[cfg(not(feature = "target_ebaz4205"))]
use crate::i2c;
extern "C" { extern "C" {
fn vsnprintf_(buffer: *mut c_char, count: size_t, format: *const c_char, va: VaList) -> c_int; fn vsnprintf_(buffer: *mut c_char, count: size_t, format: *const c_char, va: VaList) -> c_int;
@ -111,17 +109,11 @@ pub fn resolve(required: &[u8]) -> Option<u32> {
api!(cache_put = cache::put), api!(cache_put = cache::put),
// i2c // i2c
#[cfg(not(feature = "target_ebaz4205"))]
api!(i2c_start = i2c::start), api!(i2c_start = i2c::start),
#[cfg(not(feature = "target_ebaz4205"))]
api!(i2c_restart = i2c::restart), api!(i2c_restart = i2c::restart),
#[cfg(not(feature = "target_ebaz4205"))]
api!(i2c_stop = i2c::stop), api!(i2c_stop = i2c::stop),
#[cfg(not(feature = "target_ebaz4205"))]
api!(i2c_write = i2c::write), api!(i2c_write = i2c::write),
#[cfg(not(feature = "target_ebaz4205"))]
api!(i2c_read = i2c::read), api!(i2c_read = i2c::read),
#[cfg(not(feature = "target_ebaz4205"))]
api!(i2c_switch_select = i2c::switch_select), api!(i2c_switch_select = i2c::switch_select),
// subkernel // subkernel

View File

@ -21,7 +21,6 @@ pub use pl::csr::rtio_core;
use void::Void; use void::Void;
pub mod eh_artiq; pub mod eh_artiq;
#[cfg(not(feature = "target_ebaz4205"))]
pub mod i2c; pub mod i2c;
pub mod irq; pub mod irq;
pub mod kernel; pub mod kernel;

View File

@ -100,7 +100,6 @@ pub fn main_core0() {
info!("gateware ident: {}", identifier_read(&mut [0; 64])); info!("gateware ident: {}", identifier_read(&mut [0; 64]));
#[cfg(not(feature = "target_ebaz4205"))]
ksupport::i2c::init(); ksupport::i2c::init();
#[cfg(feature = "target_kasli_soc")] #[cfg(feature = "target_kasli_soc")]
{ {

View File

@ -1,6 +1,8 @@
#[cfg(not(feature = "target_ebaz4205"))]
use embedded_hal::blocking::delay::DelayMs; use embedded_hal::blocking::delay::DelayMs;
#[cfg(has_si5324)] #[cfg(has_si5324)]
use ksupport::i2c; use ksupport::i2c;
#[cfg(not(feature = "target_ebaz4205"))]
use libboard_artiq::pl; use libboard_artiq::pl;
#[cfg(has_si5324)] #[cfg(has_si5324)]
use libboard_artiq::si5324; use libboard_artiq::si5324;
@ -10,7 +12,9 @@ use libboard_artiq::si549;
use libboard_zynq::i2c::I2c; use libboard_zynq::i2c::I2c;
use libboard_zynq::timer::GlobalTimer; use libboard_zynq::timer::GlobalTimer;
use libconfig::Config; use libconfig::Config;
use log::{info, warn}; use log::warn;
#[cfg(not(feature = "target_ebaz4205"))]
use log::info;
#[derive(Debug, PartialEq, Copy, Clone)] #[derive(Debug, PartialEq, Copy, Clone)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]