mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
cores/spi_flash: add non-memory mapped S7SPIFlash modules based on SPIMaster (for design were we only want to re-program the bistream)
This commit is contained in:
parent
4c18c991bc
commit
e726ad80ac
1 changed files with 31 additions and 1 deletions
|
@ -12,8 +12,10 @@ from migen.genlib.misc import timeline
|
|||
from litex.gen import *
|
||||
|
||||
from litex.soc.interconnect import wishbone
|
||||
from litex.soc.interconnect.csr import AutoCSR, CSRStorage, CSRStatus
|
||||
from litex.soc.interconnect.csr import *
|
||||
from litex.soc.cores.spi import SPIMaster
|
||||
|
||||
# SpiFlash Quad/Dual/Single (memory-mapped) --------------------------------------------------------
|
||||
|
||||
_FAST_READ = 0x0b
|
||||
_DIOFR = 0xbb
|
||||
|
@ -275,3 +277,31 @@ def SpiFlash(pads, *args, **kw):
|
|||
return SpiFlashSingle(pads, *args, **kw)
|
||||
else:
|
||||
return SpiFlashDualQuad(pads, *args, **kw)
|
||||
|
||||
|
||||
# Xilinx 7-Series FPGAs SPI Flash (non-memory-mapped) ----------------------------------------------
|
||||
|
||||
class S7SPIFlash(Module, AutoCSR):
|
||||
def __init__(self, pads, sys_clk_freq, spi_clk_freq=25e6):
|
||||
self.submodules.spi = spi = SPIMaster(None, 40, sys_clk_freq, spi_clk_freq)
|
||||
self.specials += Instance("STARTUPE2",
|
||||
i_CLK=0,
|
||||
i_GSR=0,
|
||||
i_GTS=0,
|
||||
i_KEYCLEARB=0,
|
||||
i_PACK=0,
|
||||
i_USRCCLKO=spi.pads.clk,
|
||||
i_USRCCLKTS=0,
|
||||
i_USRDONEO=1,
|
||||
i_USRDONETS=1
|
||||
)
|
||||
if hasattr(pads, "vpp"):
|
||||
pads.vpp.reset = 1
|
||||
if hasattr(pads, "hold"):
|
||||
pads.hold.reset = 1
|
||||
|
||||
self.comb += [
|
||||
pads.cs_n.eq(spi.pads.cs_n),
|
||||
pads.mosi.eq(spi.pads.mosi),
|
||||
spi.pads.miso.eq(pads.miso)
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue