diff options
author | Felix Fietkau <nbd@openwrt.org> | 2007-06-19 22:29:51 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2007-06-19 22:29:51 +0000 |
commit | cef764fe9f5363d4b806c6b28c0676e9e77c1385 (patch) | |
tree | 5687a7bd5028234adba0b6f8bc1fbc2f828721c1 /target | |
parent | 4b36e8b096d6c2ed1789c916e20819577ff24819 (diff) | |
download | upstream-cef764fe9f5363d4b806c6b28c0676e9e77c1385.tar.gz upstream-cef764fe9f5363d4b806c6b28c0676e9e77c1385.tar.bz2 upstream-cef764fe9f5363d4b806c6b28c0676e9e77c1385.zip |
add brcm47xx mtd corruption fix by b.sander (#1502)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7675 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/brcm47xx-2.6/files/drivers/mtd/maps/bcm47xx-flash.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/target/linux/brcm47xx-2.6/files/drivers/mtd/maps/bcm47xx-flash.c b/target/linux/brcm47xx-2.6/files/drivers/mtd/maps/bcm47xx-flash.c index 5068af848f..6a82f362c6 100644 --- a/target/linux/brcm47xx-2.6/files/drivers/mtd/maps/bcm47xx-flash.c +++ b/target/linux/brcm47xx-2.6/files/drivers/mtd/maps/bcm47xx-flash.c @@ -80,6 +80,22 @@ extern struct ssb_bus ssb; #endif static struct mtd_info *bcm947xx_mtd; +static void bcm947xx_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) +{ + if (len==1) { + memcpy_fromio(to, map->virt + from, len); + } else { + int i; + u16 *dest = (u16 *) to; + u16 *src = (u16 *) (map->virt + from); + for (i = 0; i < (len / 2); i++) { + dest[i] = src[i]; + } + if (len & 1) + *((u8 *)dest+len-1) = src[i] & 0xff; + } +} + static struct map_info bcm947xx_map = { name: "Physically mapped flash", size: WINDOW_SIZE, @@ -372,6 +388,7 @@ int __init init_bcm947xx_map(void) printk("Failed to ioremap\n"); return -EIO; } + simple_map_init(&bcm947xx_map); if (!(bcm947xx_mtd = do_map_probe("cfi_probe", &bcm947xx_map))) { @@ -380,6 +397,9 @@ int __init init_bcm947xx_map(void) return -ENXIO; } + /* override copy_from routine */ + bcm947xx_map.copy_from = bcm947xx_map_copy_from; + bcm947xx_mtd->owner = THIS_MODULE; size = bcm947xx_mtd->size; |