r1750

dslinux_amadeus at dslinux.in-berlin.de dslinux_amadeus at dslinux.in-berlin.de
Sat May 5 00:55:15 CEST 2007


Author: amadeus
Date: 2007-05-05 00:55:09 +0200 (Sat, 05 May 2007)
New Revision: 1750

Log:
Improve RAM switching

Modified: trunk/linux-2.6.x/arch/arm/mach-nds/gbaram.c
===================================================================
--- trunk/linux-2.6.x/arch/arm/mach-nds/gbaram.c	2007-04-30 21:52:25 UTC (rev 1749)
+++ trunk/linux-2.6.x/arch/arm/mach-nds/gbaram.c	2007-05-04 22:55:09 UTC (rev 1750)
@@ -130,13 +130,22 @@
 /* Set the mode of EZ to I/O */
 static void ez_set_io(void)
 {
+	// SetRomPage()
 	writew(0xd200, 0x9fe0000);
 	writew(0x1500, 0x8000000);
 	writew(0xd200, 0x8020000);
 	writew(0x1500, 0x8040000);
+	
+	writew(0x8000, 0x9880000);      // PSRAM-1 (16MB) to 0x8400000-0x9400000
+	writew(0x1500, 0x9fc0000);
 
+	// OpenWrite() + DisableSD()
+	writew(0xd200, 0x9fe0000);
+	writew(0x1500, 0x8000000);
+	writew(0xd200, 0x8020000);
+	writew(0x1500, 0x8040000);
+
 	writew(0x0001, 0x9400000);
-
 	writew(0x1500, 0x9C40000);
 	writew(0x1500, 0x9fc0000);
 }
@@ -144,32 +153,22 @@
 /* Set the mode of EZ to PSRAM */
 static void ez_set_ram(void)
 {
-	// CloseNorWrite()
+	// SetRomPage()
 	writew(0xd200, 0x9fe0000);
 	writew(0x1500, 0x8000000);
 	writew(0xd200, 0x8020000);
 	writew(0x1500, 0x8040000);
-
-	writew(0x0000, 0x9400000);	// and DisableSD
-
-	writew(0xd200, 0x9C40000);
+	
+	writew(0x8000, 0x9880000);      // PSRAM-1 (16MB) to 0x8400000-0x9400000
 	writew(0x1500, 0x9fc0000);
 
-	// SetRomPage(384) == PSRAM
+	// OpenWrite() + DisableSD()
 	writew(0xd200, 0x9fe0000);
 	writew(0x1500, 0x8000000);
 	writew(0xd200, 0x8020000);
 	writew(0x1500, 0x8040000);
 
-	writew(384,    0x9880000);
-	writew(0x1500, 0x9fc0000);
-
-	// OpenNorWrite()
-	writew(0xd200, 0x9fe0000);
-	writew(0x1500, 0x8000000);
-	writew(0xd200, 0x8020000);
-	writew(0x1500, 0x8040000);
-
+	writew(0x0000, 0x9400000);
 	writew(0x1500, 0x9C40000);
 	writew(0x1500, 0x9fc0000);
 }
@@ -177,6 +176,49 @@
 //==========================================================================
 
 /*
+ * G6
+ */
+
+/* Set the mode of G6 to I/O */
+static void g6_set_io(void)
+{
+	(void)readw(0x09000000);
+	(void)readw(0x09FFFFE0);
+	(void)readw(0x09FFFFEC);
+	(void)readw(0x09FFFFEC);
+	(void)readw(0x09FFFFEC);
+	(void)readw(0x09FFFFFC);
+	(void)readw(0x09FFFFFC);
+	(void)readw(0x09FFFFFC);
+	(void)readw(0x09FFFF4A);
+	(void)readw(0x09FFFF4A);
+	(void)readw(0x09FFFF4A);
+	(void)readw(0x09200006);
+	(void)readw(0x09FFFFF0);
+	(void)readw(0x09FFFFE8);
+}
+
+/* Set the mode of G6 to RAM */
+static void g6_set_ram(void)
+{
+	(void)readw(0x09000000);
+	(void)readw(0x09FFFFE0);
+	(void)readw(0x09FFFFEC);
+	(void)readw(0x09FFFFEC);
+	(void)readw(0x09FFFFEC);
+	(void)readw(0x09FFFFFC);
+	(void)readw(0x09FFFFFC);
+	(void)readw(0x09FFFFFC);
+	(void)readw(0x09FFFF4A);
+	(void)readw(0x09FFFF4A);
+	(void)readw(0x09FFFF4A);
+	(void)readw(0x0920000C);
+	(void)readw(0x09FFFFF0);
+	(void)readw(0x09FFFFE8);
+}
+
+//==========================================================================
+/*
  * Test if the memory area is working RAM.
  * @param	addr	Start address of area
  * @param	length	Area length in bytes
@@ -232,6 +274,9 @@
 //==========================================================================
 int gba_activate_ram(void)
 {
+	/* Disable RAM extensions which are R/W at startup time */
+	// ,,,
+
 	/* test supercard CF/SD */
 	if (gba_testcard(sc_set_ram, sc_set_io, 0x08000000, 0x02000000)) goto activated;
 	/* test M3 adaptor CF/SD */
@@ -239,7 +284,9 @@
 	/* test Opera Memory Extension */
 	if (gba_testcard(op_set_ram, op_set_io, 0x09000000, 0x00800000)) goto activated;
 	/* test EZ Memory Extension */
-	if (gba_testcard(ez_set_ram, ez_set_io, 0x08000000, 0x01000000)) goto activated;
+	if (gba_testcard(ez_set_ram, ez_set_io, 0x08400000, 0x01000000)) goto activated;
+	/* test G6 */
+	if (gba_testcard(g6_set_ram, g6_set_io, 0x08000000, 0x02000000)) goto activated;
 
 	/* insert other adaptors here */
 




More information about the dslinux-commit mailing list