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