Line 57... |
Line 57... |
mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch));
|
mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch));
|
SET_FIELD(*mc_csc, MC_CSC, MS, mc_sdram_cs[ch].MS);
|
SET_FIELD(*mc_csc, MC_CSC, MS, mc_sdram_cs[ch].MS);
|
SET_FIELD(*mc_csc, MC_CSC, BW, mc_sdram_cs[ch].BW);
|
SET_FIELD(*mc_csc, MC_CSC, BW, mc_sdram_cs[ch].BW);
|
SET_FIELD(*mc_csc, MC_CSC, SEL, mc_sdram_cs[ch].M);
|
SET_FIELD(*mc_csc, MC_CSC, SEL, mc_sdram_cs[ch].M);
|
SET_FLAG(*mc_csc, MC_CSC, EN);
|
SET_FLAG(*mc_csc, MC_CSC, EN);
|
printf ("Channel Config %d - CSC = 0x%08lX\n", ch, *mc_csc);
|
PRINTF ("Channel Config %d - CSC = 0x%08lX\n", ch, *mc_csc);
|
}
|
}
|
}
|
}
|
|
|
return 0;
|
return 0;
|
}
|
}
|
Line 81... |
Line 81... |
mc_sdram_cs[ch].MS = GET_FIELD(*mc_csc, MC_CSC, MS);
|
mc_sdram_cs[ch].MS = GET_FIELD(*mc_csc, MC_CSC, MS);
|
mc_sdram_cs[ch].BW = GET_FIELD(*mc_csc, MC_CSC, BW);
|
mc_sdram_cs[ch].BW = GET_FIELD(*mc_csc, MC_CSC, BW);
|
mc_sdram_cs[ch].M = GET_FIELD(*mc_csc, MC_CSC, SEL);
|
mc_sdram_cs[ch].M = GET_FIELD(*mc_csc, MC_CSC, SEL);
|
mc_cs |= (1 << ch);
|
mc_cs |= (1 << ch);
|
|
|
printf("get_config(%d) : MS=0x%0lx, BW=0x%0lx, M=0x%0lx\n", ch,
|
PRINTF("get_config(%d) : MS=0x%0lx, BW=0x%0lx, M=0x%0lx\n", ch,
|
mc_sdram_cs[ch].MS,
|
mc_sdram_cs[ch].MS,
|
mc_sdram_cs[ch].BW,
|
mc_sdram_cs[ch].BW,
|
mc_sdram_cs[ch].M);
|
mc_sdram_cs[ch].M);
|
}
|
}
|
}
|
}
|
printf("get_config() : cs=0x%0x\n", mc_cs);
|
PRINTF("get_config() : cs=0x%0x\n", mc_cs);
|
return 0;
|
return 0;
|
}
|
}
|
|
|
int main()
|
int main()
|
{
|
{
|
Line 118... |
Line 118... |
randomin(7435);
|
randomin(7435);
|
lpoc = *mc_poc;
|
lpoc = *mc_poc;
|
|
|
#ifdef MC_READ_CONF
|
#ifdef MC_READ_CONF
|
if (get_config()) {
|
if (get_config()) {
|
printf("Error reading MC configuration\n");
|
PRINTF("Error reading MC configuration\n");
|
report(0x00000001);
|
report(0x00000001);
|
return(1);
|
return(1);
|
}
|
}
|
#else
|
#else
|
mc_cs = MC_SDRAM_CSMASK;
|
mc_cs = MC_SDRAM_CSMASK;
|
#endif
|
#endif
|
|
|
for (ch=0; ch<8; ch++) {
|
for (ch=0; ch<8; ch++) {
|
if (mc_cs & (0x01 << ch) ) {
|
if (mc_cs & (0x01 << ch) ) {
|
printf ("--- Begin Test on CS%d ---\n", ch);
|
PRINTF ("--- Begin Test on CS%d ---\n", ch);
|
|
|
mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch));
|
mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch));
|
mc_tms = (unsigned long*)(MC_BASE + MC_TMS(ch));
|
mc_tms = (unsigned long*)(MC_BASE + MC_TMS(ch));
|
mc_sel = GET_FIELD(*mc_csc, MC_CSC, SEL);
|
mc_sel = GET_FIELD(*mc_csc, MC_CSC, SEL);
|
|
|
Line 170... |
Line 170... |
nRowSize = MC_SDRAM_ROWSIZE_8;
|
nRowSize = MC_SDRAM_ROWSIZE_8;
|
nRows = MC_SDRAM_ROWS_8;
|
nRows = MC_SDRAM_ROWS_8;
|
nRowSh = MC_SDRAM_ROWSH_8; break;
|
nRowSh = MC_SDRAM_ROWSH_8; break;
|
}
|
}
|
|
|
printf ("CS configuration : CSC - 0x%08lX, TMS - 0x%08lX, rs = %lu, nr = %lu, sh = %lu, sel = %lu\n",
|
PRINTF ("CS configuration : CSC - 0x%08lX, TMS - 0x%08lX, rs = %lu, nr = %lu, sh = %lu, sel = %lu\n",
|
*mc_csc, *mc_tms, nRowSize, nRows, nRowSh, mc_sel);
|
*mc_csc, *mc_tms, nRowSize, nRows, nRowSh, mc_sel);
|
|
|
/*nRows -= MC_SDRAM_ROW_OFF;*/
|
/*nRows -= MC_SDRAM_ROW_OFF;*/
|
for (test=0; test<16; test++) {
|
for (test=0; test<16; test++) {
|
/* configure MC*/
|
/* configure MC*/
|
Line 281... |
Line 281... |
SET_FLAG(*mc_tms, MC_TMS_SDRAM, BT); /* interleaved burst */
|
SET_FLAG(*mc_tms, MC_TMS_SDRAM, BT); /* interleaved burst */
|
SET_FIELD(*mc_tms, MC_TMS_SDRAM, BL, 1); /* 2 */
|
SET_FIELD(*mc_tms, MC_TMS_SDRAM, BL, 1); /* 2 */
|
break;
|
break;
|
} /*switch test*/
|
} /*switch test*/
|
|
|
printf ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_csc, *mc_tms);
|
PRINTF ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_csc, *mc_tms);
|
|
|
if (MC_SDRAM_ACC & MC_SDRAM_SROW) {
|
if (MC_SDRAM_ACC & MC_SDRAM_SROW) {
|
/* perform sequential row access */
|
/* perform sequential row access */
|
printf("Seuential Row\n");
|
PRINTF("Seuential Row\n");
|
for (j=0; j<T_ROWS; j++) {
|
for (j=0; j<T_ROWS; j++) {
|
nAddress = mc_sel << 21;
|
nAddress = mc_sel << 21;
|
nAddress |= MC_MEM_BASE;
|
nAddress |= MC_MEM_BASE;
|
nAddress += ( (j + T_ROW_OFF) << nRowSh);
|
nAddress += ( (j + T_ROW_OFF) << nRowSh);
|
|
|
gpio_pat ^= 0x00000008;
|
gpio_pat ^= 0x00000008;
|
*rgpio_out = gpio_pat;
|
*rgpio_out = gpio_pat;
|
ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS);
|
ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS);
|
|
|
printf("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret);
|
PRINTF("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret);
|
|
|
if (ret) {
|
if (ret) {
|
gpio_pat ^= 0x00000080;
|
gpio_pat ^= 0x00000080;
|
*rgpio_out = gpio_pat;
|
*rgpio_out = gpio_pat;
|
report(ret);
|
report(ret);
|
Line 308... |
Line 308... |
}
|
}
|
}
|
}
|
|
|
if (MC_SDRAM_ACC & MC_SDRAM_RROW) {
|
if (MC_SDRAM_ACC & MC_SDRAM_RROW) {
|
/* perform random row access */
|
/* perform random row access */
|
printf("Random Row\n");
|
PRINTF("Random Row\n");
|
for (j=0; j<T_ROWS; j++) {
|
for (j=0; j<T_ROWS; j++) {
|
nAddress = mc_sel << 21;
|
nAddress = mc_sel << 21;
|
nAddress |= MC_MEM_BASE;
|
nAddress |= MC_MEM_BASE;
|
nAddress += ( (T_ROW_OFF + random(nRows)) << nRowSh);
|
nAddress += ( (T_ROW_OFF + random(nRows)) << nRowSh);
|
|
|
gpio_pat ^= 0x00000008;
|
gpio_pat ^= 0x00000008;
|
*rgpio_out = gpio_pat;
|
*rgpio_out = gpio_pat;
|
ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS);
|
ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS);
|
|
|
printf("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret);
|
PRINTF("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret);
|
|
|
if (ret) {
|
if (ret) {
|
gpio_pat ^= 0x00000080;
|
gpio_pat ^= 0x00000080;
|
*rgpio_out = gpio_pat;
|
*rgpio_out = gpio_pat;
|
report(ret);
|
report(ret);
|
Line 331... |
Line 331... |
}
|
}
|
}
|
}
|
|
|
if (MC_SDRAM_ACC & MC_SDRAM_SGRP) {
|
if (MC_SDRAM_ACC & MC_SDRAM_SGRP) {
|
/* perform sequential row in group access */
|
/* perform sequential row in group access */
|
printf("Sequential Group ");
|
PRINTF("Sequential Group ");
|
|
|
printf("Group Size = %d\n", MC_SDRAM_GROUPSIZE);
|
PRINTF("Group Size = %d\n", MC_SDRAM_GROUPSIZE);
|
for (i=0; i<T_GROUPS; i++) {
|
for (i=0; i<T_GROUPS; i++) {
|
nRowGrp = random(nRows - MC_SDRAM_GROUPSIZE) + T_ROW_OFF;
|
nRowGrp = random(nRows - MC_SDRAM_GROUPSIZE) + T_ROW_OFF;
|
for (j=0; j<MC_SDRAM_GROUPSIZE; j++) {
|
for (j=0; j<MC_SDRAM_GROUPSIZE; j++) {
|
nAddress = mc_sel << 21;
|
nAddress = mc_sel << 21;
|
nAddress |= MC_MEM_BASE;
|
nAddress |= MC_MEM_BASE;
|
Line 345... |
Line 345... |
|
|
gpio_pat ^= 0x00000008;
|
gpio_pat ^= 0x00000008;
|
*rgpio_out = gpio_pat;
|
*rgpio_out = gpio_pat;
|
ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS);
|
ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS);
|
|
|
printf("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret);
|
PRINTF("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret);
|
|
|
if (ret) {
|
if (ret) {
|
gpio_pat ^= 0x00000080;
|
gpio_pat ^= 0x00000080;
|
*rgpio_out = gpio_pat;
|
*rgpio_out = gpio_pat;
|
report(ret);
|
report(ret);
|
Line 359... |
Line 359... |
}
|
}
|
}
|
}
|
|
|
if (MC_SDRAM_ACC & MC_SDRAM_RGRP) {
|
if (MC_SDRAM_ACC & MC_SDRAM_RGRP) {
|
/* perform random row in group access */
|
/* perform random row in group access */
|
printf("Random Group ");
|
PRINTF("Random Group ");
|
|
|
printf("Group Size = %d\n", MC_SDRAM_GROUPSIZE);
|
PRINTF("Group Size = %d\n", MC_SDRAM_GROUPSIZE);
|
for (i=0; i<T_GROUPS; i++) {
|
for (i=0; i<T_GROUPS; i++) {
|
nRowGrp = random(nRows - T_GROUPS) + T_ROW_OFF;
|
nRowGrp = random(nRows - T_GROUPS) + T_ROW_OFF;
|
for (j=0; j<MC_SDRAM_GROUPSIZE; j++) {
|
for (j=0; j<MC_SDRAM_GROUPSIZE; j++) {
|
nAddress = mc_sel << 21;
|
nAddress = mc_sel << 21;
|
nAddress |= MC_MEM_BASE;
|
nAddress |= MC_MEM_BASE;
|
Line 373... |
Line 373... |
|
|
gpio_pat ^= 0x00000008;
|
gpio_pat ^= 0x00000008;
|
*rgpio_out = gpio_pat;
|
*rgpio_out = gpio_pat;
|
ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS);
|
ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS);
|
|
|
printf("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret);
|
PRINTF("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret);
|
|
|
if (ret) {
|
if (ret) {
|
gpio_pat ^= 0x00000080;
|
gpio_pat ^= 0x00000080;
|
*rgpio_out = gpio_pat;
|
*rgpio_out = gpio_pat;
|
report(ret);
|
report(ret);
|
Line 388... |
Line 388... |
} /*for groups*/
|
} /*for groups*/
|
|
|
} /*for test*/
|
} /*for test*/
|
} /*if*/
|
} /*if*/
|
} /*for CS*/
|
} /*for CS*/
|
printf("--- End SDRAM tests ---\n");
|
PRINTF("--- End SDRAM tests ---\n");
|
report(0xDEADDEAD);
|
report(0xDEADDEAD);
|
|
|
gpio_pat ^= 0x00000020;
|
gpio_pat ^= 0x00000020;
|
*rgpio_out = gpio_pat;
|
*rgpio_out = gpio_pat;
|
|
|