liblitespi/spiflash: Move memspeed to specific function (spiflash_memspeed) and reduce test size.

On slow configurations (ex iCEBreaker / SERV CPU / 12MHz SPI Flash freq) memspeed test was
too slow (>200s to do the random test for 1MB), so reduce test size to 4KB.

This will be less accurate but will still provide representative results which
is the aim of this test.
This commit is contained in:
Florent Kermarrec 2021-09-08 09:10:21 +02:00
parent 10c4523c32
commit 0222697f21
2 changed files with 13 additions and 6 deletions

View File

@ -93,6 +93,14 @@ static void spiflash_master_write(uint32_t val, size_t len, size_t width, uint32
#endif
void spiflash_memspeed(void) {
/* Test Sequential Read accesses */
memspeed((unsigned int *) SPIFLASH_BASE, 4096, 1, 0);
/* Test Random Read accesses */
memspeed((unsigned int *) SPIFLASH_BASE, 4096, 1, 1);
}
void spiflash_init(void)
{
printf("\nInitializing %s SPI Flash @0x%08lx...\n", SPIFLASH_MODULE_NAME, SPIFLASH_BASE);
@ -123,8 +131,8 @@ void spiflash_init(void)
spiflash_freq_init();
#endif
memspeed((unsigned int *) SPIFLASH_BASE, SPIFLASH_SIZE/16, 1, 0);
memspeed((unsigned int *) SPIFLASH_BASE, SPIFLASH_SIZE/16, 1, 1);
/* Test SPI Flash speed */
spiflash_memspeed();
}
#endif

View File

@ -1,13 +1,12 @@
#ifndef __LITESPI_FLASH_H
#define __LITESPI_FLASH_H
#include <generated/csr.h>
#define SPI_FLASH_BLOCK_SIZE 256
#define CRC32_ERASED_FLASH 0xFEA8A821
#define SPI_FLASH_BLOCK_SIZE 256
#define CRC32_ERASED_FLASH 0xFEA8A821
int spiflash_freq_init(void);
void spiflash_dummy_bits_setup(unsigned int dummy_bits);
void spiflash_memspeed(void);
void spiflash_init(void);
#endif /* __LITESPI_FLASH_H */