Skip to content

Commit

Permalink
soc/add_spi_flash: Rename spiflash_mmap to spi_flash_core (since Lite…
Browse files Browse the repository at this point in the history
…SPI inclule MMAP and Master Interface).
  • Loading branch information
enjoy-digital committed Jul 29, 2021
1 parent 505c8b8 commit c5b5abd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions litex/soc/integration/soc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1515,11 +1515,11 @@ def add_spi_flash(self, name="spiflash", mode="4x", dummy_cycles=None, clk_freq=
self.check_if_exists(name + "_mmap")
spiflash_pads = self.platform.request(name if mode == "1x" else name + mode)
spiflash_phy = LiteSPIPHY(spiflash_pads, module, default_divisor=max(int(self.sys_clk_freq/clk_freq), 2))
spiflash_mmap = LiteSPI(spiflash_phy, clk_freq=clk_freq, mmap_endianness=self.cpu.endianness, **kwargs)
spiflash_core = LiteSPI(spiflash_phy, clk_freq=clk_freq, mmap_endianness=self.cpu.endianness, **kwargs)
setattr(self.submodules, name + "_phy", spiflash_phy)
setattr(self.submodules, name + "_mmap", spiflash_mmap)
setattr(self.submodules, name + "_mmap", spiflash_core)
spiflash_region = SoCRegion(origin=self.mem_map.get(name, None), size=module.total_size, cached=False)
self.bus.add_slave(name=name, slave=spiflash_mmap.bus, region=spiflash_region)
self.bus.add_slave(name=name, slave=spiflash_core.bus, region=spiflash_region)

# Add SPI SDCard -------------------------------------------------------------------------------
def add_spi_sdcard(self, name="spisdcard", spi_clk_freq=400e3, software_debug=False):
Expand Down
4 changes: 2 additions & 2 deletions litex/soc/software/bios/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ int main(int i, char **c)

sdr_ok = 1;

#if defined(CSR_ETHMAC_BASE) || defined(CSR_SDRAM_BASE) || defined(CSR_SPIFLASH_MMAP_BASE)
#if defined(CSR_ETHMAC_BASE) || defined(CSR_SDRAM_BASE) || defined(CSR_SPIFLASH_CORE_BASE)
printf("--========== \e[1mInitialization\e[0m ============--\n");
#ifdef CSR_ETHMAC_BASE
eth_init();
Expand All @@ -160,7 +160,7 @@ int main(int i, char **c)
if (sdr_ok != 1)
printf("Memory initialization failed\n");
#endif
#ifdef CSR_SPIFLASH_MMAP_BASE
#ifdef CSR_SPIFLASH_CORE_BASE
spiflash_init();
#endif
printf("\n");
Expand Down
4 changes: 2 additions & 2 deletions litex/soc/software/liblitespi/spiflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "spiflash.h"

#if defined(CSR_SPIFLASH_PHY_BASE) && defined(CSR_SPIFLASH_MMAP_BASE)
#if defined(CSR_SPIFLASH_PHY_BASE) && defined(CSR_SPIFLASH_CORE_BASE)

#define DEBUG 0
#define USER_DEFINED_DUMMY_BITS 0
Expand Down Expand Up @@ -41,7 +41,7 @@ int spiflash_freq_init(void)
#endif
}
lowest_div++;
printf("SPIFlash freq configured to %d MHz\n", (spiflash_mmap_sys_clk_freq_read()/(2*(1 + lowest_div)))/1000000);
printf("SPIFlash freq configured to %d MHz\n", (spiflash_core_sys_clk_freq_read()/(2*(1 + lowest_div)))/1000000);

spiflash_phy_clk_divisor_write(lowest_div);

Expand Down

0 comments on commit c5b5abd

Please sign in to comment.