Skip to content

Commit ae8bdb7

Browse files
committed
xilinx_kc705: Add SPI-Flash support.
1 parent b778ba5 commit ae8bdb7

2 files changed

Lines changed: 32 additions & 14 deletions

File tree

litex_boards/platforms/xilinx_kc705.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,19 @@
113113
),
114114

115115
# SPIFlash
116-
("spiflash", 0, # clock needs to be accessed through STARTUPE2
116+
("spiflash", 0,
117117
Subsignal("cs_n", Pins("U19")),
118-
Subsignal("dq", Pins("P24", "R25", "R20", "R21")),
118+
#Subsignal("clk", Pins("")), # Accessed through STARTUPE2
119+
Subsignal("mosi", Pins("P24")),
120+
Subsignal("miso", Pins("R25")),
121+
Subsignal("wp", Pins("R20")),
122+
Subsignal("hold", Pins("R21")),
123+
IOStandard("LVCMOS33"),
124+
),
125+
("spiflash4x", 0,
126+
Subsignal("cs_n", Pins("U19")),
127+
#Subsignal("clk", Pins("L16")), # Accessed through STARTUPE2
128+
Subsignal("dq", Pins("P24 R25 R20 R21")),
119129
IOStandard("LVCMOS25")
120130
),
121131

litex_boards/targets/xilinx_kc705.py

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

5353
class BaseSoC(SoCCore):
5454
def __init__(self, sys_clk_freq=int(125e6), with_ethernet=False, with_led_chaser=True,
55-
with_pcie=False, with_sata=False, **kwargs):
55+
with_spi_flash=False, with_pcie=False, with_sata=False, **kwargs):
5656
platform = kc705.Platform()
5757

5858
# CRG --------------------------------------------------------------------------------------
@@ -81,6 +81,12 @@ def __init__(self, sys_clk_freq=int(125e6), with_ethernet=False, with_led_chaser
8181
clk_freq = self.clk_freq)
8282
self.add_ethernet(phy=self.ethphy)
8383

84+
# SPI Flash --------------------------------------------------------------------------------
85+
if with_spi_flash:
86+
from litespi.modules import N25Q128A13
87+
from litespi.opcodes import SpiNorFlashOpCodes as Codes
88+
self.add_spi_flash(mode="4x", module=N25Q128A13(Codes.READ_1_1_4), rate="1:1", with_master=True)
89+
8490
# PCIe -------------------------------------------------------------------------------------
8591
if with_pcie:
8692
self.submodules.pcie_phy = S7PCIEPHY(platform, platform.request("pcie_x4"),
@@ -134,22 +140,24 @@ def main():
134140
from litex.soc.integration.soc import LiteXSoCArgumentParser
135141
parser = LiteXSoCArgumentParser(description="LiteX SoC on KC705")
136142
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=125e6, help="System clock frequency.")
140-
target_group.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
141-
target_group.add_argument("--with-pcie", action="store_true", help="Enable PCIe support.")
142-
target_group.add_argument("--driver", action="store_true", help="Generate PCIe driver.")
143-
target_group.add_argument("--with-sata", action="store_true", help="Enable SATA support (over SFP2SATA).")
143+
target_group.add_argument("--build", action="store_true", help="Build bitstream.")
144+
target_group.add_argument("--load", action="store_true", help="Load bitstream.")
145+
target_group.add_argument("--sys-clk-freq", default=125e6, help="System clock frequency.")
146+
target_group.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
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.")
150+
target_group.add_argument("--with-sata", action="store_true", help="Enable SATA support (over SFP2SATA).")
144151
builder_args(parser)
145152
soc_core_args(parser)
146153
args = parser.parse_args()
147154

148155
soc = BaseSoC(
149-
sys_clk_freq = int(float(args.sys_clk_freq)),
150-
with_ethernet = args.with_ethernet,
151-
with_pcie = args.with_pcie,
152-
with_sata = args.with_sata,
156+
sys_clk_freq = int(float(args.sys_clk_freq)),
157+
with_ethernet = args.with_ethernet,
158+
with_spi_flash = args.with_spi_flash,
159+
with_pcie = args.with_pcie,
160+
with_sata = args.with_sata,
153161
**soc_core_argdict(args)
154162
)
155163
builder = Builder(soc, **builder_argdict(args))

0 commit comments

Comments
 (0)