Merge pull request #505 from DurandA/patch-3

Enable 1x mode on SPI flash
This commit is contained in:
enjoy-digital 2020-05-11 22:53:31 +02:00 committed by GitHub
commit 3ce9010083
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1190,10 +1190,10 @@ class LiteXSoC(SoC):
# Add SPI Flash -------------------------------------------------------------------------------- # Add SPI Flash --------------------------------------------------------------------------------
def add_spi_flash(self, name="spiflash", mode="4x", dummy_cycles=None, clk_freq=None): def add_spi_flash(self, name="spiflash", mode="4x", dummy_cycles=None, clk_freq=None):
assert dummy_cycles is not None # FIXME: Get dummy_cycles from SPI Flash assert dummy_cycles is not None # FIXME: Get dummy_cycles from SPI Flash
assert mode in ["4x"] # FIXME: Add 1x support. assert mode in ["1x", "4x"]
if clk_freq is None: clk_freq = self.clk_freq/2 # FIXME: Get max clk_freq from SPI Flash if clk_freq is None: clk_freq = self.clk_freq/2 # FIXME: Get max clk_freq from SPI Flash
spiflash = SpiFlash( spiflash = SpiFlash(
pads = self.platform.request(name + mode), pads = self.platform.request(name if mode == "1x" else name + mode),
dummy = dummy_cycles, dummy = dummy_cycles,
div = ceil(self.clk_freq/clk_freq), div = ceil(self.clk_freq/clk_freq),
with_bitbang = True, with_bitbang = True,