Skip to content

Commit 9914478

Browse files
committed
xilinx_ac701: Add SPI-Flash support.
1 parent ae8bdb7 commit 9914478

3 files changed

Lines changed: 39 additions & 15 deletions

File tree

litex_boards/platforms/xilinx_ac701.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,23 @@
9292
Misc("SLEW=FAST"),
9393
),
9494

95+
# SPIFlash
96+
("spiflash", 0,
97+
Subsignal("cs_n", Pins("P18")),
98+
#Subsignal("clk", Pins("")), # Accessed through STARTUPE2
99+
Subsignal("mosi", Pins("R14")),
100+
Subsignal("miso", Pins("R15")),
101+
Subsignal("wp", Pins("P14")),
102+
Subsignal("hold", Pins("N14")),
103+
IOStandard("LVCMOS33"),
104+
),
105+
("spiflash4x", 0,
106+
Subsignal("cs_n", Pins("P18")),
107+
#Subsignal("clk", Pins("")), # Accessed through STARTUPE2
108+
Subsignal("dq", Pins("R14 R15 P14 N14")),
109+
IOStandard("LVCMOS33")
110+
),
111+
95112
# PCIe
96113
("pcie_x1", 0,
97114
Subsignal("rst_n", Pins("M20"), IOStandard("LVCMOS25")),

litex_boards/platforms/xilinx_kc705.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@
120120
Subsignal("miso", Pins("R25")),
121121
Subsignal("wp", Pins("R20")),
122122
Subsignal("hold", Pins("R21")),
123-
IOStandard("LVCMOS33"),
123+
IOStandard("LVCMOS25"),
124124
),
125125
("spiflash4x", 0,
126126
Subsignal("cs_n", Pins("U19")),
127-
#Subsignal("clk", Pins("L16")), # Accessed through STARTUPE2
127+
#Subsignal("clk", Pins("")), # Accessed through STARTUPE2
128128
Subsignal("dq", Pins("P24 R25 R20 R21")),
129129
IOStandard("LVCMOS25")
130130
),

litex_boards/targets/xilinx_ac701.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(self, platform, sys_clk_freq):
5656

5757
class BaseSoC(SoCCore):
5858
def __init__(self, sys_clk_freq=int(100e6), with_ethernet=False, eth_phy="rgmii",
59-
with_led_chaser=True, with_pcie=False, **kwargs):
59+
with_spi_flash=False, with_led_chaser=True, with_pcie=False, **kwargs):
6060
platform = ac701.Platform()
6161

6262
# CRG --------------------------------------------------------------------------------------
@@ -75,7 +75,6 @@ def __init__(self, sys_clk_freq=int(100e6), with_ethernet=False, eth_phy="rgmii"
7575
self.add_sdram("sdram",
7676
phy = self.ddrphy,
7777
module = MT8JTF12864(sys_clk_freq, "1:4"),
78-
size = 0x40000000,
7978
l2_cache_size = kwargs.get("l2_size", 8192)
8079
)
8180

@@ -116,6 +115,12 @@ def __init__(self, sys_clk_freq=int(100e6), with_ethernet=False, eth_phy="rgmii"
116115

117116
self.add_ethernet(phy=self.ethphy)
118117

118+
# SPI Flash --------------------------------------------------------------------------------
119+
if with_spi_flash:
120+
from litespi.modules import N25Q256A
121+
from litespi.opcodes import SpiNorFlashOpCodes as Codes
122+
self.add_spi_flash(mode="4x", module=N25Q256A(Codes.READ_1_1_4), rate="1:1", with_master=True)
123+
119124
# PCIe -------------------------------------------------------------------------------------
120125
if with_pcie:
121126
self.submodules.pcie_phy = S7PCIEPHY(platform, platform.request("pcie_x4"),
@@ -134,22 +139,24 @@ def main():
134139
from litex.soc.integration.soc import LiteXSoCArgumentParser
135140
parser = LiteXSoCArgumentParser(description="LiteX SoC on AC701")
136141
target_group = parser.add_argument_group(title="Target options")
137-
target_group.add_argument("--build", action="store_true", help="Build bitstream.")
138-
target_group.add_argument("--load", action="store_true", help="Load bitstream.")
139-
target_group.add_argument("--sys-clk-freq", default=100e6, help="System clock frequency.")
140-
target_group.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
141-
target_group.add_argument("--eth-phy", default="rgmii", help="Select Ethernet PHY (rgmii or 1000basex).")
142-
target_group.add_argument("--with-pcie", action="store_true", help="Enable PCIe support.")
143-
target_group.add_argument("--driver", action="store_true", help="Generate PCIe driver.")
142+
target_group.add_argument("--build", action="store_true", help="Build bitstream.")
143+
target_group.add_argument("--load", action="store_true", help="Load bitstream.")
144+
target_group.add_argument("--sys-clk-freq", default=100e6, help="System clock frequency.")
145+
target_group.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
146+
target_group.add_argument("--eth-phy", default="rgmii", help="Select Ethernet PHY (rgmii or 1000basex).")
147+
target_group.add_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed).")
148+
target_group.add_argument("--with-pcie", action="store_true", help="Enable PCIe support.")
149+
target_group.add_argument("--driver", action="store_true", help="Generate PCIe driver.")
144150
builder_args(parser)
145151
soc_core_args(parser)
146152
args = parser.parse_args()
147153

148154
soc = BaseSoC(
149-
sys_clk_freq = int(float(args.sys_clk_freq)),
150-
with_ethernet = args.with_ethernet,
151-
eth_phy = args.eth_phy,
152-
with_pcie = args.with_pcie,
155+
sys_clk_freq = int(float(args.sys_clk_freq)),
156+
with_ethernet = args.with_ethernet,
157+
eth_phy = args.eth_phy,
158+
with_spi_flash = args.with_spi_flash,
159+
with_pcie = args.with_pcie,
153160
**soc_core_argdict(args)
154161
)
155162
builder = Builder(soc, **builder_argdict(args))

0 commit comments

Comments
 (0)