sdram: Use unsigned long for memory test

This makes it twice as fast on 64-bit CPUs when using a 64-bit bus :-)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
Benjamin Herrenschmidt 2020-06-02 08:08:42 +10:00
parent 5cc7a98845
commit 6239eac130
1 changed files with 5 additions and 4 deletions

View File

@ -878,12 +878,13 @@ static int memtest_addr(void)
static void memspeed(void) static void memspeed(void)
{ {
volatile unsigned int *array = (unsigned int *)MAIN_RAM_BASE; volatile unsigned long *array = (unsigned long *)MAIN_RAM_BASE;
int i; int i;
unsigned int start, end; unsigned int start, end;
unsigned long write_speed; unsigned long write_speed;
unsigned long read_speed; unsigned long read_speed;
__attribute__((unused)) unsigned int data; __attribute__((unused)) unsigned long data;
const unsigned int sz = sizeof(unsigned long);
/* init timer */ /* init timer */
timer0_en_write(0); timer0_en_write(0);
@ -894,7 +895,7 @@ static void memspeed(void)
/* write speed */ /* write speed */
timer0_update_value_write(1); timer0_update_value_write(1);
start = timer0_value_read(); start = timer0_value_read();
for(i=0;i<MEMTEST_DATA_SIZE/4;i++) { for(i=0;i<MEMTEST_DATA_SIZE/sz;i++) {
array[i] = i; array[i] = i;
} }
timer0_update_value_write(1); timer0_update_value_write(1);
@ -911,7 +912,7 @@ static void memspeed(void)
timer0_en_write(1); timer0_en_write(1);
timer0_update_value_write(1); timer0_update_value_write(1);
start = timer0_value_read(); start = timer0_value_read();
for(i=0;i<MEMTEST_DATA_SIZE/4;i++) { for(i=0;i<MEMTEST_DATA_SIZE/sz;i++) {
data = array[i]; data = array[i];
} }
timer0_update_value_write(1); timer0_update_value_write(1);