From 6b4696e3e047208530faceb8e8ddaa7aa8598549 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 18 Nov 2022 18:31:19 +0100 Subject: [PATCH] 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. --- litex/soc/integration/soc.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/litex/soc/integration/soc.py b/litex/soc/integration/soc.py index 47578b320..8238028eb 100755 --- a/litex/soc/integration/soc.py +++ b/litex/soc/integration/soc.py @@ -1765,14 +1765,14 @@ class LiteXSoC(SoC): self.bus.add_slave(name=name, slave=spiflash_core.bus, region=spiflash_region) # Constants. - self.add_constant("SPIFLASH_PHY_FREQUENCY", clk_freq) - self.add_constant("SPIFLASH_MODULE_NAME", module.name.upper()) - self.add_constant("SPIFLASH_MODULE_TOTAL_SIZE", module.total_size) - self.add_constant("SPIFLASH_MODULE_PAGE_SIZE", module.page_size) + self.add_constant(f"{name}_PHY_FREQUENCY", clk_freq) + self.add_constant(f"{name}_MODULE_NAME", module.name.upper()) + self.add_constant(f"{name}_MODULE_TOTAL_SIZE", module.total_size) + self.add_constant(f"{name}_MODULE_PAGE_SIZE", module.page_size) 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: - self.add_constant("SPIFLASH_MODULE_QPI_CAPABLE") + self.add_constant(f"{name}_MODULE_QPI_CAPABLE") # Add SPI SDCard ------------------------------------------------------------------------------- def add_spi_sdcard(self, name="spisdcard", spi_clk_freq=400e3, with_tristate=False, software_debug=False):