xilinx_ac701: Add SPI-Flash support.

This commit is contained in:
Florent Kermarrec 2022-04-28 11:05:41 +02:00
parent ae8bdb74a9
commit 9914478854
3 changed files with 39 additions and 15 deletions

View File

@ -92,6 +92,23 @@ _io = [
Misc("SLEW=FAST"), Misc("SLEW=FAST"),
), ),
# SPIFlash
("spiflash", 0,
Subsignal("cs_n", Pins("P18")),
#Subsignal("clk", Pins("")), # Accessed through STARTUPE2
Subsignal("mosi", Pins("R14")),
Subsignal("miso", Pins("R15")),
Subsignal("wp", Pins("P14")),
Subsignal("hold", Pins("N14")),
IOStandard("LVCMOS33"),
),
("spiflash4x", 0,
Subsignal("cs_n", Pins("P18")),
#Subsignal("clk", Pins("")), # Accessed through STARTUPE2
Subsignal("dq", Pins("R14 R15 P14 N14")),
IOStandard("LVCMOS33")
),
# PCIe # PCIe
("pcie_x1", 0, ("pcie_x1", 0,
Subsignal("rst_n", Pins("M20"), IOStandard("LVCMOS25")), Subsignal("rst_n", Pins("M20"), IOStandard("LVCMOS25")),

View File

@ -120,11 +120,11 @@ _io = [
Subsignal("miso", Pins("R25")), Subsignal("miso", Pins("R25")),
Subsignal("wp", Pins("R20")), Subsignal("wp", Pins("R20")),
Subsignal("hold", Pins("R21")), Subsignal("hold", Pins("R21")),
IOStandard("LVCMOS33"), IOStandard("LVCMOS25"),
), ),
("spiflash4x", 0, ("spiflash4x", 0,
Subsignal("cs_n", Pins("U19")), Subsignal("cs_n", Pins("U19")),
#Subsignal("clk", Pins("L16")), # Accessed through STARTUPE2 #Subsignal("clk", Pins("")), # Accessed through STARTUPE2
Subsignal("dq", Pins("P24 R25 R20 R21")), Subsignal("dq", Pins("P24 R25 R20 R21")),
IOStandard("LVCMOS25") IOStandard("LVCMOS25")
), ),

View File

@ -56,7 +56,7 @@ class _CRG(Module):
class BaseSoC(SoCCore): class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=int(100e6), with_ethernet=False, eth_phy="rgmii", def __init__(self, sys_clk_freq=int(100e6), with_ethernet=False, eth_phy="rgmii",
with_led_chaser=True, with_pcie=False, **kwargs): with_spi_flash=False, with_led_chaser=True, with_pcie=False, **kwargs):
platform = ac701.Platform() platform = ac701.Platform()
# CRG -------------------------------------------------------------------------------------- # CRG --------------------------------------------------------------------------------------
@ -75,7 +75,6 @@ class BaseSoC(SoCCore):
self.add_sdram("sdram", self.add_sdram("sdram",
phy = self.ddrphy, phy = self.ddrphy,
module = MT8JTF12864(sys_clk_freq, "1:4"), module = MT8JTF12864(sys_clk_freq, "1:4"),
size = 0x40000000,
l2_cache_size = kwargs.get("l2_size", 8192) l2_cache_size = kwargs.get("l2_size", 8192)
) )
@ -116,6 +115,12 @@ class BaseSoC(SoCCore):
self.add_ethernet(phy=self.ethphy) self.add_ethernet(phy=self.ethphy)
# SPI Flash --------------------------------------------------------------------------------
if with_spi_flash:
from litespi.modules import N25Q256A
from litespi.opcodes import SpiNorFlashOpCodes as Codes
self.add_spi_flash(mode="4x", module=N25Q256A(Codes.READ_1_1_4), rate="1:1", with_master=True)
# PCIe ------------------------------------------------------------------------------------- # PCIe -------------------------------------------------------------------------------------
if with_pcie: if with_pcie:
self.submodules.pcie_phy = S7PCIEPHY(platform, platform.request("pcie_x4"), self.submodules.pcie_phy = S7PCIEPHY(platform, platform.request("pcie_x4"),
@ -139,6 +144,7 @@ def main():
target_group.add_argument("--sys-clk-freq", default=100e6, help="System clock frequency.") target_group.add_argument("--sys-clk-freq", default=100e6, help="System clock frequency.")
target_group.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.") target_group.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
target_group.add_argument("--eth-phy", default="rgmii", help="Select Ethernet PHY (rgmii or 1000basex).") target_group.add_argument("--eth-phy", default="rgmii", help="Select Ethernet PHY (rgmii or 1000basex).")
target_group.add_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed).")
target_group.add_argument("--with-pcie", action="store_true", help="Enable PCIe support.") target_group.add_argument("--with-pcie", action="store_true", help="Enable PCIe support.")
target_group.add_argument("--driver", action="store_true", help="Generate PCIe driver.") target_group.add_argument("--driver", action="store_true", help="Generate PCIe driver.")
builder_args(parser) builder_args(parser)
@ -149,6 +155,7 @@ def main():
sys_clk_freq = int(float(args.sys_clk_freq)), sys_clk_freq = int(float(args.sys_clk_freq)),
with_ethernet = args.with_ethernet, with_ethernet = args.with_ethernet,
eth_phy = args.eth_phy, eth_phy = args.eth_phy,
with_spi_flash = args.with_spi_flash,
with_pcie = args.with_pcie, with_pcie = args.with_pcie,
**soc_core_argdict(args) **soc_core_argdict(args)
) )