diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-11-28 12:21:33 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-11-28 12:21:33 -0600 |
commit | a9046d78f00853c60ee649816dea99df45b4e340 (patch) | |
tree | 01ed0d01ce56ce2f3f6dedc4fe91408805722cae /nuttx/fs/nxffs | |
parent | fd544495939ce18296d064a5d7905e40f305e433 (diff) | |
download | nuttx-a9046d78f00853c60ee649816dea99df45b4e340.tar.gz nuttx-a9046d78f00853c60ee649816dea99df45b4e340.tar.bz2 nuttx-a9046d78f00853c60ee649816dea99df45b4e340.zip |
SAMA5 NAND: Still debugging
Diffstat (limited to 'nuttx/fs/nxffs')
-rw-r--r-- | nuttx/fs/nxffs/nxffs.h | 3 | ||||
-rw-r--r-- | nuttx/fs/nxffs/nxffs_blockstats.c | 18 |
2 files changed, 16 insertions, 5 deletions
diff --git a/nuttx/fs/nxffs/nxffs.h b/nuttx/fs/nxffs/nxffs.h index f434fa4c9..38a27da38 100644 --- a/nuttx/fs/nxffs/nxffs.h +++ b/nuttx/fs/nxffs/nxffs.h @@ -311,7 +311,8 @@ struct nxffs_blkstats_s off_t ngood; /* Number of good FLASH blocks found */ off_t nbad; /* Number of well-formatted FLASH blocks marked as bad */ off_t nunformat; /* Number of unformatted FLASH blocks */ - off_t ncorrupt; /* Number of blocks with correupted format info */ + off_t ncorrupt; /* Number of blocks with corrupted format info */ + off_t nbadread; /* Number of blocks that could not be read */ }; /**************************************************************************** diff --git a/nuttx/fs/nxffs/nxffs_blockstats.c b/nuttx/fs/nxffs/nxffs_blockstats.c index f345b19b4..d8f30a40e 100644 --- a/nuttx/fs/nxffs/nxffs_blockstats.c +++ b/nuttx/fs/nxffs/nxffs_blockstats.c @@ -107,8 +107,19 @@ int nxffs_blockstats(FAR struct nxffs_volume_s *volume, ret = MTD_BREAD(volume->mtd, ioblock, volume->blkper, volume->pack); if (ret < volume->blkper) { - fdbg("Failed to read erase block %d: %d\n", ioblock / volume->blkper, -ret); - return ret; + /* This should not happen at all on most FLASH. A bad read will + * happen normally with a NAND device that has uncorrectable blocks. + * So, just for NAND, we keep the count of unreadable blocks. + */ + + fdbg("Failed to read erase block %d: %d\n", + ioblock / volume->blkper, ret); + + /* Declare all blocks in the eraseblock as bad */ + + stats->nblocks += volume->blkper; + stats->nbadread += volume->blkper; + continue; } /* Process each logical block */ @@ -146,7 +157,6 @@ int nxffs_blockstats(FAR struct nxffs_volume_s *volume, fdbg(" Bad blocks: %d\n", stats->nbad); fdbg(" Unformatted blocks: %d\n", stats->nunformat); fdbg(" Corrupt blocks: %d\n", stats->ncorrupt); + fdbg(" Undreadable blocks: %d\n", stats->nbadread); return OK; } - - |