]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
cmd_nand.c: Fix 'nand dump' after latest MTD resync
authorTom Rini <trini@ti.com>
Thu, 23 Feb 2012 22:47:46 +0000 (15:47 -0700)
committerScott Wood <scottwood@freescale.com>
Tue, 28 Feb 2012 20:04:54 +0000 (14:04 -0600)
With 2a8e0fc nand_do_read_ops changed in behavior slightly (keeping in sync
with the kernel which did this change in b64d39d8) such that the OOB data is
always copied into oobbuf and never appended to datbuf.  Within U-Boot only
the nand_dump function (for the dump nand subcommand) was expecting the OOB
data to only be appended to datbuf.  So we now change nand_dump to not
malloc extra space, correct the comment about datbuf and OOB data and switch
the pointer to oobbuf before printing.

Cc: Scott Wood <scottwood@freescale.com>
Signed-off-by: Tom Rini <trini@ti.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
common/cmd_nand.c

index 3e2edb8aaabd4cf1c8ff32f0f6575a039944e3ca..fa96a5201cc89cc6ee8ac7d85915a224b3e504c3 100644 (file)
@@ -48,7 +48,7 @@ static int nand_dump(nand_info_t *nand, ulong off, int only_oob, int repeat)
 
        last = off;
 
-       datbuf = malloc(nand->writesize + nand->oobsize);
+       datbuf = malloc(nand->writesize);
        oobbuf = malloc(nand->oobsize);
        if (!datbuf || !oobbuf) {
                puts("No memory for page buffer\n");
@@ -59,7 +59,7 @@ static int nand_dump(nand_info_t *nand, ulong off, int only_oob, int repeat)
        struct mtd_oob_ops ops;
        memset(&ops, 0, sizeof(ops));
        ops.datbuf = datbuf;
-       ops.oobbuf = oobbuf; /* must exist, but oob data will be appended to ops.datbuf */
+       ops.oobbuf = oobbuf;
        ops.len = nand->writesize;
        ops.ooblen = nand->oobsize;
        ops.mode = MTD_OOB_RAW;
@@ -85,6 +85,7 @@ static int nand_dump(nand_info_t *nand, ulong off, int only_oob, int repeat)
        }
        puts("OOB:\n");
        i = nand->oobsize >> 3;
+       p = oobbuf;
        while (i--) {
                printf("\t%02x %02x %02x %02x %02x %02x %02x %02x\n",
                       p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);