Changeset 27768 for branches/backfire


Ignore:
Timestamp:
2011-07-25T11:52:05+02:00 (5 years ago)
Author:
jow
Message:

[backfire] backport r27049, should fix newer WRT160NL models with Backfire

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/backfire/target/linux/ar71xx/files/drivers/mtd/wrt160nl_part.c

    r20525 r27768  
    7979static struct mtd_partition trx_parts[TRX_PARTS]; 
    8080 
     81#define WRT160NL_UBOOT_LEN      0x40000 
     82#define WRT160NL_ART_LEN        0x10000 
     83#define WRT160NL_NVRAM_LEN      0x10000 
     84 
    8185static int wrt160nl_parse_partitions(struct mtd_info *master, 
    8286                                     struct mtd_partition **pparts, 
     
    8892        size_t retlen; 
    8993        unsigned int kernel_len; 
     94        unsigned int uboot_len = max(master->erasesize, WRT160NL_UBOOT_LEN); 
     95        unsigned int nvram_len = max(master->erasesize, WRT160NL_NVRAM_LEN); 
     96        unsigned int art_len = max(master->erasesize, WRT160NL_ART_LEN); 
    9097        int ret; 
    9198 
     
    96103        } 
    97104 
    98         ret = master->read(master, 4 * master->erasesize, sizeof(*header), 
     105        ret = master->read(master, uboot_len, sizeof(*header), 
    99106                           &retlen, (void *) header); 
    100107        if (ret) 
     
    128135        trx_parts[0].name = "u-boot"; 
    129136        trx_parts[0].offset = 0; 
    130         trx_parts[0].size = 4 * master->erasesize; 
     137        trx_parts[0].size = uboot_len; 
    131138        trx_parts[0].mask_flags = MTD_WRITEABLE; 
    132139 
     
    138145        trx_parts[2].name = "rootfs"; 
    139146        trx_parts[2].offset = trx_parts[1].offset + trx_parts[1].size; 
    140         trx_parts[2].size = master->size - 6 * master->erasesize - trx_parts[1].size; 
     147        trx_parts[2].size = master->size - uboot_len - nvram_len - art_len - trx_parts[1].size; 
    141148        trx_parts[2].mask_flags = 0; 
    142149 
    143150        trx_parts[3].name = "nvram"; 
    144         trx_parts[3].offset = master->size - 2 * master->erasesize; 
    145         trx_parts[3].size = master->erasesize; 
     151        trx_parts[3].offset = master->size - nvram_len - art_len; 
     152        trx_parts[3].size = nvram_len; 
    146153        trx_parts[3].mask_flags = MTD_WRITEABLE; 
    147154 
    148155        trx_parts[4].name = "art"; 
    149         trx_parts[4].offset = master->size - master->erasesize; 
    150         trx_parts[4].size = master->erasesize; 
     156        trx_parts[4].offset = master->size - art_len; 
     157        trx_parts[4].size = art_len; 
    151158        trx_parts[4].mask_flags = MTD_WRITEABLE; 
    152159 
    153160        trx_parts[5].name = "firmware"; 
    154         trx_parts[5].offset = 4 * master->erasesize; 
    155         trx_parts[5].size = master->size - 6 * master->erasesize; 
     161        trx_parts[5].offset = uboot_len; 
     162        trx_parts[5].size = master->size - uboot_len - nvram_len - art_len; 
    156163        trx_parts[5].mask_flags = 0; 
    157164 
Note: See TracChangeset for help on using the changeset viewer.