Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

bios: more DDR diagnostic functions

  • Loading branch information...
commit 7ecfd603685e26d63fc0b1fb6ecc637d4a18658e 1 parent 2ccdade
Sébastien Bourdeauducq authored May 14, 2012
42  software/bios/ddrinit.c
@@ -81,6 +81,43 @@ static void init_sequence(void)
81 81
 	cdelay(200);
82 82
 }
83 83
 
  84
+void ddrsw(void)
  85
+{
  86
+	CSR_DFII_CONTROL = DFII_CONTROL_CKE;
  87
+	printf("DDR now under software control\n");
  88
+}
  89
+
  90
+void ddrhw(void)
  91
+{
  92
+	CSR_DFII_CONTROL = DFII_CONTROL_SEL|DFII_CONTROL_CKE;
  93
+	printf("DDR now under hardware control\n");
  94
+}
  95
+
  96
+void ddrrow(char *_row)
  97
+{
  98
+	char *c;
  99
+	unsigned int row;
  100
+	
  101
+	if(*_row == 0) {
  102
+		setaddr(0x0000);
  103
+		CSR_DFII_BA_P0 = 0;
  104
+		CSR_DFII_COMMAND_P0 = DFII_COMMAND_RAS|DFII_COMMAND_WE|DFII_COMMAND_CS;
  105
+		cdelay(15);
  106
+		printf("Precharged\n");
  107
+	} else {
  108
+		row = strtoul(_row, &c, 0);
  109
+		if(*c != 0) {
  110
+			printf("incorrect row\n");
  111
+			return;
  112
+		}
  113
+		setaddr(row);
  114
+		CSR_DFII_BA_P0 = 0;
  115
+		CSR_DFII_COMMAND_P0 = DFII_COMMAND_RAS|DFII_COMMAND_CS;
  116
+		cdelay(15);
  117
+		printf("Activated row %d\n", row);
  118
+	}
  119
+}
  120
+
84 121
 void ddrrd(char *startaddr)
85 122
 {
86 123
 	char *c;
@@ -141,10 +178,5 @@ int ddrinit(void)
141 178
 	
142 179
 	init_sequence();
143 180
 	
144  
-	setaddr(0x0000);
145  
-	CSR_DFII_BA_P0 = 0;
146  
-	CSR_DFII_COMMAND_P0 = DFII_COMMAND_RAS|DFII_COMMAND_CS;
147  
-	cdelay(15);
148  
-	
149 181
 	return 1;
150 182
 }
3  software/bios/ddrinit.h
@@ -19,6 +19,9 @@
19 19
 #define __DDRINIT_H
20 20
 
21 21
 int ddrinit(void);
  22
+void ddrsw(void);
  23
+void ddrhw(void);
  24
+void ddrrow(char *_row);
22 25
 void ddrrd(char *startaddr);
23 26
 void ddrwr(char *startaddr);
24 27
 
3  software/bios/main.c
@@ -353,6 +353,9 @@ static void do_command(char *c)
353 353
 	else if(strcmp(token, "wcsr") == 0) wcsr(get_token(&c), get_token(&c));
354 354
 	
355 355
 	else if(strcmp(token, "ddrinit") == 0) ddrinit();
  356
+	else if(strcmp(token, "ddrrow") == 0) ddrrow(get_token(&c));
  357
+	else if(strcmp(token, "ddrsw") == 0) ddrsw();
  358
+	else if(strcmp(token, "ddrhw") == 0) ddrhw();
356 359
 	else if(strcmp(token, "ddrrd") == 0) ddrrd(get_token(&c));
357 360
 	else if(strcmp(token, "ddrwr") == 0) ddrwr(get_token(&c));
358 361
 

0 notes on commit 7ecfd60

Please sign in to comment.
Something went wrong with that request. Please try again.