aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/redboot.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 13:20:31 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 13:20:31 -0500
commita8e98d6d51a3eb7bb061b1625193a129c8bd094f (patch)
tree0fa58b6e11e37023b024e55b8f0e7e01438706d4 /drivers/mtd/redboot.c
parentf0f1b3364ae7f48084bdf2837fb979ff59622523 (diff)
parentf9f7dd222364a6428d2ad99a515935dd1dd89d18 (diff)
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (120 commits) [MTD] Fix mtdoops.c compilation [MTD] [NOR] fix startup lock when using multiple nor flash chips [MTD] [DOC200x] eccbuf is statically defined and always evaluate to true [MTD] Fix maps/physmap.c compilation with CONFIG_PM [MTD] onenand: Add panic_write function to the onenand driver [MTD] mtdoops: Use the panic_write function when present [MTD] Add mtd panic_write function pointer [MTD] [NAND] Freescale enhanced Local Bus Controller FCM NAND support. [MTD] physmap.c: Add support for multiple resources [MTD] [NAND] Fix misparenthesization introduced by commit 78b65179... [MTD] [NAND] Fix Blackfin NFC ECC calculating bug with page size 512 bytes [MTD] [NAND] Remove wrong operation in PM function of the BF54x NFC driver [MTD] [NAND] Remove unused variable in plat_nand_remove [MTD] Unlocking all Intel flash that is locked on power up. [MTD] [NAND] at91_nand: Make mtdparts option can override board info [MTD] mtdoops: Various minor cleanups [MTD] mtdoops: Ensure sequential write to the buffer [MTD] mtdoops: Perform write operations in a workqueue [MTD] mtdoops: Add further error return code checking [MTD] [NOR] Test devtype, not definition in flash_probe(), drivers/mtd/devices/lart.c ...
Diffstat (limited to 'drivers/mtd/redboot.c')
-rw-r--r--drivers/mtd/redboot.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c
index a61351f88ec0..47474903263c 100644
--- a/drivers/mtd/redboot.c
+++ b/drivers/mtd/redboot.c
@@ -59,16 +59,31 @@ static int parse_redboot_partitions(struct mtd_info *master,
59 static char nullstring[] = "unallocated"; 59 static char nullstring[] = "unallocated";
60#endif 60#endif
61 61
62 if ( directory < 0 ) {
63 offset = master->size + directory * master->erasesize;
64 while (master->block_isbad &&
65 master->block_isbad(master, offset)) {
66 if (!offset) {
67 nogood:
68 printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n");
69 return -EIO;
70 }
71 offset -= master->erasesize;
72 }
73 } else {
74 offset = directory * master->erasesize;
75 while (master->block_isbad &&
76 master->block_isbad(master, offset)) {
77 offset += master->erasesize;
78 if (offset == master->size)
79 goto nogood;
80 }
81 }
62 buf = vmalloc(master->erasesize); 82 buf = vmalloc(master->erasesize);
63 83
64 if (!buf) 84 if (!buf)
65 return -ENOMEM; 85 return -ENOMEM;
66 86
67 if ( directory < 0 )
68 offset = master->size + directory*master->erasesize;
69 else
70 offset = directory*master->erasesize;
71
72 printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n", 87 printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n",
73 master->name, offset); 88 master->name, offset);
74 89