1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-29 17:22:24 +02:00
openwrt-xburst/target/linux/etrax-2.6/patches/cris/016-auto-detect-ram.patch
blogic 9b11307b07 add initial support for the crisarchitecture used on foxboards to openwrt
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7439 3c298f89-4303-0410-b956-a3cf2f4a3e73
2007-06-02 00:46:02 +00:00

102 lines
4.5 KiB
Diff

diff -urN linux-2.6.19.2//arch/cris/arch-v10/boot/compressed/hw_settings.S /tmp/linux-2.6.19.2/arch/cris/arch-v10/boot/compressed/hw_settings.S
--- linux-2.6.19.2//arch/cris/arch-v10/boot/compressed/hw_settings.S 2007-06-01 00:37:57.000000000 +0200
+++ /tmp/linux-2.6.19.2/arch/cris/arch-v10/boot/compressed/hw_settings.S 2007-06-01 00:34:55.000000000 +0200
@@ -62,3 +62,5 @@
.dword 0 ; No more register values
.ascii "ACME_PART_MAGIC" ; Magic number
.dword 0xdeadc0de
+ .ascii "ACME_RAM_MAGIC" ; Magic number
+ .dword 0x2000000
diff -urN linux-2.6.19.2//arch/cris/arch-v10/boot/compressed/hw_settings_416.S /tmp/linux-2.6.19.2/arch/cris/arch-v10/boot/compressed/hw_settings_416.S
--- linux-2.6.19.2//arch/cris/arch-v10/boot/compressed/hw_settings_416.S 2007-06-01 00:37:57.000000000 +0200
+++ /tmp/linux-2.6.19.2/arch/cris/arch-v10/boot/compressed/hw_settings_416.S 2007-06-01 00:34:55.000000000 +0200
@@ -62,3 +62,5 @@
.dword 0 ; No more register values
.ascii "ACME_PART_MAGIC" ; Magic number
.dword 0xdeadc0de
+ .ascii "ACME_RAM_MAGIC" ; Magic number
+ .dword 0x1000000
diff -urN linux-2.6.19.2//arch/cris/arch-v10/boot/compressed/hw_settings_816.S /tmp/linux-2.6.19.2/arch/cris/arch-v10/boot/compressed/hw_settings_816.S
--- linux-2.6.19.2//arch/cris/arch-v10/boot/compressed/hw_settings_816.S 2007-06-01 00:37:57.000000000 +0200
+++ /tmp/linux-2.6.19.2/arch/cris/arch-v10/boot/compressed/hw_settings_816.S 2007-06-01 00:34:55.000000000 +0200
@@ -62,3 +62,5 @@
.dword 0 ; No more register values
.ascii "ACME_PART_MAGIC" ; Magic number
.dword 0xdeadc0de
+ .ascii "ACME_RAM_MAGIC" ; Magic number
+ .dword 0x1000000
diff -urN linux-2.6.19.2//arch/cris/arch-v10/boot/compressed/hw_settings_832.S /tmp/linux-2.6.19.2/arch/cris/arch-v10/boot/compressed/hw_settings_832.S
--- linux-2.6.19.2//arch/cris/arch-v10/boot/compressed/hw_settings_832.S 2007-06-01 00:37:57.000000000 +0200
+++ /tmp/linux-2.6.19.2/arch/cris/arch-v10/boot/compressed/hw_settings_832.S 2007-06-01 00:34:55.000000000 +0200
@@ -62,3 +62,5 @@
.dword 0 ; No more register values
.ascii "ACME_PART_MAGIC" ; Magic number
.dword 0xdeadc0de
+ .ascii "ACME_RAM_MAGIC" ; Magic number
+ .dword 0x2000000
diff -urN linux-2.6.19.2//arch/cris/arch-v10/boot/compressed/hw_settings_MCM.S /tmp/linux-2.6.19.2/arch/cris/arch-v10/boot/compressed/hw_settings_MCM.S
--- linux-2.6.19.2//arch/cris/arch-v10/boot/compressed/hw_settings_MCM.S 2007-06-01 00:37:57.000000000 +0200
+++ /tmp/linux-2.6.19.2/arch/cris/arch-v10/boot/compressed/hw_settings_MCM.S 2007-06-01 00:34:55.000000000 +0200
@@ -62,3 +62,5 @@
.dword 0 ; No more register values
.ascii "ACME_PART_MAGIC" ; Magic number
.dword 0xdeadc0de
+ .ascii "ACME_RAM_MAGIC" ; Magic number
+ .dword 0x1000000
--- linux-2.6.19.2//arch/cris/kernel/setup.c 2007-06-01 00:37:55.000000000 +0200
+++ /tmp/linux-2.6.19.2/arch/cris/kernel/setup.c 2007-06-01 00:34:55.000000000 +0200
@@ -55,6 +55,13 @@
* boot code and the system.
*
*/
+#ifdef CONFIG_CRIS_LOW_MAP
+#define FLASH_UNCACHED_ADDR KSEG_8
+#define FLASH_CACHED_ADDR KSEG_5
+#else
+#define FLASH_UNCACHED_ADDR KSEG_E
+#define FLASH_CACHED_ADDR KSEG_F
+#endif
void __init
setup_arch(char **cmdline_p)
@@ -63,15 +70,37 @@
unsigned long bootmap_size;
unsigned long start_pfn, max_pfn;
unsigned long memory_start;
-
+ unsigned int ram_size = 0;
+ unsigned char *flash_mem = (unsigned char*)(FLASH_CACHED_ADDR);
+ unsigned int ram_scan_count = 0;
+ const char *ram_magic = "ACME_RAM_MAGIC";
+ unsigned int magic_len = strlen(ram_magic);
+ unsigned long dend;
/* register an initial console printing routine for printk's */
init_etrax_debug();
/* we should really poll for DRAM size! */
+ printk(KERN_INFO "Determinig RAM size\n");
+ for(ram_scan_count = 0; ram_scan_count < 100000; ram_scan_count++){
+ if(strncmp(&flash_mem[ram_scan_count], ram_magic, magic_len - 1) == 0){
+ ram_size = flash_mem[ram_scan_count + magic_len ];
+ ram_size <<= 8;
+ ram_size += flash_mem[ram_scan_count + magic_len + 2];
+ ram_size <<= 8;
+ ram_size += flash_mem[ram_scan_count + magic_len + 1];
+ ram_size <<= 8;
+ ram_size += flash_mem[ram_scan_count + magic_len + 3];
+ printk(KERN_INFO "RAM size is %uMB\n", 16 * ram_size);
+ ram_scan_count = 1100000;
+ }
+ }
high_memory = &dram_end;
-
+ dend = dram_start + 16 * 1024 * 1024 * ram_size;
+ if(ram_size == 1){
+ high_memory = 0xc1000000;
+ }
if(romfs_in_flash || !romfs_length) {
/* if we have the romfs in flash, or if there is no rom filesystem,
* our free area starts directly after the BSS