summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-2.6.24/cm-x270/0002-ramdisk_load.patch
blob: 4cc0c56a73ec5e9116e1a77d6250d85e12aca3a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
From e2e1f41847cdd2ec6cbcfa97ca47972301fec10e Mon Sep 17 00:00:00 2001
From: Cliff Brake <cbrake@happy.dev.bec-systems.com>
Date: Fri, 20 Jul 2007 19:01:50 -0400
Subject: [PATCH] ramdisk_load

---
 arch/arm/mach-pxa/cm-x270.c        |    6 ++++++
 include/asm-arm/arch-pxa/cm-x270.h |    4 ++++
 init/initramfs.c                   |   16 ++++++++++++++++
 3 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
index 177664c..fb607e9 100644
--- a/arch/arm/mach-pxa/cm-x270.c
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -239,6 +239,12 @@ static struct map_desc cmx270_io_desc[] __initdata = {
 		.length		= SZ_64M,
 		.type		= MT_DEVICE
 	},
+	[2] = { /* NOR flash */
+		.virtual	= CMX270_FLASH_VIRT,
+		.pfn		= __phys_to_pfn(PXA_CS0_PHYS),
+		.length		= (8<<20), /* up to 8 MByte flash */
+		.type		= MT_DEVICE
+	},
 };
 
 /*
diff --git a/include/asm-arm/arch-pxa/cm-x270.h b/include/asm-arm/arch-pxa/cm-x270.h
index f8fac9e..70e0dce 100644
--- a/include/asm-arm/arch-pxa/cm-x270.h
+++ b/include/asm-arm/arch-pxa/cm-x270.h
@@ -20,6 +20,10 @@
 #define CMX270_VIRT_BASE		(0xe8000000)
 #define CMX270_IT8152_VIRT		(CMX270_VIRT_BASE)
 #define CMX270_IDE104_VIRT		(CMX270_IT8152_VIRT + SZ_64M)
+#define CMX270_FLASH_VIRT              (CMX270_IDE104_VIRT + SZ_64M)
+
+#define CMX270_FLASH_RAMDISK_VIRT      (CMX270_FLASH_VIRT + 0x1c0000)
+
 
 /* GPIO related definitions */
 #define GPIO_IT8152_IRQ			(22)
diff --git a/init/initramfs.c b/init/initramfs.c
index 1db02a0..d875fbc 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -7,6 +7,9 @@
 #include <linux/string.h>
 #include <linux/syscalls.h>
 
+// HACK for compulab cm-x270
+#include <asm/arch/cm-x270.h>
+
 static __initdata char *message;
 static void __init error(char *x)
 {
@@ -550,7 +553,20 @@ static int __init populate_rootfs(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 	if (initrd_start) {
 #ifdef CONFIG_BLK_DEV_RAM
+ 
+		/* hack to make initramfs work because the 
+		 * compulab BL does not zero out the 
+		 * initrd memory.  This only seems to affect loading
+		 * initramfs (cpio.gz) archives.  Does not seem to 
+		 * affect ramdisks.
+		 */
+ 		int initrd_size = *(int *)(CMX270_FLASH_RAMDISK_VIRT);
 		int fd;
+
+ 		initrd_end = initrd_start + initrd_size;
+ 		//printk("CLIFF: initrd_start = 0x%x\n", initrd_start);
+ 		//printk("CLIFF: initrd_end = 0x%x\n", initrd_end);
+
 		printk(KERN_INFO "checking if image is initramfs...");
 		err = unpack_to_rootfs((char *)initrd_start,
 			initrd_end - initrd_start, 1);
-- 
1.5.4.rc4