[kernel] refreshed layer7 patches for 2.6.26.8, 2.6.27.21, 2.6.28.9 and 2.6.29.1
[openwrt.git] / target / linux / etrax / patches-2.6.29 / 201-flashsize.patch
1 Index: linux-2.6.28.2/arch/cris/arch-v10/drivers/axisflashmap.c
2 ===================================================================
3 --- linux-2.6.28.2.orig/arch/cris/arch-v10/drivers/axisflashmap.c 2009-02-04 13:49:34.000000000 +0100
4 +++ linux-2.6.28.2/arch/cris/arch-v10/drivers/axisflashmap.c 2009-02-04 13:55:30.000000000 +0100
5 @@ -113,7 +113,7 @@
6
7 /* If no partition-table was found, we use this default-set. */
8 #define MAX_PARTITIONS 7
9 -#define NUM_DEFAULT_PARTITIONS 3
10 +#define NUM_DEFAULT_PARTITIONS 2
11
12 /*
13 * Default flash size is 2MB. CONFIG_ETRAX_PTABLE_SECTOR is most likely the
14 @@ -122,19 +122,14 @@
15 */
16 static struct mtd_partition axis_default_partitions[NUM_DEFAULT_PARTITIONS] = {
17 {
18 - .name = "boot firmware",
19 - .size = CONFIG_ETRAX_PTABLE_SECTOR,
20 - .offset = 0
21 - },
22 - {
23 .name = "kernel",
24 - .size = 0x200000 - (6 * CONFIG_ETRAX_PTABLE_SECTOR),
25 - .offset = CONFIG_ETRAX_PTABLE_SECTOR
26 + .size = 0x00,
27 + .offset = 0
28 },
29 {
30 - .name = "filesystem",
31 - .size = 5 * CONFIG_ETRAX_PTABLE_SECTOR,
32 - .offset = 0x200000 - (5 * CONFIG_ETRAX_PTABLE_SECTOR)
33 + .name = "rootfs",
34 + .size = 0x200000,
35 + .offset = 0x200000
36 }
37 };
38
39 @@ -281,6 +276,11 @@
40 struct partitiontable_entry *ptable;
41 int use_default_ptable = 1; /* Until proven otherwise. */
42 const char pmsg[] = " /dev/flash%d at 0x%08x, size 0x%08x\n";
43 + unsigned int kernel_part_size = 0;
44 + unsigned char *flash_mem = (unsigned char*)(FLASH_CACHED_ADDR);
45 + unsigned int flash_scan_count = 0;
46 + const char *part_magic = "ACME_PART_MAGIC";
47 + unsigned int magic_len = strlen(part_magic);
48
49 if (!(mymtd = flash_probe())) {
50 /* There's no reason to use this module if no flash chip can
51 @@ -293,6 +293,31 @@
52 axisflash_mtd = mymtd;
53 }
54
55 + /* scan flash to findout where out partition starts */
56 +
57 + printk(KERN_INFO "Scanning flash for end of kernel magic\n");
58 + for(flash_scan_count = 0; flash_scan_count < 100000; flash_scan_count++) {
59 + if(strncmp(&flash_mem[flash_scan_count], part_magic, magic_len - 1) == 0) {
60 + kernel_part_size = flash_mem[flash_scan_count + magic_len ];
61 + kernel_part_size <<= 8;
62 + kernel_part_size += flash_mem[flash_scan_count + magic_len + 2];
63 + kernel_part_size <<= 8;
64 + kernel_part_size += flash_mem[flash_scan_count + magic_len + 1];
65 + kernel_part_size <<= 8;
66 + kernel_part_size += flash_mem[flash_scan_count + magic_len + 3];
67 + printk(KERN_INFO "Kernel ends at 0x%.08X\n", kernel_part_size);
68 + flash_scan_count = 1100000;
69 + }
70 + }
71 +
72 +
73 + if(kernel_part_size){
74 + kernel_part_size = (kernel_part_size & 0xffff0000);
75 + axis_default_partitions[0].size = kernel_part_size;
76 + axis_default_partitions[1].size = mymtd->size - axis_default_partitions[0].size;
77 + axis_default_partitions[1].offset = axis_default_partitions[0].size;
78 + }
79 +
80 if (mymtd) {
81 mymtd->owner = THIS_MODULE;
82 ptable_head = (struct partitiontable_head *)(FLASH_CACHED_ADDR +
83 Index: linux-2.6.28.2/arch/cris/arch-v10/lib/hw_settings.S
84 ===================================================================
85 --- linux-2.6.28.2.orig/arch/cris/arch-v10/lib/hw_settings.S 2009-02-04 13:48:25.000000000 +0100
86 +++ linux-2.6.28.2/arch/cris/arch-v10/lib/hw_settings.S 2009-02-04 13:49:04.000000000 +0100
87 @@ -60,3 +60,5 @@
88 .dword R_PORT_PB_SET
89 .dword PB_SET_VALUE
90 .dword 0 ; No more register values
91 + .ascii "ACME_PART_MAGIC"
92 + .dword 0xdeadc0de
This page took 0.045448 seconds and 5 git commands to generate.