diff options
Diffstat (limited to 'target/linux/etrax/patches/cris/016-auto-detect-ram.patch')
-rw-r--r-- | target/linux/etrax/patches/cris/016-auto-detect-ram.patch | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/target/linux/etrax/patches/cris/016-auto-detect-ram.patch b/target/linux/etrax/patches/cris/016-auto-detect-ram.patch new file mode 100644 index 0000000000..51930f2ce2 --- /dev/null +++ b/target/linux/etrax/patches/cris/016-auto-detect-ram.patch @@ -0,0 +1,101 @@ +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 |