soc/add_spi_flash: Use name as prefix for defined constants.

Allow adding multiple SPIFlash with different names to the SoC. The BIOS will
only use "spiflash" for now but the other SPI Flash core will  be accessible.
This commit is contained in:
Florent Kermarrec 2022-11-18 18:31:19 +01:00
parent c957ed6ed3
commit 6b4696e3e0
1 changed files with 6 additions and 6 deletions

View File

@ -1765,14 +1765,14 @@ class LiteXSoC(SoC):
self.bus.add_slave(name=name, slave=spiflash_core.bus, region=spiflash_region) self.bus.add_slave(name=name, slave=spiflash_core.bus, region=spiflash_region)
# Constants. # Constants.
self.add_constant("SPIFLASH_PHY_FREQUENCY", clk_freq) self.add_constant(f"{name}_PHY_FREQUENCY", clk_freq)
self.add_constant("SPIFLASH_MODULE_NAME", module.name.upper()) self.add_constant(f"{name}_MODULE_NAME", module.name.upper())
self.add_constant("SPIFLASH_MODULE_TOTAL_SIZE", module.total_size) self.add_constant(f"{name}_MODULE_TOTAL_SIZE", module.total_size)
self.add_constant("SPIFLASH_MODULE_PAGE_SIZE", module.page_size) self.add_constant(f"{name}_MODULE_PAGE_SIZE", module.page_size)
if SpiNorFlashOpCodes.READ_1_1_4 in module.supported_opcodes: if SpiNorFlashOpCodes.READ_1_1_4 in module.supported_opcodes:
self.add_constant("SPIFLASH_MODULE_QUAD_CAPABLE") self.add_constant(f"{name}_MODULE_QUAD_CAPABLE")
if SpiNorFlashOpCodes.READ_4_4_4 in module.supported_opcodes: if SpiNorFlashOpCodes.READ_4_4_4 in module.supported_opcodes:
self.add_constant("SPIFLASH_MODULE_QPI_CAPABLE") self.add_constant(f"{name}_MODULE_QPI_CAPABLE")
# Add SPI SDCard ------------------------------------------------------------------------------- # Add SPI SDCard -------------------------------------------------------------------------------
def add_spi_sdcard(self, name="spisdcard", spi_clk_freq=400e3, with_tristate=False, software_debug=False): def add_spi_sdcard(self, name="spisdcard", spi_clk_freq=400e3, with_tristate=False, software_debug=False):