1 --- a/arch/cris/arch-v10/lib/hw_settings.S
2 +++ b/arch/cris/arch-v10/lib/hw_settings.S
6 .dword 0 ; No more register values
7 + .ascii "ACME_PART_MAGIC"
9 --- a/arch/cris/arch-v10/drivers/axisflashmap.c
10 +++ b/arch/cris/arch-v10/drivers/axisflashmap.c
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
19 * Default flash size is 2MB. CONFIG_ETRAX_PTABLE_SECTOR is most likely the
22 static struct mtd_partition axis_default_partitions[NUM_DEFAULT_PARTITIONS] = {
24 - .name = "boot firmware",
25 - .size = CONFIG_ETRAX_PTABLE_SECTOR,
30 - .size = 0x200000 - (6 * CONFIG_ETRAX_PTABLE_SECTOR),
31 - .offset = CONFIG_ETRAX_PTABLE_SECTOR
36 - .name = "filesystem",
37 - .size = 5 * CONFIG_ETRAX_PTABLE_SECTOR,
38 - .offset = 0x200000 - (5 * CONFIG_ETRAX_PTABLE_SECTOR)
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);
55 if (!(mymtd = flash_probe())) {
56 /* There's no reason to use this module if no flash chip can
58 mymtd->name, mymtd->size);
59 axisflash_mtd = mymtd;
61 + /* scan flash to findout where out partition starts */
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)
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;
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;
88 mymtd->owner = THIS_MODULE;