bios: more DDR diagnostic functions

This commit is contained in:
Sebastien Bourdeauducq 2012-05-14 20:07:57 +02:00
parent 2ccdade88e
commit 7ecfd60368
3 changed files with 43 additions and 5 deletions

View File

@ -81,6 +81,43 @@ static void init_sequence(void)
cdelay(200);
}
void ddrsw(void)
{
CSR_DFII_CONTROL = DFII_CONTROL_CKE;
printf("DDR now under software control\n");
}
void ddrhw(void)
{
CSR_DFII_CONTROL = DFII_CONTROL_SEL|DFII_CONTROL_CKE;
printf("DDR now under hardware control\n");
}
void ddrrow(char *_row)
{
char *c;
unsigned int row;
if(*_row == 0) {
setaddr(0x0000);
CSR_DFII_BA_P0 = 0;
CSR_DFII_COMMAND_P0 = DFII_COMMAND_RAS|DFII_COMMAND_WE|DFII_COMMAND_CS;
cdelay(15);
printf("Precharged\n");
} else {
row = strtoul(_row, &c, 0);
if(*c != 0) {
printf("incorrect row\n");
return;
}
setaddr(row);
CSR_DFII_BA_P0 = 0;
CSR_DFII_COMMAND_P0 = DFII_COMMAND_RAS|DFII_COMMAND_CS;
cdelay(15);
printf("Activated row %d\n", row);
}
}
void ddrrd(char *startaddr)
{
char *c;
@ -141,10 +178,5 @@ int ddrinit(void)
init_sequence();
setaddr(0x0000);
CSR_DFII_BA_P0 = 0;
CSR_DFII_COMMAND_P0 = DFII_COMMAND_RAS|DFII_COMMAND_CS;
cdelay(15);
return 1;
}

View File

@ -19,6 +19,9 @@
#define __DDRINIT_H
int ddrinit(void);
void ddrsw(void);
void ddrhw(void);
void ddrrow(char *_row);
void ddrrd(char *startaddr);
void ddrwr(char *startaddr);

View File

@ -353,6 +353,9 @@ static void do_command(char *c)
else if(strcmp(token, "wcsr") == 0) wcsr(get_token(&c), get_token(&c));
else if(strcmp(token, "ddrinit") == 0) ddrinit();
else if(strcmp(token, "ddrrow") == 0) ddrrow(get_token(&c));
else if(strcmp(token, "ddrsw") == 0) ddrsw();
else if(strcmp(token, "ddrhw") == 0) ddrhw();
else if(strcmp(token, "ddrrd") == 0) ddrrd(get_token(&c));
else if(strcmp(token, "ddrwr") == 0) ddrwr(get_token(&c));